Update auto-generated bindings
[ldk-c-bindings] / lightning-c-bindings / src / c_types / derived.rs
1
2 use alloc::str::FromStr;
3 use core::ffi::c_void;
4 use core::convert::Infallible;
5 use bitcoin::hashes::Hash;
6 use crate::c_types::*;
7 #[cfg(feature="no-std")]
8 use alloc::{vec::Vec, boxed::Box};
9
10 #[repr(C)]
11 /// A dynamically-allocated array of crate::c_types::PublicKeys of arbitrary size.
12 /// This corresponds to std::vector in C++
13 pub struct CVec_PublicKeyZ {
14         /// The elements in the array.
15         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
16         pub data: *mut crate::c_types::PublicKey,
17         /// The number of elements pointed to by `data`.
18         pub datalen: usize
19 }
20 impl CVec_PublicKeyZ {
21         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::PublicKey> {
22                 if self.datalen == 0 { return Vec::new(); }
23                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
24                 self.data = core::ptr::null_mut();
25                 self.datalen = 0;
26                 ret
27         }
28         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::PublicKey] {
29                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
30         }
31 }
32 impl From<Vec<crate::c_types::PublicKey>> for CVec_PublicKeyZ {
33         fn from(v: Vec<crate::c_types::PublicKey>) -> Self {
34                 let datalen = v.len();
35                 let data = Box::into_raw(v.into_boxed_slice());
36                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
37         }
38 }
39 #[no_mangle]
40 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
41 pub extern "C" fn CVec_PublicKeyZ_free(_res: CVec_PublicKeyZ) { }
42 impl Drop for CVec_PublicKeyZ {
43         fn drop(&mut self) {
44                 if self.datalen == 0 { return; }
45                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
46         }
47 }
48 impl Clone for CVec_PublicKeyZ {
49         fn clone(&self) -> Self {
50                 let mut res = Vec::new();
51                 if self.datalen == 0 { return Self::from(res); }
52                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
53                 Self::from(res)
54         }
55 }
56 #[repr(C)]
57 /// The contents of CResult_BlindedRouteNoneZ
58 pub union CResult_BlindedRouteNoneZPtr {
59         /// A pointer to the contents in the success state.
60         /// Reading from this pointer when `result_ok` is not set is undefined.
61         pub result: *mut crate::lightning::onion_message::blinded_route::BlindedRoute,
62         /// Note that this value is always NULL, as there are no contents in the Err variant
63         pub err: *mut core::ffi::c_void,
64 }
65 #[repr(C)]
66 /// A CResult_BlindedRouteNoneZ represents the result of a fallible operation,
67 /// containing a crate::lightning::onion_message::blinded_route::BlindedRoute on success and a () on failure.
68 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
69 pub struct CResult_BlindedRouteNoneZ {
70         /// The contents of this CResult_BlindedRouteNoneZ, accessible via either
71         /// `err` or `result` depending on the state of `result_ok`.
72         pub contents: CResult_BlindedRouteNoneZPtr,
73         /// Whether this CResult_BlindedRouteNoneZ represents a success state.
74         pub result_ok: bool,
75 }
76 #[no_mangle]
77 /// Creates a new CResult_BlindedRouteNoneZ in the success state.
78 pub extern "C" fn CResult_BlindedRouteNoneZ_ok(o: crate::lightning::onion_message::blinded_route::BlindedRoute) -> CResult_BlindedRouteNoneZ {
79         CResult_BlindedRouteNoneZ {
80                 contents: CResult_BlindedRouteNoneZPtr {
81                         result: Box::into_raw(Box::new(o)),
82                 },
83                 result_ok: true,
84         }
85 }
86 #[no_mangle]
87 /// Creates a new CResult_BlindedRouteNoneZ in the error state.
88 pub extern "C" fn CResult_BlindedRouteNoneZ_err() -> CResult_BlindedRouteNoneZ {
89         CResult_BlindedRouteNoneZ {
90                 contents: CResult_BlindedRouteNoneZPtr {
91                         err: core::ptr::null_mut(),
92                 },
93                 result_ok: false,
94         }
95 }
96 /// Checks if the given object is currently in the success state
97 #[no_mangle]
98 pub extern "C" fn CResult_BlindedRouteNoneZ_is_ok(o: &CResult_BlindedRouteNoneZ) -> bool {
99         o.result_ok
100 }
101 #[no_mangle]
102 /// Frees any resources used by the CResult_BlindedRouteNoneZ.
103 pub extern "C" fn CResult_BlindedRouteNoneZ_free(_res: CResult_BlindedRouteNoneZ) { }
104 impl Drop for CResult_BlindedRouteNoneZ {
105         fn drop(&mut self) {
106                 if self.result_ok {
107                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
108                                 let _ = unsafe { Box::from_raw(self.contents.result) };
109                         }
110                 } else {
111                 }
112         }
113 }
114 impl From<crate::c_types::CResultTempl<crate::lightning::onion_message::blinded_route::BlindedRoute, ()>> for CResult_BlindedRouteNoneZ {
115         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::onion_message::blinded_route::BlindedRoute, ()>) -> Self {
116                 let contents = if o.result_ok {
117                         let result = unsafe { o.contents.result };
118                         unsafe { o.contents.result = core::ptr::null_mut() };
119                         CResult_BlindedRouteNoneZPtr { result }
120                 } else {
121                         let _ = unsafe { Box::from_raw(o.contents.err) };
122                         o.contents.err = core::ptr::null_mut();
123                         CResult_BlindedRouteNoneZPtr { err: core::ptr::null_mut() }
124                 };
125                 Self {
126                         contents,
127                         result_ok: o.result_ok,
128                 }
129         }
130 }
131 #[repr(C)]
132 /// The contents of CResult_BlindedRouteDecodeErrorZ
133 pub union CResult_BlindedRouteDecodeErrorZPtr {
134         /// A pointer to the contents in the success state.
135         /// Reading from this pointer when `result_ok` is not set is undefined.
136         pub result: *mut crate::lightning::onion_message::blinded_route::BlindedRoute,
137         /// A pointer to the contents in the error state.
138         /// Reading from this pointer when `result_ok` is set is undefined.
139         pub err: *mut crate::lightning::ln::msgs::DecodeError,
140 }
141 #[repr(C)]
142 /// A CResult_BlindedRouteDecodeErrorZ represents the result of a fallible operation,
143 /// containing a crate::lightning::onion_message::blinded_route::BlindedRoute on success and a crate::lightning::ln::msgs::DecodeError on failure.
144 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
145 pub struct CResult_BlindedRouteDecodeErrorZ {
146         /// The contents of this CResult_BlindedRouteDecodeErrorZ, accessible via either
147         /// `err` or `result` depending on the state of `result_ok`.
148         pub contents: CResult_BlindedRouteDecodeErrorZPtr,
149         /// Whether this CResult_BlindedRouteDecodeErrorZ represents a success state.
150         pub result_ok: bool,
151 }
152 #[no_mangle]
153 /// Creates a new CResult_BlindedRouteDecodeErrorZ in the success state.
154 pub extern "C" fn CResult_BlindedRouteDecodeErrorZ_ok(o: crate::lightning::onion_message::blinded_route::BlindedRoute) -> CResult_BlindedRouteDecodeErrorZ {
155         CResult_BlindedRouteDecodeErrorZ {
156                 contents: CResult_BlindedRouteDecodeErrorZPtr {
157                         result: Box::into_raw(Box::new(o)),
158                 },
159                 result_ok: true,
160         }
161 }
162 #[no_mangle]
163 /// Creates a new CResult_BlindedRouteDecodeErrorZ in the error state.
164 pub extern "C" fn CResult_BlindedRouteDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_BlindedRouteDecodeErrorZ {
165         CResult_BlindedRouteDecodeErrorZ {
166                 contents: CResult_BlindedRouteDecodeErrorZPtr {
167                         err: Box::into_raw(Box::new(e)),
168                 },
169                 result_ok: false,
170         }
171 }
172 /// Checks if the given object is currently in the success state
173 #[no_mangle]
174 pub extern "C" fn CResult_BlindedRouteDecodeErrorZ_is_ok(o: &CResult_BlindedRouteDecodeErrorZ) -> bool {
175         o.result_ok
176 }
177 #[no_mangle]
178 /// Frees any resources used by the CResult_BlindedRouteDecodeErrorZ.
179 pub extern "C" fn CResult_BlindedRouteDecodeErrorZ_free(_res: CResult_BlindedRouteDecodeErrorZ) { }
180 impl Drop for CResult_BlindedRouteDecodeErrorZ {
181         fn drop(&mut self) {
182                 if self.result_ok {
183                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
184                                 let _ = unsafe { Box::from_raw(self.contents.result) };
185                         }
186                 } else {
187                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
188                                 let _ = unsafe { Box::from_raw(self.contents.err) };
189                         }
190                 }
191         }
192 }
193 impl From<crate::c_types::CResultTempl<crate::lightning::onion_message::blinded_route::BlindedRoute, crate::lightning::ln::msgs::DecodeError>> for CResult_BlindedRouteDecodeErrorZ {
194         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::onion_message::blinded_route::BlindedRoute, crate::lightning::ln::msgs::DecodeError>) -> Self {
195                 let contents = if o.result_ok {
196                         let result = unsafe { o.contents.result };
197                         unsafe { o.contents.result = core::ptr::null_mut() };
198                         CResult_BlindedRouteDecodeErrorZPtr { result }
199                 } else {
200                         let err = unsafe { o.contents.err };
201                         unsafe { o.contents.err = core::ptr::null_mut(); }
202                         CResult_BlindedRouteDecodeErrorZPtr { err }
203                 };
204                 Self {
205                         contents,
206                         result_ok: o.result_ok,
207                 }
208         }
209 }
210 #[repr(C)]
211 /// The contents of CResult_BlindedHopDecodeErrorZ
212 pub union CResult_BlindedHopDecodeErrorZPtr {
213         /// A pointer to the contents in the success state.
214         /// Reading from this pointer when `result_ok` is not set is undefined.
215         pub result: *mut crate::lightning::onion_message::blinded_route::BlindedHop,
216         /// A pointer to the contents in the error state.
217         /// Reading from this pointer when `result_ok` is set is undefined.
218         pub err: *mut crate::lightning::ln::msgs::DecodeError,
219 }
220 #[repr(C)]
221 /// A CResult_BlindedHopDecodeErrorZ represents the result of a fallible operation,
222 /// containing a crate::lightning::onion_message::blinded_route::BlindedHop on success and a crate::lightning::ln::msgs::DecodeError on failure.
223 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
224 pub struct CResult_BlindedHopDecodeErrorZ {
225         /// The contents of this CResult_BlindedHopDecodeErrorZ, accessible via either
226         /// `err` or `result` depending on the state of `result_ok`.
227         pub contents: CResult_BlindedHopDecodeErrorZPtr,
228         /// Whether this CResult_BlindedHopDecodeErrorZ represents a success state.
229         pub result_ok: bool,
230 }
231 #[no_mangle]
232 /// Creates a new CResult_BlindedHopDecodeErrorZ in the success state.
233 pub extern "C" fn CResult_BlindedHopDecodeErrorZ_ok(o: crate::lightning::onion_message::blinded_route::BlindedHop) -> CResult_BlindedHopDecodeErrorZ {
234         CResult_BlindedHopDecodeErrorZ {
235                 contents: CResult_BlindedHopDecodeErrorZPtr {
236                         result: Box::into_raw(Box::new(o)),
237                 },
238                 result_ok: true,
239         }
240 }
241 #[no_mangle]
242 /// Creates a new CResult_BlindedHopDecodeErrorZ in the error state.
243 pub extern "C" fn CResult_BlindedHopDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_BlindedHopDecodeErrorZ {
244         CResult_BlindedHopDecodeErrorZ {
245                 contents: CResult_BlindedHopDecodeErrorZPtr {
246                         err: Box::into_raw(Box::new(e)),
247                 },
248                 result_ok: false,
249         }
250 }
251 /// Checks if the given object is currently in the success state
252 #[no_mangle]
253 pub extern "C" fn CResult_BlindedHopDecodeErrorZ_is_ok(o: &CResult_BlindedHopDecodeErrorZ) -> bool {
254         o.result_ok
255 }
256 #[no_mangle]
257 /// Frees any resources used by the CResult_BlindedHopDecodeErrorZ.
258 pub extern "C" fn CResult_BlindedHopDecodeErrorZ_free(_res: CResult_BlindedHopDecodeErrorZ) { }
259 impl Drop for CResult_BlindedHopDecodeErrorZ {
260         fn drop(&mut self) {
261                 if self.result_ok {
262                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
263                                 let _ = unsafe { Box::from_raw(self.contents.result) };
264                         }
265                 } else {
266                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
267                                 let _ = unsafe { Box::from_raw(self.contents.err) };
268                         }
269                 }
270         }
271 }
272 impl From<crate::c_types::CResultTempl<crate::lightning::onion_message::blinded_route::BlindedHop, crate::lightning::ln::msgs::DecodeError>> for CResult_BlindedHopDecodeErrorZ {
273         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::onion_message::blinded_route::BlindedHop, crate::lightning::ln::msgs::DecodeError>) -> Self {
274                 let contents = if o.result_ok {
275                         let result = unsafe { o.contents.result };
276                         unsafe { o.contents.result = core::ptr::null_mut() };
277                         CResult_BlindedHopDecodeErrorZPtr { result }
278                 } else {
279                         let err = unsafe { o.contents.err };
280                         unsafe { o.contents.err = core::ptr::null_mut(); }
281                         CResult_BlindedHopDecodeErrorZPtr { err }
282                 };
283                 Self {
284                         contents,
285                         result_ok: o.result_ok,
286                 }
287         }
288 }
289 #[repr(C)]
290 /// The contents of CResult_NoneNoneZ
291 pub union CResult_NoneNoneZPtr {
292         /// Note that this value is always NULL, as there are no contents in the OK variant
293         pub result: *mut core::ffi::c_void,
294         /// Note that this value is always NULL, as there are no contents in the Err variant
295         pub err: *mut core::ffi::c_void,
296 }
297 #[repr(C)]
298 /// A CResult_NoneNoneZ represents the result of a fallible operation,
299 /// containing a () on success and a () on failure.
300 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
301 pub struct CResult_NoneNoneZ {
302         /// The contents of this CResult_NoneNoneZ, accessible via either
303         /// `err` or `result` depending on the state of `result_ok`.
304         pub contents: CResult_NoneNoneZPtr,
305         /// Whether this CResult_NoneNoneZ represents a success state.
306         pub result_ok: bool,
307 }
308 #[no_mangle]
309 /// Creates a new CResult_NoneNoneZ in the success state.
310 pub extern "C" fn CResult_NoneNoneZ_ok() -> CResult_NoneNoneZ {
311         CResult_NoneNoneZ {
312                 contents: CResult_NoneNoneZPtr {
313                         result: core::ptr::null_mut(),
314                 },
315                 result_ok: true,
316         }
317 }
318 #[no_mangle]
319 /// Creates a new CResult_NoneNoneZ in the error state.
320 pub extern "C" fn CResult_NoneNoneZ_err() -> CResult_NoneNoneZ {
321         CResult_NoneNoneZ {
322                 contents: CResult_NoneNoneZPtr {
323                         err: core::ptr::null_mut(),
324                 },
325                 result_ok: false,
326         }
327 }
328 /// Checks if the given object is currently in the success state
329 #[no_mangle]
330 pub extern "C" fn CResult_NoneNoneZ_is_ok(o: &CResult_NoneNoneZ) -> bool {
331         o.result_ok
332 }
333 #[no_mangle]
334 /// Frees any resources used by the CResult_NoneNoneZ.
335 pub extern "C" fn CResult_NoneNoneZ_free(_res: CResult_NoneNoneZ) { }
336 impl Drop for CResult_NoneNoneZ {
337         fn drop(&mut self) {
338                 if self.result_ok {
339                 } else {
340                 }
341         }
342 }
343 impl From<crate::c_types::CResultTempl<(), ()>> for CResult_NoneNoneZ {
344         fn from(mut o: crate::c_types::CResultTempl<(), ()>) -> Self {
345                 let contents = if o.result_ok {
346                         let _ = unsafe { Box::from_raw(o.contents.result) };
347                         o.contents.result = core::ptr::null_mut();
348                         CResult_NoneNoneZPtr { result: core::ptr::null_mut() }
349                 } else {
350                         let _ = unsafe { Box::from_raw(o.contents.err) };
351                         o.contents.err = core::ptr::null_mut();
352                         CResult_NoneNoneZPtr { err: core::ptr::null_mut() }
353                 };
354                 Self {
355                         contents,
356                         result_ok: o.result_ok,
357                 }
358         }
359 }
360 impl Clone for CResult_NoneNoneZ {
361         fn clone(&self) -> Self {
362                 if self.result_ok {
363                         Self { result_ok: true, contents: CResult_NoneNoneZPtr {
364                                 result: core::ptr::null_mut()
365                         } }
366                 } else {
367                         Self { result_ok: false, contents: CResult_NoneNoneZPtr {
368                                 err: core::ptr::null_mut()
369                         } }
370                 }
371         }
372 }
373 #[no_mangle]
374 /// Creates a new CResult_NoneNoneZ which has the same data as `orig`
375 /// but with all dynamically-allocated buffers duplicated in new buffers.
376 pub extern "C" fn CResult_NoneNoneZ_clone(orig: &CResult_NoneNoneZ) -> CResult_NoneNoneZ { Clone::clone(&orig) }
377 #[repr(C)]
378 /// The contents of CResult_CounterpartyCommitmentSecretsDecodeErrorZ
379 pub union CResult_CounterpartyCommitmentSecretsDecodeErrorZPtr {
380         /// A pointer to the contents in the success state.
381         /// Reading from this pointer when `result_ok` is not set is undefined.
382         pub result: *mut crate::lightning::ln::chan_utils::CounterpartyCommitmentSecrets,
383         /// A pointer to the contents in the error state.
384         /// Reading from this pointer when `result_ok` is set is undefined.
385         pub err: *mut crate::lightning::ln::msgs::DecodeError,
386 }
387 #[repr(C)]
388 /// A CResult_CounterpartyCommitmentSecretsDecodeErrorZ represents the result of a fallible operation,
389 /// containing a crate::lightning::ln::chan_utils::CounterpartyCommitmentSecrets on success and a crate::lightning::ln::msgs::DecodeError on failure.
390 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
391 pub struct CResult_CounterpartyCommitmentSecretsDecodeErrorZ {
392         /// The contents of this CResult_CounterpartyCommitmentSecretsDecodeErrorZ, accessible via either
393         /// `err` or `result` depending on the state of `result_ok`.
394         pub contents: CResult_CounterpartyCommitmentSecretsDecodeErrorZPtr,
395         /// Whether this CResult_CounterpartyCommitmentSecretsDecodeErrorZ represents a success state.
396         pub result_ok: bool,
397 }
398 #[no_mangle]
399 /// Creates a new CResult_CounterpartyCommitmentSecretsDecodeErrorZ in the success state.
400 pub extern "C" fn CResult_CounterpartyCommitmentSecretsDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::CounterpartyCommitmentSecrets) -> CResult_CounterpartyCommitmentSecretsDecodeErrorZ {
401         CResult_CounterpartyCommitmentSecretsDecodeErrorZ {
402                 contents: CResult_CounterpartyCommitmentSecretsDecodeErrorZPtr {
403                         result: Box::into_raw(Box::new(o)),
404                 },
405                 result_ok: true,
406         }
407 }
408 #[no_mangle]
409 /// Creates a new CResult_CounterpartyCommitmentSecretsDecodeErrorZ in the error state.
410 pub extern "C" fn CResult_CounterpartyCommitmentSecretsDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_CounterpartyCommitmentSecretsDecodeErrorZ {
411         CResult_CounterpartyCommitmentSecretsDecodeErrorZ {
412                 contents: CResult_CounterpartyCommitmentSecretsDecodeErrorZPtr {
413                         err: Box::into_raw(Box::new(e)),
414                 },
415                 result_ok: false,
416         }
417 }
418 /// Checks if the given object is currently in the success state
419 #[no_mangle]
420 pub extern "C" fn CResult_CounterpartyCommitmentSecretsDecodeErrorZ_is_ok(o: &CResult_CounterpartyCommitmentSecretsDecodeErrorZ) -> bool {
421         o.result_ok
422 }
423 #[no_mangle]
424 /// Frees any resources used by the CResult_CounterpartyCommitmentSecretsDecodeErrorZ.
425 pub extern "C" fn CResult_CounterpartyCommitmentSecretsDecodeErrorZ_free(_res: CResult_CounterpartyCommitmentSecretsDecodeErrorZ) { }
426 impl Drop for CResult_CounterpartyCommitmentSecretsDecodeErrorZ {
427         fn drop(&mut self) {
428                 if self.result_ok {
429                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
430                                 let _ = unsafe { Box::from_raw(self.contents.result) };
431                         }
432                 } else {
433                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
434                                 let _ = unsafe { Box::from_raw(self.contents.err) };
435                         }
436                 }
437         }
438 }
439 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::CounterpartyCommitmentSecrets, crate::lightning::ln::msgs::DecodeError>> for CResult_CounterpartyCommitmentSecretsDecodeErrorZ {
440         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::CounterpartyCommitmentSecrets, crate::lightning::ln::msgs::DecodeError>) -> Self {
441                 let contents = if o.result_ok {
442                         let result = unsafe { o.contents.result };
443                         unsafe { o.contents.result = core::ptr::null_mut() };
444                         CResult_CounterpartyCommitmentSecretsDecodeErrorZPtr { result }
445                 } else {
446                         let err = unsafe { o.contents.err };
447                         unsafe { o.contents.err = core::ptr::null_mut(); }
448                         CResult_CounterpartyCommitmentSecretsDecodeErrorZPtr { err }
449                 };
450                 Self {
451                         contents,
452                         result_ok: o.result_ok,
453                 }
454         }
455 }
456 impl Clone for CResult_CounterpartyCommitmentSecretsDecodeErrorZ {
457         fn clone(&self) -> Self {
458                 if self.result_ok {
459                         Self { result_ok: true, contents: CResult_CounterpartyCommitmentSecretsDecodeErrorZPtr {
460                                 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::CounterpartyCommitmentSecrets>::clone(unsafe { &*self.contents.result })))
461                         } }
462                 } else {
463                         Self { result_ok: false, contents: CResult_CounterpartyCommitmentSecretsDecodeErrorZPtr {
464                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
465                         } }
466                 }
467         }
468 }
469 #[no_mangle]
470 /// Creates a new CResult_CounterpartyCommitmentSecretsDecodeErrorZ which has the same data as `orig`
471 /// but with all dynamically-allocated buffers duplicated in new buffers.
472 pub extern "C" fn CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone(orig: &CResult_CounterpartyCommitmentSecretsDecodeErrorZ) -> CResult_CounterpartyCommitmentSecretsDecodeErrorZ { Clone::clone(&orig) }
473 #[repr(C)]
474 /// The contents of CResult_SecretKeyErrorZ
475 pub union CResult_SecretKeyErrorZPtr {
476         /// A pointer to the contents in the success state.
477         /// Reading from this pointer when `result_ok` is not set is undefined.
478         pub result: *mut crate::c_types::SecretKey,
479         /// A pointer to the contents in the error state.
480         /// Reading from this pointer when `result_ok` is set is undefined.
481         pub err: *mut crate::c_types::Secp256k1Error,
482 }
483 #[repr(C)]
484 /// A CResult_SecretKeyErrorZ represents the result of a fallible operation,
485 /// containing a crate::c_types::SecretKey on success and a crate::c_types::Secp256k1Error on failure.
486 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
487 pub struct CResult_SecretKeyErrorZ {
488         /// The contents of this CResult_SecretKeyErrorZ, accessible via either
489         /// `err` or `result` depending on the state of `result_ok`.
490         pub contents: CResult_SecretKeyErrorZPtr,
491         /// Whether this CResult_SecretKeyErrorZ represents a success state.
492         pub result_ok: bool,
493 }
494 #[no_mangle]
495 /// Creates a new CResult_SecretKeyErrorZ in the success state.
496 pub extern "C" fn CResult_SecretKeyErrorZ_ok(o: crate::c_types::SecretKey) -> CResult_SecretKeyErrorZ {
497         CResult_SecretKeyErrorZ {
498                 contents: CResult_SecretKeyErrorZPtr {
499                         result: Box::into_raw(Box::new(o)),
500                 },
501                 result_ok: true,
502         }
503 }
504 #[no_mangle]
505 /// Creates a new CResult_SecretKeyErrorZ in the error state.
506 pub extern "C" fn CResult_SecretKeyErrorZ_err(e: crate::c_types::Secp256k1Error) -> CResult_SecretKeyErrorZ {
507         CResult_SecretKeyErrorZ {
508                 contents: CResult_SecretKeyErrorZPtr {
509                         err: Box::into_raw(Box::new(e)),
510                 },
511                 result_ok: false,
512         }
513 }
514 /// Checks if the given object is currently in the success state
515 #[no_mangle]
516 pub extern "C" fn CResult_SecretKeyErrorZ_is_ok(o: &CResult_SecretKeyErrorZ) -> bool {
517         o.result_ok
518 }
519 #[no_mangle]
520 /// Frees any resources used by the CResult_SecretKeyErrorZ.
521 pub extern "C" fn CResult_SecretKeyErrorZ_free(_res: CResult_SecretKeyErrorZ) { }
522 impl Drop for CResult_SecretKeyErrorZ {
523         fn drop(&mut self) {
524                 if self.result_ok {
525                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
526                                 let _ = unsafe { Box::from_raw(self.contents.result) };
527                         }
528                 } else {
529                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
530                                 let _ = unsafe { Box::from_raw(self.contents.err) };
531                         }
532                 }
533         }
534 }
535 impl From<crate::c_types::CResultTempl<crate::c_types::SecretKey, crate::c_types::Secp256k1Error>> for CResult_SecretKeyErrorZ {
536         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::SecretKey, crate::c_types::Secp256k1Error>) -> Self {
537                 let contents = if o.result_ok {
538                         let result = unsafe { o.contents.result };
539                         unsafe { o.contents.result = core::ptr::null_mut() };
540                         CResult_SecretKeyErrorZPtr { result }
541                 } else {
542                         let err = unsafe { o.contents.err };
543                         unsafe { o.contents.err = core::ptr::null_mut(); }
544                         CResult_SecretKeyErrorZPtr { err }
545                 };
546                 Self {
547                         contents,
548                         result_ok: o.result_ok,
549                 }
550         }
551 }
552 impl Clone for CResult_SecretKeyErrorZ {
553         fn clone(&self) -> Self {
554                 if self.result_ok {
555                         Self { result_ok: true, contents: CResult_SecretKeyErrorZPtr {
556                                 result: Box::into_raw(Box::new(<crate::c_types::SecretKey>::clone(unsafe { &*self.contents.result })))
557                         } }
558                 } else {
559                         Self { result_ok: false, contents: CResult_SecretKeyErrorZPtr {
560                                 err: Box::into_raw(Box::new(<crate::c_types::Secp256k1Error>::clone(unsafe { &*self.contents.err })))
561                         } }
562                 }
563         }
564 }
565 #[no_mangle]
566 /// Creates a new CResult_SecretKeyErrorZ which has the same data as `orig`
567 /// but with all dynamically-allocated buffers duplicated in new buffers.
568 pub extern "C" fn CResult_SecretKeyErrorZ_clone(orig: &CResult_SecretKeyErrorZ) -> CResult_SecretKeyErrorZ { Clone::clone(&orig) }
569 #[repr(C)]
570 /// The contents of CResult_PublicKeyErrorZ
571 pub union CResult_PublicKeyErrorZPtr {
572         /// A pointer to the contents in the success state.
573         /// Reading from this pointer when `result_ok` is not set is undefined.
574         pub result: *mut crate::c_types::PublicKey,
575         /// A pointer to the contents in the error state.
576         /// Reading from this pointer when `result_ok` is set is undefined.
577         pub err: *mut crate::c_types::Secp256k1Error,
578 }
579 #[repr(C)]
580 /// A CResult_PublicKeyErrorZ represents the result of a fallible operation,
581 /// containing a crate::c_types::PublicKey on success and a crate::c_types::Secp256k1Error on failure.
582 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
583 pub struct CResult_PublicKeyErrorZ {
584         /// The contents of this CResult_PublicKeyErrorZ, accessible via either
585         /// `err` or `result` depending on the state of `result_ok`.
586         pub contents: CResult_PublicKeyErrorZPtr,
587         /// Whether this CResult_PublicKeyErrorZ represents a success state.
588         pub result_ok: bool,
589 }
590 #[no_mangle]
591 /// Creates a new CResult_PublicKeyErrorZ in the success state.
592 pub extern "C" fn CResult_PublicKeyErrorZ_ok(o: crate::c_types::PublicKey) -> CResult_PublicKeyErrorZ {
593         CResult_PublicKeyErrorZ {
594                 contents: CResult_PublicKeyErrorZPtr {
595                         result: Box::into_raw(Box::new(o)),
596                 },
597                 result_ok: true,
598         }
599 }
600 #[no_mangle]
601 /// Creates a new CResult_PublicKeyErrorZ in the error state.
602 pub extern "C" fn CResult_PublicKeyErrorZ_err(e: crate::c_types::Secp256k1Error) -> CResult_PublicKeyErrorZ {
603         CResult_PublicKeyErrorZ {
604                 contents: CResult_PublicKeyErrorZPtr {
605                         err: Box::into_raw(Box::new(e)),
606                 },
607                 result_ok: false,
608         }
609 }
610 /// Checks if the given object is currently in the success state
611 #[no_mangle]
612 pub extern "C" fn CResult_PublicKeyErrorZ_is_ok(o: &CResult_PublicKeyErrorZ) -> bool {
613         o.result_ok
614 }
615 #[no_mangle]
616 /// Frees any resources used by the CResult_PublicKeyErrorZ.
617 pub extern "C" fn CResult_PublicKeyErrorZ_free(_res: CResult_PublicKeyErrorZ) { }
618 impl Drop for CResult_PublicKeyErrorZ {
619         fn drop(&mut self) {
620                 if self.result_ok {
621                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
622                                 let _ = unsafe { Box::from_raw(self.contents.result) };
623                         }
624                 } else {
625                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
626                                 let _ = unsafe { Box::from_raw(self.contents.err) };
627                         }
628                 }
629         }
630 }
631 impl From<crate::c_types::CResultTempl<crate::c_types::PublicKey, crate::c_types::Secp256k1Error>> for CResult_PublicKeyErrorZ {
632         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::PublicKey, crate::c_types::Secp256k1Error>) -> Self {
633                 let contents = if o.result_ok {
634                         let result = unsafe { o.contents.result };
635                         unsafe { o.contents.result = core::ptr::null_mut() };
636                         CResult_PublicKeyErrorZPtr { result }
637                 } else {
638                         let err = unsafe { o.contents.err };
639                         unsafe { o.contents.err = core::ptr::null_mut(); }
640                         CResult_PublicKeyErrorZPtr { err }
641                 };
642                 Self {
643                         contents,
644                         result_ok: o.result_ok,
645                 }
646         }
647 }
648 impl Clone for CResult_PublicKeyErrorZ {
649         fn clone(&self) -> Self {
650                 if self.result_ok {
651                         Self { result_ok: true, contents: CResult_PublicKeyErrorZPtr {
652                                 result: Box::into_raw(Box::new(<crate::c_types::PublicKey>::clone(unsafe { &*self.contents.result })))
653                         } }
654                 } else {
655                         Self { result_ok: false, contents: CResult_PublicKeyErrorZPtr {
656                                 err: Box::into_raw(Box::new(<crate::c_types::Secp256k1Error>::clone(unsafe { &*self.contents.err })))
657                         } }
658                 }
659         }
660 }
661 #[no_mangle]
662 /// Creates a new CResult_PublicKeyErrorZ which has the same data as `orig`
663 /// but with all dynamically-allocated buffers duplicated in new buffers.
664 pub extern "C" fn CResult_PublicKeyErrorZ_clone(orig: &CResult_PublicKeyErrorZ) -> CResult_PublicKeyErrorZ { Clone::clone(&orig) }
665 #[repr(C)]
666 /// The contents of CResult_TxCreationKeysDecodeErrorZ
667 pub union CResult_TxCreationKeysDecodeErrorZPtr {
668         /// A pointer to the contents in the success state.
669         /// Reading from this pointer when `result_ok` is not set is undefined.
670         pub result: *mut crate::lightning::ln::chan_utils::TxCreationKeys,
671         /// A pointer to the contents in the error state.
672         /// Reading from this pointer when `result_ok` is set is undefined.
673         pub err: *mut crate::lightning::ln::msgs::DecodeError,
674 }
675 #[repr(C)]
676 /// A CResult_TxCreationKeysDecodeErrorZ represents the result of a fallible operation,
677 /// containing a crate::lightning::ln::chan_utils::TxCreationKeys on success and a crate::lightning::ln::msgs::DecodeError on failure.
678 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
679 pub struct CResult_TxCreationKeysDecodeErrorZ {
680         /// The contents of this CResult_TxCreationKeysDecodeErrorZ, accessible via either
681         /// `err` or `result` depending on the state of `result_ok`.
682         pub contents: CResult_TxCreationKeysDecodeErrorZPtr,
683         /// Whether this CResult_TxCreationKeysDecodeErrorZ represents a success state.
684         pub result_ok: bool,
685 }
686 #[no_mangle]
687 /// Creates a new CResult_TxCreationKeysDecodeErrorZ in the success state.
688 pub extern "C" fn CResult_TxCreationKeysDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::TxCreationKeys) -> CResult_TxCreationKeysDecodeErrorZ {
689         CResult_TxCreationKeysDecodeErrorZ {
690                 contents: CResult_TxCreationKeysDecodeErrorZPtr {
691                         result: Box::into_raw(Box::new(o)),
692                 },
693                 result_ok: true,
694         }
695 }
696 #[no_mangle]
697 /// Creates a new CResult_TxCreationKeysDecodeErrorZ in the error state.
698 pub extern "C" fn CResult_TxCreationKeysDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_TxCreationKeysDecodeErrorZ {
699         CResult_TxCreationKeysDecodeErrorZ {
700                 contents: CResult_TxCreationKeysDecodeErrorZPtr {
701                         err: Box::into_raw(Box::new(e)),
702                 },
703                 result_ok: false,
704         }
705 }
706 /// Checks if the given object is currently in the success state
707 #[no_mangle]
708 pub extern "C" fn CResult_TxCreationKeysDecodeErrorZ_is_ok(o: &CResult_TxCreationKeysDecodeErrorZ) -> bool {
709         o.result_ok
710 }
711 #[no_mangle]
712 /// Frees any resources used by the CResult_TxCreationKeysDecodeErrorZ.
713 pub extern "C" fn CResult_TxCreationKeysDecodeErrorZ_free(_res: CResult_TxCreationKeysDecodeErrorZ) { }
714 impl Drop for CResult_TxCreationKeysDecodeErrorZ {
715         fn drop(&mut self) {
716                 if self.result_ok {
717                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
718                                 let _ = unsafe { Box::from_raw(self.contents.result) };
719                         }
720                 } else {
721                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
722                                 let _ = unsafe { Box::from_raw(self.contents.err) };
723                         }
724                 }
725         }
726 }
727 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::TxCreationKeys, crate::lightning::ln::msgs::DecodeError>> for CResult_TxCreationKeysDecodeErrorZ {
728         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::TxCreationKeys, crate::lightning::ln::msgs::DecodeError>) -> Self {
729                 let contents = if o.result_ok {
730                         let result = unsafe { o.contents.result };
731                         unsafe { o.contents.result = core::ptr::null_mut() };
732                         CResult_TxCreationKeysDecodeErrorZPtr { result }
733                 } else {
734                         let err = unsafe { o.contents.err };
735                         unsafe { o.contents.err = core::ptr::null_mut(); }
736                         CResult_TxCreationKeysDecodeErrorZPtr { err }
737                 };
738                 Self {
739                         contents,
740                         result_ok: o.result_ok,
741                 }
742         }
743 }
744 impl Clone for CResult_TxCreationKeysDecodeErrorZ {
745         fn clone(&self) -> Self {
746                 if self.result_ok {
747                         Self { result_ok: true, contents: CResult_TxCreationKeysDecodeErrorZPtr {
748                                 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::TxCreationKeys>::clone(unsafe { &*self.contents.result })))
749                         } }
750                 } else {
751                         Self { result_ok: false, contents: CResult_TxCreationKeysDecodeErrorZPtr {
752                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
753                         } }
754                 }
755         }
756 }
757 #[no_mangle]
758 /// Creates a new CResult_TxCreationKeysDecodeErrorZ which has the same data as `orig`
759 /// but with all dynamically-allocated buffers duplicated in new buffers.
760 pub extern "C" fn CResult_TxCreationKeysDecodeErrorZ_clone(orig: &CResult_TxCreationKeysDecodeErrorZ) -> CResult_TxCreationKeysDecodeErrorZ { Clone::clone(&orig) }
761 #[repr(C)]
762 /// The contents of CResult_ChannelPublicKeysDecodeErrorZ
763 pub union CResult_ChannelPublicKeysDecodeErrorZPtr {
764         /// A pointer to the contents in the success state.
765         /// Reading from this pointer when `result_ok` is not set is undefined.
766         pub result: *mut crate::lightning::ln::chan_utils::ChannelPublicKeys,
767         /// A pointer to the contents in the error state.
768         /// Reading from this pointer when `result_ok` is set is undefined.
769         pub err: *mut crate::lightning::ln::msgs::DecodeError,
770 }
771 #[repr(C)]
772 /// A CResult_ChannelPublicKeysDecodeErrorZ represents the result of a fallible operation,
773 /// containing a crate::lightning::ln::chan_utils::ChannelPublicKeys on success and a crate::lightning::ln::msgs::DecodeError on failure.
774 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
775 pub struct CResult_ChannelPublicKeysDecodeErrorZ {
776         /// The contents of this CResult_ChannelPublicKeysDecodeErrorZ, accessible via either
777         /// `err` or `result` depending on the state of `result_ok`.
778         pub contents: CResult_ChannelPublicKeysDecodeErrorZPtr,
779         /// Whether this CResult_ChannelPublicKeysDecodeErrorZ represents a success state.
780         pub result_ok: bool,
781 }
782 #[no_mangle]
783 /// Creates a new CResult_ChannelPublicKeysDecodeErrorZ in the success state.
784 pub extern "C" fn CResult_ChannelPublicKeysDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::ChannelPublicKeys) -> CResult_ChannelPublicKeysDecodeErrorZ {
785         CResult_ChannelPublicKeysDecodeErrorZ {
786                 contents: CResult_ChannelPublicKeysDecodeErrorZPtr {
787                         result: Box::into_raw(Box::new(o)),
788                 },
789                 result_ok: true,
790         }
791 }
792 #[no_mangle]
793 /// Creates a new CResult_ChannelPublicKeysDecodeErrorZ in the error state.
794 pub extern "C" fn CResult_ChannelPublicKeysDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelPublicKeysDecodeErrorZ {
795         CResult_ChannelPublicKeysDecodeErrorZ {
796                 contents: CResult_ChannelPublicKeysDecodeErrorZPtr {
797                         err: Box::into_raw(Box::new(e)),
798                 },
799                 result_ok: false,
800         }
801 }
802 /// Checks if the given object is currently in the success state
803 #[no_mangle]
804 pub extern "C" fn CResult_ChannelPublicKeysDecodeErrorZ_is_ok(o: &CResult_ChannelPublicKeysDecodeErrorZ) -> bool {
805         o.result_ok
806 }
807 #[no_mangle]
808 /// Frees any resources used by the CResult_ChannelPublicKeysDecodeErrorZ.
809 pub extern "C" fn CResult_ChannelPublicKeysDecodeErrorZ_free(_res: CResult_ChannelPublicKeysDecodeErrorZ) { }
810 impl Drop for CResult_ChannelPublicKeysDecodeErrorZ {
811         fn drop(&mut self) {
812                 if self.result_ok {
813                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
814                                 let _ = unsafe { Box::from_raw(self.contents.result) };
815                         }
816                 } else {
817                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
818                                 let _ = unsafe { Box::from_raw(self.contents.err) };
819                         }
820                 }
821         }
822 }
823 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::ChannelPublicKeys, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelPublicKeysDecodeErrorZ {
824         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::ChannelPublicKeys, crate::lightning::ln::msgs::DecodeError>) -> Self {
825                 let contents = if o.result_ok {
826                         let result = unsafe { o.contents.result };
827                         unsafe { o.contents.result = core::ptr::null_mut() };
828                         CResult_ChannelPublicKeysDecodeErrorZPtr { result }
829                 } else {
830                         let err = unsafe { o.contents.err };
831                         unsafe { o.contents.err = core::ptr::null_mut(); }
832                         CResult_ChannelPublicKeysDecodeErrorZPtr { err }
833                 };
834                 Self {
835                         contents,
836                         result_ok: o.result_ok,
837                 }
838         }
839 }
840 impl Clone for CResult_ChannelPublicKeysDecodeErrorZ {
841         fn clone(&self) -> Self {
842                 if self.result_ok {
843                         Self { result_ok: true, contents: CResult_ChannelPublicKeysDecodeErrorZPtr {
844                                 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::ChannelPublicKeys>::clone(unsafe { &*self.contents.result })))
845                         } }
846                 } else {
847                         Self { result_ok: false, contents: CResult_ChannelPublicKeysDecodeErrorZPtr {
848                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
849                         } }
850                 }
851         }
852 }
853 #[no_mangle]
854 /// Creates a new CResult_ChannelPublicKeysDecodeErrorZ which has the same data as `orig`
855 /// but with all dynamically-allocated buffers duplicated in new buffers.
856 pub extern "C" fn CResult_ChannelPublicKeysDecodeErrorZ_clone(orig: &CResult_ChannelPublicKeysDecodeErrorZ) -> CResult_ChannelPublicKeysDecodeErrorZ { Clone::clone(&orig) }
857 #[repr(C)]
858 /// The contents of CResult_TxCreationKeysErrorZ
859 pub union CResult_TxCreationKeysErrorZPtr {
860         /// A pointer to the contents in the success state.
861         /// Reading from this pointer when `result_ok` is not set is undefined.
862         pub result: *mut crate::lightning::ln::chan_utils::TxCreationKeys,
863         /// A pointer to the contents in the error state.
864         /// Reading from this pointer when `result_ok` is set is undefined.
865         pub err: *mut crate::c_types::Secp256k1Error,
866 }
867 #[repr(C)]
868 /// A CResult_TxCreationKeysErrorZ represents the result of a fallible operation,
869 /// containing a crate::lightning::ln::chan_utils::TxCreationKeys on success and a crate::c_types::Secp256k1Error on failure.
870 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
871 pub struct CResult_TxCreationKeysErrorZ {
872         /// The contents of this CResult_TxCreationKeysErrorZ, accessible via either
873         /// `err` or `result` depending on the state of `result_ok`.
874         pub contents: CResult_TxCreationKeysErrorZPtr,
875         /// Whether this CResult_TxCreationKeysErrorZ represents a success state.
876         pub result_ok: bool,
877 }
878 #[no_mangle]
879 /// Creates a new CResult_TxCreationKeysErrorZ in the success state.
880 pub extern "C" fn CResult_TxCreationKeysErrorZ_ok(o: crate::lightning::ln::chan_utils::TxCreationKeys) -> CResult_TxCreationKeysErrorZ {
881         CResult_TxCreationKeysErrorZ {
882                 contents: CResult_TxCreationKeysErrorZPtr {
883                         result: Box::into_raw(Box::new(o)),
884                 },
885                 result_ok: true,
886         }
887 }
888 #[no_mangle]
889 /// Creates a new CResult_TxCreationKeysErrorZ in the error state.
890 pub extern "C" fn CResult_TxCreationKeysErrorZ_err(e: crate::c_types::Secp256k1Error) -> CResult_TxCreationKeysErrorZ {
891         CResult_TxCreationKeysErrorZ {
892                 contents: CResult_TxCreationKeysErrorZPtr {
893                         err: Box::into_raw(Box::new(e)),
894                 },
895                 result_ok: false,
896         }
897 }
898 /// Checks if the given object is currently in the success state
899 #[no_mangle]
900 pub extern "C" fn CResult_TxCreationKeysErrorZ_is_ok(o: &CResult_TxCreationKeysErrorZ) -> bool {
901         o.result_ok
902 }
903 #[no_mangle]
904 /// Frees any resources used by the CResult_TxCreationKeysErrorZ.
905 pub extern "C" fn CResult_TxCreationKeysErrorZ_free(_res: CResult_TxCreationKeysErrorZ) { }
906 impl Drop for CResult_TxCreationKeysErrorZ {
907         fn drop(&mut self) {
908                 if self.result_ok {
909                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
910                                 let _ = unsafe { Box::from_raw(self.contents.result) };
911                         }
912                 } else {
913                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
914                                 let _ = unsafe { Box::from_raw(self.contents.err) };
915                         }
916                 }
917         }
918 }
919 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::TxCreationKeys, crate::c_types::Secp256k1Error>> for CResult_TxCreationKeysErrorZ {
920         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::TxCreationKeys, crate::c_types::Secp256k1Error>) -> Self {
921                 let contents = if o.result_ok {
922                         let result = unsafe { o.contents.result };
923                         unsafe { o.contents.result = core::ptr::null_mut() };
924                         CResult_TxCreationKeysErrorZPtr { result }
925                 } else {
926                         let err = unsafe { o.contents.err };
927                         unsafe { o.contents.err = core::ptr::null_mut(); }
928                         CResult_TxCreationKeysErrorZPtr { err }
929                 };
930                 Self {
931                         contents,
932                         result_ok: o.result_ok,
933                 }
934         }
935 }
936 impl Clone for CResult_TxCreationKeysErrorZ {
937         fn clone(&self) -> Self {
938                 if self.result_ok {
939                         Self { result_ok: true, contents: CResult_TxCreationKeysErrorZPtr {
940                                 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::TxCreationKeys>::clone(unsafe { &*self.contents.result })))
941                         } }
942                 } else {
943                         Self { result_ok: false, contents: CResult_TxCreationKeysErrorZPtr {
944                                 err: Box::into_raw(Box::new(<crate::c_types::Secp256k1Error>::clone(unsafe { &*self.contents.err })))
945                         } }
946                 }
947         }
948 }
949 #[no_mangle]
950 /// Creates a new CResult_TxCreationKeysErrorZ which has the same data as `orig`
951 /// but with all dynamically-allocated buffers duplicated in new buffers.
952 pub extern "C" fn CResult_TxCreationKeysErrorZ_clone(orig: &CResult_TxCreationKeysErrorZ) -> CResult_TxCreationKeysErrorZ { Clone::clone(&orig) }
953 #[repr(C)]
954 #[derive(Clone)]
955 /// An enum which can either contain a u32 or not
956 pub enum COption_u32Z {
957         /// When we're in this state, this COption_u32Z contains a u32
958         Some(u32),
959         /// When we're in this state, this COption_u32Z contains nothing
960         None
961 }
962 impl COption_u32Z {
963         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
964                 if let Self::None = self { false } else { true }
965         }
966         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
967                 !self.is_some()
968         }
969         #[allow(unused)] pub(crate) fn take(mut self) -> u32 {
970                 if let Self::Some(v) = self { v } else { unreachable!() }
971         }
972 }
973 #[no_mangle]
974 /// Constructs a new COption_u32Z containing a u32
975 pub extern "C" fn COption_u32Z_some(o: u32) -> COption_u32Z {
976         COption_u32Z::Some(o)
977 }
978 #[no_mangle]
979 /// Constructs a new COption_u32Z containing nothing
980 pub extern "C" fn COption_u32Z_none() -> COption_u32Z {
981         COption_u32Z::None
982 }
983 #[no_mangle]
984 /// Frees any resources associated with the u32, if we are in the Some state
985 pub extern "C" fn COption_u32Z_free(_res: COption_u32Z) { }
986 #[no_mangle]
987 /// Creates a new COption_u32Z which has the same data as `orig`
988 /// but with all dynamically-allocated buffers duplicated in new buffers.
989 pub extern "C" fn COption_u32Z_clone(orig: &COption_u32Z) -> COption_u32Z { Clone::clone(&orig) }
990 #[repr(C)]
991 /// The contents of CResult_HTLCOutputInCommitmentDecodeErrorZ
992 pub union CResult_HTLCOutputInCommitmentDecodeErrorZPtr {
993         /// A pointer to the contents in the success state.
994         /// Reading from this pointer when `result_ok` is not set is undefined.
995         pub result: *mut crate::lightning::ln::chan_utils::HTLCOutputInCommitment,
996         /// A pointer to the contents in the error state.
997         /// Reading from this pointer when `result_ok` is set is undefined.
998         pub err: *mut crate::lightning::ln::msgs::DecodeError,
999 }
1000 #[repr(C)]
1001 /// A CResult_HTLCOutputInCommitmentDecodeErrorZ represents the result of a fallible operation,
1002 /// containing a crate::lightning::ln::chan_utils::HTLCOutputInCommitment on success and a crate::lightning::ln::msgs::DecodeError on failure.
1003 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1004 pub struct CResult_HTLCOutputInCommitmentDecodeErrorZ {
1005         /// The contents of this CResult_HTLCOutputInCommitmentDecodeErrorZ, accessible via either
1006         /// `err` or `result` depending on the state of `result_ok`.
1007         pub contents: CResult_HTLCOutputInCommitmentDecodeErrorZPtr,
1008         /// Whether this CResult_HTLCOutputInCommitmentDecodeErrorZ represents a success state.
1009         pub result_ok: bool,
1010 }
1011 #[no_mangle]
1012 /// Creates a new CResult_HTLCOutputInCommitmentDecodeErrorZ in the success state.
1013 pub extern "C" fn CResult_HTLCOutputInCommitmentDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::HTLCOutputInCommitment) -> CResult_HTLCOutputInCommitmentDecodeErrorZ {
1014         CResult_HTLCOutputInCommitmentDecodeErrorZ {
1015                 contents: CResult_HTLCOutputInCommitmentDecodeErrorZPtr {
1016                         result: Box::into_raw(Box::new(o)),
1017                 },
1018                 result_ok: true,
1019         }
1020 }
1021 #[no_mangle]
1022 /// Creates a new CResult_HTLCOutputInCommitmentDecodeErrorZ in the error state.
1023 pub extern "C" fn CResult_HTLCOutputInCommitmentDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_HTLCOutputInCommitmentDecodeErrorZ {
1024         CResult_HTLCOutputInCommitmentDecodeErrorZ {
1025                 contents: CResult_HTLCOutputInCommitmentDecodeErrorZPtr {
1026                         err: Box::into_raw(Box::new(e)),
1027                 },
1028                 result_ok: false,
1029         }
1030 }
1031 /// Checks if the given object is currently in the success state
1032 #[no_mangle]
1033 pub extern "C" fn CResult_HTLCOutputInCommitmentDecodeErrorZ_is_ok(o: &CResult_HTLCOutputInCommitmentDecodeErrorZ) -> bool {
1034         o.result_ok
1035 }
1036 #[no_mangle]
1037 /// Frees any resources used by the CResult_HTLCOutputInCommitmentDecodeErrorZ.
1038 pub extern "C" fn CResult_HTLCOutputInCommitmentDecodeErrorZ_free(_res: CResult_HTLCOutputInCommitmentDecodeErrorZ) { }
1039 impl Drop for CResult_HTLCOutputInCommitmentDecodeErrorZ {
1040         fn drop(&mut self) {
1041                 if self.result_ok {
1042                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
1043                                 let _ = unsafe { Box::from_raw(self.contents.result) };
1044                         }
1045                 } else {
1046                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
1047                                 let _ = unsafe { Box::from_raw(self.contents.err) };
1048                         }
1049                 }
1050         }
1051 }
1052 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::HTLCOutputInCommitment, crate::lightning::ln::msgs::DecodeError>> for CResult_HTLCOutputInCommitmentDecodeErrorZ {
1053         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::HTLCOutputInCommitment, crate::lightning::ln::msgs::DecodeError>) -> Self {
1054                 let contents = if o.result_ok {
1055                         let result = unsafe { o.contents.result };
1056                         unsafe { o.contents.result = core::ptr::null_mut() };
1057                         CResult_HTLCOutputInCommitmentDecodeErrorZPtr { result }
1058                 } else {
1059                         let err = unsafe { o.contents.err };
1060                         unsafe { o.contents.err = core::ptr::null_mut(); }
1061                         CResult_HTLCOutputInCommitmentDecodeErrorZPtr { err }
1062                 };
1063                 Self {
1064                         contents,
1065                         result_ok: o.result_ok,
1066                 }
1067         }
1068 }
1069 impl Clone for CResult_HTLCOutputInCommitmentDecodeErrorZ {
1070         fn clone(&self) -> Self {
1071                 if self.result_ok {
1072                         Self { result_ok: true, contents: CResult_HTLCOutputInCommitmentDecodeErrorZPtr {
1073                                 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::HTLCOutputInCommitment>::clone(unsafe { &*self.contents.result })))
1074                         } }
1075                 } else {
1076                         Self { result_ok: false, contents: CResult_HTLCOutputInCommitmentDecodeErrorZPtr {
1077                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
1078                         } }
1079                 }
1080         }
1081 }
1082 #[no_mangle]
1083 /// Creates a new CResult_HTLCOutputInCommitmentDecodeErrorZ which has the same data as `orig`
1084 /// but with all dynamically-allocated buffers duplicated in new buffers.
1085 pub extern "C" fn CResult_HTLCOutputInCommitmentDecodeErrorZ_clone(orig: &CResult_HTLCOutputInCommitmentDecodeErrorZ) -> CResult_HTLCOutputInCommitmentDecodeErrorZ { Clone::clone(&orig) }
1086 #[repr(C)]
1087 /// An enum which can either contain a  or not
1088 pub enum COption_NoneZ {
1089         /// When we're in this state, this COption_NoneZ contains a 
1090         Some,
1091         /// When we're in this state, this COption_NoneZ contains nothing
1092         None
1093 }
1094 impl COption_NoneZ {
1095         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
1096                 if let Self::None = self { false } else { true }
1097         }
1098         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
1099                 !self.is_some()
1100         }
1101 }
1102 #[no_mangle]
1103 /// Constructs a new COption_NoneZ containing a 
1104 pub extern "C" fn COption_NoneZ_some() -> COption_NoneZ {
1105         COption_NoneZ::Some
1106 }
1107 #[no_mangle]
1108 /// Constructs a new COption_NoneZ containing nothing
1109 pub extern "C" fn COption_NoneZ_none() -> COption_NoneZ {
1110         COption_NoneZ::None
1111 }
1112 #[no_mangle]
1113 /// Frees any resources associated with the , if we are in the Some state
1114 pub extern "C" fn COption_NoneZ_free(_res: COption_NoneZ) { }
1115 #[repr(C)]
1116 /// The contents of CResult_CounterpartyChannelTransactionParametersDecodeErrorZ
1117 pub union CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr {
1118         /// A pointer to the contents in the success state.
1119         /// Reading from this pointer when `result_ok` is not set is undefined.
1120         pub result: *mut crate::lightning::ln::chan_utils::CounterpartyChannelTransactionParameters,
1121         /// A pointer to the contents in the error state.
1122         /// Reading from this pointer when `result_ok` is set is undefined.
1123         pub err: *mut crate::lightning::ln::msgs::DecodeError,
1124 }
1125 #[repr(C)]
1126 /// A CResult_CounterpartyChannelTransactionParametersDecodeErrorZ represents the result of a fallible operation,
1127 /// containing a crate::lightning::ln::chan_utils::CounterpartyChannelTransactionParameters on success and a crate::lightning::ln::msgs::DecodeError on failure.
1128 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1129 pub struct CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
1130         /// The contents of this CResult_CounterpartyChannelTransactionParametersDecodeErrorZ, accessible via either
1131         /// `err` or `result` depending on the state of `result_ok`.
1132         pub contents: CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr,
1133         /// Whether this CResult_CounterpartyChannelTransactionParametersDecodeErrorZ represents a success state.
1134         pub result_ok: bool,
1135 }
1136 #[no_mangle]
1137 /// Creates a new CResult_CounterpartyChannelTransactionParametersDecodeErrorZ in the success state.
1138 pub extern "C" fn CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::CounterpartyChannelTransactionParameters) -> CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
1139         CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
1140                 contents: CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr {
1141                         result: Box::into_raw(Box::new(o)),
1142                 },
1143                 result_ok: true,
1144         }
1145 }
1146 #[no_mangle]
1147 /// Creates a new CResult_CounterpartyChannelTransactionParametersDecodeErrorZ in the error state.
1148 pub extern "C" fn CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
1149         CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
1150                 contents: CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr {
1151                         err: Box::into_raw(Box::new(e)),
1152                 },
1153                 result_ok: false,
1154         }
1155 }
1156 /// Checks if the given object is currently in the success state
1157 #[no_mangle]
1158 pub extern "C" fn CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_is_ok(o: &CResult_CounterpartyChannelTransactionParametersDecodeErrorZ) -> bool {
1159         o.result_ok
1160 }
1161 #[no_mangle]
1162 /// Frees any resources used by the CResult_CounterpartyChannelTransactionParametersDecodeErrorZ.
1163 pub extern "C" fn CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_free(_res: CResult_CounterpartyChannelTransactionParametersDecodeErrorZ) { }
1164 impl Drop for CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
1165         fn drop(&mut self) {
1166                 if self.result_ok {
1167                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
1168                                 let _ = unsafe { Box::from_raw(self.contents.result) };
1169                         }
1170                 } else {
1171                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
1172                                 let _ = unsafe { Box::from_raw(self.contents.err) };
1173                         }
1174                 }
1175         }
1176 }
1177 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::CounterpartyChannelTransactionParameters, crate::lightning::ln::msgs::DecodeError>> for CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
1178         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::CounterpartyChannelTransactionParameters, crate::lightning::ln::msgs::DecodeError>) -> Self {
1179                 let contents = if o.result_ok {
1180                         let result = unsafe { o.contents.result };
1181                         unsafe { o.contents.result = core::ptr::null_mut() };
1182                         CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr { result }
1183                 } else {
1184                         let err = unsafe { o.contents.err };
1185                         unsafe { o.contents.err = core::ptr::null_mut(); }
1186                         CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr { err }
1187                 };
1188                 Self {
1189                         contents,
1190                         result_ok: o.result_ok,
1191                 }
1192         }
1193 }
1194 impl Clone for CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
1195         fn clone(&self) -> Self {
1196                 if self.result_ok {
1197                         Self { result_ok: true, contents: CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr {
1198                                 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::CounterpartyChannelTransactionParameters>::clone(unsafe { &*self.contents.result })))
1199                         } }
1200                 } else {
1201                         Self { result_ok: false, contents: CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr {
1202                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
1203                         } }
1204                 }
1205         }
1206 }
1207 #[no_mangle]
1208 /// Creates a new CResult_CounterpartyChannelTransactionParametersDecodeErrorZ which has the same data as `orig`
1209 /// but with all dynamically-allocated buffers duplicated in new buffers.
1210 pub extern "C" fn CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone(orig: &CResult_CounterpartyChannelTransactionParametersDecodeErrorZ) -> CResult_CounterpartyChannelTransactionParametersDecodeErrorZ { Clone::clone(&orig) }
1211 #[repr(C)]
1212 /// The contents of CResult_ChannelTransactionParametersDecodeErrorZ
1213 pub union CResult_ChannelTransactionParametersDecodeErrorZPtr {
1214         /// A pointer to the contents in the success state.
1215         /// Reading from this pointer when `result_ok` is not set is undefined.
1216         pub result: *mut crate::lightning::ln::chan_utils::ChannelTransactionParameters,
1217         /// A pointer to the contents in the error state.
1218         /// Reading from this pointer when `result_ok` is set is undefined.
1219         pub err: *mut crate::lightning::ln::msgs::DecodeError,
1220 }
1221 #[repr(C)]
1222 /// A CResult_ChannelTransactionParametersDecodeErrorZ represents the result of a fallible operation,
1223 /// containing a crate::lightning::ln::chan_utils::ChannelTransactionParameters on success and a crate::lightning::ln::msgs::DecodeError on failure.
1224 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1225 pub struct CResult_ChannelTransactionParametersDecodeErrorZ {
1226         /// The contents of this CResult_ChannelTransactionParametersDecodeErrorZ, accessible via either
1227         /// `err` or `result` depending on the state of `result_ok`.
1228         pub contents: CResult_ChannelTransactionParametersDecodeErrorZPtr,
1229         /// Whether this CResult_ChannelTransactionParametersDecodeErrorZ represents a success state.
1230         pub result_ok: bool,
1231 }
1232 #[no_mangle]
1233 /// Creates a new CResult_ChannelTransactionParametersDecodeErrorZ in the success state.
1234 pub extern "C" fn CResult_ChannelTransactionParametersDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::ChannelTransactionParameters) -> CResult_ChannelTransactionParametersDecodeErrorZ {
1235         CResult_ChannelTransactionParametersDecodeErrorZ {
1236                 contents: CResult_ChannelTransactionParametersDecodeErrorZPtr {
1237                         result: Box::into_raw(Box::new(o)),
1238                 },
1239                 result_ok: true,
1240         }
1241 }
1242 #[no_mangle]
1243 /// Creates a new CResult_ChannelTransactionParametersDecodeErrorZ in the error state.
1244 pub extern "C" fn CResult_ChannelTransactionParametersDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelTransactionParametersDecodeErrorZ {
1245         CResult_ChannelTransactionParametersDecodeErrorZ {
1246                 contents: CResult_ChannelTransactionParametersDecodeErrorZPtr {
1247                         err: Box::into_raw(Box::new(e)),
1248                 },
1249                 result_ok: false,
1250         }
1251 }
1252 /// Checks if the given object is currently in the success state
1253 #[no_mangle]
1254 pub extern "C" fn CResult_ChannelTransactionParametersDecodeErrorZ_is_ok(o: &CResult_ChannelTransactionParametersDecodeErrorZ) -> bool {
1255         o.result_ok
1256 }
1257 #[no_mangle]
1258 /// Frees any resources used by the CResult_ChannelTransactionParametersDecodeErrorZ.
1259 pub extern "C" fn CResult_ChannelTransactionParametersDecodeErrorZ_free(_res: CResult_ChannelTransactionParametersDecodeErrorZ) { }
1260 impl Drop for CResult_ChannelTransactionParametersDecodeErrorZ {
1261         fn drop(&mut self) {
1262                 if self.result_ok {
1263                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
1264                                 let _ = unsafe { Box::from_raw(self.contents.result) };
1265                         }
1266                 } else {
1267                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
1268                                 let _ = unsafe { Box::from_raw(self.contents.err) };
1269                         }
1270                 }
1271         }
1272 }
1273 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::ChannelTransactionParameters, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelTransactionParametersDecodeErrorZ {
1274         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::ChannelTransactionParameters, crate::lightning::ln::msgs::DecodeError>) -> Self {
1275                 let contents = if o.result_ok {
1276                         let result = unsafe { o.contents.result };
1277                         unsafe { o.contents.result = core::ptr::null_mut() };
1278                         CResult_ChannelTransactionParametersDecodeErrorZPtr { result }
1279                 } else {
1280                         let err = unsafe { o.contents.err };
1281                         unsafe { o.contents.err = core::ptr::null_mut(); }
1282                         CResult_ChannelTransactionParametersDecodeErrorZPtr { err }
1283                 };
1284                 Self {
1285                         contents,
1286                         result_ok: o.result_ok,
1287                 }
1288         }
1289 }
1290 impl Clone for CResult_ChannelTransactionParametersDecodeErrorZ {
1291         fn clone(&self) -> Self {
1292                 if self.result_ok {
1293                         Self { result_ok: true, contents: CResult_ChannelTransactionParametersDecodeErrorZPtr {
1294                                 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::ChannelTransactionParameters>::clone(unsafe { &*self.contents.result })))
1295                         } }
1296                 } else {
1297                         Self { result_ok: false, contents: CResult_ChannelTransactionParametersDecodeErrorZPtr {
1298                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
1299                         } }
1300                 }
1301         }
1302 }
1303 #[no_mangle]
1304 /// Creates a new CResult_ChannelTransactionParametersDecodeErrorZ which has the same data as `orig`
1305 /// but with all dynamically-allocated buffers duplicated in new buffers.
1306 pub extern "C" fn CResult_ChannelTransactionParametersDecodeErrorZ_clone(orig: &CResult_ChannelTransactionParametersDecodeErrorZ) -> CResult_ChannelTransactionParametersDecodeErrorZ { Clone::clone(&orig) }
1307 #[repr(C)]
1308 /// A dynamically-allocated array of crate::c_types::Signatures of arbitrary size.
1309 /// This corresponds to std::vector in C++
1310 pub struct CVec_SignatureZ {
1311         /// The elements in the array.
1312         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
1313         pub data: *mut crate::c_types::Signature,
1314         /// The number of elements pointed to by `data`.
1315         pub datalen: usize
1316 }
1317 impl CVec_SignatureZ {
1318         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::Signature> {
1319                 if self.datalen == 0 { return Vec::new(); }
1320                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
1321                 self.data = core::ptr::null_mut();
1322                 self.datalen = 0;
1323                 ret
1324         }
1325         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::Signature] {
1326                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
1327         }
1328 }
1329 impl From<Vec<crate::c_types::Signature>> for CVec_SignatureZ {
1330         fn from(v: Vec<crate::c_types::Signature>) -> Self {
1331                 let datalen = v.len();
1332                 let data = Box::into_raw(v.into_boxed_slice());
1333                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
1334         }
1335 }
1336 #[no_mangle]
1337 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
1338 pub extern "C" fn CVec_SignatureZ_free(_res: CVec_SignatureZ) { }
1339 impl Drop for CVec_SignatureZ {
1340         fn drop(&mut self) {
1341                 if self.datalen == 0 { return; }
1342                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
1343         }
1344 }
1345 impl Clone for CVec_SignatureZ {
1346         fn clone(&self) -> Self {
1347                 let mut res = Vec::new();
1348                 if self.datalen == 0 { return Self::from(res); }
1349                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
1350                 Self::from(res)
1351         }
1352 }
1353 #[repr(C)]
1354 /// The contents of CResult_HolderCommitmentTransactionDecodeErrorZ
1355 pub union CResult_HolderCommitmentTransactionDecodeErrorZPtr {
1356         /// A pointer to the contents in the success state.
1357         /// Reading from this pointer when `result_ok` is not set is undefined.
1358         pub result: *mut crate::lightning::ln::chan_utils::HolderCommitmentTransaction,
1359         /// A pointer to the contents in the error state.
1360         /// Reading from this pointer when `result_ok` is set is undefined.
1361         pub err: *mut crate::lightning::ln::msgs::DecodeError,
1362 }
1363 #[repr(C)]
1364 /// A CResult_HolderCommitmentTransactionDecodeErrorZ represents the result of a fallible operation,
1365 /// containing a crate::lightning::ln::chan_utils::HolderCommitmentTransaction on success and a crate::lightning::ln::msgs::DecodeError on failure.
1366 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1367 pub struct CResult_HolderCommitmentTransactionDecodeErrorZ {
1368         /// The contents of this CResult_HolderCommitmentTransactionDecodeErrorZ, accessible via either
1369         /// `err` or `result` depending on the state of `result_ok`.
1370         pub contents: CResult_HolderCommitmentTransactionDecodeErrorZPtr,
1371         /// Whether this CResult_HolderCommitmentTransactionDecodeErrorZ represents a success state.
1372         pub result_ok: bool,
1373 }
1374 #[no_mangle]
1375 /// Creates a new CResult_HolderCommitmentTransactionDecodeErrorZ in the success state.
1376 pub extern "C" fn CResult_HolderCommitmentTransactionDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::HolderCommitmentTransaction) -> CResult_HolderCommitmentTransactionDecodeErrorZ {
1377         CResult_HolderCommitmentTransactionDecodeErrorZ {
1378                 contents: CResult_HolderCommitmentTransactionDecodeErrorZPtr {
1379                         result: Box::into_raw(Box::new(o)),
1380                 },
1381                 result_ok: true,
1382         }
1383 }
1384 #[no_mangle]
1385 /// Creates a new CResult_HolderCommitmentTransactionDecodeErrorZ in the error state.
1386 pub extern "C" fn CResult_HolderCommitmentTransactionDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_HolderCommitmentTransactionDecodeErrorZ {
1387         CResult_HolderCommitmentTransactionDecodeErrorZ {
1388                 contents: CResult_HolderCommitmentTransactionDecodeErrorZPtr {
1389                         err: Box::into_raw(Box::new(e)),
1390                 },
1391                 result_ok: false,
1392         }
1393 }
1394 /// Checks if the given object is currently in the success state
1395 #[no_mangle]
1396 pub extern "C" fn CResult_HolderCommitmentTransactionDecodeErrorZ_is_ok(o: &CResult_HolderCommitmentTransactionDecodeErrorZ) -> bool {
1397         o.result_ok
1398 }
1399 #[no_mangle]
1400 /// Frees any resources used by the CResult_HolderCommitmentTransactionDecodeErrorZ.
1401 pub extern "C" fn CResult_HolderCommitmentTransactionDecodeErrorZ_free(_res: CResult_HolderCommitmentTransactionDecodeErrorZ) { }
1402 impl Drop for CResult_HolderCommitmentTransactionDecodeErrorZ {
1403         fn drop(&mut self) {
1404                 if self.result_ok {
1405                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
1406                                 let _ = unsafe { Box::from_raw(self.contents.result) };
1407                         }
1408                 } else {
1409                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
1410                                 let _ = unsafe { Box::from_raw(self.contents.err) };
1411                         }
1412                 }
1413         }
1414 }
1415 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::HolderCommitmentTransaction, crate::lightning::ln::msgs::DecodeError>> for CResult_HolderCommitmentTransactionDecodeErrorZ {
1416         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::HolderCommitmentTransaction, crate::lightning::ln::msgs::DecodeError>) -> Self {
1417                 let contents = if o.result_ok {
1418                         let result = unsafe { o.contents.result };
1419                         unsafe { o.contents.result = core::ptr::null_mut() };
1420                         CResult_HolderCommitmentTransactionDecodeErrorZPtr { result }
1421                 } else {
1422                         let err = unsafe { o.contents.err };
1423                         unsafe { o.contents.err = core::ptr::null_mut(); }
1424                         CResult_HolderCommitmentTransactionDecodeErrorZPtr { err }
1425                 };
1426                 Self {
1427                         contents,
1428                         result_ok: o.result_ok,
1429                 }
1430         }
1431 }
1432 impl Clone for CResult_HolderCommitmentTransactionDecodeErrorZ {
1433         fn clone(&self) -> Self {
1434                 if self.result_ok {
1435                         Self { result_ok: true, contents: CResult_HolderCommitmentTransactionDecodeErrorZPtr {
1436                                 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::HolderCommitmentTransaction>::clone(unsafe { &*self.contents.result })))
1437                         } }
1438                 } else {
1439                         Self { result_ok: false, contents: CResult_HolderCommitmentTransactionDecodeErrorZPtr {
1440                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
1441                         } }
1442                 }
1443         }
1444 }
1445 #[no_mangle]
1446 /// Creates a new CResult_HolderCommitmentTransactionDecodeErrorZ which has the same data as `orig`
1447 /// but with all dynamically-allocated buffers duplicated in new buffers.
1448 pub extern "C" fn CResult_HolderCommitmentTransactionDecodeErrorZ_clone(orig: &CResult_HolderCommitmentTransactionDecodeErrorZ) -> CResult_HolderCommitmentTransactionDecodeErrorZ { Clone::clone(&orig) }
1449 #[repr(C)]
1450 /// The contents of CResult_BuiltCommitmentTransactionDecodeErrorZ
1451 pub union CResult_BuiltCommitmentTransactionDecodeErrorZPtr {
1452         /// A pointer to the contents in the success state.
1453         /// Reading from this pointer when `result_ok` is not set is undefined.
1454         pub result: *mut crate::lightning::ln::chan_utils::BuiltCommitmentTransaction,
1455         /// A pointer to the contents in the error state.
1456         /// Reading from this pointer when `result_ok` is set is undefined.
1457         pub err: *mut crate::lightning::ln::msgs::DecodeError,
1458 }
1459 #[repr(C)]
1460 /// A CResult_BuiltCommitmentTransactionDecodeErrorZ represents the result of a fallible operation,
1461 /// containing a crate::lightning::ln::chan_utils::BuiltCommitmentTransaction on success and a crate::lightning::ln::msgs::DecodeError on failure.
1462 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1463 pub struct CResult_BuiltCommitmentTransactionDecodeErrorZ {
1464         /// The contents of this CResult_BuiltCommitmentTransactionDecodeErrorZ, accessible via either
1465         /// `err` or `result` depending on the state of `result_ok`.
1466         pub contents: CResult_BuiltCommitmentTransactionDecodeErrorZPtr,
1467         /// Whether this CResult_BuiltCommitmentTransactionDecodeErrorZ represents a success state.
1468         pub result_ok: bool,
1469 }
1470 #[no_mangle]
1471 /// Creates a new CResult_BuiltCommitmentTransactionDecodeErrorZ in the success state.
1472 pub extern "C" fn CResult_BuiltCommitmentTransactionDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::BuiltCommitmentTransaction) -> CResult_BuiltCommitmentTransactionDecodeErrorZ {
1473         CResult_BuiltCommitmentTransactionDecodeErrorZ {
1474                 contents: CResult_BuiltCommitmentTransactionDecodeErrorZPtr {
1475                         result: Box::into_raw(Box::new(o)),
1476                 },
1477                 result_ok: true,
1478         }
1479 }
1480 #[no_mangle]
1481 /// Creates a new CResult_BuiltCommitmentTransactionDecodeErrorZ in the error state.
1482 pub extern "C" fn CResult_BuiltCommitmentTransactionDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_BuiltCommitmentTransactionDecodeErrorZ {
1483         CResult_BuiltCommitmentTransactionDecodeErrorZ {
1484                 contents: CResult_BuiltCommitmentTransactionDecodeErrorZPtr {
1485                         err: Box::into_raw(Box::new(e)),
1486                 },
1487                 result_ok: false,
1488         }
1489 }
1490 /// Checks if the given object is currently in the success state
1491 #[no_mangle]
1492 pub extern "C" fn CResult_BuiltCommitmentTransactionDecodeErrorZ_is_ok(o: &CResult_BuiltCommitmentTransactionDecodeErrorZ) -> bool {
1493         o.result_ok
1494 }
1495 #[no_mangle]
1496 /// Frees any resources used by the CResult_BuiltCommitmentTransactionDecodeErrorZ.
1497 pub extern "C" fn CResult_BuiltCommitmentTransactionDecodeErrorZ_free(_res: CResult_BuiltCommitmentTransactionDecodeErrorZ) { }
1498 impl Drop for CResult_BuiltCommitmentTransactionDecodeErrorZ {
1499         fn drop(&mut self) {
1500                 if self.result_ok {
1501                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
1502                                 let _ = unsafe { Box::from_raw(self.contents.result) };
1503                         }
1504                 } else {
1505                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
1506                                 let _ = unsafe { Box::from_raw(self.contents.err) };
1507                         }
1508                 }
1509         }
1510 }
1511 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::BuiltCommitmentTransaction, crate::lightning::ln::msgs::DecodeError>> for CResult_BuiltCommitmentTransactionDecodeErrorZ {
1512         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::BuiltCommitmentTransaction, crate::lightning::ln::msgs::DecodeError>) -> Self {
1513                 let contents = if o.result_ok {
1514                         let result = unsafe { o.contents.result };
1515                         unsafe { o.contents.result = core::ptr::null_mut() };
1516                         CResult_BuiltCommitmentTransactionDecodeErrorZPtr { result }
1517                 } else {
1518                         let err = unsafe { o.contents.err };
1519                         unsafe { o.contents.err = core::ptr::null_mut(); }
1520                         CResult_BuiltCommitmentTransactionDecodeErrorZPtr { err }
1521                 };
1522                 Self {
1523                         contents,
1524                         result_ok: o.result_ok,
1525                 }
1526         }
1527 }
1528 impl Clone for CResult_BuiltCommitmentTransactionDecodeErrorZ {
1529         fn clone(&self) -> Self {
1530                 if self.result_ok {
1531                         Self { result_ok: true, contents: CResult_BuiltCommitmentTransactionDecodeErrorZPtr {
1532                                 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::BuiltCommitmentTransaction>::clone(unsafe { &*self.contents.result })))
1533                         } }
1534                 } else {
1535                         Self { result_ok: false, contents: CResult_BuiltCommitmentTransactionDecodeErrorZPtr {
1536                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
1537                         } }
1538                 }
1539         }
1540 }
1541 #[no_mangle]
1542 /// Creates a new CResult_BuiltCommitmentTransactionDecodeErrorZ which has the same data as `orig`
1543 /// but with all dynamically-allocated buffers duplicated in new buffers.
1544 pub extern "C" fn CResult_BuiltCommitmentTransactionDecodeErrorZ_clone(orig: &CResult_BuiltCommitmentTransactionDecodeErrorZ) -> CResult_BuiltCommitmentTransactionDecodeErrorZ { Clone::clone(&orig) }
1545 #[repr(C)]
1546 /// The contents of CResult_TrustedClosingTransactionNoneZ
1547 pub union CResult_TrustedClosingTransactionNoneZPtr {
1548         /// A pointer to the contents in the success state.
1549         /// Reading from this pointer when `result_ok` is not set is undefined.
1550         pub result: *mut crate::lightning::ln::chan_utils::TrustedClosingTransaction,
1551         /// Note that this value is always NULL, as there are no contents in the Err variant
1552         pub err: *mut core::ffi::c_void,
1553 }
1554 #[repr(C)]
1555 /// A CResult_TrustedClosingTransactionNoneZ represents the result of a fallible operation,
1556 /// containing a crate::lightning::ln::chan_utils::TrustedClosingTransaction on success and a () on failure.
1557 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1558 pub struct CResult_TrustedClosingTransactionNoneZ {
1559         /// The contents of this CResult_TrustedClosingTransactionNoneZ, accessible via either
1560         /// `err` or `result` depending on the state of `result_ok`.
1561         pub contents: CResult_TrustedClosingTransactionNoneZPtr,
1562         /// Whether this CResult_TrustedClosingTransactionNoneZ represents a success state.
1563         pub result_ok: bool,
1564 }
1565 #[no_mangle]
1566 /// Creates a new CResult_TrustedClosingTransactionNoneZ in the success state.
1567 pub extern "C" fn CResult_TrustedClosingTransactionNoneZ_ok(o: crate::lightning::ln::chan_utils::TrustedClosingTransaction) -> CResult_TrustedClosingTransactionNoneZ {
1568         CResult_TrustedClosingTransactionNoneZ {
1569                 contents: CResult_TrustedClosingTransactionNoneZPtr {
1570                         result: Box::into_raw(Box::new(o)),
1571                 },
1572                 result_ok: true,
1573         }
1574 }
1575 #[no_mangle]
1576 /// Creates a new CResult_TrustedClosingTransactionNoneZ in the error state.
1577 pub extern "C" fn CResult_TrustedClosingTransactionNoneZ_err() -> CResult_TrustedClosingTransactionNoneZ {
1578         CResult_TrustedClosingTransactionNoneZ {
1579                 contents: CResult_TrustedClosingTransactionNoneZPtr {
1580                         err: core::ptr::null_mut(),
1581                 },
1582                 result_ok: false,
1583         }
1584 }
1585 /// Checks if the given object is currently in the success state
1586 #[no_mangle]
1587 pub extern "C" fn CResult_TrustedClosingTransactionNoneZ_is_ok(o: &CResult_TrustedClosingTransactionNoneZ) -> bool {
1588         o.result_ok
1589 }
1590 #[no_mangle]
1591 /// Frees any resources used by the CResult_TrustedClosingTransactionNoneZ.
1592 pub extern "C" fn CResult_TrustedClosingTransactionNoneZ_free(_res: CResult_TrustedClosingTransactionNoneZ) { }
1593 impl Drop for CResult_TrustedClosingTransactionNoneZ {
1594         fn drop(&mut self) {
1595                 if self.result_ok {
1596                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
1597                                 let _ = unsafe { Box::from_raw(self.contents.result) };
1598                         }
1599                 } else {
1600                 }
1601         }
1602 }
1603 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::TrustedClosingTransaction, ()>> for CResult_TrustedClosingTransactionNoneZ {
1604         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::TrustedClosingTransaction, ()>) -> Self {
1605                 let contents = if o.result_ok {
1606                         let result = unsafe { o.contents.result };
1607                         unsafe { o.contents.result = core::ptr::null_mut() };
1608                         CResult_TrustedClosingTransactionNoneZPtr { result }
1609                 } else {
1610                         let _ = unsafe { Box::from_raw(o.contents.err) };
1611                         o.contents.err = core::ptr::null_mut();
1612                         CResult_TrustedClosingTransactionNoneZPtr { err: core::ptr::null_mut() }
1613                 };
1614                 Self {
1615                         contents,
1616                         result_ok: o.result_ok,
1617                 }
1618         }
1619 }
1620 #[repr(C)]
1621 /// The contents of CResult_CommitmentTransactionDecodeErrorZ
1622 pub union CResult_CommitmentTransactionDecodeErrorZPtr {
1623         /// A pointer to the contents in the success state.
1624         /// Reading from this pointer when `result_ok` is not set is undefined.
1625         pub result: *mut crate::lightning::ln::chan_utils::CommitmentTransaction,
1626         /// A pointer to the contents in the error state.
1627         /// Reading from this pointer when `result_ok` is set is undefined.
1628         pub err: *mut crate::lightning::ln::msgs::DecodeError,
1629 }
1630 #[repr(C)]
1631 /// A CResult_CommitmentTransactionDecodeErrorZ represents the result of a fallible operation,
1632 /// containing a crate::lightning::ln::chan_utils::CommitmentTransaction on success and a crate::lightning::ln::msgs::DecodeError on failure.
1633 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1634 pub struct CResult_CommitmentTransactionDecodeErrorZ {
1635         /// The contents of this CResult_CommitmentTransactionDecodeErrorZ, accessible via either
1636         /// `err` or `result` depending on the state of `result_ok`.
1637         pub contents: CResult_CommitmentTransactionDecodeErrorZPtr,
1638         /// Whether this CResult_CommitmentTransactionDecodeErrorZ represents a success state.
1639         pub result_ok: bool,
1640 }
1641 #[no_mangle]
1642 /// Creates a new CResult_CommitmentTransactionDecodeErrorZ in the success state.
1643 pub extern "C" fn CResult_CommitmentTransactionDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::CommitmentTransaction) -> CResult_CommitmentTransactionDecodeErrorZ {
1644         CResult_CommitmentTransactionDecodeErrorZ {
1645                 contents: CResult_CommitmentTransactionDecodeErrorZPtr {
1646                         result: Box::into_raw(Box::new(o)),
1647                 },
1648                 result_ok: true,
1649         }
1650 }
1651 #[no_mangle]
1652 /// Creates a new CResult_CommitmentTransactionDecodeErrorZ in the error state.
1653 pub extern "C" fn CResult_CommitmentTransactionDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_CommitmentTransactionDecodeErrorZ {
1654         CResult_CommitmentTransactionDecodeErrorZ {
1655                 contents: CResult_CommitmentTransactionDecodeErrorZPtr {
1656                         err: Box::into_raw(Box::new(e)),
1657                 },
1658                 result_ok: false,
1659         }
1660 }
1661 /// Checks if the given object is currently in the success state
1662 #[no_mangle]
1663 pub extern "C" fn CResult_CommitmentTransactionDecodeErrorZ_is_ok(o: &CResult_CommitmentTransactionDecodeErrorZ) -> bool {
1664         o.result_ok
1665 }
1666 #[no_mangle]
1667 /// Frees any resources used by the CResult_CommitmentTransactionDecodeErrorZ.
1668 pub extern "C" fn CResult_CommitmentTransactionDecodeErrorZ_free(_res: CResult_CommitmentTransactionDecodeErrorZ) { }
1669 impl Drop for CResult_CommitmentTransactionDecodeErrorZ {
1670         fn drop(&mut self) {
1671                 if self.result_ok {
1672                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
1673                                 let _ = unsafe { Box::from_raw(self.contents.result) };
1674                         }
1675                 } else {
1676                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
1677                                 let _ = unsafe { Box::from_raw(self.contents.err) };
1678                         }
1679                 }
1680         }
1681 }
1682 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::CommitmentTransaction, crate::lightning::ln::msgs::DecodeError>> for CResult_CommitmentTransactionDecodeErrorZ {
1683         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::CommitmentTransaction, crate::lightning::ln::msgs::DecodeError>) -> Self {
1684                 let contents = if o.result_ok {
1685                         let result = unsafe { o.contents.result };
1686                         unsafe { o.contents.result = core::ptr::null_mut() };
1687                         CResult_CommitmentTransactionDecodeErrorZPtr { result }
1688                 } else {
1689                         let err = unsafe { o.contents.err };
1690                         unsafe { o.contents.err = core::ptr::null_mut(); }
1691                         CResult_CommitmentTransactionDecodeErrorZPtr { err }
1692                 };
1693                 Self {
1694                         contents,
1695                         result_ok: o.result_ok,
1696                 }
1697         }
1698 }
1699 impl Clone for CResult_CommitmentTransactionDecodeErrorZ {
1700         fn clone(&self) -> Self {
1701                 if self.result_ok {
1702                         Self { result_ok: true, contents: CResult_CommitmentTransactionDecodeErrorZPtr {
1703                                 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::CommitmentTransaction>::clone(unsafe { &*self.contents.result })))
1704                         } }
1705                 } else {
1706                         Self { result_ok: false, contents: CResult_CommitmentTransactionDecodeErrorZPtr {
1707                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
1708                         } }
1709                 }
1710         }
1711 }
1712 #[no_mangle]
1713 /// Creates a new CResult_CommitmentTransactionDecodeErrorZ which has the same data as `orig`
1714 /// but with all dynamically-allocated buffers duplicated in new buffers.
1715 pub extern "C" fn CResult_CommitmentTransactionDecodeErrorZ_clone(orig: &CResult_CommitmentTransactionDecodeErrorZ) -> CResult_CommitmentTransactionDecodeErrorZ { Clone::clone(&orig) }
1716 #[repr(C)]
1717 /// The contents of CResult_TrustedCommitmentTransactionNoneZ
1718 pub union CResult_TrustedCommitmentTransactionNoneZPtr {
1719         /// A pointer to the contents in the success state.
1720         /// Reading from this pointer when `result_ok` is not set is undefined.
1721         pub result: *mut crate::lightning::ln::chan_utils::TrustedCommitmentTransaction,
1722         /// Note that this value is always NULL, as there are no contents in the Err variant
1723         pub err: *mut core::ffi::c_void,
1724 }
1725 #[repr(C)]
1726 /// A CResult_TrustedCommitmentTransactionNoneZ represents the result of a fallible operation,
1727 /// containing a crate::lightning::ln::chan_utils::TrustedCommitmentTransaction on success and a () on failure.
1728 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1729 pub struct CResult_TrustedCommitmentTransactionNoneZ {
1730         /// The contents of this CResult_TrustedCommitmentTransactionNoneZ, accessible via either
1731         /// `err` or `result` depending on the state of `result_ok`.
1732         pub contents: CResult_TrustedCommitmentTransactionNoneZPtr,
1733         /// Whether this CResult_TrustedCommitmentTransactionNoneZ represents a success state.
1734         pub result_ok: bool,
1735 }
1736 #[no_mangle]
1737 /// Creates a new CResult_TrustedCommitmentTransactionNoneZ in the success state.
1738 pub extern "C" fn CResult_TrustedCommitmentTransactionNoneZ_ok(o: crate::lightning::ln::chan_utils::TrustedCommitmentTransaction) -> CResult_TrustedCommitmentTransactionNoneZ {
1739         CResult_TrustedCommitmentTransactionNoneZ {
1740                 contents: CResult_TrustedCommitmentTransactionNoneZPtr {
1741                         result: Box::into_raw(Box::new(o)),
1742                 },
1743                 result_ok: true,
1744         }
1745 }
1746 #[no_mangle]
1747 /// Creates a new CResult_TrustedCommitmentTransactionNoneZ in the error state.
1748 pub extern "C" fn CResult_TrustedCommitmentTransactionNoneZ_err() -> CResult_TrustedCommitmentTransactionNoneZ {
1749         CResult_TrustedCommitmentTransactionNoneZ {
1750                 contents: CResult_TrustedCommitmentTransactionNoneZPtr {
1751                         err: core::ptr::null_mut(),
1752                 },
1753                 result_ok: false,
1754         }
1755 }
1756 /// Checks if the given object is currently in the success state
1757 #[no_mangle]
1758 pub extern "C" fn CResult_TrustedCommitmentTransactionNoneZ_is_ok(o: &CResult_TrustedCommitmentTransactionNoneZ) -> bool {
1759         o.result_ok
1760 }
1761 #[no_mangle]
1762 /// Frees any resources used by the CResult_TrustedCommitmentTransactionNoneZ.
1763 pub extern "C" fn CResult_TrustedCommitmentTransactionNoneZ_free(_res: CResult_TrustedCommitmentTransactionNoneZ) { }
1764 impl Drop for CResult_TrustedCommitmentTransactionNoneZ {
1765         fn drop(&mut self) {
1766                 if self.result_ok {
1767                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
1768                                 let _ = unsafe { Box::from_raw(self.contents.result) };
1769                         }
1770                 } else {
1771                 }
1772         }
1773 }
1774 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::TrustedCommitmentTransaction, ()>> for CResult_TrustedCommitmentTransactionNoneZ {
1775         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::TrustedCommitmentTransaction, ()>) -> Self {
1776                 let contents = if o.result_ok {
1777                         let result = unsafe { o.contents.result };
1778                         unsafe { o.contents.result = core::ptr::null_mut() };
1779                         CResult_TrustedCommitmentTransactionNoneZPtr { result }
1780                 } else {
1781                         let _ = unsafe { Box::from_raw(o.contents.err) };
1782                         o.contents.err = core::ptr::null_mut();
1783                         CResult_TrustedCommitmentTransactionNoneZPtr { err: core::ptr::null_mut() }
1784                 };
1785                 Self {
1786                         contents,
1787                         result_ok: o.result_ok,
1788                 }
1789         }
1790 }
1791 #[repr(C)]
1792 /// The contents of CResult_CVec_SignatureZNoneZ
1793 pub union CResult_CVec_SignatureZNoneZPtr {
1794         /// A pointer to the contents in the success state.
1795         /// Reading from this pointer when `result_ok` is not set is undefined.
1796         pub result: *mut crate::c_types::derived::CVec_SignatureZ,
1797         /// Note that this value is always NULL, as there are no contents in the Err variant
1798         pub err: *mut core::ffi::c_void,
1799 }
1800 #[repr(C)]
1801 /// A CResult_CVec_SignatureZNoneZ represents the result of a fallible operation,
1802 /// containing a crate::c_types::derived::CVec_SignatureZ on success and a () on failure.
1803 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1804 pub struct CResult_CVec_SignatureZNoneZ {
1805         /// The contents of this CResult_CVec_SignatureZNoneZ, accessible via either
1806         /// `err` or `result` depending on the state of `result_ok`.
1807         pub contents: CResult_CVec_SignatureZNoneZPtr,
1808         /// Whether this CResult_CVec_SignatureZNoneZ represents a success state.
1809         pub result_ok: bool,
1810 }
1811 #[no_mangle]
1812 /// Creates a new CResult_CVec_SignatureZNoneZ in the success state.
1813 pub extern "C" fn CResult_CVec_SignatureZNoneZ_ok(o: crate::c_types::derived::CVec_SignatureZ) -> CResult_CVec_SignatureZNoneZ {
1814         CResult_CVec_SignatureZNoneZ {
1815                 contents: CResult_CVec_SignatureZNoneZPtr {
1816                         result: Box::into_raw(Box::new(o)),
1817                 },
1818                 result_ok: true,
1819         }
1820 }
1821 #[no_mangle]
1822 /// Creates a new CResult_CVec_SignatureZNoneZ in the error state.
1823 pub extern "C" fn CResult_CVec_SignatureZNoneZ_err() -> CResult_CVec_SignatureZNoneZ {
1824         CResult_CVec_SignatureZNoneZ {
1825                 contents: CResult_CVec_SignatureZNoneZPtr {
1826                         err: core::ptr::null_mut(),
1827                 },
1828                 result_ok: false,
1829         }
1830 }
1831 /// Checks if the given object is currently in the success state
1832 #[no_mangle]
1833 pub extern "C" fn CResult_CVec_SignatureZNoneZ_is_ok(o: &CResult_CVec_SignatureZNoneZ) -> bool {
1834         o.result_ok
1835 }
1836 #[no_mangle]
1837 /// Frees any resources used by the CResult_CVec_SignatureZNoneZ.
1838 pub extern "C" fn CResult_CVec_SignatureZNoneZ_free(_res: CResult_CVec_SignatureZNoneZ) { }
1839 impl Drop for CResult_CVec_SignatureZNoneZ {
1840         fn drop(&mut self) {
1841                 if self.result_ok {
1842                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
1843                                 let _ = unsafe { Box::from_raw(self.contents.result) };
1844                         }
1845                 } else {
1846                 }
1847         }
1848 }
1849 impl From<crate::c_types::CResultTempl<crate::c_types::derived::CVec_SignatureZ, ()>> for CResult_CVec_SignatureZNoneZ {
1850         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CVec_SignatureZ, ()>) -> Self {
1851                 let contents = if o.result_ok {
1852                         let result = unsafe { o.contents.result };
1853                         unsafe { o.contents.result = core::ptr::null_mut() };
1854                         CResult_CVec_SignatureZNoneZPtr { result }
1855                 } else {
1856                         let _ = unsafe { Box::from_raw(o.contents.err) };
1857                         o.contents.err = core::ptr::null_mut();
1858                         CResult_CVec_SignatureZNoneZPtr { err: core::ptr::null_mut() }
1859                 };
1860                 Self {
1861                         contents,
1862                         result_ok: o.result_ok,
1863                 }
1864         }
1865 }
1866 impl Clone for CResult_CVec_SignatureZNoneZ {
1867         fn clone(&self) -> Self {
1868                 if self.result_ok {
1869                         Self { result_ok: true, contents: CResult_CVec_SignatureZNoneZPtr {
1870                                 result: Box::into_raw(Box::new(<crate::c_types::derived::CVec_SignatureZ>::clone(unsafe { &*self.contents.result })))
1871                         } }
1872                 } else {
1873                         Self { result_ok: false, contents: CResult_CVec_SignatureZNoneZPtr {
1874                                 err: core::ptr::null_mut()
1875                         } }
1876                 }
1877         }
1878 }
1879 #[no_mangle]
1880 /// Creates a new CResult_CVec_SignatureZNoneZ which has the same data as `orig`
1881 /// but with all dynamically-allocated buffers duplicated in new buffers.
1882 pub extern "C" fn CResult_CVec_SignatureZNoneZ_clone(orig: &CResult_CVec_SignatureZNoneZ) -> CResult_CVec_SignatureZNoneZ { Clone::clone(&orig) }
1883 #[repr(C)]
1884 /// The contents of CResult_ShutdownScriptDecodeErrorZ
1885 pub union CResult_ShutdownScriptDecodeErrorZPtr {
1886         /// A pointer to the contents in the success state.
1887         /// Reading from this pointer when `result_ok` is not set is undefined.
1888         pub result: *mut crate::lightning::ln::script::ShutdownScript,
1889         /// A pointer to the contents in the error state.
1890         /// Reading from this pointer when `result_ok` is set is undefined.
1891         pub err: *mut crate::lightning::ln::msgs::DecodeError,
1892 }
1893 #[repr(C)]
1894 /// A CResult_ShutdownScriptDecodeErrorZ represents the result of a fallible operation,
1895 /// containing a crate::lightning::ln::script::ShutdownScript on success and a crate::lightning::ln::msgs::DecodeError on failure.
1896 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1897 pub struct CResult_ShutdownScriptDecodeErrorZ {
1898         /// The contents of this CResult_ShutdownScriptDecodeErrorZ, accessible via either
1899         /// `err` or `result` depending on the state of `result_ok`.
1900         pub contents: CResult_ShutdownScriptDecodeErrorZPtr,
1901         /// Whether this CResult_ShutdownScriptDecodeErrorZ represents a success state.
1902         pub result_ok: bool,
1903 }
1904 #[no_mangle]
1905 /// Creates a new CResult_ShutdownScriptDecodeErrorZ in the success state.
1906 pub extern "C" fn CResult_ShutdownScriptDecodeErrorZ_ok(o: crate::lightning::ln::script::ShutdownScript) -> CResult_ShutdownScriptDecodeErrorZ {
1907         CResult_ShutdownScriptDecodeErrorZ {
1908                 contents: CResult_ShutdownScriptDecodeErrorZPtr {
1909                         result: Box::into_raw(Box::new(o)),
1910                 },
1911                 result_ok: true,
1912         }
1913 }
1914 #[no_mangle]
1915 /// Creates a new CResult_ShutdownScriptDecodeErrorZ in the error state.
1916 pub extern "C" fn CResult_ShutdownScriptDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ShutdownScriptDecodeErrorZ {
1917         CResult_ShutdownScriptDecodeErrorZ {
1918                 contents: CResult_ShutdownScriptDecodeErrorZPtr {
1919                         err: Box::into_raw(Box::new(e)),
1920                 },
1921                 result_ok: false,
1922         }
1923 }
1924 /// Checks if the given object is currently in the success state
1925 #[no_mangle]
1926 pub extern "C" fn CResult_ShutdownScriptDecodeErrorZ_is_ok(o: &CResult_ShutdownScriptDecodeErrorZ) -> bool {
1927         o.result_ok
1928 }
1929 #[no_mangle]
1930 /// Frees any resources used by the CResult_ShutdownScriptDecodeErrorZ.
1931 pub extern "C" fn CResult_ShutdownScriptDecodeErrorZ_free(_res: CResult_ShutdownScriptDecodeErrorZ) { }
1932 impl Drop for CResult_ShutdownScriptDecodeErrorZ {
1933         fn drop(&mut self) {
1934                 if self.result_ok {
1935                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
1936                                 let _ = unsafe { Box::from_raw(self.contents.result) };
1937                         }
1938                 } else {
1939                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
1940                                 let _ = unsafe { Box::from_raw(self.contents.err) };
1941                         }
1942                 }
1943         }
1944 }
1945 impl From<crate::c_types::CResultTempl<crate::lightning::ln::script::ShutdownScript, crate::lightning::ln::msgs::DecodeError>> for CResult_ShutdownScriptDecodeErrorZ {
1946         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::script::ShutdownScript, crate::lightning::ln::msgs::DecodeError>) -> Self {
1947                 let contents = if o.result_ok {
1948                         let result = unsafe { o.contents.result };
1949                         unsafe { o.contents.result = core::ptr::null_mut() };
1950                         CResult_ShutdownScriptDecodeErrorZPtr { result }
1951                 } else {
1952                         let err = unsafe { o.contents.err };
1953                         unsafe { o.contents.err = core::ptr::null_mut(); }
1954                         CResult_ShutdownScriptDecodeErrorZPtr { err }
1955                 };
1956                 Self {
1957                         contents,
1958                         result_ok: o.result_ok,
1959                 }
1960         }
1961 }
1962 impl Clone for CResult_ShutdownScriptDecodeErrorZ {
1963         fn clone(&self) -> Self {
1964                 if self.result_ok {
1965                         Self { result_ok: true, contents: CResult_ShutdownScriptDecodeErrorZPtr {
1966                                 result: Box::into_raw(Box::new(<crate::lightning::ln::script::ShutdownScript>::clone(unsafe { &*self.contents.result })))
1967                         } }
1968                 } else {
1969                         Self { result_ok: false, contents: CResult_ShutdownScriptDecodeErrorZPtr {
1970                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
1971                         } }
1972                 }
1973         }
1974 }
1975 #[no_mangle]
1976 /// Creates a new CResult_ShutdownScriptDecodeErrorZ which has the same data as `orig`
1977 /// but with all dynamically-allocated buffers duplicated in new buffers.
1978 pub extern "C" fn CResult_ShutdownScriptDecodeErrorZ_clone(orig: &CResult_ShutdownScriptDecodeErrorZ) -> CResult_ShutdownScriptDecodeErrorZ { Clone::clone(&orig) }
1979 #[repr(C)]
1980 /// The contents of CResult_ShutdownScriptInvalidShutdownScriptZ
1981 pub union CResult_ShutdownScriptInvalidShutdownScriptZPtr {
1982         /// A pointer to the contents in the success state.
1983         /// Reading from this pointer when `result_ok` is not set is undefined.
1984         pub result: *mut crate::lightning::ln::script::ShutdownScript,
1985         /// A pointer to the contents in the error state.
1986         /// Reading from this pointer when `result_ok` is set is undefined.
1987         pub err: *mut crate::lightning::ln::script::InvalidShutdownScript,
1988 }
1989 #[repr(C)]
1990 /// A CResult_ShutdownScriptInvalidShutdownScriptZ represents the result of a fallible operation,
1991 /// containing a crate::lightning::ln::script::ShutdownScript on success and a crate::lightning::ln::script::InvalidShutdownScript on failure.
1992 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1993 pub struct CResult_ShutdownScriptInvalidShutdownScriptZ {
1994         /// The contents of this CResult_ShutdownScriptInvalidShutdownScriptZ, accessible via either
1995         /// `err` or `result` depending on the state of `result_ok`.
1996         pub contents: CResult_ShutdownScriptInvalidShutdownScriptZPtr,
1997         /// Whether this CResult_ShutdownScriptInvalidShutdownScriptZ represents a success state.
1998         pub result_ok: bool,
1999 }
2000 #[no_mangle]
2001 /// Creates a new CResult_ShutdownScriptInvalidShutdownScriptZ in the success state.
2002 pub extern "C" fn CResult_ShutdownScriptInvalidShutdownScriptZ_ok(o: crate::lightning::ln::script::ShutdownScript) -> CResult_ShutdownScriptInvalidShutdownScriptZ {
2003         CResult_ShutdownScriptInvalidShutdownScriptZ {
2004                 contents: CResult_ShutdownScriptInvalidShutdownScriptZPtr {
2005                         result: Box::into_raw(Box::new(o)),
2006                 },
2007                 result_ok: true,
2008         }
2009 }
2010 #[no_mangle]
2011 /// Creates a new CResult_ShutdownScriptInvalidShutdownScriptZ in the error state.
2012 pub extern "C" fn CResult_ShutdownScriptInvalidShutdownScriptZ_err(e: crate::lightning::ln::script::InvalidShutdownScript) -> CResult_ShutdownScriptInvalidShutdownScriptZ {
2013         CResult_ShutdownScriptInvalidShutdownScriptZ {
2014                 contents: CResult_ShutdownScriptInvalidShutdownScriptZPtr {
2015                         err: Box::into_raw(Box::new(e)),
2016                 },
2017                 result_ok: false,
2018         }
2019 }
2020 /// Checks if the given object is currently in the success state
2021 #[no_mangle]
2022 pub extern "C" fn CResult_ShutdownScriptInvalidShutdownScriptZ_is_ok(o: &CResult_ShutdownScriptInvalidShutdownScriptZ) -> bool {
2023         o.result_ok
2024 }
2025 #[no_mangle]
2026 /// Frees any resources used by the CResult_ShutdownScriptInvalidShutdownScriptZ.
2027 pub extern "C" fn CResult_ShutdownScriptInvalidShutdownScriptZ_free(_res: CResult_ShutdownScriptInvalidShutdownScriptZ) { }
2028 impl Drop for CResult_ShutdownScriptInvalidShutdownScriptZ {
2029         fn drop(&mut self) {
2030                 if self.result_ok {
2031                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
2032                                 let _ = unsafe { Box::from_raw(self.contents.result) };
2033                         }
2034                 } else {
2035                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
2036                                 let _ = unsafe { Box::from_raw(self.contents.err) };
2037                         }
2038                 }
2039         }
2040 }
2041 impl From<crate::c_types::CResultTempl<crate::lightning::ln::script::ShutdownScript, crate::lightning::ln::script::InvalidShutdownScript>> for CResult_ShutdownScriptInvalidShutdownScriptZ {
2042         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::script::ShutdownScript, crate::lightning::ln::script::InvalidShutdownScript>) -> Self {
2043                 let contents = if o.result_ok {
2044                         let result = unsafe { o.contents.result };
2045                         unsafe { o.contents.result = core::ptr::null_mut() };
2046                         CResult_ShutdownScriptInvalidShutdownScriptZPtr { result }
2047                 } else {
2048                         let err = unsafe { o.contents.err };
2049                         unsafe { o.contents.err = core::ptr::null_mut(); }
2050                         CResult_ShutdownScriptInvalidShutdownScriptZPtr { err }
2051                 };
2052                 Self {
2053                         contents,
2054                         result_ok: o.result_ok,
2055                 }
2056         }
2057 }
2058 impl Clone for CResult_ShutdownScriptInvalidShutdownScriptZ {
2059         fn clone(&self) -> Self {
2060                 if self.result_ok {
2061                         Self { result_ok: true, contents: CResult_ShutdownScriptInvalidShutdownScriptZPtr {
2062                                 result: Box::into_raw(Box::new(<crate::lightning::ln::script::ShutdownScript>::clone(unsafe { &*self.contents.result })))
2063                         } }
2064                 } else {
2065                         Self { result_ok: false, contents: CResult_ShutdownScriptInvalidShutdownScriptZPtr {
2066                                 err: Box::into_raw(Box::new(<crate::lightning::ln::script::InvalidShutdownScript>::clone(unsafe { &*self.contents.err })))
2067                         } }
2068                 }
2069         }
2070 }
2071 #[no_mangle]
2072 /// Creates a new CResult_ShutdownScriptInvalidShutdownScriptZ which has the same data as `orig`
2073 /// but with all dynamically-allocated buffers duplicated in new buffers.
2074 pub extern "C" fn CResult_ShutdownScriptInvalidShutdownScriptZ_clone(orig: &CResult_ShutdownScriptInvalidShutdownScriptZ) -> CResult_ShutdownScriptInvalidShutdownScriptZ { Clone::clone(&orig) }
2075 #[repr(C)]
2076 /// An enum which can either contain a crate::lightning::routing::scoring::WriteableScore or not
2077 pub enum COption_WriteableScoreZ {
2078         /// When we're in this state, this COption_WriteableScoreZ contains a crate::lightning::routing::scoring::WriteableScore
2079         Some(crate::lightning::routing::scoring::WriteableScore),
2080         /// When we're in this state, this COption_WriteableScoreZ contains nothing
2081         None
2082 }
2083 impl COption_WriteableScoreZ {
2084         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
2085                 if let Self::None = self { false } else { true }
2086         }
2087         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
2088                 !self.is_some()
2089         }
2090         #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::routing::scoring::WriteableScore {
2091                 if let Self::Some(v) = self { v } else { unreachable!() }
2092         }
2093 }
2094 #[no_mangle]
2095 /// Constructs a new COption_WriteableScoreZ containing a crate::lightning::routing::scoring::WriteableScore
2096 pub extern "C" fn COption_WriteableScoreZ_some(o: crate::lightning::routing::scoring::WriteableScore) -> COption_WriteableScoreZ {
2097         COption_WriteableScoreZ::Some(o)
2098 }
2099 #[no_mangle]
2100 /// Constructs a new COption_WriteableScoreZ containing nothing
2101 pub extern "C" fn COption_WriteableScoreZ_none() -> COption_WriteableScoreZ {
2102         COption_WriteableScoreZ::None
2103 }
2104 #[no_mangle]
2105 /// Frees any resources associated with the crate::lightning::routing::scoring::WriteableScore, if we are in the Some state
2106 pub extern "C" fn COption_WriteableScoreZ_free(_res: COption_WriteableScoreZ) { }
2107 #[repr(C)]
2108 /// The contents of CResult_NoneErrorZ
2109 pub union CResult_NoneErrorZPtr {
2110         /// Note that this value is always NULL, as there are no contents in the OK variant
2111         pub result: *mut core::ffi::c_void,
2112         /// A pointer to the contents in the error state.
2113         /// Reading from this pointer when `result_ok` is set is undefined.
2114         pub err: *mut crate::c_types::IOError,
2115 }
2116 #[repr(C)]
2117 /// A CResult_NoneErrorZ represents the result of a fallible operation,
2118 /// containing a () on success and a crate::c_types::IOError on failure.
2119 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2120 pub struct CResult_NoneErrorZ {
2121         /// The contents of this CResult_NoneErrorZ, accessible via either
2122         /// `err` or `result` depending on the state of `result_ok`.
2123         pub contents: CResult_NoneErrorZPtr,
2124         /// Whether this CResult_NoneErrorZ represents a success state.
2125         pub result_ok: bool,
2126 }
2127 #[no_mangle]
2128 /// Creates a new CResult_NoneErrorZ in the success state.
2129 pub extern "C" fn CResult_NoneErrorZ_ok() -> CResult_NoneErrorZ {
2130         CResult_NoneErrorZ {
2131                 contents: CResult_NoneErrorZPtr {
2132                         result: core::ptr::null_mut(),
2133                 },
2134                 result_ok: true,
2135         }
2136 }
2137 #[no_mangle]
2138 /// Creates a new CResult_NoneErrorZ in the error state.
2139 pub extern "C" fn CResult_NoneErrorZ_err(e: crate::c_types::IOError) -> CResult_NoneErrorZ {
2140         CResult_NoneErrorZ {
2141                 contents: CResult_NoneErrorZPtr {
2142                         err: Box::into_raw(Box::new(e)),
2143                 },
2144                 result_ok: false,
2145         }
2146 }
2147 /// Checks if the given object is currently in the success state
2148 #[no_mangle]
2149 pub extern "C" fn CResult_NoneErrorZ_is_ok(o: &CResult_NoneErrorZ) -> bool {
2150         o.result_ok
2151 }
2152 #[no_mangle]
2153 /// Frees any resources used by the CResult_NoneErrorZ.
2154 pub extern "C" fn CResult_NoneErrorZ_free(_res: CResult_NoneErrorZ) { }
2155 impl Drop for CResult_NoneErrorZ {
2156         fn drop(&mut self) {
2157                 if self.result_ok {
2158                 } else {
2159                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
2160                                 let _ = unsafe { Box::from_raw(self.contents.err) };
2161                         }
2162                 }
2163         }
2164 }
2165 impl From<crate::c_types::CResultTempl<(), crate::c_types::IOError>> for CResult_NoneErrorZ {
2166         fn from(mut o: crate::c_types::CResultTempl<(), crate::c_types::IOError>) -> Self {
2167                 let contents = if o.result_ok {
2168                         let _ = unsafe { Box::from_raw(o.contents.result) };
2169                         o.contents.result = core::ptr::null_mut();
2170                         CResult_NoneErrorZPtr { result: core::ptr::null_mut() }
2171                 } else {
2172                         let err = unsafe { o.contents.err };
2173                         unsafe { o.contents.err = core::ptr::null_mut(); }
2174                         CResult_NoneErrorZPtr { err }
2175                 };
2176                 Self {
2177                         contents,
2178                         result_ok: o.result_ok,
2179                 }
2180         }
2181 }
2182 impl Clone for CResult_NoneErrorZ {
2183         fn clone(&self) -> Self {
2184                 if self.result_ok {
2185                         Self { result_ok: true, contents: CResult_NoneErrorZPtr {
2186                                 result: core::ptr::null_mut()
2187                         } }
2188                 } else {
2189                         Self { result_ok: false, contents: CResult_NoneErrorZPtr {
2190                                 err: Box::into_raw(Box::new(<crate::c_types::IOError>::clone(unsafe { &*self.contents.err })))
2191                         } }
2192                 }
2193         }
2194 }
2195 #[no_mangle]
2196 /// Creates a new CResult_NoneErrorZ which has the same data as `orig`
2197 /// but with all dynamically-allocated buffers duplicated in new buffers.
2198 pub extern "C" fn CResult_NoneErrorZ_clone(orig: &CResult_NoneErrorZ) -> CResult_NoneErrorZ { Clone::clone(&orig) }
2199 #[repr(C)]
2200 /// The contents of CResult_RouteHopDecodeErrorZ
2201 pub union CResult_RouteHopDecodeErrorZPtr {
2202         /// A pointer to the contents in the success state.
2203         /// Reading from this pointer when `result_ok` is not set is undefined.
2204         pub result: *mut crate::lightning::routing::router::RouteHop,
2205         /// A pointer to the contents in the error state.
2206         /// Reading from this pointer when `result_ok` is set is undefined.
2207         pub err: *mut crate::lightning::ln::msgs::DecodeError,
2208 }
2209 #[repr(C)]
2210 /// A CResult_RouteHopDecodeErrorZ represents the result of a fallible operation,
2211 /// containing a crate::lightning::routing::router::RouteHop on success and a crate::lightning::ln::msgs::DecodeError on failure.
2212 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2213 pub struct CResult_RouteHopDecodeErrorZ {
2214         /// The contents of this CResult_RouteHopDecodeErrorZ, accessible via either
2215         /// `err` or `result` depending on the state of `result_ok`.
2216         pub contents: CResult_RouteHopDecodeErrorZPtr,
2217         /// Whether this CResult_RouteHopDecodeErrorZ represents a success state.
2218         pub result_ok: bool,
2219 }
2220 #[no_mangle]
2221 /// Creates a new CResult_RouteHopDecodeErrorZ in the success state.
2222 pub extern "C" fn CResult_RouteHopDecodeErrorZ_ok(o: crate::lightning::routing::router::RouteHop) -> CResult_RouteHopDecodeErrorZ {
2223         CResult_RouteHopDecodeErrorZ {
2224                 contents: CResult_RouteHopDecodeErrorZPtr {
2225                         result: Box::into_raw(Box::new(o)),
2226                 },
2227                 result_ok: true,
2228         }
2229 }
2230 #[no_mangle]
2231 /// Creates a new CResult_RouteHopDecodeErrorZ in the error state.
2232 pub extern "C" fn CResult_RouteHopDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RouteHopDecodeErrorZ {
2233         CResult_RouteHopDecodeErrorZ {
2234                 contents: CResult_RouteHopDecodeErrorZPtr {
2235                         err: Box::into_raw(Box::new(e)),
2236                 },
2237                 result_ok: false,
2238         }
2239 }
2240 /// Checks if the given object is currently in the success state
2241 #[no_mangle]
2242 pub extern "C" fn CResult_RouteHopDecodeErrorZ_is_ok(o: &CResult_RouteHopDecodeErrorZ) -> bool {
2243         o.result_ok
2244 }
2245 #[no_mangle]
2246 /// Frees any resources used by the CResult_RouteHopDecodeErrorZ.
2247 pub extern "C" fn CResult_RouteHopDecodeErrorZ_free(_res: CResult_RouteHopDecodeErrorZ) { }
2248 impl Drop for CResult_RouteHopDecodeErrorZ {
2249         fn drop(&mut self) {
2250                 if self.result_ok {
2251                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
2252                                 let _ = unsafe { Box::from_raw(self.contents.result) };
2253                         }
2254                 } else {
2255                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
2256                                 let _ = unsafe { Box::from_raw(self.contents.err) };
2257                         }
2258                 }
2259         }
2260 }
2261 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::RouteHop, crate::lightning::ln::msgs::DecodeError>> for CResult_RouteHopDecodeErrorZ {
2262         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::RouteHop, crate::lightning::ln::msgs::DecodeError>) -> Self {
2263                 let contents = if o.result_ok {
2264                         let result = unsafe { o.contents.result };
2265                         unsafe { o.contents.result = core::ptr::null_mut() };
2266                         CResult_RouteHopDecodeErrorZPtr { result }
2267                 } else {
2268                         let err = unsafe { o.contents.err };
2269                         unsafe { o.contents.err = core::ptr::null_mut(); }
2270                         CResult_RouteHopDecodeErrorZPtr { err }
2271                 };
2272                 Self {
2273                         contents,
2274                         result_ok: o.result_ok,
2275                 }
2276         }
2277 }
2278 impl Clone for CResult_RouteHopDecodeErrorZ {
2279         fn clone(&self) -> Self {
2280                 if self.result_ok {
2281                         Self { result_ok: true, contents: CResult_RouteHopDecodeErrorZPtr {
2282                                 result: Box::into_raw(Box::new(<crate::lightning::routing::router::RouteHop>::clone(unsafe { &*self.contents.result })))
2283                         } }
2284                 } else {
2285                         Self { result_ok: false, contents: CResult_RouteHopDecodeErrorZPtr {
2286                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
2287                         } }
2288                 }
2289         }
2290 }
2291 #[no_mangle]
2292 /// Creates a new CResult_RouteHopDecodeErrorZ which has the same data as `orig`
2293 /// but with all dynamically-allocated buffers duplicated in new buffers.
2294 pub extern "C" fn CResult_RouteHopDecodeErrorZ_clone(orig: &CResult_RouteHopDecodeErrorZ) -> CResult_RouteHopDecodeErrorZ { Clone::clone(&orig) }
2295 #[repr(C)]
2296 /// A dynamically-allocated array of crate::lightning::routing::router::RouteHops of arbitrary size.
2297 /// This corresponds to std::vector in C++
2298 pub struct CVec_RouteHopZ {
2299         /// The elements in the array.
2300         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2301         pub data: *mut crate::lightning::routing::router::RouteHop,
2302         /// The number of elements pointed to by `data`.
2303         pub datalen: usize
2304 }
2305 impl CVec_RouteHopZ {
2306         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::routing::router::RouteHop> {
2307                 if self.datalen == 0 { return Vec::new(); }
2308                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
2309                 self.data = core::ptr::null_mut();
2310                 self.datalen = 0;
2311                 ret
2312         }
2313         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::routing::router::RouteHop] {
2314                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
2315         }
2316 }
2317 impl From<Vec<crate::lightning::routing::router::RouteHop>> for CVec_RouteHopZ {
2318         fn from(v: Vec<crate::lightning::routing::router::RouteHop>) -> Self {
2319                 let datalen = v.len();
2320                 let data = Box::into_raw(v.into_boxed_slice());
2321                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
2322         }
2323 }
2324 #[no_mangle]
2325 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
2326 pub extern "C" fn CVec_RouteHopZ_free(_res: CVec_RouteHopZ) { }
2327 impl Drop for CVec_RouteHopZ {
2328         fn drop(&mut self) {
2329                 if self.datalen == 0 { return; }
2330                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
2331         }
2332 }
2333 impl Clone for CVec_RouteHopZ {
2334         fn clone(&self) -> Self {
2335                 let mut res = Vec::new();
2336                 if self.datalen == 0 { return Self::from(res); }
2337                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
2338                 Self::from(res)
2339         }
2340 }
2341 #[repr(C)]
2342 /// A dynamically-allocated array of crate::c_types::derived::CVec_RouteHopZs of arbitrary size.
2343 /// This corresponds to std::vector in C++
2344 pub struct CVec_CVec_RouteHopZZ {
2345         /// The elements in the array.
2346         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2347         pub data: *mut crate::c_types::derived::CVec_RouteHopZ,
2348         /// The number of elements pointed to by `data`.
2349         pub datalen: usize
2350 }
2351 impl CVec_CVec_RouteHopZZ {
2352         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::CVec_RouteHopZ> {
2353                 if self.datalen == 0 { return Vec::new(); }
2354                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
2355                 self.data = core::ptr::null_mut();
2356                 self.datalen = 0;
2357                 ret
2358         }
2359         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::CVec_RouteHopZ] {
2360                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
2361         }
2362 }
2363 impl From<Vec<crate::c_types::derived::CVec_RouteHopZ>> for CVec_CVec_RouteHopZZ {
2364         fn from(v: Vec<crate::c_types::derived::CVec_RouteHopZ>) -> Self {
2365                 let datalen = v.len();
2366                 let data = Box::into_raw(v.into_boxed_slice());
2367                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
2368         }
2369 }
2370 #[no_mangle]
2371 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
2372 pub extern "C" fn CVec_CVec_RouteHopZZ_free(_res: CVec_CVec_RouteHopZZ) { }
2373 impl Drop for CVec_CVec_RouteHopZZ {
2374         fn drop(&mut self) {
2375                 if self.datalen == 0 { return; }
2376                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
2377         }
2378 }
2379 impl Clone for CVec_CVec_RouteHopZZ {
2380         fn clone(&self) -> Self {
2381                 let mut res = Vec::new();
2382                 if self.datalen == 0 { return Self::from(res); }
2383                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
2384                 Self::from(res)
2385         }
2386 }
2387 #[repr(C)]
2388 /// The contents of CResult_RouteDecodeErrorZ
2389 pub union CResult_RouteDecodeErrorZPtr {
2390         /// A pointer to the contents in the success state.
2391         /// Reading from this pointer when `result_ok` is not set is undefined.
2392         pub result: *mut crate::lightning::routing::router::Route,
2393         /// A pointer to the contents in the error state.
2394         /// Reading from this pointer when `result_ok` is set is undefined.
2395         pub err: *mut crate::lightning::ln::msgs::DecodeError,
2396 }
2397 #[repr(C)]
2398 /// A CResult_RouteDecodeErrorZ represents the result of a fallible operation,
2399 /// containing a crate::lightning::routing::router::Route on success and a crate::lightning::ln::msgs::DecodeError on failure.
2400 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2401 pub struct CResult_RouteDecodeErrorZ {
2402         /// The contents of this CResult_RouteDecodeErrorZ, accessible via either
2403         /// `err` or `result` depending on the state of `result_ok`.
2404         pub contents: CResult_RouteDecodeErrorZPtr,
2405         /// Whether this CResult_RouteDecodeErrorZ represents a success state.
2406         pub result_ok: bool,
2407 }
2408 #[no_mangle]
2409 /// Creates a new CResult_RouteDecodeErrorZ in the success state.
2410 pub extern "C" fn CResult_RouteDecodeErrorZ_ok(o: crate::lightning::routing::router::Route) -> CResult_RouteDecodeErrorZ {
2411         CResult_RouteDecodeErrorZ {
2412                 contents: CResult_RouteDecodeErrorZPtr {
2413                         result: Box::into_raw(Box::new(o)),
2414                 },
2415                 result_ok: true,
2416         }
2417 }
2418 #[no_mangle]
2419 /// Creates a new CResult_RouteDecodeErrorZ in the error state.
2420 pub extern "C" fn CResult_RouteDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RouteDecodeErrorZ {
2421         CResult_RouteDecodeErrorZ {
2422                 contents: CResult_RouteDecodeErrorZPtr {
2423                         err: Box::into_raw(Box::new(e)),
2424                 },
2425                 result_ok: false,
2426         }
2427 }
2428 /// Checks if the given object is currently in the success state
2429 #[no_mangle]
2430 pub extern "C" fn CResult_RouteDecodeErrorZ_is_ok(o: &CResult_RouteDecodeErrorZ) -> bool {
2431         o.result_ok
2432 }
2433 #[no_mangle]
2434 /// Frees any resources used by the CResult_RouteDecodeErrorZ.
2435 pub extern "C" fn CResult_RouteDecodeErrorZ_free(_res: CResult_RouteDecodeErrorZ) { }
2436 impl Drop for CResult_RouteDecodeErrorZ {
2437         fn drop(&mut self) {
2438                 if self.result_ok {
2439                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
2440                                 let _ = unsafe { Box::from_raw(self.contents.result) };
2441                         }
2442                 } else {
2443                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
2444                                 let _ = unsafe { Box::from_raw(self.contents.err) };
2445                         }
2446                 }
2447         }
2448 }
2449 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::Route, crate::lightning::ln::msgs::DecodeError>> for CResult_RouteDecodeErrorZ {
2450         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::Route, crate::lightning::ln::msgs::DecodeError>) -> Self {
2451                 let contents = if o.result_ok {
2452                         let result = unsafe { o.contents.result };
2453                         unsafe { o.contents.result = core::ptr::null_mut() };
2454                         CResult_RouteDecodeErrorZPtr { result }
2455                 } else {
2456                         let err = unsafe { o.contents.err };
2457                         unsafe { o.contents.err = core::ptr::null_mut(); }
2458                         CResult_RouteDecodeErrorZPtr { err }
2459                 };
2460                 Self {
2461                         contents,
2462                         result_ok: o.result_ok,
2463                 }
2464         }
2465 }
2466 impl Clone for CResult_RouteDecodeErrorZ {
2467         fn clone(&self) -> Self {
2468                 if self.result_ok {
2469                         Self { result_ok: true, contents: CResult_RouteDecodeErrorZPtr {
2470                                 result: Box::into_raw(Box::new(<crate::lightning::routing::router::Route>::clone(unsafe { &*self.contents.result })))
2471                         } }
2472                 } else {
2473                         Self { result_ok: false, contents: CResult_RouteDecodeErrorZPtr {
2474                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
2475                         } }
2476                 }
2477         }
2478 }
2479 #[no_mangle]
2480 /// Creates a new CResult_RouteDecodeErrorZ which has the same data as `orig`
2481 /// but with all dynamically-allocated buffers duplicated in new buffers.
2482 pub extern "C" fn CResult_RouteDecodeErrorZ_clone(orig: &CResult_RouteDecodeErrorZ) -> CResult_RouteDecodeErrorZ { Clone::clone(&orig) }
2483 #[repr(C)]
2484 /// The contents of CResult_RouteParametersDecodeErrorZ
2485 pub union CResult_RouteParametersDecodeErrorZPtr {
2486         /// A pointer to the contents in the success state.
2487         /// Reading from this pointer when `result_ok` is not set is undefined.
2488         pub result: *mut crate::lightning::routing::router::RouteParameters,
2489         /// A pointer to the contents in the error state.
2490         /// Reading from this pointer when `result_ok` is set is undefined.
2491         pub err: *mut crate::lightning::ln::msgs::DecodeError,
2492 }
2493 #[repr(C)]
2494 /// A CResult_RouteParametersDecodeErrorZ represents the result of a fallible operation,
2495 /// containing a crate::lightning::routing::router::RouteParameters on success and a crate::lightning::ln::msgs::DecodeError on failure.
2496 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2497 pub struct CResult_RouteParametersDecodeErrorZ {
2498         /// The contents of this CResult_RouteParametersDecodeErrorZ, accessible via either
2499         /// `err` or `result` depending on the state of `result_ok`.
2500         pub contents: CResult_RouteParametersDecodeErrorZPtr,
2501         /// Whether this CResult_RouteParametersDecodeErrorZ represents a success state.
2502         pub result_ok: bool,
2503 }
2504 #[no_mangle]
2505 /// Creates a new CResult_RouteParametersDecodeErrorZ in the success state.
2506 pub extern "C" fn CResult_RouteParametersDecodeErrorZ_ok(o: crate::lightning::routing::router::RouteParameters) -> CResult_RouteParametersDecodeErrorZ {
2507         CResult_RouteParametersDecodeErrorZ {
2508                 contents: CResult_RouteParametersDecodeErrorZPtr {
2509                         result: Box::into_raw(Box::new(o)),
2510                 },
2511                 result_ok: true,
2512         }
2513 }
2514 #[no_mangle]
2515 /// Creates a new CResult_RouteParametersDecodeErrorZ in the error state.
2516 pub extern "C" fn CResult_RouteParametersDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RouteParametersDecodeErrorZ {
2517         CResult_RouteParametersDecodeErrorZ {
2518                 contents: CResult_RouteParametersDecodeErrorZPtr {
2519                         err: Box::into_raw(Box::new(e)),
2520                 },
2521                 result_ok: false,
2522         }
2523 }
2524 /// Checks if the given object is currently in the success state
2525 #[no_mangle]
2526 pub extern "C" fn CResult_RouteParametersDecodeErrorZ_is_ok(o: &CResult_RouteParametersDecodeErrorZ) -> bool {
2527         o.result_ok
2528 }
2529 #[no_mangle]
2530 /// Frees any resources used by the CResult_RouteParametersDecodeErrorZ.
2531 pub extern "C" fn CResult_RouteParametersDecodeErrorZ_free(_res: CResult_RouteParametersDecodeErrorZ) { }
2532 impl Drop for CResult_RouteParametersDecodeErrorZ {
2533         fn drop(&mut self) {
2534                 if self.result_ok {
2535                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
2536                                 let _ = unsafe { Box::from_raw(self.contents.result) };
2537                         }
2538                 } else {
2539                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
2540                                 let _ = unsafe { Box::from_raw(self.contents.err) };
2541                         }
2542                 }
2543         }
2544 }
2545 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::RouteParameters, crate::lightning::ln::msgs::DecodeError>> for CResult_RouteParametersDecodeErrorZ {
2546         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::RouteParameters, crate::lightning::ln::msgs::DecodeError>) -> Self {
2547                 let contents = if o.result_ok {
2548                         let result = unsafe { o.contents.result };
2549                         unsafe { o.contents.result = core::ptr::null_mut() };
2550                         CResult_RouteParametersDecodeErrorZPtr { result }
2551                 } else {
2552                         let err = unsafe { o.contents.err };
2553                         unsafe { o.contents.err = core::ptr::null_mut(); }
2554                         CResult_RouteParametersDecodeErrorZPtr { err }
2555                 };
2556                 Self {
2557                         contents,
2558                         result_ok: o.result_ok,
2559                 }
2560         }
2561 }
2562 impl Clone for CResult_RouteParametersDecodeErrorZ {
2563         fn clone(&self) -> Self {
2564                 if self.result_ok {
2565                         Self { result_ok: true, contents: CResult_RouteParametersDecodeErrorZPtr {
2566                                 result: Box::into_raw(Box::new(<crate::lightning::routing::router::RouteParameters>::clone(unsafe { &*self.contents.result })))
2567                         } }
2568                 } else {
2569                         Self { result_ok: false, contents: CResult_RouteParametersDecodeErrorZPtr {
2570                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
2571                         } }
2572                 }
2573         }
2574 }
2575 #[no_mangle]
2576 /// Creates a new CResult_RouteParametersDecodeErrorZ which has the same data as `orig`
2577 /// but with all dynamically-allocated buffers duplicated in new buffers.
2578 pub extern "C" fn CResult_RouteParametersDecodeErrorZ_clone(orig: &CResult_RouteParametersDecodeErrorZ) -> CResult_RouteParametersDecodeErrorZ { Clone::clone(&orig) }
2579 #[repr(C)]
2580 /// A dynamically-allocated array of crate::lightning::routing::router::RouteHints of arbitrary size.
2581 /// This corresponds to std::vector in C++
2582 pub struct CVec_RouteHintZ {
2583         /// The elements in the array.
2584         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2585         pub data: *mut crate::lightning::routing::router::RouteHint,
2586         /// The number of elements pointed to by `data`.
2587         pub datalen: usize
2588 }
2589 impl CVec_RouteHintZ {
2590         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::routing::router::RouteHint> {
2591                 if self.datalen == 0 { return Vec::new(); }
2592                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
2593                 self.data = core::ptr::null_mut();
2594                 self.datalen = 0;
2595                 ret
2596         }
2597         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::routing::router::RouteHint] {
2598                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
2599         }
2600 }
2601 impl From<Vec<crate::lightning::routing::router::RouteHint>> for CVec_RouteHintZ {
2602         fn from(v: Vec<crate::lightning::routing::router::RouteHint>) -> Self {
2603                 let datalen = v.len();
2604                 let data = Box::into_raw(v.into_boxed_slice());
2605                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
2606         }
2607 }
2608 #[no_mangle]
2609 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
2610 pub extern "C" fn CVec_RouteHintZ_free(_res: CVec_RouteHintZ) { }
2611 impl Drop for CVec_RouteHintZ {
2612         fn drop(&mut self) {
2613                 if self.datalen == 0 { return; }
2614                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
2615         }
2616 }
2617 impl Clone for CVec_RouteHintZ {
2618         fn clone(&self) -> Self {
2619                 let mut res = Vec::new();
2620                 if self.datalen == 0 { return Self::from(res); }
2621                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
2622                 Self::from(res)
2623         }
2624 }
2625 #[repr(C)]
2626 #[derive(Clone)]
2627 /// An enum which can either contain a u64 or not
2628 pub enum COption_u64Z {
2629         /// When we're in this state, this COption_u64Z contains a u64
2630         Some(u64),
2631         /// When we're in this state, this COption_u64Z contains nothing
2632         None
2633 }
2634 impl COption_u64Z {
2635         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
2636                 if let Self::None = self { false } else { true }
2637         }
2638         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
2639                 !self.is_some()
2640         }
2641         #[allow(unused)] pub(crate) fn take(mut self) -> u64 {
2642                 if let Self::Some(v) = self { v } else { unreachable!() }
2643         }
2644 }
2645 #[no_mangle]
2646 /// Constructs a new COption_u64Z containing a u64
2647 pub extern "C" fn COption_u64Z_some(o: u64) -> COption_u64Z {
2648         COption_u64Z::Some(o)
2649 }
2650 #[no_mangle]
2651 /// Constructs a new COption_u64Z containing nothing
2652 pub extern "C" fn COption_u64Z_none() -> COption_u64Z {
2653         COption_u64Z::None
2654 }
2655 #[no_mangle]
2656 /// Frees any resources associated with the u64, if we are in the Some state
2657 pub extern "C" fn COption_u64Z_free(_res: COption_u64Z) { }
2658 #[no_mangle]
2659 /// Creates a new COption_u64Z which has the same data as `orig`
2660 /// but with all dynamically-allocated buffers duplicated in new buffers.
2661 pub extern "C" fn COption_u64Z_clone(orig: &COption_u64Z) -> COption_u64Z { Clone::clone(&orig) }
2662 #[repr(C)]
2663 /// A dynamically-allocated array of u64s of arbitrary size.
2664 /// This corresponds to std::vector in C++
2665 pub struct CVec_u64Z {
2666         /// The elements in the array.
2667         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2668         pub data: *mut u64,
2669         /// The number of elements pointed to by `data`.
2670         pub datalen: usize
2671 }
2672 impl CVec_u64Z {
2673         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<u64> {
2674                 if self.datalen == 0 { return Vec::new(); }
2675                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
2676                 self.data = core::ptr::null_mut();
2677                 self.datalen = 0;
2678                 ret
2679         }
2680         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[u64] {
2681                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
2682         }
2683 }
2684 impl From<Vec<u64>> for CVec_u64Z {
2685         fn from(v: Vec<u64>) -> Self {
2686                 let datalen = v.len();
2687                 let data = Box::into_raw(v.into_boxed_slice());
2688                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
2689         }
2690 }
2691 #[no_mangle]
2692 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
2693 pub extern "C" fn CVec_u64Z_free(_res: CVec_u64Z) { }
2694 impl Drop for CVec_u64Z {
2695         fn drop(&mut self) {
2696                 if self.datalen == 0 { return; }
2697                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
2698         }
2699 }
2700 impl Clone for CVec_u64Z {
2701         fn clone(&self) -> Self {
2702                 let mut res = Vec::new();
2703                 if self.datalen == 0 { return Self::from(res); }
2704                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
2705                 Self::from(res)
2706         }
2707 }
2708 #[repr(C)]
2709 /// The contents of CResult_PaymentParametersDecodeErrorZ
2710 pub union CResult_PaymentParametersDecodeErrorZPtr {
2711         /// A pointer to the contents in the success state.
2712         /// Reading from this pointer when `result_ok` is not set is undefined.
2713         pub result: *mut crate::lightning::routing::router::PaymentParameters,
2714         /// A pointer to the contents in the error state.
2715         /// Reading from this pointer when `result_ok` is set is undefined.
2716         pub err: *mut crate::lightning::ln::msgs::DecodeError,
2717 }
2718 #[repr(C)]
2719 /// A CResult_PaymentParametersDecodeErrorZ represents the result of a fallible operation,
2720 /// containing a crate::lightning::routing::router::PaymentParameters on success and a crate::lightning::ln::msgs::DecodeError on failure.
2721 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2722 pub struct CResult_PaymentParametersDecodeErrorZ {
2723         /// The contents of this CResult_PaymentParametersDecodeErrorZ, accessible via either
2724         /// `err` or `result` depending on the state of `result_ok`.
2725         pub contents: CResult_PaymentParametersDecodeErrorZPtr,
2726         /// Whether this CResult_PaymentParametersDecodeErrorZ represents a success state.
2727         pub result_ok: bool,
2728 }
2729 #[no_mangle]
2730 /// Creates a new CResult_PaymentParametersDecodeErrorZ in the success state.
2731 pub extern "C" fn CResult_PaymentParametersDecodeErrorZ_ok(o: crate::lightning::routing::router::PaymentParameters) -> CResult_PaymentParametersDecodeErrorZ {
2732         CResult_PaymentParametersDecodeErrorZ {
2733                 contents: CResult_PaymentParametersDecodeErrorZPtr {
2734                         result: Box::into_raw(Box::new(o)),
2735                 },
2736                 result_ok: true,
2737         }
2738 }
2739 #[no_mangle]
2740 /// Creates a new CResult_PaymentParametersDecodeErrorZ in the error state.
2741 pub extern "C" fn CResult_PaymentParametersDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_PaymentParametersDecodeErrorZ {
2742         CResult_PaymentParametersDecodeErrorZ {
2743                 contents: CResult_PaymentParametersDecodeErrorZPtr {
2744                         err: Box::into_raw(Box::new(e)),
2745                 },
2746                 result_ok: false,
2747         }
2748 }
2749 /// Checks if the given object is currently in the success state
2750 #[no_mangle]
2751 pub extern "C" fn CResult_PaymentParametersDecodeErrorZ_is_ok(o: &CResult_PaymentParametersDecodeErrorZ) -> bool {
2752         o.result_ok
2753 }
2754 #[no_mangle]
2755 /// Frees any resources used by the CResult_PaymentParametersDecodeErrorZ.
2756 pub extern "C" fn CResult_PaymentParametersDecodeErrorZ_free(_res: CResult_PaymentParametersDecodeErrorZ) { }
2757 impl Drop for CResult_PaymentParametersDecodeErrorZ {
2758         fn drop(&mut self) {
2759                 if self.result_ok {
2760                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
2761                                 let _ = unsafe { Box::from_raw(self.contents.result) };
2762                         }
2763                 } else {
2764                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
2765                                 let _ = unsafe { Box::from_raw(self.contents.err) };
2766                         }
2767                 }
2768         }
2769 }
2770 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::PaymentParameters, crate::lightning::ln::msgs::DecodeError>> for CResult_PaymentParametersDecodeErrorZ {
2771         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::PaymentParameters, crate::lightning::ln::msgs::DecodeError>) -> Self {
2772                 let contents = if o.result_ok {
2773                         let result = unsafe { o.contents.result };
2774                         unsafe { o.contents.result = core::ptr::null_mut() };
2775                         CResult_PaymentParametersDecodeErrorZPtr { result }
2776                 } else {
2777                         let err = unsafe { o.contents.err };
2778                         unsafe { o.contents.err = core::ptr::null_mut(); }
2779                         CResult_PaymentParametersDecodeErrorZPtr { err }
2780                 };
2781                 Self {
2782                         contents,
2783                         result_ok: o.result_ok,
2784                 }
2785         }
2786 }
2787 impl Clone for CResult_PaymentParametersDecodeErrorZ {
2788         fn clone(&self) -> Self {
2789                 if self.result_ok {
2790                         Self { result_ok: true, contents: CResult_PaymentParametersDecodeErrorZPtr {
2791                                 result: Box::into_raw(Box::new(<crate::lightning::routing::router::PaymentParameters>::clone(unsafe { &*self.contents.result })))
2792                         } }
2793                 } else {
2794                         Self { result_ok: false, contents: CResult_PaymentParametersDecodeErrorZPtr {
2795                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
2796                         } }
2797                 }
2798         }
2799 }
2800 #[no_mangle]
2801 /// Creates a new CResult_PaymentParametersDecodeErrorZ which has the same data as `orig`
2802 /// but with all dynamically-allocated buffers duplicated in new buffers.
2803 pub extern "C" fn CResult_PaymentParametersDecodeErrorZ_clone(orig: &CResult_PaymentParametersDecodeErrorZ) -> CResult_PaymentParametersDecodeErrorZ { Clone::clone(&orig) }
2804 #[repr(C)]
2805 /// A dynamically-allocated array of crate::lightning::routing::router::RouteHintHops of arbitrary size.
2806 /// This corresponds to std::vector in C++
2807 pub struct CVec_RouteHintHopZ {
2808         /// The elements in the array.
2809         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2810         pub data: *mut crate::lightning::routing::router::RouteHintHop,
2811         /// The number of elements pointed to by `data`.
2812         pub datalen: usize
2813 }
2814 impl CVec_RouteHintHopZ {
2815         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::routing::router::RouteHintHop> {
2816                 if self.datalen == 0 { return Vec::new(); }
2817                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
2818                 self.data = core::ptr::null_mut();
2819                 self.datalen = 0;
2820                 ret
2821         }
2822         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::routing::router::RouteHintHop] {
2823                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
2824         }
2825 }
2826 impl From<Vec<crate::lightning::routing::router::RouteHintHop>> for CVec_RouteHintHopZ {
2827         fn from(v: Vec<crate::lightning::routing::router::RouteHintHop>) -> Self {
2828                 let datalen = v.len();
2829                 let data = Box::into_raw(v.into_boxed_slice());
2830                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
2831         }
2832 }
2833 #[no_mangle]
2834 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
2835 pub extern "C" fn CVec_RouteHintHopZ_free(_res: CVec_RouteHintHopZ) { }
2836 impl Drop for CVec_RouteHintHopZ {
2837         fn drop(&mut self) {
2838                 if self.datalen == 0 { return; }
2839                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
2840         }
2841 }
2842 impl Clone for CVec_RouteHintHopZ {
2843         fn clone(&self) -> Self {
2844                 let mut res = Vec::new();
2845                 if self.datalen == 0 { return Self::from(res); }
2846                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
2847                 Self::from(res)
2848         }
2849 }
2850 #[repr(C)]
2851 /// The contents of CResult_RouteHintDecodeErrorZ
2852 pub union CResult_RouteHintDecodeErrorZPtr {
2853         /// A pointer to the contents in the success state.
2854         /// Reading from this pointer when `result_ok` is not set is undefined.
2855         pub result: *mut crate::lightning::routing::router::RouteHint,
2856         /// A pointer to the contents in the error state.
2857         /// Reading from this pointer when `result_ok` is set is undefined.
2858         pub err: *mut crate::lightning::ln::msgs::DecodeError,
2859 }
2860 #[repr(C)]
2861 /// A CResult_RouteHintDecodeErrorZ represents the result of a fallible operation,
2862 /// containing a crate::lightning::routing::router::RouteHint on success and a crate::lightning::ln::msgs::DecodeError on failure.
2863 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2864 pub struct CResult_RouteHintDecodeErrorZ {
2865         /// The contents of this CResult_RouteHintDecodeErrorZ, accessible via either
2866         /// `err` or `result` depending on the state of `result_ok`.
2867         pub contents: CResult_RouteHintDecodeErrorZPtr,
2868         /// Whether this CResult_RouteHintDecodeErrorZ represents a success state.
2869         pub result_ok: bool,
2870 }
2871 #[no_mangle]
2872 /// Creates a new CResult_RouteHintDecodeErrorZ in the success state.
2873 pub extern "C" fn CResult_RouteHintDecodeErrorZ_ok(o: crate::lightning::routing::router::RouteHint) -> CResult_RouteHintDecodeErrorZ {
2874         CResult_RouteHintDecodeErrorZ {
2875                 contents: CResult_RouteHintDecodeErrorZPtr {
2876                         result: Box::into_raw(Box::new(o)),
2877                 },
2878                 result_ok: true,
2879         }
2880 }
2881 #[no_mangle]
2882 /// Creates a new CResult_RouteHintDecodeErrorZ in the error state.
2883 pub extern "C" fn CResult_RouteHintDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RouteHintDecodeErrorZ {
2884         CResult_RouteHintDecodeErrorZ {
2885                 contents: CResult_RouteHintDecodeErrorZPtr {
2886                         err: Box::into_raw(Box::new(e)),
2887                 },
2888                 result_ok: false,
2889         }
2890 }
2891 /// Checks if the given object is currently in the success state
2892 #[no_mangle]
2893 pub extern "C" fn CResult_RouteHintDecodeErrorZ_is_ok(o: &CResult_RouteHintDecodeErrorZ) -> bool {
2894         o.result_ok
2895 }
2896 #[no_mangle]
2897 /// Frees any resources used by the CResult_RouteHintDecodeErrorZ.
2898 pub extern "C" fn CResult_RouteHintDecodeErrorZ_free(_res: CResult_RouteHintDecodeErrorZ) { }
2899 impl Drop for CResult_RouteHintDecodeErrorZ {
2900         fn drop(&mut self) {
2901                 if self.result_ok {
2902                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
2903                                 let _ = unsafe { Box::from_raw(self.contents.result) };
2904                         }
2905                 } else {
2906                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
2907                                 let _ = unsafe { Box::from_raw(self.contents.err) };
2908                         }
2909                 }
2910         }
2911 }
2912 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::RouteHint, crate::lightning::ln::msgs::DecodeError>> for CResult_RouteHintDecodeErrorZ {
2913         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::RouteHint, crate::lightning::ln::msgs::DecodeError>) -> Self {
2914                 let contents = if o.result_ok {
2915                         let result = unsafe { o.contents.result };
2916                         unsafe { o.contents.result = core::ptr::null_mut() };
2917                         CResult_RouteHintDecodeErrorZPtr { result }
2918                 } else {
2919                         let err = unsafe { o.contents.err };
2920                         unsafe { o.contents.err = core::ptr::null_mut(); }
2921                         CResult_RouteHintDecodeErrorZPtr { err }
2922                 };
2923                 Self {
2924                         contents,
2925                         result_ok: o.result_ok,
2926                 }
2927         }
2928 }
2929 impl Clone for CResult_RouteHintDecodeErrorZ {
2930         fn clone(&self) -> Self {
2931                 if self.result_ok {
2932                         Self { result_ok: true, contents: CResult_RouteHintDecodeErrorZPtr {
2933                                 result: Box::into_raw(Box::new(<crate::lightning::routing::router::RouteHint>::clone(unsafe { &*self.contents.result })))
2934                         } }
2935                 } else {
2936                         Self { result_ok: false, contents: CResult_RouteHintDecodeErrorZPtr {
2937                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
2938                         } }
2939                 }
2940         }
2941 }
2942 #[no_mangle]
2943 /// Creates a new CResult_RouteHintDecodeErrorZ which has the same data as `orig`
2944 /// but with all dynamically-allocated buffers duplicated in new buffers.
2945 pub extern "C" fn CResult_RouteHintDecodeErrorZ_clone(orig: &CResult_RouteHintDecodeErrorZ) -> CResult_RouteHintDecodeErrorZ { Clone::clone(&orig) }
2946 #[repr(C)]
2947 /// The contents of CResult_RouteHintHopDecodeErrorZ
2948 pub union CResult_RouteHintHopDecodeErrorZPtr {
2949         /// A pointer to the contents in the success state.
2950         /// Reading from this pointer when `result_ok` is not set is undefined.
2951         pub result: *mut crate::lightning::routing::router::RouteHintHop,
2952         /// A pointer to the contents in the error state.
2953         /// Reading from this pointer when `result_ok` is set is undefined.
2954         pub err: *mut crate::lightning::ln::msgs::DecodeError,
2955 }
2956 #[repr(C)]
2957 /// A CResult_RouteHintHopDecodeErrorZ represents the result of a fallible operation,
2958 /// containing a crate::lightning::routing::router::RouteHintHop on success and a crate::lightning::ln::msgs::DecodeError on failure.
2959 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2960 pub struct CResult_RouteHintHopDecodeErrorZ {
2961         /// The contents of this CResult_RouteHintHopDecodeErrorZ, accessible via either
2962         /// `err` or `result` depending on the state of `result_ok`.
2963         pub contents: CResult_RouteHintHopDecodeErrorZPtr,
2964         /// Whether this CResult_RouteHintHopDecodeErrorZ represents a success state.
2965         pub result_ok: bool,
2966 }
2967 #[no_mangle]
2968 /// Creates a new CResult_RouteHintHopDecodeErrorZ in the success state.
2969 pub extern "C" fn CResult_RouteHintHopDecodeErrorZ_ok(o: crate::lightning::routing::router::RouteHintHop) -> CResult_RouteHintHopDecodeErrorZ {
2970         CResult_RouteHintHopDecodeErrorZ {
2971                 contents: CResult_RouteHintHopDecodeErrorZPtr {
2972                         result: Box::into_raw(Box::new(o)),
2973                 },
2974                 result_ok: true,
2975         }
2976 }
2977 #[no_mangle]
2978 /// Creates a new CResult_RouteHintHopDecodeErrorZ in the error state.
2979 pub extern "C" fn CResult_RouteHintHopDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RouteHintHopDecodeErrorZ {
2980         CResult_RouteHintHopDecodeErrorZ {
2981                 contents: CResult_RouteHintHopDecodeErrorZPtr {
2982                         err: Box::into_raw(Box::new(e)),
2983                 },
2984                 result_ok: false,
2985         }
2986 }
2987 /// Checks if the given object is currently in the success state
2988 #[no_mangle]
2989 pub extern "C" fn CResult_RouteHintHopDecodeErrorZ_is_ok(o: &CResult_RouteHintHopDecodeErrorZ) -> bool {
2990         o.result_ok
2991 }
2992 #[no_mangle]
2993 /// Frees any resources used by the CResult_RouteHintHopDecodeErrorZ.
2994 pub extern "C" fn CResult_RouteHintHopDecodeErrorZ_free(_res: CResult_RouteHintHopDecodeErrorZ) { }
2995 impl Drop for CResult_RouteHintHopDecodeErrorZ {
2996         fn drop(&mut self) {
2997                 if self.result_ok {
2998                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
2999                                 let _ = unsafe { Box::from_raw(self.contents.result) };
3000                         }
3001                 } else {
3002                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
3003                                 let _ = unsafe { Box::from_raw(self.contents.err) };
3004                         }
3005                 }
3006         }
3007 }
3008 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::RouteHintHop, crate::lightning::ln::msgs::DecodeError>> for CResult_RouteHintHopDecodeErrorZ {
3009         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::RouteHintHop, crate::lightning::ln::msgs::DecodeError>) -> Self {
3010                 let contents = if o.result_ok {
3011                         let result = unsafe { o.contents.result };
3012                         unsafe { o.contents.result = core::ptr::null_mut() };
3013                         CResult_RouteHintHopDecodeErrorZPtr { result }
3014                 } else {
3015                         let err = unsafe { o.contents.err };
3016                         unsafe { o.contents.err = core::ptr::null_mut(); }
3017                         CResult_RouteHintHopDecodeErrorZPtr { err }
3018                 };
3019                 Self {
3020                         contents,
3021                         result_ok: o.result_ok,
3022                 }
3023         }
3024 }
3025 impl Clone for CResult_RouteHintHopDecodeErrorZ {
3026         fn clone(&self) -> Self {
3027                 if self.result_ok {
3028                         Self { result_ok: true, contents: CResult_RouteHintHopDecodeErrorZPtr {
3029                                 result: Box::into_raw(Box::new(<crate::lightning::routing::router::RouteHintHop>::clone(unsafe { &*self.contents.result })))
3030                         } }
3031                 } else {
3032                         Self { result_ok: false, contents: CResult_RouteHintHopDecodeErrorZPtr {
3033                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
3034                         } }
3035                 }
3036         }
3037 }
3038 #[no_mangle]
3039 /// Creates a new CResult_RouteHintHopDecodeErrorZ which has the same data as `orig`
3040 /// but with all dynamically-allocated buffers duplicated in new buffers.
3041 pub extern "C" fn CResult_RouteHintHopDecodeErrorZ_clone(orig: &CResult_RouteHintHopDecodeErrorZ) -> CResult_RouteHintHopDecodeErrorZ { Clone::clone(&orig) }
3042 #[repr(C)]
3043 /// A dynamically-allocated array of crate::lightning::ln::channelmanager::ChannelDetailss of arbitrary size.
3044 /// This corresponds to std::vector in C++
3045 pub struct CVec_ChannelDetailsZ {
3046         /// The elements in the array.
3047         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3048         pub data: *mut crate::lightning::ln::channelmanager::ChannelDetails,
3049         /// The number of elements pointed to by `data`.
3050         pub datalen: usize
3051 }
3052 impl CVec_ChannelDetailsZ {
3053         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::channelmanager::ChannelDetails> {
3054                 if self.datalen == 0 { return Vec::new(); }
3055                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
3056                 self.data = core::ptr::null_mut();
3057                 self.datalen = 0;
3058                 ret
3059         }
3060         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::channelmanager::ChannelDetails] {
3061                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
3062         }
3063 }
3064 impl From<Vec<crate::lightning::ln::channelmanager::ChannelDetails>> for CVec_ChannelDetailsZ {
3065         fn from(v: Vec<crate::lightning::ln::channelmanager::ChannelDetails>) -> Self {
3066                 let datalen = v.len();
3067                 let data = Box::into_raw(v.into_boxed_slice());
3068                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
3069         }
3070 }
3071 #[no_mangle]
3072 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
3073 pub extern "C" fn CVec_ChannelDetailsZ_free(_res: CVec_ChannelDetailsZ) { }
3074 impl Drop for CVec_ChannelDetailsZ {
3075         fn drop(&mut self) {
3076                 if self.datalen == 0 { return; }
3077                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
3078         }
3079 }
3080 impl Clone for CVec_ChannelDetailsZ {
3081         fn clone(&self) -> Self {
3082                 let mut res = Vec::new();
3083                 if self.datalen == 0 { return Self::from(res); }
3084                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
3085                 Self::from(res)
3086         }
3087 }
3088 #[repr(C)]
3089 /// The contents of CResult_RouteLightningErrorZ
3090 pub union CResult_RouteLightningErrorZPtr {
3091         /// A pointer to the contents in the success state.
3092         /// Reading from this pointer when `result_ok` is not set is undefined.
3093         pub result: *mut crate::lightning::routing::router::Route,
3094         /// A pointer to the contents in the error state.
3095         /// Reading from this pointer when `result_ok` is set is undefined.
3096         pub err: *mut crate::lightning::ln::msgs::LightningError,
3097 }
3098 #[repr(C)]
3099 /// A CResult_RouteLightningErrorZ represents the result of a fallible operation,
3100 /// containing a crate::lightning::routing::router::Route on success and a crate::lightning::ln::msgs::LightningError on failure.
3101 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3102 pub struct CResult_RouteLightningErrorZ {
3103         /// The contents of this CResult_RouteLightningErrorZ, accessible via either
3104         /// `err` or `result` depending on the state of `result_ok`.
3105         pub contents: CResult_RouteLightningErrorZPtr,
3106         /// Whether this CResult_RouteLightningErrorZ represents a success state.
3107         pub result_ok: bool,
3108 }
3109 #[no_mangle]
3110 /// Creates a new CResult_RouteLightningErrorZ in the success state.
3111 pub extern "C" fn CResult_RouteLightningErrorZ_ok(o: crate::lightning::routing::router::Route) -> CResult_RouteLightningErrorZ {
3112         CResult_RouteLightningErrorZ {
3113                 contents: CResult_RouteLightningErrorZPtr {
3114                         result: Box::into_raw(Box::new(o)),
3115                 },
3116                 result_ok: true,
3117         }
3118 }
3119 #[no_mangle]
3120 /// Creates a new CResult_RouteLightningErrorZ in the error state.
3121 pub extern "C" fn CResult_RouteLightningErrorZ_err(e: crate::lightning::ln::msgs::LightningError) -> CResult_RouteLightningErrorZ {
3122         CResult_RouteLightningErrorZ {
3123                 contents: CResult_RouteLightningErrorZPtr {
3124                         err: Box::into_raw(Box::new(e)),
3125                 },
3126                 result_ok: false,
3127         }
3128 }
3129 /// Checks if the given object is currently in the success state
3130 #[no_mangle]
3131 pub extern "C" fn CResult_RouteLightningErrorZ_is_ok(o: &CResult_RouteLightningErrorZ) -> bool {
3132         o.result_ok
3133 }
3134 #[no_mangle]
3135 /// Frees any resources used by the CResult_RouteLightningErrorZ.
3136 pub extern "C" fn CResult_RouteLightningErrorZ_free(_res: CResult_RouteLightningErrorZ) { }
3137 impl Drop for CResult_RouteLightningErrorZ {
3138         fn drop(&mut self) {
3139                 if self.result_ok {
3140                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
3141                                 let _ = unsafe { Box::from_raw(self.contents.result) };
3142                         }
3143                 } else {
3144                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
3145                                 let _ = unsafe { Box::from_raw(self.contents.err) };
3146                         }
3147                 }
3148         }
3149 }
3150 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::Route, crate::lightning::ln::msgs::LightningError>> for CResult_RouteLightningErrorZ {
3151         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::Route, crate::lightning::ln::msgs::LightningError>) -> Self {
3152                 let contents = if o.result_ok {
3153                         let result = unsafe { o.contents.result };
3154                         unsafe { o.contents.result = core::ptr::null_mut() };
3155                         CResult_RouteLightningErrorZPtr { result }
3156                 } else {
3157                         let err = unsafe { o.contents.err };
3158                         unsafe { o.contents.err = core::ptr::null_mut(); }
3159                         CResult_RouteLightningErrorZPtr { err }
3160                 };
3161                 Self {
3162                         contents,
3163                         result_ok: o.result_ok,
3164                 }
3165         }
3166 }
3167 impl Clone for CResult_RouteLightningErrorZ {
3168         fn clone(&self) -> Self {
3169                 if self.result_ok {
3170                         Self { result_ok: true, contents: CResult_RouteLightningErrorZPtr {
3171                                 result: Box::into_raw(Box::new(<crate::lightning::routing::router::Route>::clone(unsafe { &*self.contents.result })))
3172                         } }
3173                 } else {
3174                         Self { result_ok: false, contents: CResult_RouteLightningErrorZPtr {
3175                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::LightningError>::clone(unsafe { &*self.contents.err })))
3176                         } }
3177                 }
3178         }
3179 }
3180 #[no_mangle]
3181 /// Creates a new CResult_RouteLightningErrorZ which has the same data as `orig`
3182 /// but with all dynamically-allocated buffers duplicated in new buffers.
3183 pub extern "C" fn CResult_RouteLightningErrorZ_clone(orig: &CResult_RouteLightningErrorZ) -> CResult_RouteLightningErrorZ { Clone::clone(&orig) }
3184 #[repr(C)]
3185 /// The contents of CResult_PaymentPurposeDecodeErrorZ
3186 pub union CResult_PaymentPurposeDecodeErrorZPtr {
3187         /// A pointer to the contents in the success state.
3188         /// Reading from this pointer when `result_ok` is not set is undefined.
3189         pub result: *mut crate::lightning::util::events::PaymentPurpose,
3190         /// A pointer to the contents in the error state.
3191         /// Reading from this pointer when `result_ok` is set is undefined.
3192         pub err: *mut crate::lightning::ln::msgs::DecodeError,
3193 }
3194 #[repr(C)]
3195 /// A CResult_PaymentPurposeDecodeErrorZ represents the result of a fallible operation,
3196 /// containing a crate::lightning::util::events::PaymentPurpose on success and a crate::lightning::ln::msgs::DecodeError on failure.
3197 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3198 pub struct CResult_PaymentPurposeDecodeErrorZ {
3199         /// The contents of this CResult_PaymentPurposeDecodeErrorZ, accessible via either
3200         /// `err` or `result` depending on the state of `result_ok`.
3201         pub contents: CResult_PaymentPurposeDecodeErrorZPtr,
3202         /// Whether this CResult_PaymentPurposeDecodeErrorZ represents a success state.
3203         pub result_ok: bool,
3204 }
3205 #[no_mangle]
3206 /// Creates a new CResult_PaymentPurposeDecodeErrorZ in the success state.
3207 pub extern "C" fn CResult_PaymentPurposeDecodeErrorZ_ok(o: crate::lightning::util::events::PaymentPurpose) -> CResult_PaymentPurposeDecodeErrorZ {
3208         CResult_PaymentPurposeDecodeErrorZ {
3209                 contents: CResult_PaymentPurposeDecodeErrorZPtr {
3210                         result: Box::into_raw(Box::new(o)),
3211                 },
3212                 result_ok: true,
3213         }
3214 }
3215 #[no_mangle]
3216 /// Creates a new CResult_PaymentPurposeDecodeErrorZ in the error state.
3217 pub extern "C" fn CResult_PaymentPurposeDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_PaymentPurposeDecodeErrorZ {
3218         CResult_PaymentPurposeDecodeErrorZ {
3219                 contents: CResult_PaymentPurposeDecodeErrorZPtr {
3220                         err: Box::into_raw(Box::new(e)),
3221                 },
3222                 result_ok: false,
3223         }
3224 }
3225 /// Checks if the given object is currently in the success state
3226 #[no_mangle]
3227 pub extern "C" fn CResult_PaymentPurposeDecodeErrorZ_is_ok(o: &CResult_PaymentPurposeDecodeErrorZ) -> bool {
3228         o.result_ok
3229 }
3230 #[no_mangle]
3231 /// Frees any resources used by the CResult_PaymentPurposeDecodeErrorZ.
3232 pub extern "C" fn CResult_PaymentPurposeDecodeErrorZ_free(_res: CResult_PaymentPurposeDecodeErrorZ) { }
3233 impl Drop for CResult_PaymentPurposeDecodeErrorZ {
3234         fn drop(&mut self) {
3235                 if self.result_ok {
3236                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
3237                                 let _ = unsafe { Box::from_raw(self.contents.result) };
3238                         }
3239                 } else {
3240                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
3241                                 let _ = unsafe { Box::from_raw(self.contents.err) };
3242                         }
3243                 }
3244         }
3245 }
3246 impl From<crate::c_types::CResultTempl<crate::lightning::util::events::PaymentPurpose, crate::lightning::ln::msgs::DecodeError>> for CResult_PaymentPurposeDecodeErrorZ {
3247         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::util::events::PaymentPurpose, crate::lightning::ln::msgs::DecodeError>) -> Self {
3248                 let contents = if o.result_ok {
3249                         let result = unsafe { o.contents.result };
3250                         unsafe { o.contents.result = core::ptr::null_mut() };
3251                         CResult_PaymentPurposeDecodeErrorZPtr { result }
3252                 } else {
3253                         let err = unsafe { o.contents.err };
3254                         unsafe { o.contents.err = core::ptr::null_mut(); }
3255                         CResult_PaymentPurposeDecodeErrorZPtr { err }
3256                 };
3257                 Self {
3258                         contents,
3259                         result_ok: o.result_ok,
3260                 }
3261         }
3262 }
3263 impl Clone for CResult_PaymentPurposeDecodeErrorZ {
3264         fn clone(&self) -> Self {
3265                 if self.result_ok {
3266                         Self { result_ok: true, contents: CResult_PaymentPurposeDecodeErrorZPtr {
3267                                 result: Box::into_raw(Box::new(<crate::lightning::util::events::PaymentPurpose>::clone(unsafe { &*self.contents.result })))
3268                         } }
3269                 } else {
3270                         Self { result_ok: false, contents: CResult_PaymentPurposeDecodeErrorZPtr {
3271                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
3272                         } }
3273                 }
3274         }
3275 }
3276 #[no_mangle]
3277 /// Creates a new CResult_PaymentPurposeDecodeErrorZ which has the same data as `orig`
3278 /// but with all dynamically-allocated buffers duplicated in new buffers.
3279 pub extern "C" fn CResult_PaymentPurposeDecodeErrorZ_clone(orig: &CResult_PaymentPurposeDecodeErrorZ) -> CResult_PaymentPurposeDecodeErrorZ { Clone::clone(&orig) }
3280 #[repr(C)]
3281 #[derive(Clone)]
3282 /// An enum which can either contain a crate::lightning::util::events::ClosureReason or not
3283 pub enum COption_ClosureReasonZ {
3284         /// When we're in this state, this COption_ClosureReasonZ contains a crate::lightning::util::events::ClosureReason
3285         Some(crate::lightning::util::events::ClosureReason),
3286         /// When we're in this state, this COption_ClosureReasonZ contains nothing
3287         None
3288 }
3289 impl COption_ClosureReasonZ {
3290         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
3291                 if let Self::None = self { false } else { true }
3292         }
3293         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
3294                 !self.is_some()
3295         }
3296         #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::util::events::ClosureReason {
3297                 if let Self::Some(v) = self { v } else { unreachable!() }
3298         }
3299 }
3300 #[no_mangle]
3301 /// Constructs a new COption_ClosureReasonZ containing a crate::lightning::util::events::ClosureReason
3302 pub extern "C" fn COption_ClosureReasonZ_some(o: crate::lightning::util::events::ClosureReason) -> COption_ClosureReasonZ {
3303         COption_ClosureReasonZ::Some(o)
3304 }
3305 #[no_mangle]
3306 /// Constructs a new COption_ClosureReasonZ containing nothing
3307 pub extern "C" fn COption_ClosureReasonZ_none() -> COption_ClosureReasonZ {
3308         COption_ClosureReasonZ::None
3309 }
3310 #[no_mangle]
3311 /// Frees any resources associated with the crate::lightning::util::events::ClosureReason, if we are in the Some state
3312 pub extern "C" fn COption_ClosureReasonZ_free(_res: COption_ClosureReasonZ) { }
3313 #[no_mangle]
3314 /// Creates a new COption_ClosureReasonZ which has the same data as `orig`
3315 /// but with all dynamically-allocated buffers duplicated in new buffers.
3316 pub extern "C" fn COption_ClosureReasonZ_clone(orig: &COption_ClosureReasonZ) -> COption_ClosureReasonZ { Clone::clone(&orig) }
3317 #[repr(C)]
3318 /// The contents of CResult_COption_ClosureReasonZDecodeErrorZ
3319 pub union CResult_COption_ClosureReasonZDecodeErrorZPtr {
3320         /// A pointer to the contents in the success state.
3321         /// Reading from this pointer when `result_ok` is not set is undefined.
3322         pub result: *mut crate::c_types::derived::COption_ClosureReasonZ,
3323         /// A pointer to the contents in the error state.
3324         /// Reading from this pointer when `result_ok` is set is undefined.
3325         pub err: *mut crate::lightning::ln::msgs::DecodeError,
3326 }
3327 #[repr(C)]
3328 /// A CResult_COption_ClosureReasonZDecodeErrorZ represents the result of a fallible operation,
3329 /// containing a crate::c_types::derived::COption_ClosureReasonZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
3330 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3331 pub struct CResult_COption_ClosureReasonZDecodeErrorZ {
3332         /// The contents of this CResult_COption_ClosureReasonZDecodeErrorZ, accessible via either
3333         /// `err` or `result` depending on the state of `result_ok`.
3334         pub contents: CResult_COption_ClosureReasonZDecodeErrorZPtr,
3335         /// Whether this CResult_COption_ClosureReasonZDecodeErrorZ represents a success state.
3336         pub result_ok: bool,
3337 }
3338 #[no_mangle]
3339 /// Creates a new CResult_COption_ClosureReasonZDecodeErrorZ in the success state.
3340 pub extern "C" fn CResult_COption_ClosureReasonZDecodeErrorZ_ok(o: crate::c_types::derived::COption_ClosureReasonZ) -> CResult_COption_ClosureReasonZDecodeErrorZ {
3341         CResult_COption_ClosureReasonZDecodeErrorZ {
3342                 contents: CResult_COption_ClosureReasonZDecodeErrorZPtr {
3343                         result: Box::into_raw(Box::new(o)),
3344                 },
3345                 result_ok: true,
3346         }
3347 }
3348 #[no_mangle]
3349 /// Creates a new CResult_COption_ClosureReasonZDecodeErrorZ in the error state.
3350 pub extern "C" fn CResult_COption_ClosureReasonZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_ClosureReasonZDecodeErrorZ {
3351         CResult_COption_ClosureReasonZDecodeErrorZ {
3352                 contents: CResult_COption_ClosureReasonZDecodeErrorZPtr {
3353                         err: Box::into_raw(Box::new(e)),
3354                 },
3355                 result_ok: false,
3356         }
3357 }
3358 /// Checks if the given object is currently in the success state
3359 #[no_mangle]
3360 pub extern "C" fn CResult_COption_ClosureReasonZDecodeErrorZ_is_ok(o: &CResult_COption_ClosureReasonZDecodeErrorZ) -> bool {
3361         o.result_ok
3362 }
3363 #[no_mangle]
3364 /// Frees any resources used by the CResult_COption_ClosureReasonZDecodeErrorZ.
3365 pub extern "C" fn CResult_COption_ClosureReasonZDecodeErrorZ_free(_res: CResult_COption_ClosureReasonZDecodeErrorZ) { }
3366 impl Drop for CResult_COption_ClosureReasonZDecodeErrorZ {
3367         fn drop(&mut self) {
3368                 if self.result_ok {
3369                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
3370                                 let _ = unsafe { Box::from_raw(self.contents.result) };
3371                         }
3372                 } else {
3373                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
3374                                 let _ = unsafe { Box::from_raw(self.contents.err) };
3375                         }
3376                 }
3377         }
3378 }
3379 impl From<crate::c_types::CResultTempl<crate::c_types::derived::COption_ClosureReasonZ, crate::lightning::ln::msgs::DecodeError>> for CResult_COption_ClosureReasonZDecodeErrorZ {
3380         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::COption_ClosureReasonZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
3381                 let contents = if o.result_ok {
3382                         let result = unsafe { o.contents.result };
3383                         unsafe { o.contents.result = core::ptr::null_mut() };
3384                         CResult_COption_ClosureReasonZDecodeErrorZPtr { result }
3385                 } else {
3386                         let err = unsafe { o.contents.err };
3387                         unsafe { o.contents.err = core::ptr::null_mut(); }
3388                         CResult_COption_ClosureReasonZDecodeErrorZPtr { err }
3389                 };
3390                 Self {
3391                         contents,
3392                         result_ok: o.result_ok,
3393                 }
3394         }
3395 }
3396 impl Clone for CResult_COption_ClosureReasonZDecodeErrorZ {
3397         fn clone(&self) -> Self {
3398                 if self.result_ok {
3399                         Self { result_ok: true, contents: CResult_COption_ClosureReasonZDecodeErrorZPtr {
3400                                 result: Box::into_raw(Box::new(<crate::c_types::derived::COption_ClosureReasonZ>::clone(unsafe { &*self.contents.result })))
3401                         } }
3402                 } else {
3403                         Self { result_ok: false, contents: CResult_COption_ClosureReasonZDecodeErrorZPtr {
3404                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
3405                         } }
3406                 }
3407         }
3408 }
3409 #[no_mangle]
3410 /// Creates a new CResult_COption_ClosureReasonZDecodeErrorZ which has the same data as `orig`
3411 /// but with all dynamically-allocated buffers duplicated in new buffers.
3412 pub extern "C" fn CResult_COption_ClosureReasonZDecodeErrorZ_clone(orig: &CResult_COption_ClosureReasonZDecodeErrorZ) -> CResult_COption_ClosureReasonZDecodeErrorZ { Clone::clone(&orig) }
3413 #[repr(C)]
3414 #[derive(Clone)]
3415 /// An enum which can either contain a crate::lightning::util::events::HTLCDestination or not
3416 pub enum COption_HTLCDestinationZ {
3417         /// When we're in this state, this COption_HTLCDestinationZ contains a crate::lightning::util::events::HTLCDestination
3418         Some(crate::lightning::util::events::HTLCDestination),
3419         /// When we're in this state, this COption_HTLCDestinationZ contains nothing
3420         None
3421 }
3422 impl COption_HTLCDestinationZ {
3423         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
3424                 if let Self::None = self { false } else { true }
3425         }
3426         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
3427                 !self.is_some()
3428         }
3429         #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::util::events::HTLCDestination {
3430                 if let Self::Some(v) = self { v } else { unreachable!() }
3431         }
3432 }
3433 #[no_mangle]
3434 /// Constructs a new COption_HTLCDestinationZ containing a crate::lightning::util::events::HTLCDestination
3435 pub extern "C" fn COption_HTLCDestinationZ_some(o: crate::lightning::util::events::HTLCDestination) -> COption_HTLCDestinationZ {
3436         COption_HTLCDestinationZ::Some(o)
3437 }
3438 #[no_mangle]
3439 /// Constructs a new COption_HTLCDestinationZ containing nothing
3440 pub extern "C" fn COption_HTLCDestinationZ_none() -> COption_HTLCDestinationZ {
3441         COption_HTLCDestinationZ::None
3442 }
3443 #[no_mangle]
3444 /// Frees any resources associated with the crate::lightning::util::events::HTLCDestination, if we are in the Some state
3445 pub extern "C" fn COption_HTLCDestinationZ_free(_res: COption_HTLCDestinationZ) { }
3446 #[no_mangle]
3447 /// Creates a new COption_HTLCDestinationZ which has the same data as `orig`
3448 /// but with all dynamically-allocated buffers duplicated in new buffers.
3449 pub extern "C" fn COption_HTLCDestinationZ_clone(orig: &COption_HTLCDestinationZ) -> COption_HTLCDestinationZ { Clone::clone(&orig) }
3450 #[repr(C)]
3451 /// The contents of CResult_COption_HTLCDestinationZDecodeErrorZ
3452 pub union CResult_COption_HTLCDestinationZDecodeErrorZPtr {
3453         /// A pointer to the contents in the success state.
3454         /// Reading from this pointer when `result_ok` is not set is undefined.
3455         pub result: *mut crate::c_types::derived::COption_HTLCDestinationZ,
3456         /// A pointer to the contents in the error state.
3457         /// Reading from this pointer when `result_ok` is set is undefined.
3458         pub err: *mut crate::lightning::ln::msgs::DecodeError,
3459 }
3460 #[repr(C)]
3461 /// A CResult_COption_HTLCDestinationZDecodeErrorZ represents the result of a fallible operation,
3462 /// containing a crate::c_types::derived::COption_HTLCDestinationZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
3463 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3464 pub struct CResult_COption_HTLCDestinationZDecodeErrorZ {
3465         /// The contents of this CResult_COption_HTLCDestinationZDecodeErrorZ, accessible via either
3466         /// `err` or `result` depending on the state of `result_ok`.
3467         pub contents: CResult_COption_HTLCDestinationZDecodeErrorZPtr,
3468         /// Whether this CResult_COption_HTLCDestinationZDecodeErrorZ represents a success state.
3469         pub result_ok: bool,
3470 }
3471 #[no_mangle]
3472 /// Creates a new CResult_COption_HTLCDestinationZDecodeErrorZ in the success state.
3473 pub extern "C" fn CResult_COption_HTLCDestinationZDecodeErrorZ_ok(o: crate::c_types::derived::COption_HTLCDestinationZ) -> CResult_COption_HTLCDestinationZDecodeErrorZ {
3474         CResult_COption_HTLCDestinationZDecodeErrorZ {
3475                 contents: CResult_COption_HTLCDestinationZDecodeErrorZPtr {
3476                         result: Box::into_raw(Box::new(o)),
3477                 },
3478                 result_ok: true,
3479         }
3480 }
3481 #[no_mangle]
3482 /// Creates a new CResult_COption_HTLCDestinationZDecodeErrorZ in the error state.
3483 pub extern "C" fn CResult_COption_HTLCDestinationZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_HTLCDestinationZDecodeErrorZ {
3484         CResult_COption_HTLCDestinationZDecodeErrorZ {
3485                 contents: CResult_COption_HTLCDestinationZDecodeErrorZPtr {
3486                         err: Box::into_raw(Box::new(e)),
3487                 },
3488                 result_ok: false,
3489         }
3490 }
3491 /// Checks if the given object is currently in the success state
3492 #[no_mangle]
3493 pub extern "C" fn CResult_COption_HTLCDestinationZDecodeErrorZ_is_ok(o: &CResult_COption_HTLCDestinationZDecodeErrorZ) -> bool {
3494         o.result_ok
3495 }
3496 #[no_mangle]
3497 /// Frees any resources used by the CResult_COption_HTLCDestinationZDecodeErrorZ.
3498 pub extern "C" fn CResult_COption_HTLCDestinationZDecodeErrorZ_free(_res: CResult_COption_HTLCDestinationZDecodeErrorZ) { }
3499 impl Drop for CResult_COption_HTLCDestinationZDecodeErrorZ {
3500         fn drop(&mut self) {
3501                 if self.result_ok {
3502                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
3503                                 let _ = unsafe { Box::from_raw(self.contents.result) };
3504                         }
3505                 } else {
3506                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
3507                                 let _ = unsafe { Box::from_raw(self.contents.err) };
3508                         }
3509                 }
3510         }
3511 }
3512 impl From<crate::c_types::CResultTempl<crate::c_types::derived::COption_HTLCDestinationZ, crate::lightning::ln::msgs::DecodeError>> for CResult_COption_HTLCDestinationZDecodeErrorZ {
3513         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::COption_HTLCDestinationZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
3514                 let contents = if o.result_ok {
3515                         let result = unsafe { o.contents.result };
3516                         unsafe { o.contents.result = core::ptr::null_mut() };
3517                         CResult_COption_HTLCDestinationZDecodeErrorZPtr { result }
3518                 } else {
3519                         let err = unsafe { o.contents.err };
3520                         unsafe { o.contents.err = core::ptr::null_mut(); }
3521                         CResult_COption_HTLCDestinationZDecodeErrorZPtr { err }
3522                 };
3523                 Self {
3524                         contents,
3525                         result_ok: o.result_ok,
3526                 }
3527         }
3528 }
3529 impl Clone for CResult_COption_HTLCDestinationZDecodeErrorZ {
3530         fn clone(&self) -> Self {
3531                 if self.result_ok {
3532                         Self { result_ok: true, contents: CResult_COption_HTLCDestinationZDecodeErrorZPtr {
3533                                 result: Box::into_raw(Box::new(<crate::c_types::derived::COption_HTLCDestinationZ>::clone(unsafe { &*self.contents.result })))
3534                         } }
3535                 } else {
3536                         Self { result_ok: false, contents: CResult_COption_HTLCDestinationZDecodeErrorZPtr {
3537                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
3538                         } }
3539                 }
3540         }
3541 }
3542 #[no_mangle]
3543 /// Creates a new CResult_COption_HTLCDestinationZDecodeErrorZ which has the same data as `orig`
3544 /// but with all dynamically-allocated buffers duplicated in new buffers.
3545 pub extern "C" fn CResult_COption_HTLCDestinationZDecodeErrorZ_clone(orig: &CResult_COption_HTLCDestinationZDecodeErrorZ) -> CResult_COption_HTLCDestinationZDecodeErrorZ { Clone::clone(&orig) }
3546 #[repr(C)]
3547 #[derive(Clone)]
3548 /// An enum which can either contain a crate::lightning::routing::gossip::NetworkUpdate or not
3549 pub enum COption_NetworkUpdateZ {
3550         /// When we're in this state, this COption_NetworkUpdateZ contains a crate::lightning::routing::gossip::NetworkUpdate
3551         Some(crate::lightning::routing::gossip::NetworkUpdate),
3552         /// When we're in this state, this COption_NetworkUpdateZ contains nothing
3553         None
3554 }
3555 impl COption_NetworkUpdateZ {
3556         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
3557                 if let Self::None = self { false } else { true }
3558         }
3559         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
3560                 !self.is_some()
3561         }
3562         #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::routing::gossip::NetworkUpdate {
3563                 if let Self::Some(v) = self { v } else { unreachable!() }
3564         }
3565 }
3566 #[no_mangle]
3567 /// Constructs a new COption_NetworkUpdateZ containing a crate::lightning::routing::gossip::NetworkUpdate
3568 pub extern "C" fn COption_NetworkUpdateZ_some(o: crate::lightning::routing::gossip::NetworkUpdate) -> COption_NetworkUpdateZ {
3569         COption_NetworkUpdateZ::Some(o)
3570 }
3571 #[no_mangle]
3572 /// Constructs a new COption_NetworkUpdateZ containing nothing
3573 pub extern "C" fn COption_NetworkUpdateZ_none() -> COption_NetworkUpdateZ {
3574         COption_NetworkUpdateZ::None
3575 }
3576 #[no_mangle]
3577 /// Frees any resources associated with the crate::lightning::routing::gossip::NetworkUpdate, if we are in the Some state
3578 pub extern "C" fn COption_NetworkUpdateZ_free(_res: COption_NetworkUpdateZ) { }
3579 #[no_mangle]
3580 /// Creates a new COption_NetworkUpdateZ which has the same data as `orig`
3581 /// but with all dynamically-allocated buffers duplicated in new buffers.
3582 pub extern "C" fn COption_NetworkUpdateZ_clone(orig: &COption_NetworkUpdateZ) -> COption_NetworkUpdateZ { Clone::clone(&orig) }
3583 #[repr(C)]
3584 /// A dynamically-allocated array of crate::lightning::chain::keysinterface::SpendableOutputDescriptors of arbitrary size.
3585 /// This corresponds to std::vector in C++
3586 pub struct CVec_SpendableOutputDescriptorZ {
3587         /// The elements in the array.
3588         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3589         pub data: *mut crate::lightning::chain::keysinterface::SpendableOutputDescriptor,
3590         /// The number of elements pointed to by `data`.
3591         pub datalen: usize
3592 }
3593 impl CVec_SpendableOutputDescriptorZ {
3594         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::chain::keysinterface::SpendableOutputDescriptor> {
3595                 if self.datalen == 0 { return Vec::new(); }
3596                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
3597                 self.data = core::ptr::null_mut();
3598                 self.datalen = 0;
3599                 ret
3600         }
3601         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::chain::keysinterface::SpendableOutputDescriptor] {
3602                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
3603         }
3604 }
3605 impl From<Vec<crate::lightning::chain::keysinterface::SpendableOutputDescriptor>> for CVec_SpendableOutputDescriptorZ {
3606         fn from(v: Vec<crate::lightning::chain::keysinterface::SpendableOutputDescriptor>) -> Self {
3607                 let datalen = v.len();
3608                 let data = Box::into_raw(v.into_boxed_slice());
3609                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
3610         }
3611 }
3612 #[no_mangle]
3613 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
3614 pub extern "C" fn CVec_SpendableOutputDescriptorZ_free(_res: CVec_SpendableOutputDescriptorZ) { }
3615 impl Drop for CVec_SpendableOutputDescriptorZ {
3616         fn drop(&mut self) {
3617                 if self.datalen == 0 { return; }
3618                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
3619         }
3620 }
3621 impl Clone for CVec_SpendableOutputDescriptorZ {
3622         fn clone(&self) -> Self {
3623                 let mut res = Vec::new();
3624                 if self.datalen == 0 { return Self::from(res); }
3625                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
3626                 Self::from(res)
3627         }
3628 }
3629 #[repr(C)]
3630 #[derive(Clone)]
3631 /// An enum which can either contain a crate::lightning::util::events::Event or not
3632 pub enum COption_EventZ {
3633         /// When we're in this state, this COption_EventZ contains a crate::lightning::util::events::Event
3634         Some(crate::lightning::util::events::Event),
3635         /// When we're in this state, this COption_EventZ contains nothing
3636         None
3637 }
3638 impl COption_EventZ {
3639         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
3640                 if let Self::None = self { false } else { true }
3641         }
3642         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
3643                 !self.is_some()
3644         }
3645         #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::util::events::Event {
3646                 if let Self::Some(v) = self { v } else { unreachable!() }
3647         }
3648 }
3649 #[no_mangle]
3650 /// Constructs a new COption_EventZ containing a crate::lightning::util::events::Event
3651 pub extern "C" fn COption_EventZ_some(o: crate::lightning::util::events::Event) -> COption_EventZ {
3652         COption_EventZ::Some(o)
3653 }
3654 #[no_mangle]
3655 /// Constructs a new COption_EventZ containing nothing
3656 pub extern "C" fn COption_EventZ_none() -> COption_EventZ {
3657         COption_EventZ::None
3658 }
3659 #[no_mangle]
3660 /// Frees any resources associated with the crate::lightning::util::events::Event, if we are in the Some state
3661 pub extern "C" fn COption_EventZ_free(_res: COption_EventZ) { }
3662 #[no_mangle]
3663 /// Creates a new COption_EventZ which has the same data as `orig`
3664 /// but with all dynamically-allocated buffers duplicated in new buffers.
3665 pub extern "C" fn COption_EventZ_clone(orig: &COption_EventZ) -> COption_EventZ { Clone::clone(&orig) }
3666 #[repr(C)]
3667 /// The contents of CResult_COption_EventZDecodeErrorZ
3668 pub union CResult_COption_EventZDecodeErrorZPtr {
3669         /// A pointer to the contents in the success state.
3670         /// Reading from this pointer when `result_ok` is not set is undefined.
3671         pub result: *mut crate::c_types::derived::COption_EventZ,
3672         /// A pointer to the contents in the error state.
3673         /// Reading from this pointer when `result_ok` is set is undefined.
3674         pub err: *mut crate::lightning::ln::msgs::DecodeError,
3675 }
3676 #[repr(C)]
3677 /// A CResult_COption_EventZDecodeErrorZ represents the result of a fallible operation,
3678 /// containing a crate::c_types::derived::COption_EventZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
3679 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3680 pub struct CResult_COption_EventZDecodeErrorZ {
3681         /// The contents of this CResult_COption_EventZDecodeErrorZ, accessible via either
3682         /// `err` or `result` depending on the state of `result_ok`.
3683         pub contents: CResult_COption_EventZDecodeErrorZPtr,
3684         /// Whether this CResult_COption_EventZDecodeErrorZ represents a success state.
3685         pub result_ok: bool,
3686 }
3687 #[no_mangle]
3688 /// Creates a new CResult_COption_EventZDecodeErrorZ in the success state.
3689 pub extern "C" fn CResult_COption_EventZDecodeErrorZ_ok(o: crate::c_types::derived::COption_EventZ) -> CResult_COption_EventZDecodeErrorZ {
3690         CResult_COption_EventZDecodeErrorZ {
3691                 contents: CResult_COption_EventZDecodeErrorZPtr {
3692                         result: Box::into_raw(Box::new(o)),
3693                 },
3694                 result_ok: true,
3695         }
3696 }
3697 #[no_mangle]
3698 /// Creates a new CResult_COption_EventZDecodeErrorZ in the error state.
3699 pub extern "C" fn CResult_COption_EventZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_EventZDecodeErrorZ {
3700         CResult_COption_EventZDecodeErrorZ {
3701                 contents: CResult_COption_EventZDecodeErrorZPtr {
3702                         err: Box::into_raw(Box::new(e)),
3703                 },
3704                 result_ok: false,
3705         }
3706 }
3707 /// Checks if the given object is currently in the success state
3708 #[no_mangle]
3709 pub extern "C" fn CResult_COption_EventZDecodeErrorZ_is_ok(o: &CResult_COption_EventZDecodeErrorZ) -> bool {
3710         o.result_ok
3711 }
3712 #[no_mangle]
3713 /// Frees any resources used by the CResult_COption_EventZDecodeErrorZ.
3714 pub extern "C" fn CResult_COption_EventZDecodeErrorZ_free(_res: CResult_COption_EventZDecodeErrorZ) { }
3715 impl Drop for CResult_COption_EventZDecodeErrorZ {
3716         fn drop(&mut self) {
3717                 if self.result_ok {
3718                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
3719                                 let _ = unsafe { Box::from_raw(self.contents.result) };
3720                         }
3721                 } else {
3722                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
3723                                 let _ = unsafe { Box::from_raw(self.contents.err) };
3724                         }
3725                 }
3726         }
3727 }
3728 impl From<crate::c_types::CResultTempl<crate::c_types::derived::COption_EventZ, crate::lightning::ln::msgs::DecodeError>> for CResult_COption_EventZDecodeErrorZ {
3729         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::COption_EventZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
3730                 let contents = if o.result_ok {
3731                         let result = unsafe { o.contents.result };
3732                         unsafe { o.contents.result = core::ptr::null_mut() };
3733                         CResult_COption_EventZDecodeErrorZPtr { result }
3734                 } else {
3735                         let err = unsafe { o.contents.err };
3736                         unsafe { o.contents.err = core::ptr::null_mut(); }
3737                         CResult_COption_EventZDecodeErrorZPtr { err }
3738                 };
3739                 Self {
3740                         contents,
3741                         result_ok: o.result_ok,
3742                 }
3743         }
3744 }
3745 impl Clone for CResult_COption_EventZDecodeErrorZ {
3746         fn clone(&self) -> Self {
3747                 if self.result_ok {
3748                         Self { result_ok: true, contents: CResult_COption_EventZDecodeErrorZPtr {
3749                                 result: Box::into_raw(Box::new(<crate::c_types::derived::COption_EventZ>::clone(unsafe { &*self.contents.result })))
3750                         } }
3751                 } else {
3752                         Self { result_ok: false, contents: CResult_COption_EventZDecodeErrorZPtr {
3753                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
3754                         } }
3755                 }
3756         }
3757 }
3758 #[no_mangle]
3759 /// Creates a new CResult_COption_EventZDecodeErrorZ which has the same data as `orig`
3760 /// but with all dynamically-allocated buffers duplicated in new buffers.
3761 pub extern "C" fn CResult_COption_EventZDecodeErrorZ_clone(orig: &CResult_COption_EventZDecodeErrorZ) -> CResult_COption_EventZDecodeErrorZ { Clone::clone(&orig) }
3762 #[repr(C)]
3763 /// A dynamically-allocated array of crate::lightning::util::events::MessageSendEvents of arbitrary size.
3764 /// This corresponds to std::vector in C++
3765 pub struct CVec_MessageSendEventZ {
3766         /// The elements in the array.
3767         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3768         pub data: *mut crate::lightning::util::events::MessageSendEvent,
3769         /// The number of elements pointed to by `data`.
3770         pub datalen: usize
3771 }
3772 impl CVec_MessageSendEventZ {
3773         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::util::events::MessageSendEvent> {
3774                 if self.datalen == 0 { return Vec::new(); }
3775                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
3776                 self.data = core::ptr::null_mut();
3777                 self.datalen = 0;
3778                 ret
3779         }
3780         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::util::events::MessageSendEvent] {
3781                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
3782         }
3783 }
3784 impl From<Vec<crate::lightning::util::events::MessageSendEvent>> for CVec_MessageSendEventZ {
3785         fn from(v: Vec<crate::lightning::util::events::MessageSendEvent>) -> Self {
3786                 let datalen = v.len();
3787                 let data = Box::into_raw(v.into_boxed_slice());
3788                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
3789         }
3790 }
3791 #[no_mangle]
3792 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
3793 pub extern "C" fn CVec_MessageSendEventZ_free(_res: CVec_MessageSendEventZ) { }
3794 impl Drop for CVec_MessageSendEventZ {
3795         fn drop(&mut self) {
3796                 if self.datalen == 0 { return; }
3797                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
3798         }
3799 }
3800 impl Clone for CVec_MessageSendEventZ {
3801         fn clone(&self) -> Self {
3802                 let mut res = Vec::new();
3803                 if self.datalen == 0 { return Self::from(res); }
3804                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
3805                 Self::from(res)
3806         }
3807 }
3808 #[repr(C)]
3809 /// The contents of CResult_TxOutAccessErrorZ
3810 pub union CResult_TxOutAccessErrorZPtr {
3811         /// A pointer to the contents in the success state.
3812         /// Reading from this pointer when `result_ok` is not set is undefined.
3813         pub result: *mut crate::c_types::TxOut,
3814         /// A pointer to the contents in the error state.
3815         /// Reading from this pointer when `result_ok` is set is undefined.
3816         pub err: *mut crate::lightning::chain::AccessError,
3817 }
3818 #[repr(C)]
3819 /// A CResult_TxOutAccessErrorZ represents the result of a fallible operation,
3820 /// containing a crate::c_types::TxOut on success and a crate::lightning::chain::AccessError on failure.
3821 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3822 pub struct CResult_TxOutAccessErrorZ {
3823         /// The contents of this CResult_TxOutAccessErrorZ, accessible via either
3824         /// `err` or `result` depending on the state of `result_ok`.
3825         pub contents: CResult_TxOutAccessErrorZPtr,
3826         /// Whether this CResult_TxOutAccessErrorZ represents a success state.
3827         pub result_ok: bool,
3828 }
3829 #[no_mangle]
3830 /// Creates a new CResult_TxOutAccessErrorZ in the success state.
3831 pub extern "C" fn CResult_TxOutAccessErrorZ_ok(o: crate::c_types::TxOut) -> CResult_TxOutAccessErrorZ {
3832         CResult_TxOutAccessErrorZ {
3833                 contents: CResult_TxOutAccessErrorZPtr {
3834                         result: Box::into_raw(Box::new(o)),
3835                 },
3836                 result_ok: true,
3837         }
3838 }
3839 #[no_mangle]
3840 /// Creates a new CResult_TxOutAccessErrorZ in the error state.
3841 pub extern "C" fn CResult_TxOutAccessErrorZ_err(e: crate::lightning::chain::AccessError) -> CResult_TxOutAccessErrorZ {
3842         CResult_TxOutAccessErrorZ {
3843                 contents: CResult_TxOutAccessErrorZPtr {
3844                         err: Box::into_raw(Box::new(e)),
3845                 },
3846                 result_ok: false,
3847         }
3848 }
3849 /// Checks if the given object is currently in the success state
3850 #[no_mangle]
3851 pub extern "C" fn CResult_TxOutAccessErrorZ_is_ok(o: &CResult_TxOutAccessErrorZ) -> bool {
3852         o.result_ok
3853 }
3854 #[no_mangle]
3855 /// Frees any resources used by the CResult_TxOutAccessErrorZ.
3856 pub extern "C" fn CResult_TxOutAccessErrorZ_free(_res: CResult_TxOutAccessErrorZ) { }
3857 impl Drop for CResult_TxOutAccessErrorZ {
3858         fn drop(&mut self) {
3859                 if self.result_ok {
3860                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
3861                                 let _ = unsafe { Box::from_raw(self.contents.result) };
3862                         }
3863                 } else {
3864                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
3865                                 let _ = unsafe { Box::from_raw(self.contents.err) };
3866                         }
3867                 }
3868         }
3869 }
3870 impl From<crate::c_types::CResultTempl<crate::c_types::TxOut, crate::lightning::chain::AccessError>> for CResult_TxOutAccessErrorZ {
3871         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::TxOut, crate::lightning::chain::AccessError>) -> Self {
3872                 let contents = if o.result_ok {
3873                         let result = unsafe { o.contents.result };
3874                         unsafe { o.contents.result = core::ptr::null_mut() };
3875                         CResult_TxOutAccessErrorZPtr { result }
3876                 } else {
3877                         let err = unsafe { o.contents.err };
3878                         unsafe { o.contents.err = core::ptr::null_mut(); }
3879                         CResult_TxOutAccessErrorZPtr { err }
3880                 };
3881                 Self {
3882                         contents,
3883                         result_ok: o.result_ok,
3884                 }
3885         }
3886 }
3887 impl Clone for CResult_TxOutAccessErrorZ {
3888         fn clone(&self) -> Self {
3889                 if self.result_ok {
3890                         Self { result_ok: true, contents: CResult_TxOutAccessErrorZPtr {
3891                                 result: Box::into_raw(Box::new(<crate::c_types::TxOut>::clone(unsafe { &*self.contents.result })))
3892                         } }
3893                 } else {
3894                         Self { result_ok: false, contents: CResult_TxOutAccessErrorZPtr {
3895                                 err: Box::into_raw(Box::new(<crate::lightning::chain::AccessError>::clone(unsafe { &*self.contents.err })))
3896                         } }
3897                 }
3898         }
3899 }
3900 #[no_mangle]
3901 /// Creates a new CResult_TxOutAccessErrorZ which has the same data as `orig`
3902 /// but with all dynamically-allocated buffers duplicated in new buffers.
3903 pub extern "C" fn CResult_TxOutAccessErrorZ_clone(orig: &CResult_TxOutAccessErrorZ) -> CResult_TxOutAccessErrorZ { Clone::clone(&orig) }
3904 #[repr(C)]
3905 /// A tuple of 2 elements. See the individual fields for the types contained.
3906 pub struct C2Tuple_usizeTransactionZ {
3907         /// The element at position 0
3908         pub a: usize,
3909         /// The element at position 1
3910         pub b: crate::c_types::Transaction,
3911 }
3912 impl From<(usize, crate::c_types::Transaction)> for C2Tuple_usizeTransactionZ {
3913         fn from (tup: (usize, crate::c_types::Transaction)) -> Self {
3914                 Self {
3915                         a: tup.0,
3916                         b: tup.1,
3917                 }
3918         }
3919 }
3920 impl C2Tuple_usizeTransactionZ {
3921         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (usize, crate::c_types::Transaction) {
3922                 (self.a, self.b)
3923         }
3924 }
3925 impl Clone for C2Tuple_usizeTransactionZ {
3926         fn clone(&self) -> Self {
3927                 Self {
3928                         a: Clone::clone(&self.a),
3929                         b: Clone::clone(&self.b),
3930                 }
3931         }
3932 }
3933 #[no_mangle]
3934 /// Creates a new tuple which has the same data as `orig`
3935 /// but with all dynamically-allocated buffers duplicated in new buffers.
3936 pub extern "C" fn C2Tuple_usizeTransactionZ_clone(orig: &C2Tuple_usizeTransactionZ) -> C2Tuple_usizeTransactionZ { Clone::clone(&orig) }
3937 /// Creates a new C2Tuple_usizeTransactionZ from the contained elements.
3938 #[no_mangle]
3939 pub extern "C" fn C2Tuple_usizeTransactionZ_new(a: usize, b: crate::c_types::Transaction) -> C2Tuple_usizeTransactionZ {
3940         C2Tuple_usizeTransactionZ { a, b, }
3941 }
3942
3943 #[no_mangle]
3944 /// Frees any resources used by the C2Tuple_usizeTransactionZ.
3945 pub extern "C" fn C2Tuple_usizeTransactionZ_free(_res: C2Tuple_usizeTransactionZ) { }
3946 #[repr(C)]
3947 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_usizeTransactionZs of arbitrary size.
3948 /// This corresponds to std::vector in C++
3949 pub struct CVec_C2Tuple_usizeTransactionZZ {
3950         /// The elements in the array.
3951         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3952         pub data: *mut crate::c_types::derived::C2Tuple_usizeTransactionZ,
3953         /// The number of elements pointed to by `data`.
3954         pub datalen: usize
3955 }
3956 impl CVec_C2Tuple_usizeTransactionZZ {
3957         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_usizeTransactionZ> {
3958                 if self.datalen == 0 { return Vec::new(); }
3959                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
3960                 self.data = core::ptr::null_mut();
3961                 self.datalen = 0;
3962                 ret
3963         }
3964         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_usizeTransactionZ] {
3965                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
3966         }
3967 }
3968 impl From<Vec<crate::c_types::derived::C2Tuple_usizeTransactionZ>> for CVec_C2Tuple_usizeTransactionZZ {
3969         fn from(v: Vec<crate::c_types::derived::C2Tuple_usizeTransactionZ>) -> Self {
3970                 let datalen = v.len();
3971                 let data = Box::into_raw(v.into_boxed_slice());
3972                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
3973         }
3974 }
3975 #[no_mangle]
3976 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
3977 pub extern "C" fn CVec_C2Tuple_usizeTransactionZZ_free(_res: CVec_C2Tuple_usizeTransactionZZ) { }
3978 impl Drop for CVec_C2Tuple_usizeTransactionZZ {
3979         fn drop(&mut self) {
3980                 if self.datalen == 0 { return; }
3981                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
3982         }
3983 }
3984 impl Clone for CVec_C2Tuple_usizeTransactionZZ {
3985         fn clone(&self) -> Self {
3986                 let mut res = Vec::new();
3987                 if self.datalen == 0 { return Self::from(res); }
3988                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
3989                 Self::from(res)
3990         }
3991 }
3992 #[repr(C)]
3993 /// A dynamically-allocated array of crate::c_types::ThirtyTwoBytess of arbitrary size.
3994 /// This corresponds to std::vector in C++
3995 pub struct CVec_TxidZ {
3996         /// The elements in the array.
3997         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3998         pub data: *mut crate::c_types::ThirtyTwoBytes,
3999         /// The number of elements pointed to by `data`.
4000         pub datalen: usize
4001 }
4002 impl CVec_TxidZ {
4003         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::ThirtyTwoBytes> {
4004                 if self.datalen == 0 { return Vec::new(); }
4005                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
4006                 self.data = core::ptr::null_mut();
4007                 self.datalen = 0;
4008                 ret
4009         }
4010         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::ThirtyTwoBytes] {
4011                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
4012         }
4013 }
4014 impl From<Vec<crate::c_types::ThirtyTwoBytes>> for CVec_TxidZ {
4015         fn from(v: Vec<crate::c_types::ThirtyTwoBytes>) -> Self {
4016                 let datalen = v.len();
4017                 let data = Box::into_raw(v.into_boxed_slice());
4018                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
4019         }
4020 }
4021 #[no_mangle]
4022 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
4023 pub extern "C" fn CVec_TxidZ_free(_res: CVec_TxidZ) { }
4024 impl Drop for CVec_TxidZ {
4025         fn drop(&mut self) {
4026                 if self.datalen == 0 { return; }
4027                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
4028         }
4029 }
4030 impl Clone for CVec_TxidZ {
4031         fn clone(&self) -> Self {
4032                 let mut res = Vec::new();
4033                 if self.datalen == 0 { return Self::from(res); }
4034                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
4035                 Self::from(res)
4036         }
4037 }
4038 #[repr(C)]
4039 /// A dynamically-allocated array of crate::lightning::chain::channelmonitor::MonitorEvents of arbitrary size.
4040 /// This corresponds to std::vector in C++
4041 pub struct CVec_MonitorEventZ {
4042         /// The elements in the array.
4043         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4044         pub data: *mut crate::lightning::chain::channelmonitor::MonitorEvent,
4045         /// The number of elements pointed to by `data`.
4046         pub datalen: usize
4047 }
4048 impl CVec_MonitorEventZ {
4049         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::chain::channelmonitor::MonitorEvent> {
4050                 if self.datalen == 0 { return Vec::new(); }
4051                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
4052                 self.data = core::ptr::null_mut();
4053                 self.datalen = 0;
4054                 ret
4055         }
4056         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::chain::channelmonitor::MonitorEvent] {
4057                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
4058         }
4059 }
4060 impl From<Vec<crate::lightning::chain::channelmonitor::MonitorEvent>> for CVec_MonitorEventZ {
4061         fn from(v: Vec<crate::lightning::chain::channelmonitor::MonitorEvent>) -> Self {
4062                 let datalen = v.len();
4063                 let data = Box::into_raw(v.into_boxed_slice());
4064                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
4065         }
4066 }
4067 #[no_mangle]
4068 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
4069 pub extern "C" fn CVec_MonitorEventZ_free(_res: CVec_MonitorEventZ) { }
4070 impl Drop for CVec_MonitorEventZ {
4071         fn drop(&mut self) {
4072                 if self.datalen == 0 { return; }
4073                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
4074         }
4075 }
4076 impl Clone for CVec_MonitorEventZ {
4077         fn clone(&self) -> Self {
4078                 let mut res = Vec::new();
4079                 if self.datalen == 0 { return Self::from(res); }
4080                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
4081                 Self::from(res)
4082         }
4083 }
4084 #[repr(C)]
4085 /// A tuple of 3 elements. See the individual fields for the types contained.
4086 pub struct C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ {
4087         /// The element at position 0
4088         pub a: crate::lightning::chain::transaction::OutPoint,
4089         /// The element at position 1
4090         pub b: crate::c_types::derived::CVec_MonitorEventZ,
4091         /// The element at position 2
4092         pub c: crate::c_types::PublicKey,
4093 }
4094 impl From<(crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_MonitorEventZ, crate::c_types::PublicKey)> for C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ {
4095         fn from (tup: (crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_MonitorEventZ, crate::c_types::PublicKey)) -> Self {
4096                 Self {
4097                         a: tup.0,
4098                         b: tup.1,
4099                         c: tup.2,
4100                 }
4101         }
4102 }
4103 impl C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ {
4104         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_MonitorEventZ, crate::c_types::PublicKey) {
4105                 (self.a, self.b, self.c)
4106         }
4107 }
4108 impl Clone for C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ {
4109         fn clone(&self) -> Self {
4110                 Self {
4111                         a: Clone::clone(&self.a),
4112                         b: Clone::clone(&self.b),
4113                         c: Clone::clone(&self.c),
4114                 }
4115         }
4116 }
4117 #[no_mangle]
4118 /// Creates a new tuple which has the same data as `orig`
4119 /// but with all dynamically-allocated buffers duplicated in new buffers.
4120 pub extern "C" fn C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_clone(orig: &C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ) -> C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ { Clone::clone(&orig) }
4121 /// Creates a new C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ from the contained elements.
4122 #[no_mangle]
4123 pub extern "C" fn C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_new(a: crate::lightning::chain::transaction::OutPoint, b: crate::c_types::derived::CVec_MonitorEventZ, c: crate::c_types::PublicKey) -> C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ {
4124         C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ { a, b, c, }
4125 }
4126
4127 #[no_mangle]
4128 /// Frees any resources used by the C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ.
4129 pub extern "C" fn C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_free(_res: C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ) { }
4130 #[repr(C)]
4131 /// A dynamically-allocated array of crate::c_types::derived::C3Tuple_OutPointCVec_MonitorEventZPublicKeyZs of arbitrary size.
4132 /// This corresponds to std::vector in C++
4133 pub struct CVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ {
4134         /// The elements in the array.
4135         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4136         pub data: *mut crate::c_types::derived::C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ,
4137         /// The number of elements pointed to by `data`.
4138         pub datalen: usize
4139 }
4140 impl CVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ {
4141         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ> {
4142                 if self.datalen == 0 { return Vec::new(); }
4143                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
4144                 self.data = core::ptr::null_mut();
4145                 self.datalen = 0;
4146                 ret
4147         }
4148         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ] {
4149                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
4150         }
4151 }
4152 impl From<Vec<crate::c_types::derived::C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ>> for CVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ {
4153         fn from(v: Vec<crate::c_types::derived::C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ>) -> Self {
4154                 let datalen = v.len();
4155                 let data = Box::into_raw(v.into_boxed_slice());
4156                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
4157         }
4158 }
4159 #[no_mangle]
4160 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
4161 pub extern "C" fn CVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ_free(_res: CVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ) { }
4162 impl Drop for CVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ {
4163         fn drop(&mut self) {
4164                 if self.datalen == 0 { return; }
4165                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
4166         }
4167 }
4168 impl Clone for CVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ {
4169         fn clone(&self) -> Self {
4170                 let mut res = Vec::new();
4171                 if self.datalen == 0 { return Self::from(res); }
4172                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
4173                 Self::from(res)
4174         }
4175 }
4176 #[repr(C)]
4177 /// The contents of CResult_FixedPenaltyScorerDecodeErrorZ
4178 pub union CResult_FixedPenaltyScorerDecodeErrorZPtr {
4179         /// A pointer to the contents in the success state.
4180         /// Reading from this pointer when `result_ok` is not set is undefined.
4181         pub result: *mut crate::lightning::routing::scoring::FixedPenaltyScorer,
4182         /// A pointer to the contents in the error state.
4183         /// Reading from this pointer when `result_ok` is set is undefined.
4184         pub err: *mut crate::lightning::ln::msgs::DecodeError,
4185 }
4186 #[repr(C)]
4187 /// A CResult_FixedPenaltyScorerDecodeErrorZ represents the result of a fallible operation,
4188 /// containing a crate::lightning::routing::scoring::FixedPenaltyScorer on success and a crate::lightning::ln::msgs::DecodeError on failure.
4189 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4190 pub struct CResult_FixedPenaltyScorerDecodeErrorZ {
4191         /// The contents of this CResult_FixedPenaltyScorerDecodeErrorZ, accessible via either
4192         /// `err` or `result` depending on the state of `result_ok`.
4193         pub contents: CResult_FixedPenaltyScorerDecodeErrorZPtr,
4194         /// Whether this CResult_FixedPenaltyScorerDecodeErrorZ represents a success state.
4195         pub result_ok: bool,
4196 }
4197 #[no_mangle]
4198 /// Creates a new CResult_FixedPenaltyScorerDecodeErrorZ in the success state.
4199 pub extern "C" fn CResult_FixedPenaltyScorerDecodeErrorZ_ok(o: crate::lightning::routing::scoring::FixedPenaltyScorer) -> CResult_FixedPenaltyScorerDecodeErrorZ {
4200         CResult_FixedPenaltyScorerDecodeErrorZ {
4201                 contents: CResult_FixedPenaltyScorerDecodeErrorZPtr {
4202                         result: Box::into_raw(Box::new(o)),
4203                 },
4204                 result_ok: true,
4205         }
4206 }
4207 #[no_mangle]
4208 /// Creates a new CResult_FixedPenaltyScorerDecodeErrorZ in the error state.
4209 pub extern "C" fn CResult_FixedPenaltyScorerDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_FixedPenaltyScorerDecodeErrorZ {
4210         CResult_FixedPenaltyScorerDecodeErrorZ {
4211                 contents: CResult_FixedPenaltyScorerDecodeErrorZPtr {
4212                         err: Box::into_raw(Box::new(e)),
4213                 },
4214                 result_ok: false,
4215         }
4216 }
4217 /// Checks if the given object is currently in the success state
4218 #[no_mangle]
4219 pub extern "C" fn CResult_FixedPenaltyScorerDecodeErrorZ_is_ok(o: &CResult_FixedPenaltyScorerDecodeErrorZ) -> bool {
4220         o.result_ok
4221 }
4222 #[no_mangle]
4223 /// Frees any resources used by the CResult_FixedPenaltyScorerDecodeErrorZ.
4224 pub extern "C" fn CResult_FixedPenaltyScorerDecodeErrorZ_free(_res: CResult_FixedPenaltyScorerDecodeErrorZ) { }
4225 impl Drop for CResult_FixedPenaltyScorerDecodeErrorZ {
4226         fn drop(&mut self) {
4227                 if self.result_ok {
4228                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
4229                                 let _ = unsafe { Box::from_raw(self.contents.result) };
4230                         }
4231                 } else {
4232                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
4233                                 let _ = unsafe { Box::from_raw(self.contents.err) };
4234                         }
4235                 }
4236         }
4237 }
4238 impl From<crate::c_types::CResultTempl<crate::lightning::routing::scoring::FixedPenaltyScorer, crate::lightning::ln::msgs::DecodeError>> for CResult_FixedPenaltyScorerDecodeErrorZ {
4239         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::scoring::FixedPenaltyScorer, crate::lightning::ln::msgs::DecodeError>) -> Self {
4240                 let contents = if o.result_ok {
4241                         let result = unsafe { o.contents.result };
4242                         unsafe { o.contents.result = core::ptr::null_mut() };
4243                         CResult_FixedPenaltyScorerDecodeErrorZPtr { result }
4244                 } else {
4245                         let err = unsafe { o.contents.err };
4246                         unsafe { o.contents.err = core::ptr::null_mut(); }
4247                         CResult_FixedPenaltyScorerDecodeErrorZPtr { err }
4248                 };
4249                 Self {
4250                         contents,
4251                         result_ok: o.result_ok,
4252                 }
4253         }
4254 }
4255 impl Clone for CResult_FixedPenaltyScorerDecodeErrorZ {
4256         fn clone(&self) -> Self {
4257                 if self.result_ok {
4258                         Self { result_ok: true, contents: CResult_FixedPenaltyScorerDecodeErrorZPtr {
4259                                 result: Box::into_raw(Box::new(<crate::lightning::routing::scoring::FixedPenaltyScorer>::clone(unsafe { &*self.contents.result })))
4260                         } }
4261                 } else {
4262                         Self { result_ok: false, contents: CResult_FixedPenaltyScorerDecodeErrorZPtr {
4263                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
4264                         } }
4265                 }
4266         }
4267 }
4268 #[no_mangle]
4269 /// Creates a new CResult_FixedPenaltyScorerDecodeErrorZ which has the same data as `orig`
4270 /// but with all dynamically-allocated buffers duplicated in new buffers.
4271 pub extern "C" fn CResult_FixedPenaltyScorerDecodeErrorZ_clone(orig: &CResult_FixedPenaltyScorerDecodeErrorZ) -> CResult_FixedPenaltyScorerDecodeErrorZ { Clone::clone(&orig) }
4272 #[repr(C)]
4273 /// A tuple of 2 elements. See the individual fields for the types contained.
4274 pub struct C2Tuple_u64u64Z {
4275         /// The element at position 0
4276         pub a: u64,
4277         /// The element at position 1
4278         pub b: u64,
4279 }
4280 impl From<(u64, u64)> for C2Tuple_u64u64Z {
4281         fn from (tup: (u64, u64)) -> Self {
4282                 Self {
4283                         a: tup.0,
4284                         b: tup.1,
4285                 }
4286         }
4287 }
4288 impl C2Tuple_u64u64Z {
4289         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (u64, u64) {
4290                 (self.a, self.b)
4291         }
4292 }
4293 impl Clone for C2Tuple_u64u64Z {
4294         fn clone(&self) -> Self {
4295                 Self {
4296                         a: Clone::clone(&self.a),
4297                         b: Clone::clone(&self.b),
4298                 }
4299         }
4300 }
4301 #[no_mangle]
4302 /// Creates a new tuple which has the same data as `orig`
4303 /// but with all dynamically-allocated buffers duplicated in new buffers.
4304 pub extern "C" fn C2Tuple_u64u64Z_clone(orig: &C2Tuple_u64u64Z) -> C2Tuple_u64u64Z { Clone::clone(&orig) }
4305 /// Creates a new C2Tuple_u64u64Z from the contained elements.
4306 #[no_mangle]
4307 pub extern "C" fn C2Tuple_u64u64Z_new(a: u64, b: u64) -> C2Tuple_u64u64Z {
4308         C2Tuple_u64u64Z { a, b, }
4309 }
4310
4311 #[no_mangle]
4312 /// Frees any resources used by the C2Tuple_u64u64Z.
4313 pub extern "C" fn C2Tuple_u64u64Z_free(_res: C2Tuple_u64u64Z) { }
4314 #[repr(C)]
4315 #[derive(Clone)]
4316 /// An enum which can either contain a crate::c_types::derived::C2Tuple_u64u64Z or not
4317 pub enum COption_C2Tuple_u64u64ZZ {
4318         /// When we're in this state, this COption_C2Tuple_u64u64ZZ contains a crate::c_types::derived::C2Tuple_u64u64Z
4319         Some(crate::c_types::derived::C2Tuple_u64u64Z),
4320         /// When we're in this state, this COption_C2Tuple_u64u64ZZ contains nothing
4321         None
4322 }
4323 impl COption_C2Tuple_u64u64ZZ {
4324         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
4325                 if let Self::None = self { false } else { true }
4326         }
4327         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
4328                 !self.is_some()
4329         }
4330         #[allow(unused)] pub(crate) fn take(mut self) -> crate::c_types::derived::C2Tuple_u64u64Z {
4331                 if let Self::Some(v) = self { v } else { unreachable!() }
4332         }
4333 }
4334 #[no_mangle]
4335 /// Constructs a new COption_C2Tuple_u64u64ZZ containing a crate::c_types::derived::C2Tuple_u64u64Z
4336 pub extern "C" fn COption_C2Tuple_u64u64ZZ_some(o: crate::c_types::derived::C2Tuple_u64u64Z) -> COption_C2Tuple_u64u64ZZ {
4337         COption_C2Tuple_u64u64ZZ::Some(o)
4338 }
4339 #[no_mangle]
4340 /// Constructs a new COption_C2Tuple_u64u64ZZ containing nothing
4341 pub extern "C" fn COption_C2Tuple_u64u64ZZ_none() -> COption_C2Tuple_u64u64ZZ {
4342         COption_C2Tuple_u64u64ZZ::None
4343 }
4344 #[no_mangle]
4345 /// Frees any resources associated with the crate::c_types::derived::C2Tuple_u64u64Z, if we are in the Some state
4346 pub extern "C" fn COption_C2Tuple_u64u64ZZ_free(_res: COption_C2Tuple_u64u64ZZ) { }
4347 #[no_mangle]
4348 /// Creates a new COption_C2Tuple_u64u64ZZ which has the same data as `orig`
4349 /// but with all dynamically-allocated buffers duplicated in new buffers.
4350 pub extern "C" fn COption_C2Tuple_u64u64ZZ_clone(orig: &COption_C2Tuple_u64u64ZZ) -> COption_C2Tuple_u64u64ZZ { Clone::clone(&orig) }
4351 #[repr(C)]
4352 /// A dynamically-allocated array of crate::lightning::routing::gossip::NodeIds of arbitrary size.
4353 /// This corresponds to std::vector in C++
4354 pub struct CVec_NodeIdZ {
4355         /// The elements in the array.
4356         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4357         pub data: *mut crate::lightning::routing::gossip::NodeId,
4358         /// The number of elements pointed to by `data`.
4359         pub datalen: usize
4360 }
4361 impl CVec_NodeIdZ {
4362         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::routing::gossip::NodeId> {
4363                 if self.datalen == 0 { return Vec::new(); }
4364                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
4365                 self.data = core::ptr::null_mut();
4366                 self.datalen = 0;
4367                 ret
4368         }
4369         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::routing::gossip::NodeId] {
4370                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
4371         }
4372 }
4373 impl From<Vec<crate::lightning::routing::gossip::NodeId>> for CVec_NodeIdZ {
4374         fn from(v: Vec<crate::lightning::routing::gossip::NodeId>) -> Self {
4375                 let datalen = v.len();
4376                 let data = Box::into_raw(v.into_boxed_slice());
4377                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
4378         }
4379 }
4380 #[no_mangle]
4381 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
4382 pub extern "C" fn CVec_NodeIdZ_free(_res: CVec_NodeIdZ) { }
4383 impl Drop for CVec_NodeIdZ {
4384         fn drop(&mut self) {
4385                 if self.datalen == 0 { return; }
4386                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
4387         }
4388 }
4389 impl Clone for CVec_NodeIdZ {
4390         fn clone(&self) -> Self {
4391                 let mut res = Vec::new();
4392                 if self.datalen == 0 { return Self::from(res); }
4393                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
4394                 Self::from(res)
4395         }
4396 }
4397 #[repr(C)]
4398 /// The contents of CResult_ProbabilisticScorerDecodeErrorZ
4399 pub union CResult_ProbabilisticScorerDecodeErrorZPtr {
4400         /// A pointer to the contents in the success state.
4401         /// Reading from this pointer when `result_ok` is not set is undefined.
4402         pub result: *mut crate::lightning::routing::scoring::ProbabilisticScorer,
4403         /// A pointer to the contents in the error state.
4404         /// Reading from this pointer when `result_ok` is set is undefined.
4405         pub err: *mut crate::lightning::ln::msgs::DecodeError,
4406 }
4407 #[repr(C)]
4408 /// A CResult_ProbabilisticScorerDecodeErrorZ represents the result of a fallible operation,
4409 /// containing a crate::lightning::routing::scoring::ProbabilisticScorer on success and a crate::lightning::ln::msgs::DecodeError on failure.
4410 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4411 pub struct CResult_ProbabilisticScorerDecodeErrorZ {
4412         /// The contents of this CResult_ProbabilisticScorerDecodeErrorZ, accessible via either
4413         /// `err` or `result` depending on the state of `result_ok`.
4414         pub contents: CResult_ProbabilisticScorerDecodeErrorZPtr,
4415         /// Whether this CResult_ProbabilisticScorerDecodeErrorZ represents a success state.
4416         pub result_ok: bool,
4417 }
4418 #[no_mangle]
4419 /// Creates a new CResult_ProbabilisticScorerDecodeErrorZ in the success state.
4420 pub extern "C" fn CResult_ProbabilisticScorerDecodeErrorZ_ok(o: crate::lightning::routing::scoring::ProbabilisticScorer) -> CResult_ProbabilisticScorerDecodeErrorZ {
4421         CResult_ProbabilisticScorerDecodeErrorZ {
4422                 contents: CResult_ProbabilisticScorerDecodeErrorZPtr {
4423                         result: Box::into_raw(Box::new(o)),
4424                 },
4425                 result_ok: true,
4426         }
4427 }
4428 #[no_mangle]
4429 /// Creates a new CResult_ProbabilisticScorerDecodeErrorZ in the error state.
4430 pub extern "C" fn CResult_ProbabilisticScorerDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ProbabilisticScorerDecodeErrorZ {
4431         CResult_ProbabilisticScorerDecodeErrorZ {
4432                 contents: CResult_ProbabilisticScorerDecodeErrorZPtr {
4433                         err: Box::into_raw(Box::new(e)),
4434                 },
4435                 result_ok: false,
4436         }
4437 }
4438 /// Checks if the given object is currently in the success state
4439 #[no_mangle]
4440 pub extern "C" fn CResult_ProbabilisticScorerDecodeErrorZ_is_ok(o: &CResult_ProbabilisticScorerDecodeErrorZ) -> bool {
4441         o.result_ok
4442 }
4443 #[no_mangle]
4444 /// Frees any resources used by the CResult_ProbabilisticScorerDecodeErrorZ.
4445 pub extern "C" fn CResult_ProbabilisticScorerDecodeErrorZ_free(_res: CResult_ProbabilisticScorerDecodeErrorZ) { }
4446 impl Drop for CResult_ProbabilisticScorerDecodeErrorZ {
4447         fn drop(&mut self) {
4448                 if self.result_ok {
4449                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
4450                                 let _ = unsafe { Box::from_raw(self.contents.result) };
4451                         }
4452                 } else {
4453                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
4454                                 let _ = unsafe { Box::from_raw(self.contents.err) };
4455                         }
4456                 }
4457         }
4458 }
4459 impl From<crate::c_types::CResultTempl<crate::lightning::routing::scoring::ProbabilisticScorer, crate::lightning::ln::msgs::DecodeError>> for CResult_ProbabilisticScorerDecodeErrorZ {
4460         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::scoring::ProbabilisticScorer, crate::lightning::ln::msgs::DecodeError>) -> Self {
4461                 let contents = if o.result_ok {
4462                         let result = unsafe { o.contents.result };
4463                         unsafe { o.contents.result = core::ptr::null_mut() };
4464                         CResult_ProbabilisticScorerDecodeErrorZPtr { result }
4465                 } else {
4466                         let err = unsafe { o.contents.err };
4467                         unsafe { o.contents.err = core::ptr::null_mut(); }
4468                         CResult_ProbabilisticScorerDecodeErrorZPtr { err }
4469                 };
4470                 Self {
4471                         contents,
4472                         result_ok: o.result_ok,
4473                 }
4474         }
4475 }
4476 #[repr(C)]
4477 /// The contents of CResult_InitFeaturesDecodeErrorZ
4478 pub union CResult_InitFeaturesDecodeErrorZPtr {
4479         /// A pointer to the contents in the success state.
4480         /// Reading from this pointer when `result_ok` is not set is undefined.
4481         pub result: *mut crate::lightning::ln::features::InitFeatures,
4482         /// A pointer to the contents in the error state.
4483         /// Reading from this pointer when `result_ok` is set is undefined.
4484         pub err: *mut crate::lightning::ln::msgs::DecodeError,
4485 }
4486 #[repr(C)]
4487 /// A CResult_InitFeaturesDecodeErrorZ represents the result of a fallible operation,
4488 /// containing a crate::lightning::ln::features::InitFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
4489 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4490 pub struct CResult_InitFeaturesDecodeErrorZ {
4491         /// The contents of this CResult_InitFeaturesDecodeErrorZ, accessible via either
4492         /// `err` or `result` depending on the state of `result_ok`.
4493         pub contents: CResult_InitFeaturesDecodeErrorZPtr,
4494         /// Whether this CResult_InitFeaturesDecodeErrorZ represents a success state.
4495         pub result_ok: bool,
4496 }
4497 #[no_mangle]
4498 /// Creates a new CResult_InitFeaturesDecodeErrorZ in the success state.
4499 pub extern "C" fn CResult_InitFeaturesDecodeErrorZ_ok(o: crate::lightning::ln::features::InitFeatures) -> CResult_InitFeaturesDecodeErrorZ {
4500         CResult_InitFeaturesDecodeErrorZ {
4501                 contents: CResult_InitFeaturesDecodeErrorZPtr {
4502                         result: Box::into_raw(Box::new(o)),
4503                 },
4504                 result_ok: true,
4505         }
4506 }
4507 #[no_mangle]
4508 /// Creates a new CResult_InitFeaturesDecodeErrorZ in the error state.
4509 pub extern "C" fn CResult_InitFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_InitFeaturesDecodeErrorZ {
4510         CResult_InitFeaturesDecodeErrorZ {
4511                 contents: CResult_InitFeaturesDecodeErrorZPtr {
4512                         err: Box::into_raw(Box::new(e)),
4513                 },
4514                 result_ok: false,
4515         }
4516 }
4517 /// Checks if the given object is currently in the success state
4518 #[no_mangle]
4519 pub extern "C" fn CResult_InitFeaturesDecodeErrorZ_is_ok(o: &CResult_InitFeaturesDecodeErrorZ) -> bool {
4520         o.result_ok
4521 }
4522 #[no_mangle]
4523 /// Frees any resources used by the CResult_InitFeaturesDecodeErrorZ.
4524 pub extern "C" fn CResult_InitFeaturesDecodeErrorZ_free(_res: CResult_InitFeaturesDecodeErrorZ) { }
4525 impl Drop for CResult_InitFeaturesDecodeErrorZ {
4526         fn drop(&mut self) {
4527                 if self.result_ok {
4528                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
4529                                 let _ = unsafe { Box::from_raw(self.contents.result) };
4530                         }
4531                 } else {
4532                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
4533                                 let _ = unsafe { Box::from_raw(self.contents.err) };
4534                         }
4535                 }
4536         }
4537 }
4538 impl From<crate::c_types::CResultTempl<crate::lightning::ln::features::InitFeatures, crate::lightning::ln::msgs::DecodeError>> for CResult_InitFeaturesDecodeErrorZ {
4539         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::features::InitFeatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
4540                 let contents = if o.result_ok {
4541                         let result = unsafe { o.contents.result };
4542                         unsafe { o.contents.result = core::ptr::null_mut() };
4543                         CResult_InitFeaturesDecodeErrorZPtr { result }
4544                 } else {
4545                         let err = unsafe { o.contents.err };
4546                         unsafe { o.contents.err = core::ptr::null_mut(); }
4547                         CResult_InitFeaturesDecodeErrorZPtr { err }
4548                 };
4549                 Self {
4550                         contents,
4551                         result_ok: o.result_ok,
4552                 }
4553         }
4554 }
4555 impl Clone for CResult_InitFeaturesDecodeErrorZ {
4556         fn clone(&self) -> Self {
4557                 if self.result_ok {
4558                         Self { result_ok: true, contents: CResult_InitFeaturesDecodeErrorZPtr {
4559                                 result: Box::into_raw(Box::new(<crate::lightning::ln::features::InitFeatures>::clone(unsafe { &*self.contents.result })))
4560                         } }
4561                 } else {
4562                         Self { result_ok: false, contents: CResult_InitFeaturesDecodeErrorZPtr {
4563                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
4564                         } }
4565                 }
4566         }
4567 }
4568 #[no_mangle]
4569 /// Creates a new CResult_InitFeaturesDecodeErrorZ which has the same data as `orig`
4570 /// but with all dynamically-allocated buffers duplicated in new buffers.
4571 pub extern "C" fn CResult_InitFeaturesDecodeErrorZ_clone(orig: &CResult_InitFeaturesDecodeErrorZ) -> CResult_InitFeaturesDecodeErrorZ { Clone::clone(&orig) }
4572 #[repr(C)]
4573 /// The contents of CResult_ChannelFeaturesDecodeErrorZ
4574 pub union CResult_ChannelFeaturesDecodeErrorZPtr {
4575         /// A pointer to the contents in the success state.
4576         /// Reading from this pointer when `result_ok` is not set is undefined.
4577         pub result: *mut crate::lightning::ln::features::ChannelFeatures,
4578         /// A pointer to the contents in the error state.
4579         /// Reading from this pointer when `result_ok` is set is undefined.
4580         pub err: *mut crate::lightning::ln::msgs::DecodeError,
4581 }
4582 #[repr(C)]
4583 /// A CResult_ChannelFeaturesDecodeErrorZ represents the result of a fallible operation,
4584 /// containing a crate::lightning::ln::features::ChannelFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
4585 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4586 pub struct CResult_ChannelFeaturesDecodeErrorZ {
4587         /// The contents of this CResult_ChannelFeaturesDecodeErrorZ, accessible via either
4588         /// `err` or `result` depending on the state of `result_ok`.
4589         pub contents: CResult_ChannelFeaturesDecodeErrorZPtr,
4590         /// Whether this CResult_ChannelFeaturesDecodeErrorZ represents a success state.
4591         pub result_ok: bool,
4592 }
4593 #[no_mangle]
4594 /// Creates a new CResult_ChannelFeaturesDecodeErrorZ in the success state.
4595 pub extern "C" fn CResult_ChannelFeaturesDecodeErrorZ_ok(o: crate::lightning::ln::features::ChannelFeatures) -> CResult_ChannelFeaturesDecodeErrorZ {
4596         CResult_ChannelFeaturesDecodeErrorZ {
4597                 contents: CResult_ChannelFeaturesDecodeErrorZPtr {
4598                         result: Box::into_raw(Box::new(o)),
4599                 },
4600                 result_ok: true,
4601         }
4602 }
4603 #[no_mangle]
4604 /// Creates a new CResult_ChannelFeaturesDecodeErrorZ in the error state.
4605 pub extern "C" fn CResult_ChannelFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelFeaturesDecodeErrorZ {
4606         CResult_ChannelFeaturesDecodeErrorZ {
4607                 contents: CResult_ChannelFeaturesDecodeErrorZPtr {
4608                         err: Box::into_raw(Box::new(e)),
4609                 },
4610                 result_ok: false,
4611         }
4612 }
4613 /// Checks if the given object is currently in the success state
4614 #[no_mangle]
4615 pub extern "C" fn CResult_ChannelFeaturesDecodeErrorZ_is_ok(o: &CResult_ChannelFeaturesDecodeErrorZ) -> bool {
4616         o.result_ok
4617 }
4618 #[no_mangle]
4619 /// Frees any resources used by the CResult_ChannelFeaturesDecodeErrorZ.
4620 pub extern "C" fn CResult_ChannelFeaturesDecodeErrorZ_free(_res: CResult_ChannelFeaturesDecodeErrorZ) { }
4621 impl Drop for CResult_ChannelFeaturesDecodeErrorZ {
4622         fn drop(&mut self) {
4623                 if self.result_ok {
4624                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
4625                                 let _ = unsafe { Box::from_raw(self.contents.result) };
4626                         }
4627                 } else {
4628                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
4629                                 let _ = unsafe { Box::from_raw(self.contents.err) };
4630                         }
4631                 }
4632         }
4633 }
4634 impl From<crate::c_types::CResultTempl<crate::lightning::ln::features::ChannelFeatures, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelFeaturesDecodeErrorZ {
4635         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::features::ChannelFeatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
4636                 let contents = if o.result_ok {
4637                         let result = unsafe { o.contents.result };
4638                         unsafe { o.contents.result = core::ptr::null_mut() };
4639                         CResult_ChannelFeaturesDecodeErrorZPtr { result }
4640                 } else {
4641                         let err = unsafe { o.contents.err };
4642                         unsafe { o.contents.err = core::ptr::null_mut(); }
4643                         CResult_ChannelFeaturesDecodeErrorZPtr { err }
4644                 };
4645                 Self {
4646                         contents,
4647                         result_ok: o.result_ok,
4648                 }
4649         }
4650 }
4651 impl Clone for CResult_ChannelFeaturesDecodeErrorZ {
4652         fn clone(&self) -> Self {
4653                 if self.result_ok {
4654                         Self { result_ok: true, contents: CResult_ChannelFeaturesDecodeErrorZPtr {
4655                                 result: Box::into_raw(Box::new(<crate::lightning::ln::features::ChannelFeatures>::clone(unsafe { &*self.contents.result })))
4656                         } }
4657                 } else {
4658                         Self { result_ok: false, contents: CResult_ChannelFeaturesDecodeErrorZPtr {
4659                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
4660                         } }
4661                 }
4662         }
4663 }
4664 #[no_mangle]
4665 /// Creates a new CResult_ChannelFeaturesDecodeErrorZ which has the same data as `orig`
4666 /// but with all dynamically-allocated buffers duplicated in new buffers.
4667 pub extern "C" fn CResult_ChannelFeaturesDecodeErrorZ_clone(orig: &CResult_ChannelFeaturesDecodeErrorZ) -> CResult_ChannelFeaturesDecodeErrorZ { Clone::clone(&orig) }
4668 #[repr(C)]
4669 /// The contents of CResult_NodeFeaturesDecodeErrorZ
4670 pub union CResult_NodeFeaturesDecodeErrorZPtr {
4671         /// A pointer to the contents in the success state.
4672         /// Reading from this pointer when `result_ok` is not set is undefined.
4673         pub result: *mut crate::lightning::ln::features::NodeFeatures,
4674         /// A pointer to the contents in the error state.
4675         /// Reading from this pointer when `result_ok` is set is undefined.
4676         pub err: *mut crate::lightning::ln::msgs::DecodeError,
4677 }
4678 #[repr(C)]
4679 /// A CResult_NodeFeaturesDecodeErrorZ represents the result of a fallible operation,
4680 /// containing a crate::lightning::ln::features::NodeFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
4681 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4682 pub struct CResult_NodeFeaturesDecodeErrorZ {
4683         /// The contents of this CResult_NodeFeaturesDecodeErrorZ, accessible via either
4684         /// `err` or `result` depending on the state of `result_ok`.
4685         pub contents: CResult_NodeFeaturesDecodeErrorZPtr,
4686         /// Whether this CResult_NodeFeaturesDecodeErrorZ represents a success state.
4687         pub result_ok: bool,
4688 }
4689 #[no_mangle]
4690 /// Creates a new CResult_NodeFeaturesDecodeErrorZ in the success state.
4691 pub extern "C" fn CResult_NodeFeaturesDecodeErrorZ_ok(o: crate::lightning::ln::features::NodeFeatures) -> CResult_NodeFeaturesDecodeErrorZ {
4692         CResult_NodeFeaturesDecodeErrorZ {
4693                 contents: CResult_NodeFeaturesDecodeErrorZPtr {
4694                         result: Box::into_raw(Box::new(o)),
4695                 },
4696                 result_ok: true,
4697         }
4698 }
4699 #[no_mangle]
4700 /// Creates a new CResult_NodeFeaturesDecodeErrorZ in the error state.
4701 pub extern "C" fn CResult_NodeFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeFeaturesDecodeErrorZ {
4702         CResult_NodeFeaturesDecodeErrorZ {
4703                 contents: CResult_NodeFeaturesDecodeErrorZPtr {
4704                         err: Box::into_raw(Box::new(e)),
4705                 },
4706                 result_ok: false,
4707         }
4708 }
4709 /// Checks if the given object is currently in the success state
4710 #[no_mangle]
4711 pub extern "C" fn CResult_NodeFeaturesDecodeErrorZ_is_ok(o: &CResult_NodeFeaturesDecodeErrorZ) -> bool {
4712         o.result_ok
4713 }
4714 #[no_mangle]
4715 /// Frees any resources used by the CResult_NodeFeaturesDecodeErrorZ.
4716 pub extern "C" fn CResult_NodeFeaturesDecodeErrorZ_free(_res: CResult_NodeFeaturesDecodeErrorZ) { }
4717 impl Drop for CResult_NodeFeaturesDecodeErrorZ {
4718         fn drop(&mut self) {
4719                 if self.result_ok {
4720                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
4721                                 let _ = unsafe { Box::from_raw(self.contents.result) };
4722                         }
4723                 } else {
4724                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
4725                                 let _ = unsafe { Box::from_raw(self.contents.err) };
4726                         }
4727                 }
4728         }
4729 }
4730 impl From<crate::c_types::CResultTempl<crate::lightning::ln::features::NodeFeatures, crate::lightning::ln::msgs::DecodeError>> for CResult_NodeFeaturesDecodeErrorZ {
4731         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::features::NodeFeatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
4732                 let contents = if o.result_ok {
4733                         let result = unsafe { o.contents.result };
4734                         unsafe { o.contents.result = core::ptr::null_mut() };
4735                         CResult_NodeFeaturesDecodeErrorZPtr { result }
4736                 } else {
4737                         let err = unsafe { o.contents.err };
4738                         unsafe { o.contents.err = core::ptr::null_mut(); }
4739                         CResult_NodeFeaturesDecodeErrorZPtr { err }
4740                 };
4741                 Self {
4742                         contents,
4743                         result_ok: o.result_ok,
4744                 }
4745         }
4746 }
4747 impl Clone for CResult_NodeFeaturesDecodeErrorZ {
4748         fn clone(&self) -> Self {
4749                 if self.result_ok {
4750                         Self { result_ok: true, contents: CResult_NodeFeaturesDecodeErrorZPtr {
4751                                 result: Box::into_raw(Box::new(<crate::lightning::ln::features::NodeFeatures>::clone(unsafe { &*self.contents.result })))
4752                         } }
4753                 } else {
4754                         Self { result_ok: false, contents: CResult_NodeFeaturesDecodeErrorZPtr {
4755                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
4756                         } }
4757                 }
4758         }
4759 }
4760 #[no_mangle]
4761 /// Creates a new CResult_NodeFeaturesDecodeErrorZ which has the same data as `orig`
4762 /// but with all dynamically-allocated buffers duplicated in new buffers.
4763 pub extern "C" fn CResult_NodeFeaturesDecodeErrorZ_clone(orig: &CResult_NodeFeaturesDecodeErrorZ) -> CResult_NodeFeaturesDecodeErrorZ { Clone::clone(&orig) }
4764 #[repr(C)]
4765 /// The contents of CResult_InvoiceFeaturesDecodeErrorZ
4766 pub union CResult_InvoiceFeaturesDecodeErrorZPtr {
4767         /// A pointer to the contents in the success state.
4768         /// Reading from this pointer when `result_ok` is not set is undefined.
4769         pub result: *mut crate::lightning::ln::features::InvoiceFeatures,
4770         /// A pointer to the contents in the error state.
4771         /// Reading from this pointer when `result_ok` is set is undefined.
4772         pub err: *mut crate::lightning::ln::msgs::DecodeError,
4773 }
4774 #[repr(C)]
4775 /// A CResult_InvoiceFeaturesDecodeErrorZ represents the result of a fallible operation,
4776 /// containing a crate::lightning::ln::features::InvoiceFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
4777 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4778 pub struct CResult_InvoiceFeaturesDecodeErrorZ {
4779         /// The contents of this CResult_InvoiceFeaturesDecodeErrorZ, accessible via either
4780         /// `err` or `result` depending on the state of `result_ok`.
4781         pub contents: CResult_InvoiceFeaturesDecodeErrorZPtr,
4782         /// Whether this CResult_InvoiceFeaturesDecodeErrorZ represents a success state.
4783         pub result_ok: bool,
4784 }
4785 #[no_mangle]
4786 /// Creates a new CResult_InvoiceFeaturesDecodeErrorZ in the success state.
4787 pub extern "C" fn CResult_InvoiceFeaturesDecodeErrorZ_ok(o: crate::lightning::ln::features::InvoiceFeatures) -> CResult_InvoiceFeaturesDecodeErrorZ {
4788         CResult_InvoiceFeaturesDecodeErrorZ {
4789                 contents: CResult_InvoiceFeaturesDecodeErrorZPtr {
4790                         result: Box::into_raw(Box::new(o)),
4791                 },
4792                 result_ok: true,
4793         }
4794 }
4795 #[no_mangle]
4796 /// Creates a new CResult_InvoiceFeaturesDecodeErrorZ in the error state.
4797 pub extern "C" fn CResult_InvoiceFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_InvoiceFeaturesDecodeErrorZ {
4798         CResult_InvoiceFeaturesDecodeErrorZ {
4799                 contents: CResult_InvoiceFeaturesDecodeErrorZPtr {
4800                         err: Box::into_raw(Box::new(e)),
4801                 },
4802                 result_ok: false,
4803         }
4804 }
4805 /// Checks if the given object is currently in the success state
4806 #[no_mangle]
4807 pub extern "C" fn CResult_InvoiceFeaturesDecodeErrorZ_is_ok(o: &CResult_InvoiceFeaturesDecodeErrorZ) -> bool {
4808         o.result_ok
4809 }
4810 #[no_mangle]
4811 /// Frees any resources used by the CResult_InvoiceFeaturesDecodeErrorZ.
4812 pub extern "C" fn CResult_InvoiceFeaturesDecodeErrorZ_free(_res: CResult_InvoiceFeaturesDecodeErrorZ) { }
4813 impl Drop for CResult_InvoiceFeaturesDecodeErrorZ {
4814         fn drop(&mut self) {
4815                 if self.result_ok {
4816                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
4817                                 let _ = unsafe { Box::from_raw(self.contents.result) };
4818                         }
4819                 } else {
4820                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
4821                                 let _ = unsafe { Box::from_raw(self.contents.err) };
4822                         }
4823                 }
4824         }
4825 }
4826 impl From<crate::c_types::CResultTempl<crate::lightning::ln::features::InvoiceFeatures, crate::lightning::ln::msgs::DecodeError>> for CResult_InvoiceFeaturesDecodeErrorZ {
4827         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::features::InvoiceFeatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
4828                 let contents = if o.result_ok {
4829                         let result = unsafe { o.contents.result };
4830                         unsafe { o.contents.result = core::ptr::null_mut() };
4831                         CResult_InvoiceFeaturesDecodeErrorZPtr { result }
4832                 } else {
4833                         let err = unsafe { o.contents.err };
4834                         unsafe { o.contents.err = core::ptr::null_mut(); }
4835                         CResult_InvoiceFeaturesDecodeErrorZPtr { err }
4836                 };
4837                 Self {
4838                         contents,
4839                         result_ok: o.result_ok,
4840                 }
4841         }
4842 }
4843 impl Clone for CResult_InvoiceFeaturesDecodeErrorZ {
4844         fn clone(&self) -> Self {
4845                 if self.result_ok {
4846                         Self { result_ok: true, contents: CResult_InvoiceFeaturesDecodeErrorZPtr {
4847                                 result: Box::into_raw(Box::new(<crate::lightning::ln::features::InvoiceFeatures>::clone(unsafe { &*self.contents.result })))
4848                         } }
4849                 } else {
4850                         Self { result_ok: false, contents: CResult_InvoiceFeaturesDecodeErrorZPtr {
4851                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
4852                         } }
4853                 }
4854         }
4855 }
4856 #[no_mangle]
4857 /// Creates a new CResult_InvoiceFeaturesDecodeErrorZ which has the same data as `orig`
4858 /// but with all dynamically-allocated buffers duplicated in new buffers.
4859 pub extern "C" fn CResult_InvoiceFeaturesDecodeErrorZ_clone(orig: &CResult_InvoiceFeaturesDecodeErrorZ) -> CResult_InvoiceFeaturesDecodeErrorZ { Clone::clone(&orig) }
4860 #[repr(C)]
4861 /// The contents of CResult_ChannelTypeFeaturesDecodeErrorZ
4862 pub union CResult_ChannelTypeFeaturesDecodeErrorZPtr {
4863         /// A pointer to the contents in the success state.
4864         /// Reading from this pointer when `result_ok` is not set is undefined.
4865         pub result: *mut crate::lightning::ln::features::ChannelTypeFeatures,
4866         /// A pointer to the contents in the error state.
4867         /// Reading from this pointer when `result_ok` is set is undefined.
4868         pub err: *mut crate::lightning::ln::msgs::DecodeError,
4869 }
4870 #[repr(C)]
4871 /// A CResult_ChannelTypeFeaturesDecodeErrorZ represents the result of a fallible operation,
4872 /// containing a crate::lightning::ln::features::ChannelTypeFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
4873 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4874 pub struct CResult_ChannelTypeFeaturesDecodeErrorZ {
4875         /// The contents of this CResult_ChannelTypeFeaturesDecodeErrorZ, accessible via either
4876         /// `err` or `result` depending on the state of `result_ok`.
4877         pub contents: CResult_ChannelTypeFeaturesDecodeErrorZPtr,
4878         /// Whether this CResult_ChannelTypeFeaturesDecodeErrorZ represents a success state.
4879         pub result_ok: bool,
4880 }
4881 #[no_mangle]
4882 /// Creates a new CResult_ChannelTypeFeaturesDecodeErrorZ in the success state.
4883 pub extern "C" fn CResult_ChannelTypeFeaturesDecodeErrorZ_ok(o: crate::lightning::ln::features::ChannelTypeFeatures) -> CResult_ChannelTypeFeaturesDecodeErrorZ {
4884         CResult_ChannelTypeFeaturesDecodeErrorZ {
4885                 contents: CResult_ChannelTypeFeaturesDecodeErrorZPtr {
4886                         result: Box::into_raw(Box::new(o)),
4887                 },
4888                 result_ok: true,
4889         }
4890 }
4891 #[no_mangle]
4892 /// Creates a new CResult_ChannelTypeFeaturesDecodeErrorZ in the error state.
4893 pub extern "C" fn CResult_ChannelTypeFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelTypeFeaturesDecodeErrorZ {
4894         CResult_ChannelTypeFeaturesDecodeErrorZ {
4895                 contents: CResult_ChannelTypeFeaturesDecodeErrorZPtr {
4896                         err: Box::into_raw(Box::new(e)),
4897                 },
4898                 result_ok: false,
4899         }
4900 }
4901 /// Checks if the given object is currently in the success state
4902 #[no_mangle]
4903 pub extern "C" fn CResult_ChannelTypeFeaturesDecodeErrorZ_is_ok(o: &CResult_ChannelTypeFeaturesDecodeErrorZ) -> bool {
4904         o.result_ok
4905 }
4906 #[no_mangle]
4907 /// Frees any resources used by the CResult_ChannelTypeFeaturesDecodeErrorZ.
4908 pub extern "C" fn CResult_ChannelTypeFeaturesDecodeErrorZ_free(_res: CResult_ChannelTypeFeaturesDecodeErrorZ) { }
4909 impl Drop for CResult_ChannelTypeFeaturesDecodeErrorZ {
4910         fn drop(&mut self) {
4911                 if self.result_ok {
4912                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
4913                                 let _ = unsafe { Box::from_raw(self.contents.result) };
4914                         }
4915                 } else {
4916                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
4917                                 let _ = unsafe { Box::from_raw(self.contents.err) };
4918                         }
4919                 }
4920         }
4921 }
4922 impl From<crate::c_types::CResultTempl<crate::lightning::ln::features::ChannelTypeFeatures, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelTypeFeaturesDecodeErrorZ {
4923         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::features::ChannelTypeFeatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
4924                 let contents = if o.result_ok {
4925                         let result = unsafe { o.contents.result };
4926                         unsafe { o.contents.result = core::ptr::null_mut() };
4927                         CResult_ChannelTypeFeaturesDecodeErrorZPtr { result }
4928                 } else {
4929                         let err = unsafe { o.contents.err };
4930                         unsafe { o.contents.err = core::ptr::null_mut(); }
4931                         CResult_ChannelTypeFeaturesDecodeErrorZPtr { err }
4932                 };
4933                 Self {
4934                         contents,
4935                         result_ok: o.result_ok,
4936                 }
4937         }
4938 }
4939 impl Clone for CResult_ChannelTypeFeaturesDecodeErrorZ {
4940         fn clone(&self) -> Self {
4941                 if self.result_ok {
4942                         Self { result_ok: true, contents: CResult_ChannelTypeFeaturesDecodeErrorZPtr {
4943                                 result: Box::into_raw(Box::new(<crate::lightning::ln::features::ChannelTypeFeatures>::clone(unsafe { &*self.contents.result })))
4944                         } }
4945                 } else {
4946                         Self { result_ok: false, contents: CResult_ChannelTypeFeaturesDecodeErrorZPtr {
4947                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
4948                         } }
4949                 }
4950         }
4951 }
4952 #[no_mangle]
4953 /// Creates a new CResult_ChannelTypeFeaturesDecodeErrorZ which has the same data as `orig`
4954 /// but with all dynamically-allocated buffers duplicated in new buffers.
4955 pub extern "C" fn CResult_ChannelTypeFeaturesDecodeErrorZ_clone(orig: &CResult_ChannelTypeFeaturesDecodeErrorZ) -> CResult_ChannelTypeFeaturesDecodeErrorZ { Clone::clone(&orig) }
4956 #[repr(C)]
4957 /// The contents of CResult_NodeIdDecodeErrorZ
4958 pub union CResult_NodeIdDecodeErrorZPtr {
4959         /// A pointer to the contents in the success state.
4960         /// Reading from this pointer when `result_ok` is not set is undefined.
4961         pub result: *mut crate::lightning::routing::gossip::NodeId,
4962         /// A pointer to the contents in the error state.
4963         /// Reading from this pointer when `result_ok` is set is undefined.
4964         pub err: *mut crate::lightning::ln::msgs::DecodeError,
4965 }
4966 #[repr(C)]
4967 /// A CResult_NodeIdDecodeErrorZ represents the result of a fallible operation,
4968 /// containing a crate::lightning::routing::gossip::NodeId on success and a crate::lightning::ln::msgs::DecodeError on failure.
4969 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4970 pub struct CResult_NodeIdDecodeErrorZ {
4971         /// The contents of this CResult_NodeIdDecodeErrorZ, accessible via either
4972         /// `err` or `result` depending on the state of `result_ok`.
4973         pub contents: CResult_NodeIdDecodeErrorZPtr,
4974         /// Whether this CResult_NodeIdDecodeErrorZ represents a success state.
4975         pub result_ok: bool,
4976 }
4977 #[no_mangle]
4978 /// Creates a new CResult_NodeIdDecodeErrorZ in the success state.
4979 pub extern "C" fn CResult_NodeIdDecodeErrorZ_ok(o: crate::lightning::routing::gossip::NodeId) -> CResult_NodeIdDecodeErrorZ {
4980         CResult_NodeIdDecodeErrorZ {
4981                 contents: CResult_NodeIdDecodeErrorZPtr {
4982                         result: Box::into_raw(Box::new(o)),
4983                 },
4984                 result_ok: true,
4985         }
4986 }
4987 #[no_mangle]
4988 /// Creates a new CResult_NodeIdDecodeErrorZ in the error state.
4989 pub extern "C" fn CResult_NodeIdDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeIdDecodeErrorZ {
4990         CResult_NodeIdDecodeErrorZ {
4991                 contents: CResult_NodeIdDecodeErrorZPtr {
4992                         err: Box::into_raw(Box::new(e)),
4993                 },
4994                 result_ok: false,
4995         }
4996 }
4997 /// Checks if the given object is currently in the success state
4998 #[no_mangle]
4999 pub extern "C" fn CResult_NodeIdDecodeErrorZ_is_ok(o: &CResult_NodeIdDecodeErrorZ) -> bool {
5000         o.result_ok
5001 }
5002 #[no_mangle]
5003 /// Frees any resources used by the CResult_NodeIdDecodeErrorZ.
5004 pub extern "C" fn CResult_NodeIdDecodeErrorZ_free(_res: CResult_NodeIdDecodeErrorZ) { }
5005 impl Drop for CResult_NodeIdDecodeErrorZ {
5006         fn drop(&mut self) {
5007                 if self.result_ok {
5008                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
5009                                 let _ = unsafe { Box::from_raw(self.contents.result) };
5010                         }
5011                 } else {
5012                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
5013                                 let _ = unsafe { Box::from_raw(self.contents.err) };
5014                         }
5015                 }
5016         }
5017 }
5018 impl From<crate::c_types::CResultTempl<crate::lightning::routing::gossip::NodeId, crate::lightning::ln::msgs::DecodeError>> for CResult_NodeIdDecodeErrorZ {
5019         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::gossip::NodeId, crate::lightning::ln::msgs::DecodeError>) -> Self {
5020                 let contents = if o.result_ok {
5021                         let result = unsafe { o.contents.result };
5022                         unsafe { o.contents.result = core::ptr::null_mut() };
5023                         CResult_NodeIdDecodeErrorZPtr { result }
5024                 } else {
5025                         let err = unsafe { o.contents.err };
5026                         unsafe { o.contents.err = core::ptr::null_mut(); }
5027                         CResult_NodeIdDecodeErrorZPtr { err }
5028                 };
5029                 Self {
5030                         contents,
5031                         result_ok: o.result_ok,
5032                 }
5033         }
5034 }
5035 impl Clone for CResult_NodeIdDecodeErrorZ {
5036         fn clone(&self) -> Self {
5037                 if self.result_ok {
5038                         Self { result_ok: true, contents: CResult_NodeIdDecodeErrorZPtr {
5039                                 result: Box::into_raw(Box::new(<crate::lightning::routing::gossip::NodeId>::clone(unsafe { &*self.contents.result })))
5040                         } }
5041                 } else {
5042                         Self { result_ok: false, contents: CResult_NodeIdDecodeErrorZPtr {
5043                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
5044                         } }
5045                 }
5046         }
5047 }
5048 #[no_mangle]
5049 /// Creates a new CResult_NodeIdDecodeErrorZ which has the same data as `orig`
5050 /// but with all dynamically-allocated buffers duplicated in new buffers.
5051 pub extern "C" fn CResult_NodeIdDecodeErrorZ_clone(orig: &CResult_NodeIdDecodeErrorZ) -> CResult_NodeIdDecodeErrorZ { Clone::clone(&orig) }
5052 #[repr(C)]
5053 /// The contents of CResult_COption_NetworkUpdateZDecodeErrorZ
5054 pub union CResult_COption_NetworkUpdateZDecodeErrorZPtr {
5055         /// A pointer to the contents in the success state.
5056         /// Reading from this pointer when `result_ok` is not set is undefined.
5057         pub result: *mut crate::c_types::derived::COption_NetworkUpdateZ,
5058         /// A pointer to the contents in the error state.
5059         /// Reading from this pointer when `result_ok` is set is undefined.
5060         pub err: *mut crate::lightning::ln::msgs::DecodeError,
5061 }
5062 #[repr(C)]
5063 /// A CResult_COption_NetworkUpdateZDecodeErrorZ represents the result of a fallible operation,
5064 /// containing a crate::c_types::derived::COption_NetworkUpdateZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
5065 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5066 pub struct CResult_COption_NetworkUpdateZDecodeErrorZ {
5067         /// The contents of this CResult_COption_NetworkUpdateZDecodeErrorZ, accessible via either
5068         /// `err` or `result` depending on the state of `result_ok`.
5069         pub contents: CResult_COption_NetworkUpdateZDecodeErrorZPtr,
5070         /// Whether this CResult_COption_NetworkUpdateZDecodeErrorZ represents a success state.
5071         pub result_ok: bool,
5072 }
5073 #[no_mangle]
5074 /// Creates a new CResult_COption_NetworkUpdateZDecodeErrorZ in the success state.
5075 pub extern "C" fn CResult_COption_NetworkUpdateZDecodeErrorZ_ok(o: crate::c_types::derived::COption_NetworkUpdateZ) -> CResult_COption_NetworkUpdateZDecodeErrorZ {
5076         CResult_COption_NetworkUpdateZDecodeErrorZ {
5077                 contents: CResult_COption_NetworkUpdateZDecodeErrorZPtr {
5078                         result: Box::into_raw(Box::new(o)),
5079                 },
5080                 result_ok: true,
5081         }
5082 }
5083 #[no_mangle]
5084 /// Creates a new CResult_COption_NetworkUpdateZDecodeErrorZ in the error state.
5085 pub extern "C" fn CResult_COption_NetworkUpdateZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_NetworkUpdateZDecodeErrorZ {
5086         CResult_COption_NetworkUpdateZDecodeErrorZ {
5087                 contents: CResult_COption_NetworkUpdateZDecodeErrorZPtr {
5088                         err: Box::into_raw(Box::new(e)),
5089                 },
5090                 result_ok: false,
5091         }
5092 }
5093 /// Checks if the given object is currently in the success state
5094 #[no_mangle]
5095 pub extern "C" fn CResult_COption_NetworkUpdateZDecodeErrorZ_is_ok(o: &CResult_COption_NetworkUpdateZDecodeErrorZ) -> bool {
5096         o.result_ok
5097 }
5098 #[no_mangle]
5099 /// Frees any resources used by the CResult_COption_NetworkUpdateZDecodeErrorZ.
5100 pub extern "C" fn CResult_COption_NetworkUpdateZDecodeErrorZ_free(_res: CResult_COption_NetworkUpdateZDecodeErrorZ) { }
5101 impl Drop for CResult_COption_NetworkUpdateZDecodeErrorZ {
5102         fn drop(&mut self) {
5103                 if self.result_ok {
5104                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
5105                                 let _ = unsafe { Box::from_raw(self.contents.result) };
5106                         }
5107                 } else {
5108                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
5109                                 let _ = unsafe { Box::from_raw(self.contents.err) };
5110                         }
5111                 }
5112         }
5113 }
5114 impl From<crate::c_types::CResultTempl<crate::c_types::derived::COption_NetworkUpdateZ, crate::lightning::ln::msgs::DecodeError>> for CResult_COption_NetworkUpdateZDecodeErrorZ {
5115         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::COption_NetworkUpdateZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
5116                 let contents = if o.result_ok {
5117                         let result = unsafe { o.contents.result };
5118                         unsafe { o.contents.result = core::ptr::null_mut() };
5119                         CResult_COption_NetworkUpdateZDecodeErrorZPtr { result }
5120                 } else {
5121                         let err = unsafe { o.contents.err };
5122                         unsafe { o.contents.err = core::ptr::null_mut(); }
5123                         CResult_COption_NetworkUpdateZDecodeErrorZPtr { err }
5124                 };
5125                 Self {
5126                         contents,
5127                         result_ok: o.result_ok,
5128                 }
5129         }
5130 }
5131 impl Clone for CResult_COption_NetworkUpdateZDecodeErrorZ {
5132         fn clone(&self) -> Self {
5133                 if self.result_ok {
5134                         Self { result_ok: true, contents: CResult_COption_NetworkUpdateZDecodeErrorZPtr {
5135                                 result: Box::into_raw(Box::new(<crate::c_types::derived::COption_NetworkUpdateZ>::clone(unsafe { &*self.contents.result })))
5136                         } }
5137                 } else {
5138                         Self { result_ok: false, contents: CResult_COption_NetworkUpdateZDecodeErrorZPtr {
5139                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
5140                         } }
5141                 }
5142         }
5143 }
5144 #[no_mangle]
5145 /// Creates a new CResult_COption_NetworkUpdateZDecodeErrorZ which has the same data as `orig`
5146 /// but with all dynamically-allocated buffers duplicated in new buffers.
5147 pub extern "C" fn CResult_COption_NetworkUpdateZDecodeErrorZ_clone(orig: &CResult_COption_NetworkUpdateZDecodeErrorZ) -> CResult_COption_NetworkUpdateZDecodeErrorZ { Clone::clone(&orig) }
5148 #[repr(C)]
5149 /// An enum which can either contain a crate::lightning::chain::Access or not
5150 pub enum COption_AccessZ {
5151         /// When we're in this state, this COption_AccessZ contains a crate::lightning::chain::Access
5152         Some(crate::lightning::chain::Access),
5153         /// When we're in this state, this COption_AccessZ contains nothing
5154         None
5155 }
5156 impl COption_AccessZ {
5157         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
5158                 if let Self::None = self { false } else { true }
5159         }
5160         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
5161                 !self.is_some()
5162         }
5163         #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::chain::Access {
5164                 if let Self::Some(v) = self { v } else { unreachable!() }
5165         }
5166 }
5167 #[no_mangle]
5168 /// Constructs a new COption_AccessZ containing a crate::lightning::chain::Access
5169 pub extern "C" fn COption_AccessZ_some(o: crate::lightning::chain::Access) -> COption_AccessZ {
5170         COption_AccessZ::Some(o)
5171 }
5172 #[no_mangle]
5173 /// Constructs a new COption_AccessZ containing nothing
5174 pub extern "C" fn COption_AccessZ_none() -> COption_AccessZ {
5175         COption_AccessZ::None
5176 }
5177 #[no_mangle]
5178 /// Frees any resources associated with the crate::lightning::chain::Access, if we are in the Some state
5179 pub extern "C" fn COption_AccessZ_free(_res: COption_AccessZ) { }
5180 #[repr(C)]
5181 /// The contents of CResult_boolLightningErrorZ
5182 pub union CResult_boolLightningErrorZPtr {
5183         /// A pointer to the contents in the success state.
5184         /// Reading from this pointer when `result_ok` is not set is undefined.
5185         pub result: *mut bool,
5186         /// A pointer to the contents in the error state.
5187         /// Reading from this pointer when `result_ok` is set is undefined.
5188         pub err: *mut crate::lightning::ln::msgs::LightningError,
5189 }
5190 #[repr(C)]
5191 /// A CResult_boolLightningErrorZ represents the result of a fallible operation,
5192 /// containing a bool on success and a crate::lightning::ln::msgs::LightningError on failure.
5193 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5194 pub struct CResult_boolLightningErrorZ {
5195         /// The contents of this CResult_boolLightningErrorZ, accessible via either
5196         /// `err` or `result` depending on the state of `result_ok`.
5197         pub contents: CResult_boolLightningErrorZPtr,
5198         /// Whether this CResult_boolLightningErrorZ represents a success state.
5199         pub result_ok: bool,
5200 }
5201 #[no_mangle]
5202 /// Creates a new CResult_boolLightningErrorZ in the success state.
5203 pub extern "C" fn CResult_boolLightningErrorZ_ok(o: bool) -> CResult_boolLightningErrorZ {
5204         CResult_boolLightningErrorZ {
5205                 contents: CResult_boolLightningErrorZPtr {
5206                         result: Box::into_raw(Box::new(o)),
5207                 },
5208                 result_ok: true,
5209         }
5210 }
5211 #[no_mangle]
5212 /// Creates a new CResult_boolLightningErrorZ in the error state.
5213 pub extern "C" fn CResult_boolLightningErrorZ_err(e: crate::lightning::ln::msgs::LightningError) -> CResult_boolLightningErrorZ {
5214         CResult_boolLightningErrorZ {
5215                 contents: CResult_boolLightningErrorZPtr {
5216                         err: Box::into_raw(Box::new(e)),
5217                 },
5218                 result_ok: false,
5219         }
5220 }
5221 /// Checks if the given object is currently in the success state
5222 #[no_mangle]
5223 pub extern "C" fn CResult_boolLightningErrorZ_is_ok(o: &CResult_boolLightningErrorZ) -> bool {
5224         o.result_ok
5225 }
5226 #[no_mangle]
5227 /// Frees any resources used by the CResult_boolLightningErrorZ.
5228 pub extern "C" fn CResult_boolLightningErrorZ_free(_res: CResult_boolLightningErrorZ) { }
5229 impl Drop for CResult_boolLightningErrorZ {
5230         fn drop(&mut self) {
5231                 if self.result_ok {
5232                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
5233                                 let _ = unsafe { Box::from_raw(self.contents.result) };
5234                         }
5235                 } else {
5236                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
5237                                 let _ = unsafe { Box::from_raw(self.contents.err) };
5238                         }
5239                 }
5240         }
5241 }
5242 impl From<crate::c_types::CResultTempl<bool, crate::lightning::ln::msgs::LightningError>> for CResult_boolLightningErrorZ {
5243         fn from(mut o: crate::c_types::CResultTempl<bool, crate::lightning::ln::msgs::LightningError>) -> Self {
5244                 let contents = if o.result_ok {
5245                         let result = unsafe { o.contents.result };
5246                         unsafe { o.contents.result = core::ptr::null_mut() };
5247                         CResult_boolLightningErrorZPtr { result }
5248                 } else {
5249                         let err = unsafe { o.contents.err };
5250                         unsafe { o.contents.err = core::ptr::null_mut(); }
5251                         CResult_boolLightningErrorZPtr { err }
5252                 };
5253                 Self {
5254                         contents,
5255                         result_ok: o.result_ok,
5256                 }
5257         }
5258 }
5259 impl Clone for CResult_boolLightningErrorZ {
5260         fn clone(&self) -> Self {
5261                 if self.result_ok {
5262                         Self { result_ok: true, contents: CResult_boolLightningErrorZPtr {
5263                                 result: Box::into_raw(Box::new(<bool>::clone(unsafe { &*self.contents.result })))
5264                         } }
5265                 } else {
5266                         Self { result_ok: false, contents: CResult_boolLightningErrorZPtr {
5267                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::LightningError>::clone(unsafe { &*self.contents.err })))
5268                         } }
5269                 }
5270         }
5271 }
5272 #[no_mangle]
5273 /// Creates a new CResult_boolLightningErrorZ which has the same data as `orig`
5274 /// but with all dynamically-allocated buffers duplicated in new buffers.
5275 pub extern "C" fn CResult_boolLightningErrorZ_clone(orig: &CResult_boolLightningErrorZ) -> CResult_boolLightningErrorZ { Clone::clone(&orig) }
5276 #[repr(C)]
5277 /// A tuple of 3 elements. See the individual fields for the types contained.
5278 pub struct C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
5279         /// The element at position 0
5280         pub a: crate::lightning::ln::msgs::ChannelAnnouncement,
5281         /// The element at position 1
5282         pub b: crate::lightning::ln::msgs::ChannelUpdate,
5283         /// The element at position 2
5284         pub c: crate::lightning::ln::msgs::ChannelUpdate,
5285 }
5286 impl From<(crate::lightning::ln::msgs::ChannelAnnouncement, crate::lightning::ln::msgs::ChannelUpdate, crate::lightning::ln::msgs::ChannelUpdate)> for C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
5287         fn from (tup: (crate::lightning::ln::msgs::ChannelAnnouncement, crate::lightning::ln::msgs::ChannelUpdate, crate::lightning::ln::msgs::ChannelUpdate)) -> Self {
5288                 Self {
5289                         a: tup.0,
5290                         b: tup.1,
5291                         c: tup.2,
5292                 }
5293         }
5294 }
5295 impl C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
5296         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::lightning::ln::msgs::ChannelAnnouncement, crate::lightning::ln::msgs::ChannelUpdate, crate::lightning::ln::msgs::ChannelUpdate) {
5297                 (self.a, self.b, self.c)
5298         }
5299 }
5300 impl Clone for C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
5301         fn clone(&self) -> Self {
5302                 Self {
5303                         a: Clone::clone(&self.a),
5304                         b: Clone::clone(&self.b),
5305                         c: Clone::clone(&self.c),
5306                 }
5307         }
5308 }
5309 #[no_mangle]
5310 /// Creates a new tuple which has the same data as `orig`
5311 /// but with all dynamically-allocated buffers duplicated in new buffers.
5312 pub extern "C" fn C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(orig: &C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ) -> C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ { Clone::clone(&orig) }
5313 /// Creates a new C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ from the contained elements.
5314 #[no_mangle]
5315 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 {
5316         C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ { a, b, c, }
5317 }
5318
5319 #[no_mangle]
5320 /// Frees any resources used by the C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ.
5321 pub extern "C" fn C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free(_res: C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ) { }
5322 #[repr(C)]
5323 #[derive(Clone)]
5324 /// An enum which can either contain a crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ or not
5325 pub enum COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
5326         /// When we're in this state, this COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ contains a crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ
5327         Some(crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ),
5328         /// When we're in this state, this COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ contains nothing
5329         None
5330 }
5331 impl COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
5332         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
5333                 if let Self::None = self { false } else { true }
5334         }
5335         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
5336                 !self.is_some()
5337         }
5338         #[allow(unused)] pub(crate) fn take(mut self) -> crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
5339                 if let Self::Some(v) = self { v } else { unreachable!() }
5340         }
5341 }
5342 #[no_mangle]
5343 /// Constructs a new COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ containing a crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ
5344 pub extern "C" fn COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_some(o: crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ) -> COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
5345         COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ::Some(o)
5346 }
5347 #[no_mangle]
5348 /// Constructs a new COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ containing nothing
5349 pub extern "C" fn COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_none() -> COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
5350         COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ::None
5351 }
5352 #[no_mangle]
5353 /// Frees any resources associated with the crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ, if we are in the Some state
5354 pub extern "C" fn COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free(_res: COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ) { }
5355 #[no_mangle]
5356 /// Creates a new COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ which has the same data as `orig`
5357 /// but with all dynamically-allocated buffers duplicated in new buffers.
5358 pub extern "C" fn COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_clone(orig: &COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ) -> COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ { Clone::clone(&orig) }
5359 #[repr(C)]
5360 /// The contents of CResult_NoneLightningErrorZ
5361 pub union CResult_NoneLightningErrorZPtr {
5362         /// Note that this value is always NULL, as there are no contents in the OK variant
5363         pub result: *mut core::ffi::c_void,
5364         /// A pointer to the contents in the error state.
5365         /// Reading from this pointer when `result_ok` is set is undefined.
5366         pub err: *mut crate::lightning::ln::msgs::LightningError,
5367 }
5368 #[repr(C)]
5369 /// A CResult_NoneLightningErrorZ represents the result of a fallible operation,
5370 /// containing a () on success and a crate::lightning::ln::msgs::LightningError on failure.
5371 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5372 pub struct CResult_NoneLightningErrorZ {
5373         /// The contents of this CResult_NoneLightningErrorZ, accessible via either
5374         /// `err` or `result` depending on the state of `result_ok`.
5375         pub contents: CResult_NoneLightningErrorZPtr,
5376         /// Whether this CResult_NoneLightningErrorZ represents a success state.
5377         pub result_ok: bool,
5378 }
5379 #[no_mangle]
5380 /// Creates a new CResult_NoneLightningErrorZ in the success state.
5381 pub extern "C" fn CResult_NoneLightningErrorZ_ok() -> CResult_NoneLightningErrorZ {
5382         CResult_NoneLightningErrorZ {
5383                 contents: CResult_NoneLightningErrorZPtr {
5384                         result: core::ptr::null_mut(),
5385                 },
5386                 result_ok: true,
5387         }
5388 }
5389 #[no_mangle]
5390 /// Creates a new CResult_NoneLightningErrorZ in the error state.
5391 pub extern "C" fn CResult_NoneLightningErrorZ_err(e: crate::lightning::ln::msgs::LightningError) -> CResult_NoneLightningErrorZ {
5392         CResult_NoneLightningErrorZ {
5393                 contents: CResult_NoneLightningErrorZPtr {
5394                         err: Box::into_raw(Box::new(e)),
5395                 },
5396                 result_ok: false,
5397         }
5398 }
5399 /// Checks if the given object is currently in the success state
5400 #[no_mangle]
5401 pub extern "C" fn CResult_NoneLightningErrorZ_is_ok(o: &CResult_NoneLightningErrorZ) -> bool {
5402         o.result_ok
5403 }
5404 #[no_mangle]
5405 /// Frees any resources used by the CResult_NoneLightningErrorZ.
5406 pub extern "C" fn CResult_NoneLightningErrorZ_free(_res: CResult_NoneLightningErrorZ) { }
5407 impl Drop for CResult_NoneLightningErrorZ {
5408         fn drop(&mut self) {
5409                 if self.result_ok {
5410                 } else {
5411                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
5412                                 let _ = unsafe { Box::from_raw(self.contents.err) };
5413                         }
5414                 }
5415         }
5416 }
5417 impl From<crate::c_types::CResultTempl<(), crate::lightning::ln::msgs::LightningError>> for CResult_NoneLightningErrorZ {
5418         fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::ln::msgs::LightningError>) -> Self {
5419                 let contents = if o.result_ok {
5420                         let _ = unsafe { Box::from_raw(o.contents.result) };
5421                         o.contents.result = core::ptr::null_mut();
5422                         CResult_NoneLightningErrorZPtr { result: core::ptr::null_mut() }
5423                 } else {
5424                         let err = unsafe { o.contents.err };
5425                         unsafe { o.contents.err = core::ptr::null_mut(); }
5426                         CResult_NoneLightningErrorZPtr { err }
5427                 };
5428                 Self {
5429                         contents,
5430                         result_ok: o.result_ok,
5431                 }
5432         }
5433 }
5434 impl Clone for CResult_NoneLightningErrorZ {
5435         fn clone(&self) -> Self {
5436                 if self.result_ok {
5437                         Self { result_ok: true, contents: CResult_NoneLightningErrorZPtr {
5438                                 result: core::ptr::null_mut()
5439                         } }
5440                 } else {
5441                         Self { result_ok: false, contents: CResult_NoneLightningErrorZPtr {
5442                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::LightningError>::clone(unsafe { &*self.contents.err })))
5443                         } }
5444                 }
5445         }
5446 }
5447 #[no_mangle]
5448 /// Creates a new CResult_NoneLightningErrorZ which has the same data as `orig`
5449 /// but with all dynamically-allocated buffers duplicated in new buffers.
5450 pub extern "C" fn CResult_NoneLightningErrorZ_clone(orig: &CResult_NoneLightningErrorZ) -> CResult_NoneLightningErrorZ { Clone::clone(&orig) }
5451 #[repr(C)]
5452 /// The contents of CResult_ChannelUpdateInfoDecodeErrorZ
5453 pub union CResult_ChannelUpdateInfoDecodeErrorZPtr {
5454         /// A pointer to the contents in the success state.
5455         /// Reading from this pointer when `result_ok` is not set is undefined.
5456         pub result: *mut crate::lightning::routing::gossip::ChannelUpdateInfo,
5457         /// A pointer to the contents in the error state.
5458         /// Reading from this pointer when `result_ok` is set is undefined.
5459         pub err: *mut crate::lightning::ln::msgs::DecodeError,
5460 }
5461 #[repr(C)]
5462 /// A CResult_ChannelUpdateInfoDecodeErrorZ represents the result of a fallible operation,
5463 /// containing a crate::lightning::routing::gossip::ChannelUpdateInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
5464 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5465 pub struct CResult_ChannelUpdateInfoDecodeErrorZ {
5466         /// The contents of this CResult_ChannelUpdateInfoDecodeErrorZ, accessible via either
5467         /// `err` or `result` depending on the state of `result_ok`.
5468         pub contents: CResult_ChannelUpdateInfoDecodeErrorZPtr,
5469         /// Whether this CResult_ChannelUpdateInfoDecodeErrorZ represents a success state.
5470         pub result_ok: bool,
5471 }
5472 #[no_mangle]
5473 /// Creates a new CResult_ChannelUpdateInfoDecodeErrorZ in the success state.
5474 pub extern "C" fn CResult_ChannelUpdateInfoDecodeErrorZ_ok(o: crate::lightning::routing::gossip::ChannelUpdateInfo) -> CResult_ChannelUpdateInfoDecodeErrorZ {
5475         CResult_ChannelUpdateInfoDecodeErrorZ {
5476                 contents: CResult_ChannelUpdateInfoDecodeErrorZPtr {
5477                         result: Box::into_raw(Box::new(o)),
5478                 },
5479                 result_ok: true,
5480         }
5481 }
5482 #[no_mangle]
5483 /// Creates a new CResult_ChannelUpdateInfoDecodeErrorZ in the error state.
5484 pub extern "C" fn CResult_ChannelUpdateInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelUpdateInfoDecodeErrorZ {
5485         CResult_ChannelUpdateInfoDecodeErrorZ {
5486                 contents: CResult_ChannelUpdateInfoDecodeErrorZPtr {
5487                         err: Box::into_raw(Box::new(e)),
5488                 },
5489                 result_ok: false,
5490         }
5491 }
5492 /// Checks if the given object is currently in the success state
5493 #[no_mangle]
5494 pub extern "C" fn CResult_ChannelUpdateInfoDecodeErrorZ_is_ok(o: &CResult_ChannelUpdateInfoDecodeErrorZ) -> bool {
5495         o.result_ok
5496 }
5497 #[no_mangle]
5498 /// Frees any resources used by the CResult_ChannelUpdateInfoDecodeErrorZ.
5499 pub extern "C" fn CResult_ChannelUpdateInfoDecodeErrorZ_free(_res: CResult_ChannelUpdateInfoDecodeErrorZ) { }
5500 impl Drop for CResult_ChannelUpdateInfoDecodeErrorZ {
5501         fn drop(&mut self) {
5502                 if self.result_ok {
5503                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
5504                                 let _ = unsafe { Box::from_raw(self.contents.result) };
5505                         }
5506                 } else {
5507                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
5508                                 let _ = unsafe { Box::from_raw(self.contents.err) };
5509                         }
5510                 }
5511         }
5512 }
5513 impl From<crate::c_types::CResultTempl<crate::lightning::routing::gossip::ChannelUpdateInfo, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelUpdateInfoDecodeErrorZ {
5514         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::gossip::ChannelUpdateInfo, crate::lightning::ln::msgs::DecodeError>) -> Self {
5515                 let contents = if o.result_ok {
5516                         let result = unsafe { o.contents.result };
5517                         unsafe { o.contents.result = core::ptr::null_mut() };
5518                         CResult_ChannelUpdateInfoDecodeErrorZPtr { result }
5519                 } else {
5520                         let err = unsafe { o.contents.err };
5521                         unsafe { o.contents.err = core::ptr::null_mut(); }
5522                         CResult_ChannelUpdateInfoDecodeErrorZPtr { err }
5523                 };
5524                 Self {
5525                         contents,
5526                         result_ok: o.result_ok,
5527                 }
5528         }
5529 }
5530 impl Clone for CResult_ChannelUpdateInfoDecodeErrorZ {
5531         fn clone(&self) -> Self {
5532                 if self.result_ok {
5533                         Self { result_ok: true, contents: CResult_ChannelUpdateInfoDecodeErrorZPtr {
5534                                 result: Box::into_raw(Box::new(<crate::lightning::routing::gossip::ChannelUpdateInfo>::clone(unsafe { &*self.contents.result })))
5535                         } }
5536                 } else {
5537                         Self { result_ok: false, contents: CResult_ChannelUpdateInfoDecodeErrorZPtr {
5538                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
5539                         } }
5540                 }
5541         }
5542 }
5543 #[no_mangle]
5544 /// Creates a new CResult_ChannelUpdateInfoDecodeErrorZ which has the same data as `orig`
5545 /// but with all dynamically-allocated buffers duplicated in new buffers.
5546 pub extern "C" fn CResult_ChannelUpdateInfoDecodeErrorZ_clone(orig: &CResult_ChannelUpdateInfoDecodeErrorZ) -> CResult_ChannelUpdateInfoDecodeErrorZ { Clone::clone(&orig) }
5547 #[repr(C)]
5548 /// The contents of CResult_ChannelInfoDecodeErrorZ
5549 pub union CResult_ChannelInfoDecodeErrorZPtr {
5550         /// A pointer to the contents in the success state.
5551         /// Reading from this pointer when `result_ok` is not set is undefined.
5552         pub result: *mut crate::lightning::routing::gossip::ChannelInfo,
5553         /// A pointer to the contents in the error state.
5554         /// Reading from this pointer when `result_ok` is set is undefined.
5555         pub err: *mut crate::lightning::ln::msgs::DecodeError,
5556 }
5557 #[repr(C)]
5558 /// A CResult_ChannelInfoDecodeErrorZ represents the result of a fallible operation,
5559 /// containing a crate::lightning::routing::gossip::ChannelInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
5560 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5561 pub struct CResult_ChannelInfoDecodeErrorZ {
5562         /// The contents of this CResult_ChannelInfoDecodeErrorZ, accessible via either
5563         /// `err` or `result` depending on the state of `result_ok`.
5564         pub contents: CResult_ChannelInfoDecodeErrorZPtr,
5565         /// Whether this CResult_ChannelInfoDecodeErrorZ represents a success state.
5566         pub result_ok: bool,
5567 }
5568 #[no_mangle]
5569 /// Creates a new CResult_ChannelInfoDecodeErrorZ in the success state.
5570 pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_ok(o: crate::lightning::routing::gossip::ChannelInfo) -> CResult_ChannelInfoDecodeErrorZ {
5571         CResult_ChannelInfoDecodeErrorZ {
5572                 contents: CResult_ChannelInfoDecodeErrorZPtr {
5573                         result: Box::into_raw(Box::new(o)),
5574                 },
5575                 result_ok: true,
5576         }
5577 }
5578 #[no_mangle]
5579 /// Creates a new CResult_ChannelInfoDecodeErrorZ in the error state.
5580 pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelInfoDecodeErrorZ {
5581         CResult_ChannelInfoDecodeErrorZ {
5582                 contents: CResult_ChannelInfoDecodeErrorZPtr {
5583                         err: Box::into_raw(Box::new(e)),
5584                 },
5585                 result_ok: false,
5586         }
5587 }
5588 /// Checks if the given object is currently in the success state
5589 #[no_mangle]
5590 pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_is_ok(o: &CResult_ChannelInfoDecodeErrorZ) -> bool {
5591         o.result_ok
5592 }
5593 #[no_mangle]
5594 /// Frees any resources used by the CResult_ChannelInfoDecodeErrorZ.
5595 pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_free(_res: CResult_ChannelInfoDecodeErrorZ) { }
5596 impl Drop for CResult_ChannelInfoDecodeErrorZ {
5597         fn drop(&mut self) {
5598                 if self.result_ok {
5599                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
5600                                 let _ = unsafe { Box::from_raw(self.contents.result) };
5601                         }
5602                 } else {
5603                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
5604                                 let _ = unsafe { Box::from_raw(self.contents.err) };
5605                         }
5606                 }
5607         }
5608 }
5609 impl From<crate::c_types::CResultTempl<crate::lightning::routing::gossip::ChannelInfo, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelInfoDecodeErrorZ {
5610         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::gossip::ChannelInfo, crate::lightning::ln::msgs::DecodeError>) -> Self {
5611                 let contents = if o.result_ok {
5612                         let result = unsafe { o.contents.result };
5613                         unsafe { o.contents.result = core::ptr::null_mut() };
5614                         CResult_ChannelInfoDecodeErrorZPtr { result }
5615                 } else {
5616                         let err = unsafe { o.contents.err };
5617                         unsafe { o.contents.err = core::ptr::null_mut(); }
5618                         CResult_ChannelInfoDecodeErrorZPtr { err }
5619                 };
5620                 Self {
5621                         contents,
5622                         result_ok: o.result_ok,
5623                 }
5624         }
5625 }
5626 impl Clone for CResult_ChannelInfoDecodeErrorZ {
5627         fn clone(&self) -> Self {
5628                 if self.result_ok {
5629                         Self { result_ok: true, contents: CResult_ChannelInfoDecodeErrorZPtr {
5630                                 result: Box::into_raw(Box::new(<crate::lightning::routing::gossip::ChannelInfo>::clone(unsafe { &*self.contents.result })))
5631                         } }
5632                 } else {
5633                         Self { result_ok: false, contents: CResult_ChannelInfoDecodeErrorZPtr {
5634                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
5635                         } }
5636                 }
5637         }
5638 }
5639 #[no_mangle]
5640 /// Creates a new CResult_ChannelInfoDecodeErrorZ which has the same data as `orig`
5641 /// but with all dynamically-allocated buffers duplicated in new buffers.
5642 pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_clone(orig: &CResult_ChannelInfoDecodeErrorZ) -> CResult_ChannelInfoDecodeErrorZ { Clone::clone(&orig) }
5643 #[repr(C)]
5644 /// The contents of CResult_RoutingFeesDecodeErrorZ
5645 pub union CResult_RoutingFeesDecodeErrorZPtr {
5646         /// A pointer to the contents in the success state.
5647         /// Reading from this pointer when `result_ok` is not set is undefined.
5648         pub result: *mut crate::lightning::routing::gossip::RoutingFees,
5649         /// A pointer to the contents in the error state.
5650         /// Reading from this pointer when `result_ok` is set is undefined.
5651         pub err: *mut crate::lightning::ln::msgs::DecodeError,
5652 }
5653 #[repr(C)]
5654 /// A CResult_RoutingFeesDecodeErrorZ represents the result of a fallible operation,
5655 /// containing a crate::lightning::routing::gossip::RoutingFees on success and a crate::lightning::ln::msgs::DecodeError on failure.
5656 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5657 pub struct CResult_RoutingFeesDecodeErrorZ {
5658         /// The contents of this CResult_RoutingFeesDecodeErrorZ, accessible via either
5659         /// `err` or `result` depending on the state of `result_ok`.
5660         pub contents: CResult_RoutingFeesDecodeErrorZPtr,
5661         /// Whether this CResult_RoutingFeesDecodeErrorZ represents a success state.
5662         pub result_ok: bool,
5663 }
5664 #[no_mangle]
5665 /// Creates a new CResult_RoutingFeesDecodeErrorZ in the success state.
5666 pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_ok(o: crate::lightning::routing::gossip::RoutingFees) -> CResult_RoutingFeesDecodeErrorZ {
5667         CResult_RoutingFeesDecodeErrorZ {
5668                 contents: CResult_RoutingFeesDecodeErrorZPtr {
5669                         result: Box::into_raw(Box::new(o)),
5670                 },
5671                 result_ok: true,
5672         }
5673 }
5674 #[no_mangle]
5675 /// Creates a new CResult_RoutingFeesDecodeErrorZ in the error state.
5676 pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RoutingFeesDecodeErrorZ {
5677         CResult_RoutingFeesDecodeErrorZ {
5678                 contents: CResult_RoutingFeesDecodeErrorZPtr {
5679                         err: Box::into_raw(Box::new(e)),
5680                 },
5681                 result_ok: false,
5682         }
5683 }
5684 /// Checks if the given object is currently in the success state
5685 #[no_mangle]
5686 pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_is_ok(o: &CResult_RoutingFeesDecodeErrorZ) -> bool {
5687         o.result_ok
5688 }
5689 #[no_mangle]
5690 /// Frees any resources used by the CResult_RoutingFeesDecodeErrorZ.
5691 pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_free(_res: CResult_RoutingFeesDecodeErrorZ) { }
5692 impl Drop for CResult_RoutingFeesDecodeErrorZ {
5693         fn drop(&mut self) {
5694                 if self.result_ok {
5695                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
5696                                 let _ = unsafe { Box::from_raw(self.contents.result) };
5697                         }
5698                 } else {
5699                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
5700                                 let _ = unsafe { Box::from_raw(self.contents.err) };
5701                         }
5702                 }
5703         }
5704 }
5705 impl From<crate::c_types::CResultTempl<crate::lightning::routing::gossip::RoutingFees, crate::lightning::ln::msgs::DecodeError>> for CResult_RoutingFeesDecodeErrorZ {
5706         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::gossip::RoutingFees, crate::lightning::ln::msgs::DecodeError>) -> Self {
5707                 let contents = if o.result_ok {
5708                         let result = unsafe { o.contents.result };
5709                         unsafe { o.contents.result = core::ptr::null_mut() };
5710                         CResult_RoutingFeesDecodeErrorZPtr { result }
5711                 } else {
5712                         let err = unsafe { o.contents.err };
5713                         unsafe { o.contents.err = core::ptr::null_mut(); }
5714                         CResult_RoutingFeesDecodeErrorZPtr { err }
5715                 };
5716                 Self {
5717                         contents,
5718                         result_ok: o.result_ok,
5719                 }
5720         }
5721 }
5722 impl Clone for CResult_RoutingFeesDecodeErrorZ {
5723         fn clone(&self) -> Self {
5724                 if self.result_ok {
5725                         Self { result_ok: true, contents: CResult_RoutingFeesDecodeErrorZPtr {
5726                                 result: Box::into_raw(Box::new(<crate::lightning::routing::gossip::RoutingFees>::clone(unsafe { &*self.contents.result })))
5727                         } }
5728                 } else {
5729                         Self { result_ok: false, contents: CResult_RoutingFeesDecodeErrorZPtr {
5730                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
5731                         } }
5732                 }
5733         }
5734 }
5735 #[no_mangle]
5736 /// Creates a new CResult_RoutingFeesDecodeErrorZ which has the same data as `orig`
5737 /// but with all dynamically-allocated buffers duplicated in new buffers.
5738 pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_clone(orig: &CResult_RoutingFeesDecodeErrorZ) -> CResult_RoutingFeesDecodeErrorZ { Clone::clone(&orig) }
5739 #[repr(C)]
5740 /// A dynamically-allocated array of crate::lightning::ln::msgs::NetAddresss of arbitrary size.
5741 /// This corresponds to std::vector in C++
5742 pub struct CVec_NetAddressZ {
5743         /// The elements in the array.
5744         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
5745         pub data: *mut crate::lightning::ln::msgs::NetAddress,
5746         /// The number of elements pointed to by `data`.
5747         pub datalen: usize
5748 }
5749 impl CVec_NetAddressZ {
5750         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::NetAddress> {
5751                 if self.datalen == 0 { return Vec::new(); }
5752                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
5753                 self.data = core::ptr::null_mut();
5754                 self.datalen = 0;
5755                 ret
5756         }
5757         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::NetAddress] {
5758                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
5759         }
5760 }
5761 impl From<Vec<crate::lightning::ln::msgs::NetAddress>> for CVec_NetAddressZ {
5762         fn from(v: Vec<crate::lightning::ln::msgs::NetAddress>) -> Self {
5763                 let datalen = v.len();
5764                 let data = Box::into_raw(v.into_boxed_slice());
5765                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
5766         }
5767 }
5768 #[no_mangle]
5769 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
5770 pub extern "C" fn CVec_NetAddressZ_free(_res: CVec_NetAddressZ) { }
5771 impl Drop for CVec_NetAddressZ {
5772         fn drop(&mut self) {
5773                 if self.datalen == 0 { return; }
5774                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
5775         }
5776 }
5777 impl Clone for CVec_NetAddressZ {
5778         fn clone(&self) -> Self {
5779                 let mut res = Vec::new();
5780                 if self.datalen == 0 { return Self::from(res); }
5781                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
5782                 Self::from(res)
5783         }
5784 }
5785 #[repr(C)]
5786 /// The contents of CResult_NodeAnnouncementInfoDecodeErrorZ
5787 pub union CResult_NodeAnnouncementInfoDecodeErrorZPtr {
5788         /// A pointer to the contents in the success state.
5789         /// Reading from this pointer when `result_ok` is not set is undefined.
5790         pub result: *mut crate::lightning::routing::gossip::NodeAnnouncementInfo,
5791         /// A pointer to the contents in the error state.
5792         /// Reading from this pointer when `result_ok` is set is undefined.
5793         pub err: *mut crate::lightning::ln::msgs::DecodeError,
5794 }
5795 #[repr(C)]
5796 /// A CResult_NodeAnnouncementInfoDecodeErrorZ represents the result of a fallible operation,
5797 /// containing a crate::lightning::routing::gossip::NodeAnnouncementInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
5798 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5799 pub struct CResult_NodeAnnouncementInfoDecodeErrorZ {
5800         /// The contents of this CResult_NodeAnnouncementInfoDecodeErrorZ, accessible via either
5801         /// `err` or `result` depending on the state of `result_ok`.
5802         pub contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr,
5803         /// Whether this CResult_NodeAnnouncementInfoDecodeErrorZ represents a success state.
5804         pub result_ok: bool,
5805 }
5806 #[no_mangle]
5807 /// Creates a new CResult_NodeAnnouncementInfoDecodeErrorZ in the success state.
5808 pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_ok(o: crate::lightning::routing::gossip::NodeAnnouncementInfo) -> CResult_NodeAnnouncementInfoDecodeErrorZ {
5809         CResult_NodeAnnouncementInfoDecodeErrorZ {
5810                 contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr {
5811                         result: Box::into_raw(Box::new(o)),
5812                 },
5813                 result_ok: true,
5814         }
5815 }
5816 #[no_mangle]
5817 /// Creates a new CResult_NodeAnnouncementInfoDecodeErrorZ in the error state.
5818 pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeAnnouncementInfoDecodeErrorZ {
5819         CResult_NodeAnnouncementInfoDecodeErrorZ {
5820                 contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr {
5821                         err: Box::into_raw(Box::new(e)),
5822                 },
5823                 result_ok: false,
5824         }
5825 }
5826 /// Checks if the given object is currently in the success state
5827 #[no_mangle]
5828 pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_is_ok(o: &CResult_NodeAnnouncementInfoDecodeErrorZ) -> bool {
5829         o.result_ok
5830 }
5831 #[no_mangle]
5832 /// Frees any resources used by the CResult_NodeAnnouncementInfoDecodeErrorZ.
5833 pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_free(_res: CResult_NodeAnnouncementInfoDecodeErrorZ) { }
5834 impl Drop for CResult_NodeAnnouncementInfoDecodeErrorZ {
5835         fn drop(&mut self) {
5836                 if self.result_ok {
5837                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
5838                                 let _ = unsafe { Box::from_raw(self.contents.result) };
5839                         }
5840                 } else {
5841                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
5842                                 let _ = unsafe { Box::from_raw(self.contents.err) };
5843                         }
5844                 }
5845         }
5846 }
5847 impl From<crate::c_types::CResultTempl<crate::lightning::routing::gossip::NodeAnnouncementInfo, crate::lightning::ln::msgs::DecodeError>> for CResult_NodeAnnouncementInfoDecodeErrorZ {
5848         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::gossip::NodeAnnouncementInfo, crate::lightning::ln::msgs::DecodeError>) -> Self {
5849                 let contents = if o.result_ok {
5850                         let result = unsafe { o.contents.result };
5851                         unsafe { o.contents.result = core::ptr::null_mut() };
5852                         CResult_NodeAnnouncementInfoDecodeErrorZPtr { result }
5853                 } else {
5854                         let err = unsafe { o.contents.err };
5855                         unsafe { o.contents.err = core::ptr::null_mut(); }
5856                         CResult_NodeAnnouncementInfoDecodeErrorZPtr { err }
5857                 };
5858                 Self {
5859                         contents,
5860                         result_ok: o.result_ok,
5861                 }
5862         }
5863 }
5864 impl Clone for CResult_NodeAnnouncementInfoDecodeErrorZ {
5865         fn clone(&self) -> Self {
5866                 if self.result_ok {
5867                         Self { result_ok: true, contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr {
5868                                 result: Box::into_raw(Box::new(<crate::lightning::routing::gossip::NodeAnnouncementInfo>::clone(unsafe { &*self.contents.result })))
5869                         } }
5870                 } else {
5871                         Self { result_ok: false, contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr {
5872                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
5873                         } }
5874                 }
5875         }
5876 }
5877 #[no_mangle]
5878 /// Creates a new CResult_NodeAnnouncementInfoDecodeErrorZ which has the same data as `orig`
5879 /// but with all dynamically-allocated buffers duplicated in new buffers.
5880 pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_clone(orig: &CResult_NodeAnnouncementInfoDecodeErrorZ) -> CResult_NodeAnnouncementInfoDecodeErrorZ { Clone::clone(&orig) }
5881 #[repr(C)]
5882 /// The contents of CResult_NodeAliasDecodeErrorZ
5883 pub union CResult_NodeAliasDecodeErrorZPtr {
5884         /// A pointer to the contents in the success state.
5885         /// Reading from this pointer when `result_ok` is not set is undefined.
5886         pub result: *mut crate::lightning::routing::gossip::NodeAlias,
5887         /// A pointer to the contents in the error state.
5888         /// Reading from this pointer when `result_ok` is set is undefined.
5889         pub err: *mut crate::lightning::ln::msgs::DecodeError,
5890 }
5891 #[repr(C)]
5892 /// A CResult_NodeAliasDecodeErrorZ represents the result of a fallible operation,
5893 /// containing a crate::lightning::routing::gossip::NodeAlias on success and a crate::lightning::ln::msgs::DecodeError on failure.
5894 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5895 pub struct CResult_NodeAliasDecodeErrorZ {
5896         /// The contents of this CResult_NodeAliasDecodeErrorZ, accessible via either
5897         /// `err` or `result` depending on the state of `result_ok`.
5898         pub contents: CResult_NodeAliasDecodeErrorZPtr,
5899         /// Whether this CResult_NodeAliasDecodeErrorZ represents a success state.
5900         pub result_ok: bool,
5901 }
5902 #[no_mangle]
5903 /// Creates a new CResult_NodeAliasDecodeErrorZ in the success state.
5904 pub extern "C" fn CResult_NodeAliasDecodeErrorZ_ok(o: crate::lightning::routing::gossip::NodeAlias) -> CResult_NodeAliasDecodeErrorZ {
5905         CResult_NodeAliasDecodeErrorZ {
5906                 contents: CResult_NodeAliasDecodeErrorZPtr {
5907                         result: Box::into_raw(Box::new(o)),
5908                 },
5909                 result_ok: true,
5910         }
5911 }
5912 #[no_mangle]
5913 /// Creates a new CResult_NodeAliasDecodeErrorZ in the error state.
5914 pub extern "C" fn CResult_NodeAliasDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeAliasDecodeErrorZ {
5915         CResult_NodeAliasDecodeErrorZ {
5916                 contents: CResult_NodeAliasDecodeErrorZPtr {
5917                         err: Box::into_raw(Box::new(e)),
5918                 },
5919                 result_ok: false,
5920         }
5921 }
5922 /// Checks if the given object is currently in the success state
5923 #[no_mangle]
5924 pub extern "C" fn CResult_NodeAliasDecodeErrorZ_is_ok(o: &CResult_NodeAliasDecodeErrorZ) -> bool {
5925         o.result_ok
5926 }
5927 #[no_mangle]
5928 /// Frees any resources used by the CResult_NodeAliasDecodeErrorZ.
5929 pub extern "C" fn CResult_NodeAliasDecodeErrorZ_free(_res: CResult_NodeAliasDecodeErrorZ) { }
5930 impl Drop for CResult_NodeAliasDecodeErrorZ {
5931         fn drop(&mut self) {
5932                 if self.result_ok {
5933                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
5934                                 let _ = unsafe { Box::from_raw(self.contents.result) };
5935                         }
5936                 } else {
5937                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
5938                                 let _ = unsafe { Box::from_raw(self.contents.err) };
5939                         }
5940                 }
5941         }
5942 }
5943 impl From<crate::c_types::CResultTempl<crate::lightning::routing::gossip::NodeAlias, crate::lightning::ln::msgs::DecodeError>> for CResult_NodeAliasDecodeErrorZ {
5944         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::gossip::NodeAlias, crate::lightning::ln::msgs::DecodeError>) -> Self {
5945                 let contents = if o.result_ok {
5946                         let result = unsafe { o.contents.result };
5947                         unsafe { o.contents.result = core::ptr::null_mut() };
5948                         CResult_NodeAliasDecodeErrorZPtr { result }
5949                 } else {
5950                         let err = unsafe { o.contents.err };
5951                         unsafe { o.contents.err = core::ptr::null_mut(); }
5952                         CResult_NodeAliasDecodeErrorZPtr { err }
5953                 };
5954                 Self {
5955                         contents,
5956                         result_ok: o.result_ok,
5957                 }
5958         }
5959 }
5960 impl Clone for CResult_NodeAliasDecodeErrorZ {
5961         fn clone(&self) -> Self {
5962                 if self.result_ok {
5963                         Self { result_ok: true, contents: CResult_NodeAliasDecodeErrorZPtr {
5964                                 result: Box::into_raw(Box::new(<crate::lightning::routing::gossip::NodeAlias>::clone(unsafe { &*self.contents.result })))
5965                         } }
5966                 } else {
5967                         Self { result_ok: false, contents: CResult_NodeAliasDecodeErrorZPtr {
5968                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
5969                         } }
5970                 }
5971         }
5972 }
5973 #[no_mangle]
5974 /// Creates a new CResult_NodeAliasDecodeErrorZ which has the same data as `orig`
5975 /// but with all dynamically-allocated buffers duplicated in new buffers.
5976 pub extern "C" fn CResult_NodeAliasDecodeErrorZ_clone(orig: &CResult_NodeAliasDecodeErrorZ) -> CResult_NodeAliasDecodeErrorZ { Clone::clone(&orig) }
5977 #[repr(C)]
5978 /// The contents of CResult_NodeInfoDecodeErrorZ
5979 pub union CResult_NodeInfoDecodeErrorZPtr {
5980         /// A pointer to the contents in the success state.
5981         /// Reading from this pointer when `result_ok` is not set is undefined.
5982         pub result: *mut crate::lightning::routing::gossip::NodeInfo,
5983         /// A pointer to the contents in the error state.
5984         /// Reading from this pointer when `result_ok` is set is undefined.
5985         pub err: *mut crate::lightning::ln::msgs::DecodeError,
5986 }
5987 #[repr(C)]
5988 /// A CResult_NodeInfoDecodeErrorZ represents the result of a fallible operation,
5989 /// containing a crate::lightning::routing::gossip::NodeInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
5990 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5991 pub struct CResult_NodeInfoDecodeErrorZ {
5992         /// The contents of this CResult_NodeInfoDecodeErrorZ, accessible via either
5993         /// `err` or `result` depending on the state of `result_ok`.
5994         pub contents: CResult_NodeInfoDecodeErrorZPtr,
5995         /// Whether this CResult_NodeInfoDecodeErrorZ represents a success state.
5996         pub result_ok: bool,
5997 }
5998 #[no_mangle]
5999 /// Creates a new CResult_NodeInfoDecodeErrorZ in the success state.
6000 pub extern "C" fn CResult_NodeInfoDecodeErrorZ_ok(o: crate::lightning::routing::gossip::NodeInfo) -> CResult_NodeInfoDecodeErrorZ {
6001         CResult_NodeInfoDecodeErrorZ {
6002                 contents: CResult_NodeInfoDecodeErrorZPtr {
6003                         result: Box::into_raw(Box::new(o)),
6004                 },
6005                 result_ok: true,
6006         }
6007 }
6008 #[no_mangle]
6009 /// Creates a new CResult_NodeInfoDecodeErrorZ in the error state.
6010 pub extern "C" fn CResult_NodeInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeInfoDecodeErrorZ {
6011         CResult_NodeInfoDecodeErrorZ {
6012                 contents: CResult_NodeInfoDecodeErrorZPtr {
6013                         err: Box::into_raw(Box::new(e)),
6014                 },
6015                 result_ok: false,
6016         }
6017 }
6018 /// Checks if the given object is currently in the success state
6019 #[no_mangle]
6020 pub extern "C" fn CResult_NodeInfoDecodeErrorZ_is_ok(o: &CResult_NodeInfoDecodeErrorZ) -> bool {
6021         o.result_ok
6022 }
6023 #[no_mangle]
6024 /// Frees any resources used by the CResult_NodeInfoDecodeErrorZ.
6025 pub extern "C" fn CResult_NodeInfoDecodeErrorZ_free(_res: CResult_NodeInfoDecodeErrorZ) { }
6026 impl Drop for CResult_NodeInfoDecodeErrorZ {
6027         fn drop(&mut self) {
6028                 if self.result_ok {
6029                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
6030                                 let _ = unsafe { Box::from_raw(self.contents.result) };
6031                         }
6032                 } else {
6033                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
6034                                 let _ = unsafe { Box::from_raw(self.contents.err) };
6035                         }
6036                 }
6037         }
6038 }
6039 impl From<crate::c_types::CResultTempl<crate::lightning::routing::gossip::NodeInfo, crate::lightning::ln::msgs::DecodeError>> for CResult_NodeInfoDecodeErrorZ {
6040         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::gossip::NodeInfo, crate::lightning::ln::msgs::DecodeError>) -> Self {
6041                 let contents = if o.result_ok {
6042                         let result = unsafe { o.contents.result };
6043                         unsafe { o.contents.result = core::ptr::null_mut() };
6044                         CResult_NodeInfoDecodeErrorZPtr { result }
6045                 } else {
6046                         let err = unsafe { o.contents.err };
6047                         unsafe { o.contents.err = core::ptr::null_mut(); }
6048                         CResult_NodeInfoDecodeErrorZPtr { err }
6049                 };
6050                 Self {
6051                         contents,
6052                         result_ok: o.result_ok,
6053                 }
6054         }
6055 }
6056 impl Clone for CResult_NodeInfoDecodeErrorZ {
6057         fn clone(&self) -> Self {
6058                 if self.result_ok {
6059                         Self { result_ok: true, contents: CResult_NodeInfoDecodeErrorZPtr {
6060                                 result: Box::into_raw(Box::new(<crate::lightning::routing::gossip::NodeInfo>::clone(unsafe { &*self.contents.result })))
6061                         } }
6062                 } else {
6063                         Self { result_ok: false, contents: CResult_NodeInfoDecodeErrorZPtr {
6064                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
6065                         } }
6066                 }
6067         }
6068 }
6069 #[no_mangle]
6070 /// Creates a new CResult_NodeInfoDecodeErrorZ which has the same data as `orig`
6071 /// but with all dynamically-allocated buffers duplicated in new buffers.
6072 pub extern "C" fn CResult_NodeInfoDecodeErrorZ_clone(orig: &CResult_NodeInfoDecodeErrorZ) -> CResult_NodeInfoDecodeErrorZ { Clone::clone(&orig) }
6073 #[repr(C)]
6074 /// The contents of CResult_NetworkGraphDecodeErrorZ
6075 pub union CResult_NetworkGraphDecodeErrorZPtr {
6076         /// A pointer to the contents in the success state.
6077         /// Reading from this pointer when `result_ok` is not set is undefined.
6078         pub result: *mut crate::lightning::routing::gossip::NetworkGraph,
6079         /// A pointer to the contents in the error state.
6080         /// Reading from this pointer when `result_ok` is set is undefined.
6081         pub err: *mut crate::lightning::ln::msgs::DecodeError,
6082 }
6083 #[repr(C)]
6084 /// A CResult_NetworkGraphDecodeErrorZ represents the result of a fallible operation,
6085 /// containing a crate::lightning::routing::gossip::NetworkGraph on success and a crate::lightning::ln::msgs::DecodeError on failure.
6086 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6087 pub struct CResult_NetworkGraphDecodeErrorZ {
6088         /// The contents of this CResult_NetworkGraphDecodeErrorZ, accessible via either
6089         /// `err` or `result` depending on the state of `result_ok`.
6090         pub contents: CResult_NetworkGraphDecodeErrorZPtr,
6091         /// Whether this CResult_NetworkGraphDecodeErrorZ represents a success state.
6092         pub result_ok: bool,
6093 }
6094 #[no_mangle]
6095 /// Creates a new CResult_NetworkGraphDecodeErrorZ in the success state.
6096 pub extern "C" fn CResult_NetworkGraphDecodeErrorZ_ok(o: crate::lightning::routing::gossip::NetworkGraph) -> CResult_NetworkGraphDecodeErrorZ {
6097         CResult_NetworkGraphDecodeErrorZ {
6098                 contents: CResult_NetworkGraphDecodeErrorZPtr {
6099                         result: Box::into_raw(Box::new(o)),
6100                 },
6101                 result_ok: true,
6102         }
6103 }
6104 #[no_mangle]
6105 /// Creates a new CResult_NetworkGraphDecodeErrorZ in the error state.
6106 pub extern "C" fn CResult_NetworkGraphDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NetworkGraphDecodeErrorZ {
6107         CResult_NetworkGraphDecodeErrorZ {
6108                 contents: CResult_NetworkGraphDecodeErrorZPtr {
6109                         err: Box::into_raw(Box::new(e)),
6110                 },
6111                 result_ok: false,
6112         }
6113 }
6114 /// Checks if the given object is currently in the success state
6115 #[no_mangle]
6116 pub extern "C" fn CResult_NetworkGraphDecodeErrorZ_is_ok(o: &CResult_NetworkGraphDecodeErrorZ) -> bool {
6117         o.result_ok
6118 }
6119 #[no_mangle]
6120 /// Frees any resources used by the CResult_NetworkGraphDecodeErrorZ.
6121 pub extern "C" fn CResult_NetworkGraphDecodeErrorZ_free(_res: CResult_NetworkGraphDecodeErrorZ) { }
6122 impl Drop for CResult_NetworkGraphDecodeErrorZ {
6123         fn drop(&mut self) {
6124                 if self.result_ok {
6125                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
6126                                 let _ = unsafe { Box::from_raw(self.contents.result) };
6127                         }
6128                 } else {
6129                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
6130                                 let _ = unsafe { Box::from_raw(self.contents.err) };
6131                         }
6132                 }
6133         }
6134 }
6135 impl From<crate::c_types::CResultTempl<crate::lightning::routing::gossip::NetworkGraph, crate::lightning::ln::msgs::DecodeError>> for CResult_NetworkGraphDecodeErrorZ {
6136         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::gossip::NetworkGraph, crate::lightning::ln::msgs::DecodeError>) -> Self {
6137                 let contents = if o.result_ok {
6138                         let result = unsafe { o.contents.result };
6139                         unsafe { o.contents.result = core::ptr::null_mut() };
6140                         CResult_NetworkGraphDecodeErrorZPtr { result }
6141                 } else {
6142                         let err = unsafe { o.contents.err };
6143                         unsafe { o.contents.err = core::ptr::null_mut(); }
6144                         CResult_NetworkGraphDecodeErrorZPtr { err }
6145                 };
6146                 Self {
6147                         contents,
6148                         result_ok: o.result_ok,
6149                 }
6150         }
6151 }
6152 #[repr(C)]
6153 #[derive(Clone)]
6154 /// An enum which can either contain a crate::c_types::derived::CVec_NetAddressZ or not
6155 pub enum COption_CVec_NetAddressZZ {
6156         /// When we're in this state, this COption_CVec_NetAddressZZ contains a crate::c_types::derived::CVec_NetAddressZ
6157         Some(crate::c_types::derived::CVec_NetAddressZ),
6158         /// When we're in this state, this COption_CVec_NetAddressZZ contains nothing
6159         None
6160 }
6161 impl COption_CVec_NetAddressZZ {
6162         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
6163                 if let Self::None = self { false } else { true }
6164         }
6165         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
6166                 !self.is_some()
6167         }
6168         #[allow(unused)] pub(crate) fn take(mut self) -> crate::c_types::derived::CVec_NetAddressZ {
6169                 if let Self::Some(v) = self { v } else { unreachable!() }
6170         }
6171 }
6172 #[no_mangle]
6173 /// Constructs a new COption_CVec_NetAddressZZ containing a crate::c_types::derived::CVec_NetAddressZ
6174 pub extern "C" fn COption_CVec_NetAddressZZ_some(o: crate::c_types::derived::CVec_NetAddressZ) -> COption_CVec_NetAddressZZ {
6175         COption_CVec_NetAddressZZ::Some(o)
6176 }
6177 #[no_mangle]
6178 /// Constructs a new COption_CVec_NetAddressZZ containing nothing
6179 pub extern "C" fn COption_CVec_NetAddressZZ_none() -> COption_CVec_NetAddressZZ {
6180         COption_CVec_NetAddressZZ::None
6181 }
6182 #[no_mangle]
6183 /// Frees any resources associated with the crate::c_types::derived::CVec_NetAddressZ, if we are in the Some state
6184 pub extern "C" fn COption_CVec_NetAddressZZ_free(_res: COption_CVec_NetAddressZZ) { }
6185 #[no_mangle]
6186 /// Creates a new COption_CVec_NetAddressZZ which has the same data as `orig`
6187 /// but with all dynamically-allocated buffers duplicated in new buffers.
6188 pub extern "C" fn COption_CVec_NetAddressZZ_clone(orig: &COption_CVec_NetAddressZZ) -> COption_CVec_NetAddressZZ { Clone::clone(&orig) }
6189 #[repr(C)]
6190 /// The contents of CResult_DelayedPaymentOutputDescriptorDecodeErrorZ
6191 pub union CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr {
6192         /// A pointer to the contents in the success state.
6193         /// Reading from this pointer when `result_ok` is not set is undefined.
6194         pub result: *mut crate::lightning::chain::keysinterface::DelayedPaymentOutputDescriptor,
6195         /// A pointer to the contents in the error state.
6196         /// Reading from this pointer when `result_ok` is set is undefined.
6197         pub err: *mut crate::lightning::ln::msgs::DecodeError,
6198 }
6199 #[repr(C)]
6200 /// A CResult_DelayedPaymentOutputDescriptorDecodeErrorZ represents the result of a fallible operation,
6201 /// containing a crate::lightning::chain::keysinterface::DelayedPaymentOutputDescriptor on success and a crate::lightning::ln::msgs::DecodeError on failure.
6202 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6203 pub struct CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
6204         /// The contents of this CResult_DelayedPaymentOutputDescriptorDecodeErrorZ, accessible via either
6205         /// `err` or `result` depending on the state of `result_ok`.
6206         pub contents: CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr,
6207         /// Whether this CResult_DelayedPaymentOutputDescriptorDecodeErrorZ represents a success state.
6208         pub result_ok: bool,
6209 }
6210 #[no_mangle]
6211 /// Creates a new CResult_DelayedPaymentOutputDescriptorDecodeErrorZ in the success state.
6212 pub extern "C" fn CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_ok(o: crate::lightning::chain::keysinterface::DelayedPaymentOutputDescriptor) -> CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
6213         CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
6214                 contents: CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr {
6215                         result: Box::into_raw(Box::new(o)),
6216                 },
6217                 result_ok: true,
6218         }
6219 }
6220 #[no_mangle]
6221 /// Creates a new CResult_DelayedPaymentOutputDescriptorDecodeErrorZ in the error state.
6222 pub extern "C" fn CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
6223         CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
6224                 contents: CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr {
6225                         err: Box::into_raw(Box::new(e)),
6226                 },
6227                 result_ok: false,
6228         }
6229 }
6230 /// Checks if the given object is currently in the success state
6231 #[no_mangle]
6232 pub extern "C" fn CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_is_ok(o: &CResult_DelayedPaymentOutputDescriptorDecodeErrorZ) -> bool {
6233         o.result_ok
6234 }
6235 #[no_mangle]
6236 /// Frees any resources used by the CResult_DelayedPaymentOutputDescriptorDecodeErrorZ.
6237 pub extern "C" fn CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_free(_res: CResult_DelayedPaymentOutputDescriptorDecodeErrorZ) { }
6238 impl Drop for CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
6239         fn drop(&mut self) {
6240                 if self.result_ok {
6241                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
6242                                 let _ = unsafe { Box::from_raw(self.contents.result) };
6243                         }
6244                 } else {
6245                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
6246                                 let _ = unsafe { Box::from_raw(self.contents.err) };
6247                         }
6248                 }
6249         }
6250 }
6251 impl From<crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::DelayedPaymentOutputDescriptor, crate::lightning::ln::msgs::DecodeError>> for CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
6252         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::DelayedPaymentOutputDescriptor, crate::lightning::ln::msgs::DecodeError>) -> Self {
6253                 let contents = if o.result_ok {
6254                         let result = unsafe { o.contents.result };
6255                         unsafe { o.contents.result = core::ptr::null_mut() };
6256                         CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr { result }
6257                 } else {
6258                         let err = unsafe { o.contents.err };
6259                         unsafe { o.contents.err = core::ptr::null_mut(); }
6260                         CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr { err }
6261                 };
6262                 Self {
6263                         contents,
6264                         result_ok: o.result_ok,
6265                 }
6266         }
6267 }
6268 impl Clone for CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
6269         fn clone(&self) -> Self {
6270                 if self.result_ok {
6271                         Self { result_ok: true, contents: CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr {
6272                                 result: Box::into_raw(Box::new(<crate::lightning::chain::keysinterface::DelayedPaymentOutputDescriptor>::clone(unsafe { &*self.contents.result })))
6273                         } }
6274                 } else {
6275                         Self { result_ok: false, contents: CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr {
6276                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
6277                         } }
6278                 }
6279         }
6280 }
6281 #[no_mangle]
6282 /// Creates a new CResult_DelayedPaymentOutputDescriptorDecodeErrorZ which has the same data as `orig`
6283 /// but with all dynamically-allocated buffers duplicated in new buffers.
6284 pub extern "C" fn CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone(orig: &CResult_DelayedPaymentOutputDescriptorDecodeErrorZ) -> CResult_DelayedPaymentOutputDescriptorDecodeErrorZ { Clone::clone(&orig) }
6285 #[repr(C)]
6286 /// The contents of CResult_StaticPaymentOutputDescriptorDecodeErrorZ
6287 pub union CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr {
6288         /// A pointer to the contents in the success state.
6289         /// Reading from this pointer when `result_ok` is not set is undefined.
6290         pub result: *mut crate::lightning::chain::keysinterface::StaticPaymentOutputDescriptor,
6291         /// A pointer to the contents in the error state.
6292         /// Reading from this pointer when `result_ok` is set is undefined.
6293         pub err: *mut crate::lightning::ln::msgs::DecodeError,
6294 }
6295 #[repr(C)]
6296 /// A CResult_StaticPaymentOutputDescriptorDecodeErrorZ represents the result of a fallible operation,
6297 /// containing a crate::lightning::chain::keysinterface::StaticPaymentOutputDescriptor on success and a crate::lightning::ln::msgs::DecodeError on failure.
6298 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6299 pub struct CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
6300         /// The contents of this CResult_StaticPaymentOutputDescriptorDecodeErrorZ, accessible via either
6301         /// `err` or `result` depending on the state of `result_ok`.
6302         pub contents: CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr,
6303         /// Whether this CResult_StaticPaymentOutputDescriptorDecodeErrorZ represents a success state.
6304         pub result_ok: bool,
6305 }
6306 #[no_mangle]
6307 /// Creates a new CResult_StaticPaymentOutputDescriptorDecodeErrorZ in the success state.
6308 pub extern "C" fn CResult_StaticPaymentOutputDescriptorDecodeErrorZ_ok(o: crate::lightning::chain::keysinterface::StaticPaymentOutputDescriptor) -> CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
6309         CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
6310                 contents: CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr {
6311                         result: Box::into_raw(Box::new(o)),
6312                 },
6313                 result_ok: true,
6314         }
6315 }
6316 #[no_mangle]
6317 /// Creates a new CResult_StaticPaymentOutputDescriptorDecodeErrorZ in the error state.
6318 pub extern "C" fn CResult_StaticPaymentOutputDescriptorDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
6319         CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
6320                 contents: CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr {
6321                         err: Box::into_raw(Box::new(e)),
6322                 },
6323                 result_ok: false,
6324         }
6325 }
6326 /// Checks if the given object is currently in the success state
6327 #[no_mangle]
6328 pub extern "C" fn CResult_StaticPaymentOutputDescriptorDecodeErrorZ_is_ok(o: &CResult_StaticPaymentOutputDescriptorDecodeErrorZ) -> bool {
6329         o.result_ok
6330 }
6331 #[no_mangle]
6332 /// Frees any resources used by the CResult_StaticPaymentOutputDescriptorDecodeErrorZ.
6333 pub extern "C" fn CResult_StaticPaymentOutputDescriptorDecodeErrorZ_free(_res: CResult_StaticPaymentOutputDescriptorDecodeErrorZ) { }
6334 impl Drop for CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
6335         fn drop(&mut self) {
6336                 if self.result_ok {
6337                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
6338                                 let _ = unsafe { Box::from_raw(self.contents.result) };
6339                         }
6340                 } else {
6341                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
6342                                 let _ = unsafe { Box::from_raw(self.contents.err) };
6343                         }
6344                 }
6345         }
6346 }
6347 impl From<crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::StaticPaymentOutputDescriptor, crate::lightning::ln::msgs::DecodeError>> for CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
6348         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::StaticPaymentOutputDescriptor, crate::lightning::ln::msgs::DecodeError>) -> Self {
6349                 let contents = if o.result_ok {
6350                         let result = unsafe { o.contents.result };
6351                         unsafe { o.contents.result = core::ptr::null_mut() };
6352                         CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr { result }
6353                 } else {
6354                         let err = unsafe { o.contents.err };
6355                         unsafe { o.contents.err = core::ptr::null_mut(); }
6356                         CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr { err }
6357                 };
6358                 Self {
6359                         contents,
6360                         result_ok: o.result_ok,
6361                 }
6362         }
6363 }
6364 impl Clone for CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
6365         fn clone(&self) -> Self {
6366                 if self.result_ok {
6367                         Self { result_ok: true, contents: CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr {
6368                                 result: Box::into_raw(Box::new(<crate::lightning::chain::keysinterface::StaticPaymentOutputDescriptor>::clone(unsafe { &*self.contents.result })))
6369                         } }
6370                 } else {
6371                         Self { result_ok: false, contents: CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr {
6372                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
6373                         } }
6374                 }
6375         }
6376 }
6377 #[no_mangle]
6378 /// Creates a new CResult_StaticPaymentOutputDescriptorDecodeErrorZ which has the same data as `orig`
6379 /// but with all dynamically-allocated buffers duplicated in new buffers.
6380 pub extern "C" fn CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone(orig: &CResult_StaticPaymentOutputDescriptorDecodeErrorZ) -> CResult_StaticPaymentOutputDescriptorDecodeErrorZ { Clone::clone(&orig) }
6381 #[repr(C)]
6382 /// The contents of CResult_SpendableOutputDescriptorDecodeErrorZ
6383 pub union CResult_SpendableOutputDescriptorDecodeErrorZPtr {
6384         /// A pointer to the contents in the success state.
6385         /// Reading from this pointer when `result_ok` is not set is undefined.
6386         pub result: *mut crate::lightning::chain::keysinterface::SpendableOutputDescriptor,
6387         /// A pointer to the contents in the error state.
6388         /// Reading from this pointer when `result_ok` is set is undefined.
6389         pub err: *mut crate::lightning::ln::msgs::DecodeError,
6390 }
6391 #[repr(C)]
6392 /// A CResult_SpendableOutputDescriptorDecodeErrorZ represents the result of a fallible operation,
6393 /// containing a crate::lightning::chain::keysinterface::SpendableOutputDescriptor on success and a crate::lightning::ln::msgs::DecodeError on failure.
6394 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6395 pub struct CResult_SpendableOutputDescriptorDecodeErrorZ {
6396         /// The contents of this CResult_SpendableOutputDescriptorDecodeErrorZ, accessible via either
6397         /// `err` or `result` depending on the state of `result_ok`.
6398         pub contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr,
6399         /// Whether this CResult_SpendableOutputDescriptorDecodeErrorZ represents a success state.
6400         pub result_ok: bool,
6401 }
6402 #[no_mangle]
6403 /// Creates a new CResult_SpendableOutputDescriptorDecodeErrorZ in the success state.
6404 pub extern "C" fn CResult_SpendableOutputDescriptorDecodeErrorZ_ok(o: crate::lightning::chain::keysinterface::SpendableOutputDescriptor) -> CResult_SpendableOutputDescriptorDecodeErrorZ {
6405         CResult_SpendableOutputDescriptorDecodeErrorZ {
6406                 contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr {
6407                         result: Box::into_raw(Box::new(o)),
6408                 },
6409                 result_ok: true,
6410         }
6411 }
6412 #[no_mangle]
6413 /// Creates a new CResult_SpendableOutputDescriptorDecodeErrorZ in the error state.
6414 pub extern "C" fn CResult_SpendableOutputDescriptorDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_SpendableOutputDescriptorDecodeErrorZ {
6415         CResult_SpendableOutputDescriptorDecodeErrorZ {
6416                 contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr {
6417                         err: Box::into_raw(Box::new(e)),
6418                 },
6419                 result_ok: false,
6420         }
6421 }
6422 /// Checks if the given object is currently in the success state
6423 #[no_mangle]
6424 pub extern "C" fn CResult_SpendableOutputDescriptorDecodeErrorZ_is_ok(o: &CResult_SpendableOutputDescriptorDecodeErrorZ) -> bool {
6425         o.result_ok
6426 }
6427 #[no_mangle]
6428 /// Frees any resources used by the CResult_SpendableOutputDescriptorDecodeErrorZ.
6429 pub extern "C" fn CResult_SpendableOutputDescriptorDecodeErrorZ_free(_res: CResult_SpendableOutputDescriptorDecodeErrorZ) { }
6430 impl Drop for CResult_SpendableOutputDescriptorDecodeErrorZ {
6431         fn drop(&mut self) {
6432                 if self.result_ok {
6433                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
6434                                 let _ = unsafe { Box::from_raw(self.contents.result) };
6435                         }
6436                 } else {
6437                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
6438                                 let _ = unsafe { Box::from_raw(self.contents.err) };
6439                         }
6440                 }
6441         }
6442 }
6443 impl From<crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::SpendableOutputDescriptor, crate::lightning::ln::msgs::DecodeError>> for CResult_SpendableOutputDescriptorDecodeErrorZ {
6444         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::SpendableOutputDescriptor, crate::lightning::ln::msgs::DecodeError>) -> Self {
6445                 let contents = if o.result_ok {
6446                         let result = unsafe { o.contents.result };
6447                         unsafe { o.contents.result = core::ptr::null_mut() };
6448                         CResult_SpendableOutputDescriptorDecodeErrorZPtr { result }
6449                 } else {
6450                         let err = unsafe { o.contents.err };
6451                         unsafe { o.contents.err = core::ptr::null_mut(); }
6452                         CResult_SpendableOutputDescriptorDecodeErrorZPtr { err }
6453                 };
6454                 Self {
6455                         contents,
6456                         result_ok: o.result_ok,
6457                 }
6458         }
6459 }
6460 impl Clone for CResult_SpendableOutputDescriptorDecodeErrorZ {
6461         fn clone(&self) -> Self {
6462                 if self.result_ok {
6463                         Self { result_ok: true, contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr {
6464                                 result: Box::into_raw(Box::new(<crate::lightning::chain::keysinterface::SpendableOutputDescriptor>::clone(unsafe { &*self.contents.result })))
6465                         } }
6466                 } else {
6467                         Self { result_ok: false, contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr {
6468                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
6469                         } }
6470                 }
6471         }
6472 }
6473 #[no_mangle]
6474 /// Creates a new CResult_SpendableOutputDescriptorDecodeErrorZ which has the same data as `orig`
6475 /// but with all dynamically-allocated buffers duplicated in new buffers.
6476 pub extern "C" fn CResult_SpendableOutputDescriptorDecodeErrorZ_clone(orig: &CResult_SpendableOutputDescriptorDecodeErrorZ) -> CResult_SpendableOutputDescriptorDecodeErrorZ { Clone::clone(&orig) }
6477 #[repr(C)]
6478 /// A dynamically-allocated array of crate::c_types::ThirtyTwoBytess of arbitrary size.
6479 /// This corresponds to std::vector in C++
6480 pub struct CVec_PaymentPreimageZ {
6481         /// The elements in the array.
6482         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
6483         pub data: *mut crate::c_types::ThirtyTwoBytes,
6484         /// The number of elements pointed to by `data`.
6485         pub datalen: usize
6486 }
6487 impl CVec_PaymentPreimageZ {
6488         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::ThirtyTwoBytes> {
6489                 if self.datalen == 0 { return Vec::new(); }
6490                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
6491                 self.data = core::ptr::null_mut();
6492                 self.datalen = 0;
6493                 ret
6494         }
6495         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::ThirtyTwoBytes] {
6496                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
6497         }
6498 }
6499 impl From<Vec<crate::c_types::ThirtyTwoBytes>> for CVec_PaymentPreimageZ {
6500         fn from(v: Vec<crate::c_types::ThirtyTwoBytes>) -> Self {
6501                 let datalen = v.len();
6502                 let data = Box::into_raw(v.into_boxed_slice());
6503                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
6504         }
6505 }
6506 #[no_mangle]
6507 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
6508 pub extern "C" fn CVec_PaymentPreimageZ_free(_res: CVec_PaymentPreimageZ) { }
6509 impl Drop for CVec_PaymentPreimageZ {
6510         fn drop(&mut self) {
6511                 if self.datalen == 0 { return; }
6512                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
6513         }
6514 }
6515 impl Clone for CVec_PaymentPreimageZ {
6516         fn clone(&self) -> Self {
6517                 let mut res = Vec::new();
6518                 if self.datalen == 0 { return Self::from(res); }
6519                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
6520                 Self::from(res)
6521         }
6522 }
6523 #[repr(C)]
6524 /// A tuple of 2 elements. See the individual fields for the types contained.
6525 pub struct C2Tuple_SignatureCVec_SignatureZZ {
6526         /// The element at position 0
6527         pub a: crate::c_types::Signature,
6528         /// The element at position 1
6529         pub b: crate::c_types::derived::CVec_SignatureZ,
6530 }
6531 impl From<(crate::c_types::Signature, crate::c_types::derived::CVec_SignatureZ)> for C2Tuple_SignatureCVec_SignatureZZ {
6532         fn from (tup: (crate::c_types::Signature, crate::c_types::derived::CVec_SignatureZ)) -> Self {
6533                 Self {
6534                         a: tup.0,
6535                         b: tup.1,
6536                 }
6537         }
6538 }
6539 impl C2Tuple_SignatureCVec_SignatureZZ {
6540         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::Signature, crate::c_types::derived::CVec_SignatureZ) {
6541                 (self.a, self.b)
6542         }
6543 }
6544 impl Clone for C2Tuple_SignatureCVec_SignatureZZ {
6545         fn clone(&self) -> Self {
6546                 Self {
6547                         a: Clone::clone(&self.a),
6548                         b: Clone::clone(&self.b),
6549                 }
6550         }
6551 }
6552 #[no_mangle]
6553 /// Creates a new tuple which has the same data as `orig`
6554 /// but with all dynamically-allocated buffers duplicated in new buffers.
6555 pub extern "C" fn C2Tuple_SignatureCVec_SignatureZZ_clone(orig: &C2Tuple_SignatureCVec_SignatureZZ) -> C2Tuple_SignatureCVec_SignatureZZ { Clone::clone(&orig) }
6556 /// Creates a new C2Tuple_SignatureCVec_SignatureZZ from the contained elements.
6557 #[no_mangle]
6558 pub extern "C" fn C2Tuple_SignatureCVec_SignatureZZ_new(a: crate::c_types::Signature, b: crate::c_types::derived::CVec_SignatureZ) -> C2Tuple_SignatureCVec_SignatureZZ {
6559         C2Tuple_SignatureCVec_SignatureZZ { a, b, }
6560 }
6561
6562 #[no_mangle]
6563 /// Frees any resources used by the C2Tuple_SignatureCVec_SignatureZZ.
6564 pub extern "C" fn C2Tuple_SignatureCVec_SignatureZZ_free(_res: C2Tuple_SignatureCVec_SignatureZZ) { }
6565 #[repr(C)]
6566 /// The contents of CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ
6567 pub union CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
6568         /// A pointer to the contents in the success state.
6569         /// Reading from this pointer when `result_ok` is not set is undefined.
6570         pub result: *mut crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ,
6571         /// Note that this value is always NULL, as there are no contents in the Err variant
6572         pub err: *mut core::ffi::c_void,
6573 }
6574 #[repr(C)]
6575 /// A CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ represents the result of a fallible operation,
6576 /// containing a crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ on success and a () on failure.
6577 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6578 pub struct CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
6579         /// The contents of this CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ, accessible via either
6580         /// `err` or `result` depending on the state of `result_ok`.
6581         pub contents: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr,
6582         /// Whether this CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ represents a success state.
6583         pub result_ok: bool,
6584 }
6585 #[no_mangle]
6586 /// Creates a new CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ in the success state.
6587 pub extern "C" fn CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_ok(o: crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ) -> CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
6588         CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
6589                 contents: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
6590                         result: Box::into_raw(Box::new(o)),
6591                 },
6592                 result_ok: true,
6593         }
6594 }
6595 #[no_mangle]
6596 /// Creates a new CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ in the error state.
6597 pub extern "C" fn CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_err() -> CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
6598         CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
6599                 contents: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
6600                         err: core::ptr::null_mut(),
6601                 },
6602                 result_ok: false,
6603         }
6604 }
6605 /// Checks if the given object is currently in the success state
6606 #[no_mangle]
6607 pub extern "C" fn CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_is_ok(o: &CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ) -> bool {
6608         o.result_ok
6609 }
6610 #[no_mangle]
6611 /// Frees any resources used by the CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ.
6612 pub extern "C" fn CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_free(_res: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ) { }
6613 impl Drop for CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
6614         fn drop(&mut self) {
6615                 if self.result_ok {
6616                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
6617                                 let _ = unsafe { Box::from_raw(self.contents.result) };
6618                         }
6619                 } else {
6620                 }
6621         }
6622 }
6623 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ, ()>> for CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
6624         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ, ()>) -> Self {
6625                 let contents = if o.result_ok {
6626                         let result = unsafe { o.contents.result };
6627                         unsafe { o.contents.result = core::ptr::null_mut() };
6628                         CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr { result }
6629                 } else {
6630                         let _ = unsafe { Box::from_raw(o.contents.err) };
6631                         o.contents.err = core::ptr::null_mut();
6632                         CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr { err: core::ptr::null_mut() }
6633                 };
6634                 Self {
6635                         contents,
6636                         result_ok: o.result_ok,
6637                 }
6638         }
6639 }
6640 impl Clone for CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
6641         fn clone(&self) -> Self {
6642                 if self.result_ok {
6643                         Self { result_ok: true, contents: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
6644                                 result: Box::into_raw(Box::new(<crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ>::clone(unsafe { &*self.contents.result })))
6645                         } }
6646                 } else {
6647                         Self { result_ok: false, contents: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
6648                                 err: core::ptr::null_mut()
6649                         } }
6650                 }
6651         }
6652 }
6653 #[no_mangle]
6654 /// Creates a new CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ which has the same data as `orig`
6655 /// but with all dynamically-allocated buffers duplicated in new buffers.
6656 pub extern "C" fn CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone(orig: &CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ) -> CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ { Clone::clone(&orig) }
6657 #[repr(C)]
6658 /// The contents of CResult_SignatureNoneZ
6659 pub union CResult_SignatureNoneZPtr {
6660         /// A pointer to the contents in the success state.
6661         /// Reading from this pointer when `result_ok` is not set is undefined.
6662         pub result: *mut crate::c_types::Signature,
6663         /// Note that this value is always NULL, as there are no contents in the Err variant
6664         pub err: *mut core::ffi::c_void,
6665 }
6666 #[repr(C)]
6667 /// A CResult_SignatureNoneZ represents the result of a fallible operation,
6668 /// containing a crate::c_types::Signature on success and a () on failure.
6669 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6670 pub struct CResult_SignatureNoneZ {
6671         /// The contents of this CResult_SignatureNoneZ, accessible via either
6672         /// `err` or `result` depending on the state of `result_ok`.
6673         pub contents: CResult_SignatureNoneZPtr,
6674         /// Whether this CResult_SignatureNoneZ represents a success state.
6675         pub result_ok: bool,
6676 }
6677 #[no_mangle]
6678 /// Creates a new CResult_SignatureNoneZ in the success state.
6679 pub extern "C" fn CResult_SignatureNoneZ_ok(o: crate::c_types::Signature) -> CResult_SignatureNoneZ {
6680         CResult_SignatureNoneZ {
6681                 contents: CResult_SignatureNoneZPtr {
6682                         result: Box::into_raw(Box::new(o)),
6683                 },
6684                 result_ok: true,
6685         }
6686 }
6687 #[no_mangle]
6688 /// Creates a new CResult_SignatureNoneZ in the error state.
6689 pub extern "C" fn CResult_SignatureNoneZ_err() -> CResult_SignatureNoneZ {
6690         CResult_SignatureNoneZ {
6691                 contents: CResult_SignatureNoneZPtr {
6692                         err: core::ptr::null_mut(),
6693                 },
6694                 result_ok: false,
6695         }
6696 }
6697 /// Checks if the given object is currently in the success state
6698 #[no_mangle]
6699 pub extern "C" fn CResult_SignatureNoneZ_is_ok(o: &CResult_SignatureNoneZ) -> bool {
6700         o.result_ok
6701 }
6702 #[no_mangle]
6703 /// Frees any resources used by the CResult_SignatureNoneZ.
6704 pub extern "C" fn CResult_SignatureNoneZ_free(_res: CResult_SignatureNoneZ) { }
6705 impl Drop for CResult_SignatureNoneZ {
6706         fn drop(&mut self) {
6707                 if self.result_ok {
6708                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
6709                                 let _ = unsafe { Box::from_raw(self.contents.result) };
6710                         }
6711                 } else {
6712                 }
6713         }
6714 }
6715 impl From<crate::c_types::CResultTempl<crate::c_types::Signature, ()>> for CResult_SignatureNoneZ {
6716         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::Signature, ()>) -> Self {
6717                 let contents = if o.result_ok {
6718                         let result = unsafe { o.contents.result };
6719                         unsafe { o.contents.result = core::ptr::null_mut() };
6720                         CResult_SignatureNoneZPtr { result }
6721                 } else {
6722                         let _ = unsafe { Box::from_raw(o.contents.err) };
6723                         o.contents.err = core::ptr::null_mut();
6724                         CResult_SignatureNoneZPtr { err: core::ptr::null_mut() }
6725                 };
6726                 Self {
6727                         contents,
6728                         result_ok: o.result_ok,
6729                 }
6730         }
6731 }
6732 impl Clone for CResult_SignatureNoneZ {
6733         fn clone(&self) -> Self {
6734                 if self.result_ok {
6735                         Self { result_ok: true, contents: CResult_SignatureNoneZPtr {
6736                                 result: Box::into_raw(Box::new(<crate::c_types::Signature>::clone(unsafe { &*self.contents.result })))
6737                         } }
6738                 } else {
6739                         Self { result_ok: false, contents: CResult_SignatureNoneZPtr {
6740                                 err: core::ptr::null_mut()
6741                         } }
6742                 }
6743         }
6744 }
6745 #[no_mangle]
6746 /// Creates a new CResult_SignatureNoneZ which has the same data as `orig`
6747 /// but with all dynamically-allocated buffers duplicated in new buffers.
6748 pub extern "C" fn CResult_SignatureNoneZ_clone(orig: &CResult_SignatureNoneZ) -> CResult_SignatureNoneZ { Clone::clone(&orig) }
6749 #[repr(C)]
6750 /// A tuple of 2 elements. See the individual fields for the types contained.
6751 pub struct C2Tuple_SignatureSignatureZ {
6752         /// The element at position 0
6753         pub a: crate::c_types::Signature,
6754         /// The element at position 1
6755         pub b: crate::c_types::Signature,
6756 }
6757 impl From<(crate::c_types::Signature, crate::c_types::Signature)> for C2Tuple_SignatureSignatureZ {
6758         fn from (tup: (crate::c_types::Signature, crate::c_types::Signature)) -> Self {
6759                 Self {
6760                         a: tup.0,
6761                         b: tup.1,
6762                 }
6763         }
6764 }
6765 impl C2Tuple_SignatureSignatureZ {
6766         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::Signature, crate::c_types::Signature) {
6767                 (self.a, self.b)
6768         }
6769 }
6770 impl Clone for C2Tuple_SignatureSignatureZ {
6771         fn clone(&self) -> Self {
6772                 Self {
6773                         a: Clone::clone(&self.a),
6774                         b: Clone::clone(&self.b),
6775                 }
6776         }
6777 }
6778 #[no_mangle]
6779 /// Creates a new tuple which has the same data as `orig`
6780 /// but with all dynamically-allocated buffers duplicated in new buffers.
6781 pub extern "C" fn C2Tuple_SignatureSignatureZ_clone(orig: &C2Tuple_SignatureSignatureZ) -> C2Tuple_SignatureSignatureZ { Clone::clone(&orig) }
6782 /// Creates a new C2Tuple_SignatureSignatureZ from the contained elements.
6783 #[no_mangle]
6784 pub extern "C" fn C2Tuple_SignatureSignatureZ_new(a: crate::c_types::Signature, b: crate::c_types::Signature) -> C2Tuple_SignatureSignatureZ {
6785         C2Tuple_SignatureSignatureZ { a, b, }
6786 }
6787
6788 #[no_mangle]
6789 /// Frees any resources used by the C2Tuple_SignatureSignatureZ.
6790 pub extern "C" fn C2Tuple_SignatureSignatureZ_free(_res: C2Tuple_SignatureSignatureZ) { }
6791 #[repr(C)]
6792 /// The contents of CResult_C2Tuple_SignatureSignatureZNoneZ
6793 pub union CResult_C2Tuple_SignatureSignatureZNoneZPtr {
6794         /// A pointer to the contents in the success state.
6795         /// Reading from this pointer when `result_ok` is not set is undefined.
6796         pub result: *mut crate::c_types::derived::C2Tuple_SignatureSignatureZ,
6797         /// Note that this value is always NULL, as there are no contents in the Err variant
6798         pub err: *mut core::ffi::c_void,
6799 }
6800 #[repr(C)]
6801 /// A CResult_C2Tuple_SignatureSignatureZNoneZ represents the result of a fallible operation,
6802 /// containing a crate::c_types::derived::C2Tuple_SignatureSignatureZ on success and a () on failure.
6803 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6804 pub struct CResult_C2Tuple_SignatureSignatureZNoneZ {
6805         /// The contents of this CResult_C2Tuple_SignatureSignatureZNoneZ, accessible via either
6806         /// `err` or `result` depending on the state of `result_ok`.
6807         pub contents: CResult_C2Tuple_SignatureSignatureZNoneZPtr,
6808         /// Whether this CResult_C2Tuple_SignatureSignatureZNoneZ represents a success state.
6809         pub result_ok: bool,
6810 }
6811 #[no_mangle]
6812 /// Creates a new CResult_C2Tuple_SignatureSignatureZNoneZ in the success state.
6813 pub extern "C" fn CResult_C2Tuple_SignatureSignatureZNoneZ_ok(o: crate::c_types::derived::C2Tuple_SignatureSignatureZ) -> CResult_C2Tuple_SignatureSignatureZNoneZ {
6814         CResult_C2Tuple_SignatureSignatureZNoneZ {
6815                 contents: CResult_C2Tuple_SignatureSignatureZNoneZPtr {
6816                         result: Box::into_raw(Box::new(o)),
6817                 },
6818                 result_ok: true,
6819         }
6820 }
6821 #[no_mangle]
6822 /// Creates a new CResult_C2Tuple_SignatureSignatureZNoneZ in the error state.
6823 pub extern "C" fn CResult_C2Tuple_SignatureSignatureZNoneZ_err() -> CResult_C2Tuple_SignatureSignatureZNoneZ {
6824         CResult_C2Tuple_SignatureSignatureZNoneZ {
6825                 contents: CResult_C2Tuple_SignatureSignatureZNoneZPtr {
6826                         err: core::ptr::null_mut(),
6827                 },
6828                 result_ok: false,
6829         }
6830 }
6831 /// Checks if the given object is currently in the success state
6832 #[no_mangle]
6833 pub extern "C" fn CResult_C2Tuple_SignatureSignatureZNoneZ_is_ok(o: &CResult_C2Tuple_SignatureSignatureZNoneZ) -> bool {
6834         o.result_ok
6835 }
6836 #[no_mangle]
6837 /// Frees any resources used by the CResult_C2Tuple_SignatureSignatureZNoneZ.
6838 pub extern "C" fn CResult_C2Tuple_SignatureSignatureZNoneZ_free(_res: CResult_C2Tuple_SignatureSignatureZNoneZ) { }
6839 impl Drop for CResult_C2Tuple_SignatureSignatureZNoneZ {
6840         fn drop(&mut self) {
6841                 if self.result_ok {
6842                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
6843                                 let _ = unsafe { Box::from_raw(self.contents.result) };
6844                         }
6845                 } else {
6846                 }
6847         }
6848 }
6849 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_SignatureSignatureZ, ()>> for CResult_C2Tuple_SignatureSignatureZNoneZ {
6850         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_SignatureSignatureZ, ()>) -> Self {
6851                 let contents = if o.result_ok {
6852                         let result = unsafe { o.contents.result };
6853                         unsafe { o.contents.result = core::ptr::null_mut() };
6854                         CResult_C2Tuple_SignatureSignatureZNoneZPtr { result }
6855                 } else {
6856                         let _ = unsafe { Box::from_raw(o.contents.err) };
6857                         o.contents.err = core::ptr::null_mut();
6858                         CResult_C2Tuple_SignatureSignatureZNoneZPtr { err: core::ptr::null_mut() }
6859                 };
6860                 Self {
6861                         contents,
6862                         result_ok: o.result_ok,
6863                 }
6864         }
6865 }
6866 impl Clone for CResult_C2Tuple_SignatureSignatureZNoneZ {
6867         fn clone(&self) -> Self {
6868                 if self.result_ok {
6869                         Self { result_ok: true, contents: CResult_C2Tuple_SignatureSignatureZNoneZPtr {
6870                                 result: Box::into_raw(Box::new(<crate::c_types::derived::C2Tuple_SignatureSignatureZ>::clone(unsafe { &*self.contents.result })))
6871                         } }
6872                 } else {
6873                         Self { result_ok: false, contents: CResult_C2Tuple_SignatureSignatureZNoneZPtr {
6874                                 err: core::ptr::null_mut()
6875                         } }
6876                 }
6877         }
6878 }
6879 #[no_mangle]
6880 /// Creates a new CResult_C2Tuple_SignatureSignatureZNoneZ which has the same data as `orig`
6881 /// but with all dynamically-allocated buffers duplicated in new buffers.
6882 pub extern "C" fn CResult_C2Tuple_SignatureSignatureZNoneZ_clone(orig: &CResult_C2Tuple_SignatureSignatureZNoneZ) -> CResult_C2Tuple_SignatureSignatureZNoneZ { Clone::clone(&orig) }
6883 #[repr(C)]
6884 /// The contents of CResult_SecretKeyNoneZ
6885 pub union CResult_SecretKeyNoneZPtr {
6886         /// A pointer to the contents in the success state.
6887         /// Reading from this pointer when `result_ok` is not set is undefined.
6888         pub result: *mut crate::c_types::SecretKey,
6889         /// Note that this value is always NULL, as there are no contents in the Err variant
6890         pub err: *mut core::ffi::c_void,
6891 }
6892 #[repr(C)]
6893 /// A CResult_SecretKeyNoneZ represents the result of a fallible operation,
6894 /// containing a crate::c_types::SecretKey on success and a () on failure.
6895 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6896 pub struct CResult_SecretKeyNoneZ {
6897         /// The contents of this CResult_SecretKeyNoneZ, accessible via either
6898         /// `err` or `result` depending on the state of `result_ok`.
6899         pub contents: CResult_SecretKeyNoneZPtr,
6900         /// Whether this CResult_SecretKeyNoneZ represents a success state.
6901         pub result_ok: bool,
6902 }
6903 #[no_mangle]
6904 /// Creates a new CResult_SecretKeyNoneZ in the success state.
6905 pub extern "C" fn CResult_SecretKeyNoneZ_ok(o: crate::c_types::SecretKey) -> CResult_SecretKeyNoneZ {
6906         CResult_SecretKeyNoneZ {
6907                 contents: CResult_SecretKeyNoneZPtr {
6908                         result: Box::into_raw(Box::new(o)),
6909                 },
6910                 result_ok: true,
6911         }
6912 }
6913 #[no_mangle]
6914 /// Creates a new CResult_SecretKeyNoneZ in the error state.
6915 pub extern "C" fn CResult_SecretKeyNoneZ_err() -> CResult_SecretKeyNoneZ {
6916         CResult_SecretKeyNoneZ {
6917                 contents: CResult_SecretKeyNoneZPtr {
6918                         err: core::ptr::null_mut(),
6919                 },
6920                 result_ok: false,
6921         }
6922 }
6923 /// Checks if the given object is currently in the success state
6924 #[no_mangle]
6925 pub extern "C" fn CResult_SecretKeyNoneZ_is_ok(o: &CResult_SecretKeyNoneZ) -> bool {
6926         o.result_ok
6927 }
6928 #[no_mangle]
6929 /// Frees any resources used by the CResult_SecretKeyNoneZ.
6930 pub extern "C" fn CResult_SecretKeyNoneZ_free(_res: CResult_SecretKeyNoneZ) { }
6931 impl Drop for CResult_SecretKeyNoneZ {
6932         fn drop(&mut self) {
6933                 if self.result_ok {
6934                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
6935                                 let _ = unsafe { Box::from_raw(self.contents.result) };
6936                         }
6937                 } else {
6938                 }
6939         }
6940 }
6941 impl From<crate::c_types::CResultTempl<crate::c_types::SecretKey, ()>> for CResult_SecretKeyNoneZ {
6942         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::SecretKey, ()>) -> Self {
6943                 let contents = if o.result_ok {
6944                         let result = unsafe { o.contents.result };
6945                         unsafe { o.contents.result = core::ptr::null_mut() };
6946                         CResult_SecretKeyNoneZPtr { result }
6947                 } else {
6948                         let _ = unsafe { Box::from_raw(o.contents.err) };
6949                         o.contents.err = core::ptr::null_mut();
6950                         CResult_SecretKeyNoneZPtr { err: core::ptr::null_mut() }
6951                 };
6952                 Self {
6953                         contents,
6954                         result_ok: o.result_ok,
6955                 }
6956         }
6957 }
6958 impl Clone for CResult_SecretKeyNoneZ {
6959         fn clone(&self) -> Self {
6960                 if self.result_ok {
6961                         Self { result_ok: true, contents: CResult_SecretKeyNoneZPtr {
6962                                 result: Box::into_raw(Box::new(<crate::c_types::SecretKey>::clone(unsafe { &*self.contents.result })))
6963                         } }
6964                 } else {
6965                         Self { result_ok: false, contents: CResult_SecretKeyNoneZPtr {
6966                                 err: core::ptr::null_mut()
6967                         } }
6968                 }
6969         }
6970 }
6971 #[no_mangle]
6972 /// Creates a new CResult_SecretKeyNoneZ which has the same data as `orig`
6973 /// but with all dynamically-allocated buffers duplicated in new buffers.
6974 pub extern "C" fn CResult_SecretKeyNoneZ_clone(orig: &CResult_SecretKeyNoneZ) -> CResult_SecretKeyNoneZ { Clone::clone(&orig) }
6975 #[repr(C)]
6976 /// The contents of CResult_PublicKeyNoneZ
6977 pub union CResult_PublicKeyNoneZPtr {
6978         /// A pointer to the contents in the success state.
6979         /// Reading from this pointer when `result_ok` is not set is undefined.
6980         pub result: *mut crate::c_types::PublicKey,
6981         /// Note that this value is always NULL, as there are no contents in the Err variant
6982         pub err: *mut core::ffi::c_void,
6983 }
6984 #[repr(C)]
6985 /// A CResult_PublicKeyNoneZ represents the result of a fallible operation,
6986 /// containing a crate::c_types::PublicKey on success and a () on failure.
6987 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6988 pub struct CResult_PublicKeyNoneZ {
6989         /// The contents of this CResult_PublicKeyNoneZ, accessible via either
6990         /// `err` or `result` depending on the state of `result_ok`.
6991         pub contents: CResult_PublicKeyNoneZPtr,
6992         /// Whether this CResult_PublicKeyNoneZ represents a success state.
6993         pub result_ok: bool,
6994 }
6995 #[no_mangle]
6996 /// Creates a new CResult_PublicKeyNoneZ in the success state.
6997 pub extern "C" fn CResult_PublicKeyNoneZ_ok(o: crate::c_types::PublicKey) -> CResult_PublicKeyNoneZ {
6998         CResult_PublicKeyNoneZ {
6999                 contents: CResult_PublicKeyNoneZPtr {
7000                         result: Box::into_raw(Box::new(o)),
7001                 },
7002                 result_ok: true,
7003         }
7004 }
7005 #[no_mangle]
7006 /// Creates a new CResult_PublicKeyNoneZ in the error state.
7007 pub extern "C" fn CResult_PublicKeyNoneZ_err() -> CResult_PublicKeyNoneZ {
7008         CResult_PublicKeyNoneZ {
7009                 contents: CResult_PublicKeyNoneZPtr {
7010                         err: core::ptr::null_mut(),
7011                 },
7012                 result_ok: false,
7013         }
7014 }
7015 /// Checks if the given object is currently in the success state
7016 #[no_mangle]
7017 pub extern "C" fn CResult_PublicKeyNoneZ_is_ok(o: &CResult_PublicKeyNoneZ) -> bool {
7018         o.result_ok
7019 }
7020 #[no_mangle]
7021 /// Frees any resources used by the CResult_PublicKeyNoneZ.
7022 pub extern "C" fn CResult_PublicKeyNoneZ_free(_res: CResult_PublicKeyNoneZ) { }
7023 impl Drop for CResult_PublicKeyNoneZ {
7024         fn drop(&mut self) {
7025                 if self.result_ok {
7026                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
7027                                 let _ = unsafe { Box::from_raw(self.contents.result) };
7028                         }
7029                 } else {
7030                 }
7031         }
7032 }
7033 impl From<crate::c_types::CResultTempl<crate::c_types::PublicKey, ()>> for CResult_PublicKeyNoneZ {
7034         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::PublicKey, ()>) -> Self {
7035                 let contents = if o.result_ok {
7036                         let result = unsafe { o.contents.result };
7037                         unsafe { o.contents.result = core::ptr::null_mut() };
7038                         CResult_PublicKeyNoneZPtr { result }
7039                 } else {
7040                         let _ = unsafe { Box::from_raw(o.contents.err) };
7041                         o.contents.err = core::ptr::null_mut();
7042                         CResult_PublicKeyNoneZPtr { err: core::ptr::null_mut() }
7043                 };
7044                 Self {
7045                         contents,
7046                         result_ok: o.result_ok,
7047                 }
7048         }
7049 }
7050 impl Clone for CResult_PublicKeyNoneZ {
7051         fn clone(&self) -> Self {
7052                 if self.result_ok {
7053                         Self { result_ok: true, contents: CResult_PublicKeyNoneZPtr {
7054                                 result: Box::into_raw(Box::new(<crate::c_types::PublicKey>::clone(unsafe { &*self.contents.result })))
7055                         } }
7056                 } else {
7057                         Self { result_ok: false, contents: CResult_PublicKeyNoneZPtr {
7058                                 err: core::ptr::null_mut()
7059                         } }
7060                 }
7061         }
7062 }
7063 #[no_mangle]
7064 /// Creates a new CResult_PublicKeyNoneZ which has the same data as `orig`
7065 /// but with all dynamically-allocated buffers duplicated in new buffers.
7066 pub extern "C" fn CResult_PublicKeyNoneZ_clone(orig: &CResult_PublicKeyNoneZ) -> CResult_PublicKeyNoneZ { Clone::clone(&orig) }
7067 #[repr(C)]
7068 /// An enum which can either contain a crate::c_types::BigEndianScalar or not
7069 pub enum COption_ScalarZ {
7070         /// When we're in this state, this COption_ScalarZ contains a crate::c_types::BigEndianScalar
7071         Some(crate::c_types::BigEndianScalar),
7072         /// When we're in this state, this COption_ScalarZ contains nothing
7073         None
7074 }
7075 impl COption_ScalarZ {
7076         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
7077                 if let Self::None = self { false } else { true }
7078         }
7079         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
7080                 !self.is_some()
7081         }
7082         #[allow(unused)] pub(crate) fn take(mut self) -> crate::c_types::BigEndianScalar {
7083                 if let Self::Some(v) = self { v } else { unreachable!() }
7084         }
7085 }
7086 #[no_mangle]
7087 /// Constructs a new COption_ScalarZ containing a crate::c_types::BigEndianScalar
7088 pub extern "C" fn COption_ScalarZ_some(o: crate::c_types::BigEndianScalar) -> COption_ScalarZ {
7089         COption_ScalarZ::Some(o)
7090 }
7091 #[no_mangle]
7092 /// Constructs a new COption_ScalarZ containing nothing
7093 pub extern "C" fn COption_ScalarZ_none() -> COption_ScalarZ {
7094         COption_ScalarZ::None
7095 }
7096 #[no_mangle]
7097 /// Frees any resources associated with the crate::c_types::BigEndianScalar, if we are in the Some state
7098 pub extern "C" fn COption_ScalarZ_free(_res: COption_ScalarZ) { }
7099 #[repr(C)]
7100 /// The contents of CResult_SharedSecretNoneZ
7101 pub union CResult_SharedSecretNoneZPtr {
7102         /// A pointer to the contents in the success state.
7103         /// Reading from this pointer when `result_ok` is not set is undefined.
7104         pub result: *mut crate::c_types::ThirtyTwoBytes,
7105         /// Note that this value is always NULL, as there are no contents in the Err variant
7106         pub err: *mut core::ffi::c_void,
7107 }
7108 #[repr(C)]
7109 /// A CResult_SharedSecretNoneZ represents the result of a fallible operation,
7110 /// containing a crate::c_types::ThirtyTwoBytes on success and a () on failure.
7111 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7112 pub struct CResult_SharedSecretNoneZ {
7113         /// The contents of this CResult_SharedSecretNoneZ, accessible via either
7114         /// `err` or `result` depending on the state of `result_ok`.
7115         pub contents: CResult_SharedSecretNoneZPtr,
7116         /// Whether this CResult_SharedSecretNoneZ represents a success state.
7117         pub result_ok: bool,
7118 }
7119 #[no_mangle]
7120 /// Creates a new CResult_SharedSecretNoneZ in the success state.
7121 pub extern "C" fn CResult_SharedSecretNoneZ_ok(o: crate::c_types::ThirtyTwoBytes) -> CResult_SharedSecretNoneZ {
7122         CResult_SharedSecretNoneZ {
7123                 contents: CResult_SharedSecretNoneZPtr {
7124                         result: Box::into_raw(Box::new(o)),
7125                 },
7126                 result_ok: true,
7127         }
7128 }
7129 #[no_mangle]
7130 /// Creates a new CResult_SharedSecretNoneZ in the error state.
7131 pub extern "C" fn CResult_SharedSecretNoneZ_err() -> CResult_SharedSecretNoneZ {
7132         CResult_SharedSecretNoneZ {
7133                 contents: CResult_SharedSecretNoneZPtr {
7134                         err: core::ptr::null_mut(),
7135                 },
7136                 result_ok: false,
7137         }
7138 }
7139 /// Checks if the given object is currently in the success state
7140 #[no_mangle]
7141 pub extern "C" fn CResult_SharedSecretNoneZ_is_ok(o: &CResult_SharedSecretNoneZ) -> bool {
7142         o.result_ok
7143 }
7144 #[no_mangle]
7145 /// Frees any resources used by the CResult_SharedSecretNoneZ.
7146 pub extern "C" fn CResult_SharedSecretNoneZ_free(_res: CResult_SharedSecretNoneZ) { }
7147 impl Drop for CResult_SharedSecretNoneZ {
7148         fn drop(&mut self) {
7149                 if self.result_ok {
7150                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
7151                                 let _ = unsafe { Box::from_raw(self.contents.result) };
7152                         }
7153                 } else {
7154                 }
7155         }
7156 }
7157 impl From<crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, ()>> for CResult_SharedSecretNoneZ {
7158         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, ()>) -> Self {
7159                 let contents = if o.result_ok {
7160                         let result = unsafe { o.contents.result };
7161                         unsafe { o.contents.result = core::ptr::null_mut() };
7162                         CResult_SharedSecretNoneZPtr { result }
7163                 } else {
7164                         let _ = unsafe { Box::from_raw(o.contents.err) };
7165                         o.contents.err = core::ptr::null_mut();
7166                         CResult_SharedSecretNoneZPtr { err: core::ptr::null_mut() }
7167                 };
7168                 Self {
7169                         contents,
7170                         result_ok: o.result_ok,
7171                 }
7172         }
7173 }
7174 impl Clone for CResult_SharedSecretNoneZ {
7175         fn clone(&self) -> Self {
7176                 if self.result_ok {
7177                         Self { result_ok: true, contents: CResult_SharedSecretNoneZPtr {
7178                                 result: Box::into_raw(Box::new(<crate::c_types::ThirtyTwoBytes>::clone(unsafe { &*self.contents.result })))
7179                         } }
7180                 } else {
7181                         Self { result_ok: false, contents: CResult_SharedSecretNoneZPtr {
7182                                 err: core::ptr::null_mut()
7183                         } }
7184                 }
7185         }
7186 }
7187 #[no_mangle]
7188 /// Creates a new CResult_SharedSecretNoneZ which has the same data as `orig`
7189 /// but with all dynamically-allocated buffers duplicated in new buffers.
7190 pub extern "C" fn CResult_SharedSecretNoneZ_clone(orig: &CResult_SharedSecretNoneZ) -> CResult_SharedSecretNoneZ { Clone::clone(&orig) }
7191 #[repr(C)]
7192 /// The contents of CResult_SignDecodeErrorZ
7193 pub union CResult_SignDecodeErrorZPtr {
7194         /// A pointer to the contents in the success state.
7195         /// Reading from this pointer when `result_ok` is not set is undefined.
7196         pub result: *mut crate::lightning::chain::keysinterface::Sign,
7197         /// A pointer to the contents in the error state.
7198         /// Reading from this pointer when `result_ok` is set is undefined.
7199         pub err: *mut crate::lightning::ln::msgs::DecodeError,
7200 }
7201 #[repr(C)]
7202 /// A CResult_SignDecodeErrorZ represents the result of a fallible operation,
7203 /// containing a crate::lightning::chain::keysinterface::Sign on success and a crate::lightning::ln::msgs::DecodeError on failure.
7204 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7205 pub struct CResult_SignDecodeErrorZ {
7206         /// The contents of this CResult_SignDecodeErrorZ, accessible via either
7207         /// `err` or `result` depending on the state of `result_ok`.
7208         pub contents: CResult_SignDecodeErrorZPtr,
7209         /// Whether this CResult_SignDecodeErrorZ represents a success state.
7210         pub result_ok: bool,
7211 }
7212 #[no_mangle]
7213 /// Creates a new CResult_SignDecodeErrorZ in the success state.
7214 pub extern "C" fn CResult_SignDecodeErrorZ_ok(o: crate::lightning::chain::keysinterface::Sign) -> CResult_SignDecodeErrorZ {
7215         CResult_SignDecodeErrorZ {
7216                 contents: CResult_SignDecodeErrorZPtr {
7217                         result: Box::into_raw(Box::new(o)),
7218                 },
7219                 result_ok: true,
7220         }
7221 }
7222 #[no_mangle]
7223 /// Creates a new CResult_SignDecodeErrorZ in the error state.
7224 pub extern "C" fn CResult_SignDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_SignDecodeErrorZ {
7225         CResult_SignDecodeErrorZ {
7226                 contents: CResult_SignDecodeErrorZPtr {
7227                         err: Box::into_raw(Box::new(e)),
7228                 },
7229                 result_ok: false,
7230         }
7231 }
7232 /// Checks if the given object is currently in the success state
7233 #[no_mangle]
7234 pub extern "C" fn CResult_SignDecodeErrorZ_is_ok(o: &CResult_SignDecodeErrorZ) -> bool {
7235         o.result_ok
7236 }
7237 #[no_mangle]
7238 /// Frees any resources used by the CResult_SignDecodeErrorZ.
7239 pub extern "C" fn CResult_SignDecodeErrorZ_free(_res: CResult_SignDecodeErrorZ) { }
7240 impl Drop for CResult_SignDecodeErrorZ {
7241         fn drop(&mut self) {
7242                 if self.result_ok {
7243                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
7244                                 let _ = unsafe { Box::from_raw(self.contents.result) };
7245                         }
7246                 } else {
7247                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
7248                                 let _ = unsafe { Box::from_raw(self.contents.err) };
7249                         }
7250                 }
7251         }
7252 }
7253 impl From<crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::Sign, crate::lightning::ln::msgs::DecodeError>> for CResult_SignDecodeErrorZ {
7254         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::Sign, crate::lightning::ln::msgs::DecodeError>) -> Self {
7255                 let contents = if o.result_ok {
7256                         let result = unsafe { o.contents.result };
7257                         unsafe { o.contents.result = core::ptr::null_mut() };
7258                         CResult_SignDecodeErrorZPtr { result }
7259                 } else {
7260                         let err = unsafe { o.contents.err };
7261                         unsafe { o.contents.err = core::ptr::null_mut(); }
7262                         CResult_SignDecodeErrorZPtr { err }
7263                 };
7264                 Self {
7265                         contents,
7266                         result_ok: o.result_ok,
7267                 }
7268         }
7269 }
7270 impl Clone for CResult_SignDecodeErrorZ {
7271         fn clone(&self) -> Self {
7272                 if self.result_ok {
7273                         Self { result_ok: true, contents: CResult_SignDecodeErrorZPtr {
7274                                 result: Box::into_raw(Box::new(<crate::lightning::chain::keysinterface::Sign>::clone(unsafe { &*self.contents.result })))
7275                         } }
7276                 } else {
7277                         Self { result_ok: false, contents: CResult_SignDecodeErrorZPtr {
7278                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
7279                         } }
7280                 }
7281         }
7282 }
7283 #[no_mangle]
7284 /// Creates a new CResult_SignDecodeErrorZ which has the same data as `orig`
7285 /// but with all dynamically-allocated buffers duplicated in new buffers.
7286 pub extern "C" fn CResult_SignDecodeErrorZ_clone(orig: &CResult_SignDecodeErrorZ) -> CResult_SignDecodeErrorZ { Clone::clone(&orig) }
7287 #[repr(C)]
7288 /// A dynamically-allocated array of crate::c_types::u5s of arbitrary size.
7289 /// This corresponds to std::vector in C++
7290 pub struct CVec_u5Z {
7291         /// The elements in the array.
7292         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
7293         pub data: *mut crate::c_types::u5,
7294         /// The number of elements pointed to by `data`.
7295         pub datalen: usize
7296 }
7297 impl CVec_u5Z {
7298         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::u5> {
7299                 if self.datalen == 0 { return Vec::new(); }
7300                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
7301                 self.data = core::ptr::null_mut();
7302                 self.datalen = 0;
7303                 ret
7304         }
7305         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::u5] {
7306                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
7307         }
7308 }
7309 impl From<Vec<crate::c_types::u5>> for CVec_u5Z {
7310         fn from(v: Vec<crate::c_types::u5>) -> Self {
7311                 let datalen = v.len();
7312                 let data = Box::into_raw(v.into_boxed_slice());
7313                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
7314         }
7315 }
7316 #[no_mangle]
7317 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
7318 pub extern "C" fn CVec_u5Z_free(_res: CVec_u5Z) { }
7319 impl Drop for CVec_u5Z {
7320         fn drop(&mut self) {
7321                 if self.datalen == 0 { return; }
7322                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
7323         }
7324 }
7325 impl Clone for CVec_u5Z {
7326         fn clone(&self) -> Self {
7327                 let mut res = Vec::new();
7328                 if self.datalen == 0 { return Self::from(res); }
7329                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
7330                 Self::from(res)
7331         }
7332 }
7333 #[repr(C)]
7334 /// The contents of CResult_RecoverableSignatureNoneZ
7335 pub union CResult_RecoverableSignatureNoneZPtr {
7336         /// A pointer to the contents in the success state.
7337         /// Reading from this pointer when `result_ok` is not set is undefined.
7338         pub result: *mut crate::c_types::RecoverableSignature,
7339         /// Note that this value is always NULL, as there are no contents in the Err variant
7340         pub err: *mut core::ffi::c_void,
7341 }
7342 #[repr(C)]
7343 /// A CResult_RecoverableSignatureNoneZ represents the result of a fallible operation,
7344 /// containing a crate::c_types::RecoverableSignature on success and a () on failure.
7345 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7346 pub struct CResult_RecoverableSignatureNoneZ {
7347         /// The contents of this CResult_RecoverableSignatureNoneZ, accessible via either
7348         /// `err` or `result` depending on the state of `result_ok`.
7349         pub contents: CResult_RecoverableSignatureNoneZPtr,
7350         /// Whether this CResult_RecoverableSignatureNoneZ represents a success state.
7351         pub result_ok: bool,
7352 }
7353 #[no_mangle]
7354 /// Creates a new CResult_RecoverableSignatureNoneZ in the success state.
7355 pub extern "C" fn CResult_RecoverableSignatureNoneZ_ok(o: crate::c_types::RecoverableSignature) -> CResult_RecoverableSignatureNoneZ {
7356         CResult_RecoverableSignatureNoneZ {
7357                 contents: CResult_RecoverableSignatureNoneZPtr {
7358                         result: Box::into_raw(Box::new(o)),
7359                 },
7360                 result_ok: true,
7361         }
7362 }
7363 #[no_mangle]
7364 /// Creates a new CResult_RecoverableSignatureNoneZ in the error state.
7365 pub extern "C" fn CResult_RecoverableSignatureNoneZ_err() -> CResult_RecoverableSignatureNoneZ {
7366         CResult_RecoverableSignatureNoneZ {
7367                 contents: CResult_RecoverableSignatureNoneZPtr {
7368                         err: core::ptr::null_mut(),
7369                 },
7370                 result_ok: false,
7371         }
7372 }
7373 /// Checks if the given object is currently in the success state
7374 #[no_mangle]
7375 pub extern "C" fn CResult_RecoverableSignatureNoneZ_is_ok(o: &CResult_RecoverableSignatureNoneZ) -> bool {
7376         o.result_ok
7377 }
7378 #[no_mangle]
7379 /// Frees any resources used by the CResult_RecoverableSignatureNoneZ.
7380 pub extern "C" fn CResult_RecoverableSignatureNoneZ_free(_res: CResult_RecoverableSignatureNoneZ) { }
7381 impl Drop for CResult_RecoverableSignatureNoneZ {
7382         fn drop(&mut self) {
7383                 if self.result_ok {
7384                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
7385                                 let _ = unsafe { Box::from_raw(self.contents.result) };
7386                         }
7387                 } else {
7388                 }
7389         }
7390 }
7391 impl From<crate::c_types::CResultTempl<crate::c_types::RecoverableSignature, ()>> for CResult_RecoverableSignatureNoneZ {
7392         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::RecoverableSignature, ()>) -> Self {
7393                 let contents = if o.result_ok {
7394                         let result = unsafe { o.contents.result };
7395                         unsafe { o.contents.result = core::ptr::null_mut() };
7396                         CResult_RecoverableSignatureNoneZPtr { result }
7397                 } else {
7398                         let _ = unsafe { Box::from_raw(o.contents.err) };
7399                         o.contents.err = core::ptr::null_mut();
7400                         CResult_RecoverableSignatureNoneZPtr { err: core::ptr::null_mut() }
7401                 };
7402                 Self {
7403                         contents,
7404                         result_ok: o.result_ok,
7405                 }
7406         }
7407 }
7408 impl Clone for CResult_RecoverableSignatureNoneZ {
7409         fn clone(&self) -> Self {
7410                 if self.result_ok {
7411                         Self { result_ok: true, contents: CResult_RecoverableSignatureNoneZPtr {
7412                                 result: Box::into_raw(Box::new(<crate::c_types::RecoverableSignature>::clone(unsafe { &*self.contents.result })))
7413                         } }
7414                 } else {
7415                         Self { result_ok: false, contents: CResult_RecoverableSignatureNoneZPtr {
7416                                 err: core::ptr::null_mut()
7417                         } }
7418                 }
7419         }
7420 }
7421 #[no_mangle]
7422 /// Creates a new CResult_RecoverableSignatureNoneZ which has the same data as `orig`
7423 /// but with all dynamically-allocated buffers duplicated in new buffers.
7424 pub extern "C" fn CResult_RecoverableSignatureNoneZ_clone(orig: &CResult_RecoverableSignatureNoneZ) -> CResult_RecoverableSignatureNoneZ { Clone::clone(&orig) }
7425 #[repr(C)]
7426 /// A dynamically-allocated array of u8s of arbitrary size.
7427 /// This corresponds to std::vector in C++
7428 pub struct CVec_u8Z {
7429         /// The elements in the array.
7430         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
7431         pub data: *mut u8,
7432         /// The number of elements pointed to by `data`.
7433         pub datalen: usize
7434 }
7435 impl CVec_u8Z {
7436         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<u8> {
7437                 if self.datalen == 0 { return Vec::new(); }
7438                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
7439                 self.data = core::ptr::null_mut();
7440                 self.datalen = 0;
7441                 ret
7442         }
7443         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[u8] {
7444                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
7445         }
7446 }
7447 impl From<Vec<u8>> for CVec_u8Z {
7448         fn from(v: Vec<u8>) -> Self {
7449                 let datalen = v.len();
7450                 let data = Box::into_raw(v.into_boxed_slice());
7451                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
7452         }
7453 }
7454 #[no_mangle]
7455 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
7456 pub extern "C" fn CVec_u8Z_free(_res: CVec_u8Z) { }
7457 impl Drop for CVec_u8Z {
7458         fn drop(&mut self) {
7459                 if self.datalen == 0 { return; }
7460                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
7461         }
7462 }
7463 impl Clone for CVec_u8Z {
7464         fn clone(&self) -> Self {
7465                 let mut res = Vec::new();
7466                 if self.datalen == 0 { return Self::from(res); }
7467                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
7468                 Self::from(res)
7469         }
7470 }
7471 #[repr(C)]
7472 /// A dynamically-allocated array of crate::c_types::derived::CVec_u8Zs of arbitrary size.
7473 /// This corresponds to std::vector in C++
7474 pub struct CVec_CVec_u8ZZ {
7475         /// The elements in the array.
7476         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
7477         pub data: *mut crate::c_types::derived::CVec_u8Z,
7478         /// The number of elements pointed to by `data`.
7479         pub datalen: usize
7480 }
7481 impl CVec_CVec_u8ZZ {
7482         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::CVec_u8Z> {
7483                 if self.datalen == 0 { return Vec::new(); }
7484                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
7485                 self.data = core::ptr::null_mut();
7486                 self.datalen = 0;
7487                 ret
7488         }
7489         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::CVec_u8Z] {
7490                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
7491         }
7492 }
7493 impl From<Vec<crate::c_types::derived::CVec_u8Z>> for CVec_CVec_u8ZZ {
7494         fn from(v: Vec<crate::c_types::derived::CVec_u8Z>) -> Self {
7495                 let datalen = v.len();
7496                 let data = Box::into_raw(v.into_boxed_slice());
7497                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
7498         }
7499 }
7500 #[no_mangle]
7501 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
7502 pub extern "C" fn CVec_CVec_u8ZZ_free(_res: CVec_CVec_u8ZZ) { }
7503 impl Drop for CVec_CVec_u8ZZ {
7504         fn drop(&mut self) {
7505                 if self.datalen == 0 { return; }
7506                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
7507         }
7508 }
7509 impl Clone for CVec_CVec_u8ZZ {
7510         fn clone(&self) -> Self {
7511                 let mut res = Vec::new();
7512                 if self.datalen == 0 { return Self::from(res); }
7513                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
7514                 Self::from(res)
7515         }
7516 }
7517 #[repr(C)]
7518 /// The contents of CResult_CVec_CVec_u8ZZNoneZ
7519 pub union CResult_CVec_CVec_u8ZZNoneZPtr {
7520         /// A pointer to the contents in the success state.
7521         /// Reading from this pointer when `result_ok` is not set is undefined.
7522         pub result: *mut crate::c_types::derived::CVec_CVec_u8ZZ,
7523         /// Note that this value is always NULL, as there are no contents in the Err variant
7524         pub err: *mut core::ffi::c_void,
7525 }
7526 #[repr(C)]
7527 /// A CResult_CVec_CVec_u8ZZNoneZ represents the result of a fallible operation,
7528 /// containing a crate::c_types::derived::CVec_CVec_u8ZZ on success and a () on failure.
7529 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7530 pub struct CResult_CVec_CVec_u8ZZNoneZ {
7531         /// The contents of this CResult_CVec_CVec_u8ZZNoneZ, accessible via either
7532         /// `err` or `result` depending on the state of `result_ok`.
7533         pub contents: CResult_CVec_CVec_u8ZZNoneZPtr,
7534         /// Whether this CResult_CVec_CVec_u8ZZNoneZ represents a success state.
7535         pub result_ok: bool,
7536 }
7537 #[no_mangle]
7538 /// Creates a new CResult_CVec_CVec_u8ZZNoneZ in the success state.
7539 pub extern "C" fn CResult_CVec_CVec_u8ZZNoneZ_ok(o: crate::c_types::derived::CVec_CVec_u8ZZ) -> CResult_CVec_CVec_u8ZZNoneZ {
7540         CResult_CVec_CVec_u8ZZNoneZ {
7541                 contents: CResult_CVec_CVec_u8ZZNoneZPtr {
7542                         result: Box::into_raw(Box::new(o)),
7543                 },
7544                 result_ok: true,
7545         }
7546 }
7547 #[no_mangle]
7548 /// Creates a new CResult_CVec_CVec_u8ZZNoneZ in the error state.
7549 pub extern "C" fn CResult_CVec_CVec_u8ZZNoneZ_err() -> CResult_CVec_CVec_u8ZZNoneZ {
7550         CResult_CVec_CVec_u8ZZNoneZ {
7551                 contents: CResult_CVec_CVec_u8ZZNoneZPtr {
7552                         err: core::ptr::null_mut(),
7553                 },
7554                 result_ok: false,
7555         }
7556 }
7557 /// Checks if the given object is currently in the success state
7558 #[no_mangle]
7559 pub extern "C" fn CResult_CVec_CVec_u8ZZNoneZ_is_ok(o: &CResult_CVec_CVec_u8ZZNoneZ) -> bool {
7560         o.result_ok
7561 }
7562 #[no_mangle]
7563 /// Frees any resources used by the CResult_CVec_CVec_u8ZZNoneZ.
7564 pub extern "C" fn CResult_CVec_CVec_u8ZZNoneZ_free(_res: CResult_CVec_CVec_u8ZZNoneZ) { }
7565 impl Drop for CResult_CVec_CVec_u8ZZNoneZ {
7566         fn drop(&mut self) {
7567                 if self.result_ok {
7568                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
7569                                 let _ = unsafe { Box::from_raw(self.contents.result) };
7570                         }
7571                 } else {
7572                 }
7573         }
7574 }
7575 impl From<crate::c_types::CResultTempl<crate::c_types::derived::CVec_CVec_u8ZZ, ()>> for CResult_CVec_CVec_u8ZZNoneZ {
7576         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CVec_CVec_u8ZZ, ()>) -> Self {
7577                 let contents = if o.result_ok {
7578                         let result = unsafe { o.contents.result };
7579                         unsafe { o.contents.result = core::ptr::null_mut() };
7580                         CResult_CVec_CVec_u8ZZNoneZPtr { result }
7581                 } else {
7582                         let _ = unsafe { Box::from_raw(o.contents.err) };
7583                         o.contents.err = core::ptr::null_mut();
7584                         CResult_CVec_CVec_u8ZZNoneZPtr { err: core::ptr::null_mut() }
7585                 };
7586                 Self {
7587                         contents,
7588                         result_ok: o.result_ok,
7589                 }
7590         }
7591 }
7592 impl Clone for CResult_CVec_CVec_u8ZZNoneZ {
7593         fn clone(&self) -> Self {
7594                 if self.result_ok {
7595                         Self { result_ok: true, contents: CResult_CVec_CVec_u8ZZNoneZPtr {
7596                                 result: Box::into_raw(Box::new(<crate::c_types::derived::CVec_CVec_u8ZZ>::clone(unsafe { &*self.contents.result })))
7597                         } }
7598                 } else {
7599                         Self { result_ok: false, contents: CResult_CVec_CVec_u8ZZNoneZPtr {
7600                                 err: core::ptr::null_mut()
7601                         } }
7602                 }
7603         }
7604 }
7605 #[no_mangle]
7606 /// Creates a new CResult_CVec_CVec_u8ZZNoneZ which has the same data as `orig`
7607 /// but with all dynamically-allocated buffers duplicated in new buffers.
7608 pub extern "C" fn CResult_CVec_CVec_u8ZZNoneZ_clone(orig: &CResult_CVec_CVec_u8ZZNoneZ) -> CResult_CVec_CVec_u8ZZNoneZ { Clone::clone(&orig) }
7609 #[repr(C)]
7610 /// The contents of CResult_InMemorySignerDecodeErrorZ
7611 pub union CResult_InMemorySignerDecodeErrorZPtr {
7612         /// A pointer to the contents in the success state.
7613         /// Reading from this pointer when `result_ok` is not set is undefined.
7614         pub result: *mut crate::lightning::chain::keysinterface::InMemorySigner,
7615         /// A pointer to the contents in the error state.
7616         /// Reading from this pointer when `result_ok` is set is undefined.
7617         pub err: *mut crate::lightning::ln::msgs::DecodeError,
7618 }
7619 #[repr(C)]
7620 /// A CResult_InMemorySignerDecodeErrorZ represents the result of a fallible operation,
7621 /// containing a crate::lightning::chain::keysinterface::InMemorySigner on success and a crate::lightning::ln::msgs::DecodeError on failure.
7622 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7623 pub struct CResult_InMemorySignerDecodeErrorZ {
7624         /// The contents of this CResult_InMemorySignerDecodeErrorZ, accessible via either
7625         /// `err` or `result` depending on the state of `result_ok`.
7626         pub contents: CResult_InMemorySignerDecodeErrorZPtr,
7627         /// Whether this CResult_InMemorySignerDecodeErrorZ represents a success state.
7628         pub result_ok: bool,
7629 }
7630 #[no_mangle]
7631 /// Creates a new CResult_InMemorySignerDecodeErrorZ in the success state.
7632 pub extern "C" fn CResult_InMemorySignerDecodeErrorZ_ok(o: crate::lightning::chain::keysinterface::InMemorySigner) -> CResult_InMemorySignerDecodeErrorZ {
7633         CResult_InMemorySignerDecodeErrorZ {
7634                 contents: CResult_InMemorySignerDecodeErrorZPtr {
7635                         result: Box::into_raw(Box::new(o)),
7636                 },
7637                 result_ok: true,
7638         }
7639 }
7640 #[no_mangle]
7641 /// Creates a new CResult_InMemorySignerDecodeErrorZ in the error state.
7642 pub extern "C" fn CResult_InMemorySignerDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_InMemorySignerDecodeErrorZ {
7643         CResult_InMemorySignerDecodeErrorZ {
7644                 contents: CResult_InMemorySignerDecodeErrorZPtr {
7645                         err: Box::into_raw(Box::new(e)),
7646                 },
7647                 result_ok: false,
7648         }
7649 }
7650 /// Checks if the given object is currently in the success state
7651 #[no_mangle]
7652 pub extern "C" fn CResult_InMemorySignerDecodeErrorZ_is_ok(o: &CResult_InMemorySignerDecodeErrorZ) -> bool {
7653         o.result_ok
7654 }
7655 #[no_mangle]
7656 /// Frees any resources used by the CResult_InMemorySignerDecodeErrorZ.
7657 pub extern "C" fn CResult_InMemorySignerDecodeErrorZ_free(_res: CResult_InMemorySignerDecodeErrorZ) { }
7658 impl Drop for CResult_InMemorySignerDecodeErrorZ {
7659         fn drop(&mut self) {
7660                 if self.result_ok {
7661                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
7662                                 let _ = unsafe { Box::from_raw(self.contents.result) };
7663                         }
7664                 } else {
7665                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
7666                                 let _ = unsafe { Box::from_raw(self.contents.err) };
7667                         }
7668                 }
7669         }
7670 }
7671 impl From<crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::InMemorySigner, crate::lightning::ln::msgs::DecodeError>> for CResult_InMemorySignerDecodeErrorZ {
7672         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::InMemorySigner, crate::lightning::ln::msgs::DecodeError>) -> Self {
7673                 let contents = if o.result_ok {
7674                         let result = unsafe { o.contents.result };
7675                         unsafe { o.contents.result = core::ptr::null_mut() };
7676                         CResult_InMemorySignerDecodeErrorZPtr { result }
7677                 } else {
7678                         let err = unsafe { o.contents.err };
7679                         unsafe { o.contents.err = core::ptr::null_mut(); }
7680                         CResult_InMemorySignerDecodeErrorZPtr { err }
7681                 };
7682                 Self {
7683                         contents,
7684                         result_ok: o.result_ok,
7685                 }
7686         }
7687 }
7688 impl Clone for CResult_InMemorySignerDecodeErrorZ {
7689         fn clone(&self) -> Self {
7690                 if self.result_ok {
7691                         Self { result_ok: true, contents: CResult_InMemorySignerDecodeErrorZPtr {
7692                                 result: Box::into_raw(Box::new(<crate::lightning::chain::keysinterface::InMemorySigner>::clone(unsafe { &*self.contents.result })))
7693                         } }
7694                 } else {
7695                         Self { result_ok: false, contents: CResult_InMemorySignerDecodeErrorZPtr {
7696                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
7697                         } }
7698                 }
7699         }
7700 }
7701 #[no_mangle]
7702 /// Creates a new CResult_InMemorySignerDecodeErrorZ which has the same data as `orig`
7703 /// but with all dynamically-allocated buffers duplicated in new buffers.
7704 pub extern "C" fn CResult_InMemorySignerDecodeErrorZ_clone(orig: &CResult_InMemorySignerDecodeErrorZ) -> CResult_InMemorySignerDecodeErrorZ { Clone::clone(&orig) }
7705 #[repr(C)]
7706 /// A dynamically-allocated array of crate::c_types::TxOuts of arbitrary size.
7707 /// This corresponds to std::vector in C++
7708 pub struct CVec_TxOutZ {
7709         /// The elements in the array.
7710         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
7711         pub data: *mut crate::c_types::TxOut,
7712         /// The number of elements pointed to by `data`.
7713         pub datalen: usize
7714 }
7715 impl CVec_TxOutZ {
7716         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::TxOut> {
7717                 if self.datalen == 0 { return Vec::new(); }
7718                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
7719                 self.data = core::ptr::null_mut();
7720                 self.datalen = 0;
7721                 ret
7722         }
7723         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::TxOut] {
7724                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
7725         }
7726 }
7727 impl From<Vec<crate::c_types::TxOut>> for CVec_TxOutZ {
7728         fn from(v: Vec<crate::c_types::TxOut>) -> Self {
7729                 let datalen = v.len();
7730                 let data = Box::into_raw(v.into_boxed_slice());
7731                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
7732         }
7733 }
7734 #[no_mangle]
7735 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
7736 pub extern "C" fn CVec_TxOutZ_free(_res: CVec_TxOutZ) { }
7737 impl Drop for CVec_TxOutZ {
7738         fn drop(&mut self) {
7739                 if self.datalen == 0 { return; }
7740                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
7741         }
7742 }
7743 impl Clone for CVec_TxOutZ {
7744         fn clone(&self) -> Self {
7745                 let mut res = Vec::new();
7746                 if self.datalen == 0 { return Self::from(res); }
7747                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
7748                 Self::from(res)
7749         }
7750 }
7751 #[repr(C)]
7752 /// The contents of CResult_TransactionNoneZ
7753 pub union CResult_TransactionNoneZPtr {
7754         /// A pointer to the contents in the success state.
7755         /// Reading from this pointer when `result_ok` is not set is undefined.
7756         pub result: *mut crate::c_types::Transaction,
7757         /// Note that this value is always NULL, as there are no contents in the Err variant
7758         pub err: *mut core::ffi::c_void,
7759 }
7760 #[repr(C)]
7761 /// A CResult_TransactionNoneZ represents the result of a fallible operation,
7762 /// containing a crate::c_types::Transaction on success and a () on failure.
7763 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7764 pub struct CResult_TransactionNoneZ {
7765         /// The contents of this CResult_TransactionNoneZ, accessible via either
7766         /// `err` or `result` depending on the state of `result_ok`.
7767         pub contents: CResult_TransactionNoneZPtr,
7768         /// Whether this CResult_TransactionNoneZ represents a success state.
7769         pub result_ok: bool,
7770 }
7771 #[no_mangle]
7772 /// Creates a new CResult_TransactionNoneZ in the success state.
7773 pub extern "C" fn CResult_TransactionNoneZ_ok(o: crate::c_types::Transaction) -> CResult_TransactionNoneZ {
7774         CResult_TransactionNoneZ {
7775                 contents: CResult_TransactionNoneZPtr {
7776                         result: Box::into_raw(Box::new(o)),
7777                 },
7778                 result_ok: true,
7779         }
7780 }
7781 #[no_mangle]
7782 /// Creates a new CResult_TransactionNoneZ in the error state.
7783 pub extern "C" fn CResult_TransactionNoneZ_err() -> CResult_TransactionNoneZ {
7784         CResult_TransactionNoneZ {
7785                 contents: CResult_TransactionNoneZPtr {
7786                         err: core::ptr::null_mut(),
7787                 },
7788                 result_ok: false,
7789         }
7790 }
7791 /// Checks if the given object is currently in the success state
7792 #[no_mangle]
7793 pub extern "C" fn CResult_TransactionNoneZ_is_ok(o: &CResult_TransactionNoneZ) -> bool {
7794         o.result_ok
7795 }
7796 #[no_mangle]
7797 /// Frees any resources used by the CResult_TransactionNoneZ.
7798 pub extern "C" fn CResult_TransactionNoneZ_free(_res: CResult_TransactionNoneZ) { }
7799 impl Drop for CResult_TransactionNoneZ {
7800         fn drop(&mut self) {
7801                 if self.result_ok {
7802                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
7803                                 let _ = unsafe { Box::from_raw(self.contents.result) };
7804                         }
7805                 } else {
7806                 }
7807         }
7808 }
7809 impl From<crate::c_types::CResultTempl<crate::c_types::Transaction, ()>> for CResult_TransactionNoneZ {
7810         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::Transaction, ()>) -> Self {
7811                 let contents = if o.result_ok {
7812                         let result = unsafe { o.contents.result };
7813                         unsafe { o.contents.result = core::ptr::null_mut() };
7814                         CResult_TransactionNoneZPtr { result }
7815                 } else {
7816                         let _ = unsafe { Box::from_raw(o.contents.err) };
7817                         o.contents.err = core::ptr::null_mut();
7818                         CResult_TransactionNoneZPtr { err: core::ptr::null_mut() }
7819                 };
7820                 Self {
7821                         contents,
7822                         result_ok: o.result_ok,
7823                 }
7824         }
7825 }
7826 impl Clone for CResult_TransactionNoneZ {
7827         fn clone(&self) -> Self {
7828                 if self.result_ok {
7829                         Self { result_ok: true, contents: CResult_TransactionNoneZPtr {
7830                                 result: Box::into_raw(Box::new(<crate::c_types::Transaction>::clone(unsafe { &*self.contents.result })))
7831                         } }
7832                 } else {
7833                         Self { result_ok: false, contents: CResult_TransactionNoneZPtr {
7834                                 err: core::ptr::null_mut()
7835                         } }
7836                 }
7837         }
7838 }
7839 #[no_mangle]
7840 /// Creates a new CResult_TransactionNoneZ which has the same data as `orig`
7841 /// but with all dynamically-allocated buffers duplicated in new buffers.
7842 pub extern "C" fn CResult_TransactionNoneZ_clone(orig: &CResult_TransactionNoneZ) -> CResult_TransactionNoneZ { Clone::clone(&orig) }
7843 #[repr(C)]
7844 /// A tuple of 2 elements. See the individual fields for the types contained.
7845 pub struct C2Tuple_BlockHashChannelMonitorZ {
7846         /// The element at position 0
7847         pub a: crate::c_types::ThirtyTwoBytes,
7848         /// The element at position 1
7849         pub b: crate::lightning::chain::channelmonitor::ChannelMonitor,
7850 }
7851 impl From<(crate::c_types::ThirtyTwoBytes, crate::lightning::chain::channelmonitor::ChannelMonitor)> for C2Tuple_BlockHashChannelMonitorZ {
7852         fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::lightning::chain::channelmonitor::ChannelMonitor)) -> Self {
7853                 Self {
7854                         a: tup.0,
7855                         b: tup.1,
7856                 }
7857         }
7858 }
7859 impl C2Tuple_BlockHashChannelMonitorZ {
7860         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::lightning::chain::channelmonitor::ChannelMonitor) {
7861                 (self.a, self.b)
7862         }
7863 }
7864 /// Creates a new C2Tuple_BlockHashChannelMonitorZ from the contained elements.
7865 #[no_mangle]
7866 pub extern "C" fn C2Tuple_BlockHashChannelMonitorZ_new(a: crate::c_types::ThirtyTwoBytes, b: crate::lightning::chain::channelmonitor::ChannelMonitor) -> C2Tuple_BlockHashChannelMonitorZ {
7867         C2Tuple_BlockHashChannelMonitorZ { a, b, }
7868 }
7869
7870 #[no_mangle]
7871 /// Frees any resources used by the C2Tuple_BlockHashChannelMonitorZ.
7872 pub extern "C" fn C2Tuple_BlockHashChannelMonitorZ_free(_res: C2Tuple_BlockHashChannelMonitorZ) { }
7873 #[repr(C)]
7874 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZs of arbitrary size.
7875 /// This corresponds to std::vector in C++
7876 pub struct CVec_C2Tuple_BlockHashChannelMonitorZZ {
7877         /// The elements in the array.
7878         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
7879         pub data: *mut crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ,
7880         /// The number of elements pointed to by `data`.
7881         pub datalen: usize
7882 }
7883 impl CVec_C2Tuple_BlockHashChannelMonitorZZ {
7884         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ> {
7885                 if self.datalen == 0 { return Vec::new(); }
7886                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
7887                 self.data = core::ptr::null_mut();
7888                 self.datalen = 0;
7889                 ret
7890         }
7891         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ] {
7892                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
7893         }
7894 }
7895 impl From<Vec<crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ>> for CVec_C2Tuple_BlockHashChannelMonitorZZ {
7896         fn from(v: Vec<crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ>) -> Self {
7897                 let datalen = v.len();
7898                 let data = Box::into_raw(v.into_boxed_slice());
7899                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
7900         }
7901 }
7902 #[no_mangle]
7903 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
7904 pub extern "C" fn CVec_C2Tuple_BlockHashChannelMonitorZZ_free(_res: CVec_C2Tuple_BlockHashChannelMonitorZZ) { }
7905 impl Drop for CVec_C2Tuple_BlockHashChannelMonitorZZ {
7906         fn drop(&mut self) {
7907                 if self.datalen == 0 { return; }
7908                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
7909         }
7910 }
7911 #[repr(C)]
7912 /// The contents of CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ
7913 pub union CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr {
7914         /// A pointer to the contents in the success state.
7915         /// Reading from this pointer when `result_ok` is not set is undefined.
7916         pub result: *mut crate::c_types::derived::CVec_C2Tuple_BlockHashChannelMonitorZZ,
7917         /// A pointer to the contents in the error state.
7918         /// Reading from this pointer when `result_ok` is set is undefined.
7919         pub err: *mut crate::c_types::IOError,
7920 }
7921 #[repr(C)]
7922 /// A CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ represents the result of a fallible operation,
7923 /// containing a crate::c_types::derived::CVec_C2Tuple_BlockHashChannelMonitorZZ on success and a crate::c_types::IOError on failure.
7924 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7925 pub struct CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
7926         /// The contents of this CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ, accessible via either
7927         /// `err` or `result` depending on the state of `result_ok`.
7928         pub contents: CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr,
7929         /// Whether this CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ represents a success state.
7930         pub result_ok: bool,
7931 }
7932 #[no_mangle]
7933 /// Creates a new CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ in the success state.
7934 pub extern "C" fn CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_ok(o: crate::c_types::derived::CVec_C2Tuple_BlockHashChannelMonitorZZ) -> CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
7935         CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
7936                 contents: CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr {
7937                         result: Box::into_raw(Box::new(o)),
7938                 },
7939                 result_ok: true,
7940         }
7941 }
7942 #[no_mangle]
7943 /// Creates a new CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ in the error state.
7944 pub extern "C" fn CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_err(e: crate::c_types::IOError) -> CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
7945         CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
7946                 contents: CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr {
7947                         err: Box::into_raw(Box::new(e)),
7948                 },
7949                 result_ok: false,
7950         }
7951 }
7952 /// Checks if the given object is currently in the success state
7953 #[no_mangle]
7954 pub extern "C" fn CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_is_ok(o: &CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ) -> bool {
7955         o.result_ok
7956 }
7957 #[no_mangle]
7958 /// Frees any resources used by the CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ.
7959 pub extern "C" fn CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_free(_res: CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ) { }
7960 impl Drop for CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
7961         fn drop(&mut self) {
7962                 if self.result_ok {
7963                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
7964                                 let _ = unsafe { Box::from_raw(self.contents.result) };
7965                         }
7966                 } else {
7967                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
7968                                 let _ = unsafe { Box::from_raw(self.contents.err) };
7969                         }
7970                 }
7971         }
7972 }
7973 impl From<crate::c_types::CResultTempl<crate::c_types::derived::CVec_C2Tuple_BlockHashChannelMonitorZZ, crate::c_types::IOError>> for CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
7974         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CVec_C2Tuple_BlockHashChannelMonitorZZ, crate::c_types::IOError>) -> Self {
7975                 let contents = if o.result_ok {
7976                         let result = unsafe { o.contents.result };
7977                         unsafe { o.contents.result = core::ptr::null_mut() };
7978                         CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr { result }
7979                 } else {
7980                         let err = unsafe { o.contents.err };
7981                         unsafe { o.contents.err = core::ptr::null_mut(); }
7982                         CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr { err }
7983                 };
7984                 Self {
7985                         contents,
7986                         result_ok: o.result_ok,
7987                 }
7988         }
7989 }
7990 #[repr(C)]
7991 #[derive(Clone)]
7992 /// An enum which can either contain a u16 or not
7993 pub enum COption_u16Z {
7994         /// When we're in this state, this COption_u16Z contains a u16
7995         Some(u16),
7996         /// When we're in this state, this COption_u16Z contains nothing
7997         None
7998 }
7999 impl COption_u16Z {
8000         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
8001                 if let Self::None = self { false } else { true }
8002         }
8003         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
8004                 !self.is_some()
8005         }
8006         #[allow(unused)] pub(crate) fn take(mut self) -> u16 {
8007                 if let Self::Some(v) = self { v } else { unreachable!() }
8008         }
8009 }
8010 #[no_mangle]
8011 /// Constructs a new COption_u16Z containing a u16
8012 pub extern "C" fn COption_u16Z_some(o: u16) -> COption_u16Z {
8013         COption_u16Z::Some(o)
8014 }
8015 #[no_mangle]
8016 /// Constructs a new COption_u16Z containing nothing
8017 pub extern "C" fn COption_u16Z_none() -> COption_u16Z {
8018         COption_u16Z::None
8019 }
8020 #[no_mangle]
8021 /// Frees any resources associated with the u16, if we are in the Some state
8022 pub extern "C" fn COption_u16Z_free(_res: COption_u16Z) { }
8023 #[no_mangle]
8024 /// Creates a new COption_u16Z which has the same data as `orig`
8025 /// but with all dynamically-allocated buffers duplicated in new buffers.
8026 pub extern "C" fn COption_u16Z_clone(orig: &COption_u16Z) -> COption_u16Z { Clone::clone(&orig) }
8027 #[repr(C)]
8028 /// The contents of CResult_NoneAPIErrorZ
8029 pub union CResult_NoneAPIErrorZPtr {
8030         /// Note that this value is always NULL, as there are no contents in the OK variant
8031         pub result: *mut core::ffi::c_void,
8032         /// A pointer to the contents in the error state.
8033         /// Reading from this pointer when `result_ok` is set is undefined.
8034         pub err: *mut crate::lightning::util::errors::APIError,
8035 }
8036 #[repr(C)]
8037 /// A CResult_NoneAPIErrorZ represents the result of a fallible operation,
8038 /// containing a () on success and a crate::lightning::util::errors::APIError on failure.
8039 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8040 pub struct CResult_NoneAPIErrorZ {
8041         /// The contents of this CResult_NoneAPIErrorZ, accessible via either
8042         /// `err` or `result` depending on the state of `result_ok`.
8043         pub contents: CResult_NoneAPIErrorZPtr,
8044         /// Whether this CResult_NoneAPIErrorZ represents a success state.
8045         pub result_ok: bool,
8046 }
8047 #[no_mangle]
8048 /// Creates a new CResult_NoneAPIErrorZ in the success state.
8049 pub extern "C" fn CResult_NoneAPIErrorZ_ok() -> CResult_NoneAPIErrorZ {
8050         CResult_NoneAPIErrorZ {
8051                 contents: CResult_NoneAPIErrorZPtr {
8052                         result: core::ptr::null_mut(),
8053                 },
8054                 result_ok: true,
8055         }
8056 }
8057 #[no_mangle]
8058 /// Creates a new CResult_NoneAPIErrorZ in the error state.
8059 pub extern "C" fn CResult_NoneAPIErrorZ_err(e: crate::lightning::util::errors::APIError) -> CResult_NoneAPIErrorZ {
8060         CResult_NoneAPIErrorZ {
8061                 contents: CResult_NoneAPIErrorZPtr {
8062                         err: Box::into_raw(Box::new(e)),
8063                 },
8064                 result_ok: false,
8065         }
8066 }
8067 /// Checks if the given object is currently in the success state
8068 #[no_mangle]
8069 pub extern "C" fn CResult_NoneAPIErrorZ_is_ok(o: &CResult_NoneAPIErrorZ) -> bool {
8070         o.result_ok
8071 }
8072 #[no_mangle]
8073 /// Frees any resources used by the CResult_NoneAPIErrorZ.
8074 pub extern "C" fn CResult_NoneAPIErrorZ_free(_res: CResult_NoneAPIErrorZ) { }
8075 impl Drop for CResult_NoneAPIErrorZ {
8076         fn drop(&mut self) {
8077                 if self.result_ok {
8078                 } else {
8079                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
8080                                 let _ = unsafe { Box::from_raw(self.contents.err) };
8081                         }
8082                 }
8083         }
8084 }
8085 impl From<crate::c_types::CResultTempl<(), crate::lightning::util::errors::APIError>> for CResult_NoneAPIErrorZ {
8086         fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::util::errors::APIError>) -> Self {
8087                 let contents = if o.result_ok {
8088                         let _ = unsafe { Box::from_raw(o.contents.result) };
8089                         o.contents.result = core::ptr::null_mut();
8090                         CResult_NoneAPIErrorZPtr { result: core::ptr::null_mut() }
8091                 } else {
8092                         let err = unsafe { o.contents.err };
8093                         unsafe { o.contents.err = core::ptr::null_mut(); }
8094                         CResult_NoneAPIErrorZPtr { err }
8095                 };
8096                 Self {
8097                         contents,
8098                         result_ok: o.result_ok,
8099                 }
8100         }
8101 }
8102 impl Clone for CResult_NoneAPIErrorZ {
8103         fn clone(&self) -> Self {
8104                 if self.result_ok {
8105                         Self { result_ok: true, contents: CResult_NoneAPIErrorZPtr {
8106                                 result: core::ptr::null_mut()
8107                         } }
8108                 } else {
8109                         Self { result_ok: false, contents: CResult_NoneAPIErrorZPtr {
8110                                 err: Box::into_raw(Box::new(<crate::lightning::util::errors::APIError>::clone(unsafe { &*self.contents.err })))
8111                         } }
8112                 }
8113         }
8114 }
8115 #[no_mangle]
8116 /// Creates a new CResult_NoneAPIErrorZ which has the same data as `orig`
8117 /// but with all dynamically-allocated buffers duplicated in new buffers.
8118 pub extern "C" fn CResult_NoneAPIErrorZ_clone(orig: &CResult_NoneAPIErrorZ) -> CResult_NoneAPIErrorZ { Clone::clone(&orig) }
8119 #[repr(C)]
8120 /// A dynamically-allocated array of crate::c_types::derived::CResult_NoneAPIErrorZs of arbitrary size.
8121 /// This corresponds to std::vector in C++
8122 pub struct CVec_CResult_NoneAPIErrorZZ {
8123         /// The elements in the array.
8124         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
8125         pub data: *mut crate::c_types::derived::CResult_NoneAPIErrorZ,
8126         /// The number of elements pointed to by `data`.
8127         pub datalen: usize
8128 }
8129 impl CVec_CResult_NoneAPIErrorZZ {
8130         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::CResult_NoneAPIErrorZ> {
8131                 if self.datalen == 0 { return Vec::new(); }
8132                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
8133                 self.data = core::ptr::null_mut();
8134                 self.datalen = 0;
8135                 ret
8136         }
8137         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::CResult_NoneAPIErrorZ] {
8138                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
8139         }
8140 }
8141 impl From<Vec<crate::c_types::derived::CResult_NoneAPIErrorZ>> for CVec_CResult_NoneAPIErrorZZ {
8142         fn from(v: Vec<crate::c_types::derived::CResult_NoneAPIErrorZ>) -> Self {
8143                 let datalen = v.len();
8144                 let data = Box::into_raw(v.into_boxed_slice());
8145                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
8146         }
8147 }
8148 #[no_mangle]
8149 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
8150 pub extern "C" fn CVec_CResult_NoneAPIErrorZZ_free(_res: CVec_CResult_NoneAPIErrorZZ) { }
8151 impl Drop for CVec_CResult_NoneAPIErrorZZ {
8152         fn drop(&mut self) {
8153                 if self.datalen == 0 { return; }
8154                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
8155         }
8156 }
8157 impl Clone for CVec_CResult_NoneAPIErrorZZ {
8158         fn clone(&self) -> Self {
8159                 let mut res = Vec::new();
8160                 if self.datalen == 0 { return Self::from(res); }
8161                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
8162                 Self::from(res)
8163         }
8164 }
8165 #[repr(C)]
8166 /// A dynamically-allocated array of crate::lightning::util::errors::APIErrors of arbitrary size.
8167 /// This corresponds to std::vector in C++
8168 pub struct CVec_APIErrorZ {
8169         /// The elements in the array.
8170         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
8171         pub data: *mut crate::lightning::util::errors::APIError,
8172         /// The number of elements pointed to by `data`.
8173         pub datalen: usize
8174 }
8175 impl CVec_APIErrorZ {
8176         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::util::errors::APIError> {
8177                 if self.datalen == 0 { return Vec::new(); }
8178                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
8179                 self.data = core::ptr::null_mut();
8180                 self.datalen = 0;
8181                 ret
8182         }
8183         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::util::errors::APIError] {
8184                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
8185         }
8186 }
8187 impl From<Vec<crate::lightning::util::errors::APIError>> for CVec_APIErrorZ {
8188         fn from(v: Vec<crate::lightning::util::errors::APIError>) -> Self {
8189                 let datalen = v.len();
8190                 let data = Box::into_raw(v.into_boxed_slice());
8191                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
8192         }
8193 }
8194 #[no_mangle]
8195 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
8196 pub extern "C" fn CVec_APIErrorZ_free(_res: CVec_APIErrorZ) { }
8197 impl Drop for CVec_APIErrorZ {
8198         fn drop(&mut self) {
8199                 if self.datalen == 0 { return; }
8200                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
8201         }
8202 }
8203 impl Clone for CVec_APIErrorZ {
8204         fn clone(&self) -> Self {
8205                 let mut res = Vec::new();
8206                 if self.datalen == 0 { return Self::from(res); }
8207                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
8208                 Self::from(res)
8209         }
8210 }
8211 #[repr(C)]
8212 /// The contents of CResult__u832APIErrorZ
8213 pub union CResult__u832APIErrorZPtr {
8214         /// A pointer to the contents in the success state.
8215         /// Reading from this pointer when `result_ok` is not set is undefined.
8216         pub result: *mut crate::c_types::ThirtyTwoBytes,
8217         /// A pointer to the contents in the error state.
8218         /// Reading from this pointer when `result_ok` is set is undefined.
8219         pub err: *mut crate::lightning::util::errors::APIError,
8220 }
8221 #[repr(C)]
8222 /// A CResult__u832APIErrorZ represents the result of a fallible operation,
8223 /// containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning::util::errors::APIError on failure.
8224 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8225 pub struct CResult__u832APIErrorZ {
8226         /// The contents of this CResult__u832APIErrorZ, accessible via either
8227         /// `err` or `result` depending on the state of `result_ok`.
8228         pub contents: CResult__u832APIErrorZPtr,
8229         /// Whether this CResult__u832APIErrorZ represents a success state.
8230         pub result_ok: bool,
8231 }
8232 #[no_mangle]
8233 /// Creates a new CResult__u832APIErrorZ in the success state.
8234 pub extern "C" fn CResult__u832APIErrorZ_ok(o: crate::c_types::ThirtyTwoBytes) -> CResult__u832APIErrorZ {
8235         CResult__u832APIErrorZ {
8236                 contents: CResult__u832APIErrorZPtr {
8237                         result: Box::into_raw(Box::new(o)),
8238                 },
8239                 result_ok: true,
8240         }
8241 }
8242 #[no_mangle]
8243 /// Creates a new CResult__u832APIErrorZ in the error state.
8244 pub extern "C" fn CResult__u832APIErrorZ_err(e: crate::lightning::util::errors::APIError) -> CResult__u832APIErrorZ {
8245         CResult__u832APIErrorZ {
8246                 contents: CResult__u832APIErrorZPtr {
8247                         err: Box::into_raw(Box::new(e)),
8248                 },
8249                 result_ok: false,
8250         }
8251 }
8252 /// Checks if the given object is currently in the success state
8253 #[no_mangle]
8254 pub extern "C" fn CResult__u832APIErrorZ_is_ok(o: &CResult__u832APIErrorZ) -> bool {
8255         o.result_ok
8256 }
8257 #[no_mangle]
8258 /// Frees any resources used by the CResult__u832APIErrorZ.
8259 pub extern "C" fn CResult__u832APIErrorZ_free(_res: CResult__u832APIErrorZ) { }
8260 impl Drop for CResult__u832APIErrorZ {
8261         fn drop(&mut self) {
8262                 if self.result_ok {
8263                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
8264                                 let _ = unsafe { Box::from_raw(self.contents.result) };
8265                         }
8266                 } else {
8267                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
8268                                 let _ = unsafe { Box::from_raw(self.contents.err) };
8269                         }
8270                 }
8271         }
8272 }
8273 impl From<crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::util::errors::APIError>> for CResult__u832APIErrorZ {
8274         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::util::errors::APIError>) -> Self {
8275                 let contents = if o.result_ok {
8276                         let result = unsafe { o.contents.result };
8277                         unsafe { o.contents.result = core::ptr::null_mut() };
8278                         CResult__u832APIErrorZPtr { result }
8279                 } else {
8280                         let err = unsafe { o.contents.err };
8281                         unsafe { o.contents.err = core::ptr::null_mut(); }
8282                         CResult__u832APIErrorZPtr { err }
8283                 };
8284                 Self {
8285                         contents,
8286                         result_ok: o.result_ok,
8287                 }
8288         }
8289 }
8290 impl Clone for CResult__u832APIErrorZ {
8291         fn clone(&self) -> Self {
8292                 if self.result_ok {
8293                         Self { result_ok: true, contents: CResult__u832APIErrorZPtr {
8294                                 result: Box::into_raw(Box::new(<crate::c_types::ThirtyTwoBytes>::clone(unsafe { &*self.contents.result })))
8295                         } }
8296                 } else {
8297                         Self { result_ok: false, contents: CResult__u832APIErrorZPtr {
8298                                 err: Box::into_raw(Box::new(<crate::lightning::util::errors::APIError>::clone(unsafe { &*self.contents.err })))
8299                         } }
8300                 }
8301         }
8302 }
8303 #[no_mangle]
8304 /// Creates a new CResult__u832APIErrorZ which has the same data as `orig`
8305 /// but with all dynamically-allocated buffers duplicated in new buffers.
8306 pub extern "C" fn CResult__u832APIErrorZ_clone(orig: &CResult__u832APIErrorZ) -> CResult__u832APIErrorZ { Clone::clone(&orig) }
8307 #[repr(C)]
8308 /// The contents of CResult_PaymentIdPaymentSendFailureZ
8309 pub union CResult_PaymentIdPaymentSendFailureZPtr {
8310         /// A pointer to the contents in the success state.
8311         /// Reading from this pointer when `result_ok` is not set is undefined.
8312         pub result: *mut crate::c_types::ThirtyTwoBytes,
8313         /// A pointer to the contents in the error state.
8314         /// Reading from this pointer when `result_ok` is set is undefined.
8315         pub err: *mut crate::lightning::ln::channelmanager::PaymentSendFailure,
8316 }
8317 #[repr(C)]
8318 /// A CResult_PaymentIdPaymentSendFailureZ represents the result of a fallible operation,
8319 /// containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning::ln::channelmanager::PaymentSendFailure on failure.
8320 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8321 pub struct CResult_PaymentIdPaymentSendFailureZ {
8322         /// The contents of this CResult_PaymentIdPaymentSendFailureZ, accessible via either
8323         /// `err` or `result` depending on the state of `result_ok`.
8324         pub contents: CResult_PaymentIdPaymentSendFailureZPtr,
8325         /// Whether this CResult_PaymentIdPaymentSendFailureZ represents a success state.
8326         pub result_ok: bool,
8327 }
8328 #[no_mangle]
8329 /// Creates a new CResult_PaymentIdPaymentSendFailureZ in the success state.
8330 pub extern "C" fn CResult_PaymentIdPaymentSendFailureZ_ok(o: crate::c_types::ThirtyTwoBytes) -> CResult_PaymentIdPaymentSendFailureZ {
8331         CResult_PaymentIdPaymentSendFailureZ {
8332                 contents: CResult_PaymentIdPaymentSendFailureZPtr {
8333                         result: Box::into_raw(Box::new(o)),
8334                 },
8335                 result_ok: true,
8336         }
8337 }
8338 #[no_mangle]
8339 /// Creates a new CResult_PaymentIdPaymentSendFailureZ in the error state.
8340 pub extern "C" fn CResult_PaymentIdPaymentSendFailureZ_err(e: crate::lightning::ln::channelmanager::PaymentSendFailure) -> CResult_PaymentIdPaymentSendFailureZ {
8341         CResult_PaymentIdPaymentSendFailureZ {
8342                 contents: CResult_PaymentIdPaymentSendFailureZPtr {
8343                         err: Box::into_raw(Box::new(e)),
8344                 },
8345                 result_ok: false,
8346         }
8347 }
8348 /// Checks if the given object is currently in the success state
8349 #[no_mangle]
8350 pub extern "C" fn CResult_PaymentIdPaymentSendFailureZ_is_ok(o: &CResult_PaymentIdPaymentSendFailureZ) -> bool {
8351         o.result_ok
8352 }
8353 #[no_mangle]
8354 /// Frees any resources used by the CResult_PaymentIdPaymentSendFailureZ.
8355 pub extern "C" fn CResult_PaymentIdPaymentSendFailureZ_free(_res: CResult_PaymentIdPaymentSendFailureZ) { }
8356 impl Drop for CResult_PaymentIdPaymentSendFailureZ {
8357         fn drop(&mut self) {
8358                 if self.result_ok {
8359                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
8360                                 let _ = unsafe { Box::from_raw(self.contents.result) };
8361                         }
8362                 } else {
8363                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
8364                                 let _ = unsafe { Box::from_raw(self.contents.err) };
8365                         }
8366                 }
8367         }
8368 }
8369 impl From<crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::ln::channelmanager::PaymentSendFailure>> for CResult_PaymentIdPaymentSendFailureZ {
8370         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::ln::channelmanager::PaymentSendFailure>) -> Self {
8371                 let contents = if o.result_ok {
8372                         let result = unsafe { o.contents.result };
8373                         unsafe { o.contents.result = core::ptr::null_mut() };
8374                         CResult_PaymentIdPaymentSendFailureZPtr { result }
8375                 } else {
8376                         let err = unsafe { o.contents.err };
8377                         unsafe { o.contents.err = core::ptr::null_mut(); }
8378                         CResult_PaymentIdPaymentSendFailureZPtr { err }
8379                 };
8380                 Self {
8381                         contents,
8382                         result_ok: o.result_ok,
8383                 }
8384         }
8385 }
8386 impl Clone for CResult_PaymentIdPaymentSendFailureZ {
8387         fn clone(&self) -> Self {
8388                 if self.result_ok {
8389                         Self { result_ok: true, contents: CResult_PaymentIdPaymentSendFailureZPtr {
8390                                 result: Box::into_raw(Box::new(<crate::c_types::ThirtyTwoBytes>::clone(unsafe { &*self.contents.result })))
8391                         } }
8392                 } else {
8393                         Self { result_ok: false, contents: CResult_PaymentIdPaymentSendFailureZPtr {
8394                                 err: Box::into_raw(Box::new(<crate::lightning::ln::channelmanager::PaymentSendFailure>::clone(unsafe { &*self.contents.err })))
8395                         } }
8396                 }
8397         }
8398 }
8399 #[no_mangle]
8400 /// Creates a new CResult_PaymentIdPaymentSendFailureZ which has the same data as `orig`
8401 /// but with all dynamically-allocated buffers duplicated in new buffers.
8402 pub extern "C" fn CResult_PaymentIdPaymentSendFailureZ_clone(orig: &CResult_PaymentIdPaymentSendFailureZ) -> CResult_PaymentIdPaymentSendFailureZ { Clone::clone(&orig) }
8403 #[repr(C)]
8404 /// The contents of CResult_NonePaymentSendFailureZ
8405 pub union CResult_NonePaymentSendFailureZPtr {
8406         /// Note that this value is always NULL, as there are no contents in the OK variant
8407         pub result: *mut core::ffi::c_void,
8408         /// A pointer to the contents in the error state.
8409         /// Reading from this pointer when `result_ok` is set is undefined.
8410         pub err: *mut crate::lightning::ln::channelmanager::PaymentSendFailure,
8411 }
8412 #[repr(C)]
8413 /// A CResult_NonePaymentSendFailureZ represents the result of a fallible operation,
8414 /// containing a () on success and a crate::lightning::ln::channelmanager::PaymentSendFailure on failure.
8415 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8416 pub struct CResult_NonePaymentSendFailureZ {
8417         /// The contents of this CResult_NonePaymentSendFailureZ, accessible via either
8418         /// `err` or `result` depending on the state of `result_ok`.
8419         pub contents: CResult_NonePaymentSendFailureZPtr,
8420         /// Whether this CResult_NonePaymentSendFailureZ represents a success state.
8421         pub result_ok: bool,
8422 }
8423 #[no_mangle]
8424 /// Creates a new CResult_NonePaymentSendFailureZ in the success state.
8425 pub extern "C" fn CResult_NonePaymentSendFailureZ_ok() -> CResult_NonePaymentSendFailureZ {
8426         CResult_NonePaymentSendFailureZ {
8427                 contents: CResult_NonePaymentSendFailureZPtr {
8428                         result: core::ptr::null_mut(),
8429                 },
8430                 result_ok: true,
8431         }
8432 }
8433 #[no_mangle]
8434 /// Creates a new CResult_NonePaymentSendFailureZ in the error state.
8435 pub extern "C" fn CResult_NonePaymentSendFailureZ_err(e: crate::lightning::ln::channelmanager::PaymentSendFailure) -> CResult_NonePaymentSendFailureZ {
8436         CResult_NonePaymentSendFailureZ {
8437                 contents: CResult_NonePaymentSendFailureZPtr {
8438                         err: Box::into_raw(Box::new(e)),
8439                 },
8440                 result_ok: false,
8441         }
8442 }
8443 /// Checks if the given object is currently in the success state
8444 #[no_mangle]
8445 pub extern "C" fn CResult_NonePaymentSendFailureZ_is_ok(o: &CResult_NonePaymentSendFailureZ) -> bool {
8446         o.result_ok
8447 }
8448 #[no_mangle]
8449 /// Frees any resources used by the CResult_NonePaymentSendFailureZ.
8450 pub extern "C" fn CResult_NonePaymentSendFailureZ_free(_res: CResult_NonePaymentSendFailureZ) { }
8451 impl Drop for CResult_NonePaymentSendFailureZ {
8452         fn drop(&mut self) {
8453                 if self.result_ok {
8454                 } else {
8455                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
8456                                 let _ = unsafe { Box::from_raw(self.contents.err) };
8457                         }
8458                 }
8459         }
8460 }
8461 impl From<crate::c_types::CResultTempl<(), crate::lightning::ln::channelmanager::PaymentSendFailure>> for CResult_NonePaymentSendFailureZ {
8462         fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::ln::channelmanager::PaymentSendFailure>) -> Self {
8463                 let contents = if o.result_ok {
8464                         let _ = unsafe { Box::from_raw(o.contents.result) };
8465                         o.contents.result = core::ptr::null_mut();
8466                         CResult_NonePaymentSendFailureZPtr { result: core::ptr::null_mut() }
8467                 } else {
8468                         let err = unsafe { o.contents.err };
8469                         unsafe { o.contents.err = core::ptr::null_mut(); }
8470                         CResult_NonePaymentSendFailureZPtr { err }
8471                 };
8472                 Self {
8473                         contents,
8474                         result_ok: o.result_ok,
8475                 }
8476         }
8477 }
8478 impl Clone for CResult_NonePaymentSendFailureZ {
8479         fn clone(&self) -> Self {
8480                 if self.result_ok {
8481                         Self { result_ok: true, contents: CResult_NonePaymentSendFailureZPtr {
8482                                 result: core::ptr::null_mut()
8483                         } }
8484                 } else {
8485                         Self { result_ok: false, contents: CResult_NonePaymentSendFailureZPtr {
8486                                 err: Box::into_raw(Box::new(<crate::lightning::ln::channelmanager::PaymentSendFailure>::clone(unsafe { &*self.contents.err })))
8487                         } }
8488                 }
8489         }
8490 }
8491 #[no_mangle]
8492 /// Creates a new CResult_NonePaymentSendFailureZ which has the same data as `orig`
8493 /// but with all dynamically-allocated buffers duplicated in new buffers.
8494 pub extern "C" fn CResult_NonePaymentSendFailureZ_clone(orig: &CResult_NonePaymentSendFailureZ) -> CResult_NonePaymentSendFailureZ { Clone::clone(&orig) }
8495 #[repr(C)]
8496 /// A tuple of 2 elements. See the individual fields for the types contained.
8497 pub struct C2Tuple_PaymentHashPaymentIdZ {
8498         /// The element at position 0
8499         pub a: crate::c_types::ThirtyTwoBytes,
8500         /// The element at position 1
8501         pub b: crate::c_types::ThirtyTwoBytes,
8502 }
8503 impl From<(crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes)> for C2Tuple_PaymentHashPaymentIdZ {
8504         fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes)) -> Self {
8505                 Self {
8506                         a: tup.0,
8507                         b: tup.1,
8508                 }
8509         }
8510 }
8511 impl C2Tuple_PaymentHashPaymentIdZ {
8512         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes) {
8513                 (self.a, self.b)
8514         }
8515 }
8516 impl Clone for C2Tuple_PaymentHashPaymentIdZ {
8517         fn clone(&self) -> Self {
8518                 Self {
8519                         a: Clone::clone(&self.a),
8520                         b: Clone::clone(&self.b),
8521                 }
8522         }
8523 }
8524 #[no_mangle]
8525 /// Creates a new tuple which has the same data as `orig`
8526 /// but with all dynamically-allocated buffers duplicated in new buffers.
8527 pub extern "C" fn C2Tuple_PaymentHashPaymentIdZ_clone(orig: &C2Tuple_PaymentHashPaymentIdZ) -> C2Tuple_PaymentHashPaymentIdZ { Clone::clone(&orig) }
8528 /// Creates a new C2Tuple_PaymentHashPaymentIdZ from the contained elements.
8529 #[no_mangle]
8530 pub extern "C" fn C2Tuple_PaymentHashPaymentIdZ_new(a: crate::c_types::ThirtyTwoBytes, b: crate::c_types::ThirtyTwoBytes) -> C2Tuple_PaymentHashPaymentIdZ {
8531         C2Tuple_PaymentHashPaymentIdZ { a, b, }
8532 }
8533
8534 #[no_mangle]
8535 /// Frees any resources used by the C2Tuple_PaymentHashPaymentIdZ.
8536 pub extern "C" fn C2Tuple_PaymentHashPaymentIdZ_free(_res: C2Tuple_PaymentHashPaymentIdZ) { }
8537 #[repr(C)]
8538 /// The contents of CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ
8539 pub union CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr {
8540         /// A pointer to the contents in the success state.
8541         /// Reading from this pointer when `result_ok` is not set is undefined.
8542         pub result: *mut crate::c_types::derived::C2Tuple_PaymentHashPaymentIdZ,
8543         /// A pointer to the contents in the error state.
8544         /// Reading from this pointer when `result_ok` is set is undefined.
8545         pub err: *mut crate::lightning::ln::channelmanager::PaymentSendFailure,
8546 }
8547 #[repr(C)]
8548 /// A CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ represents the result of a fallible operation,
8549 /// containing a crate::c_types::derived::C2Tuple_PaymentHashPaymentIdZ on success and a crate::lightning::ln::channelmanager::PaymentSendFailure on failure.
8550 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8551 pub struct CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
8552         /// The contents of this CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ, accessible via either
8553         /// `err` or `result` depending on the state of `result_ok`.
8554         pub contents: CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr,
8555         /// Whether this CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ represents a success state.
8556         pub result_ok: bool,
8557 }
8558 #[no_mangle]
8559 /// Creates a new CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ in the success state.
8560 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_ok(o: crate::c_types::derived::C2Tuple_PaymentHashPaymentIdZ) -> CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
8561         CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
8562                 contents: CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr {
8563                         result: Box::into_raw(Box::new(o)),
8564                 },
8565                 result_ok: true,
8566         }
8567 }
8568 #[no_mangle]
8569 /// Creates a new CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ in the error state.
8570 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_err(e: crate::lightning::ln::channelmanager::PaymentSendFailure) -> CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
8571         CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
8572                 contents: CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr {
8573                         err: Box::into_raw(Box::new(e)),
8574                 },
8575                 result_ok: false,
8576         }
8577 }
8578 /// Checks if the given object is currently in the success state
8579 #[no_mangle]
8580 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_is_ok(o: &CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ) -> bool {
8581         o.result_ok
8582 }
8583 #[no_mangle]
8584 /// Frees any resources used by the CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ.
8585 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_free(_res: CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ) { }
8586 impl Drop for CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
8587         fn drop(&mut self) {
8588                 if self.result_ok {
8589                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
8590                                 let _ = unsafe { Box::from_raw(self.contents.result) };
8591                         }
8592                 } else {
8593                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
8594                                 let _ = unsafe { Box::from_raw(self.contents.err) };
8595                         }
8596                 }
8597         }
8598 }
8599 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_PaymentHashPaymentIdZ, crate::lightning::ln::channelmanager::PaymentSendFailure>> for CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
8600         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_PaymentHashPaymentIdZ, crate::lightning::ln::channelmanager::PaymentSendFailure>) -> Self {
8601                 let contents = if o.result_ok {
8602                         let result = unsafe { o.contents.result };
8603                         unsafe { o.contents.result = core::ptr::null_mut() };
8604                         CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr { result }
8605                 } else {
8606                         let err = unsafe { o.contents.err };
8607                         unsafe { o.contents.err = core::ptr::null_mut(); }
8608                         CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr { err }
8609                 };
8610                 Self {
8611                         contents,
8612                         result_ok: o.result_ok,
8613                 }
8614         }
8615 }
8616 impl Clone for CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
8617         fn clone(&self) -> Self {
8618                 if self.result_ok {
8619                         Self { result_ok: true, contents: CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr {
8620                                 result: Box::into_raw(Box::new(<crate::c_types::derived::C2Tuple_PaymentHashPaymentIdZ>::clone(unsafe { &*self.contents.result })))
8621                         } }
8622                 } else {
8623                         Self { result_ok: false, contents: CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr {
8624                                 err: Box::into_raw(Box::new(<crate::lightning::ln::channelmanager::PaymentSendFailure>::clone(unsafe { &*self.contents.err })))
8625                         } }
8626                 }
8627         }
8628 }
8629 #[no_mangle]
8630 /// Creates a new CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ which has the same data as `orig`
8631 /// but with all dynamically-allocated buffers duplicated in new buffers.
8632 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone(orig: &CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ) -> CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ { Clone::clone(&orig) }
8633 #[repr(C)]
8634 /// A dynamically-allocated array of crate::c_types::ThirtyTwoBytess of arbitrary size.
8635 /// This corresponds to std::vector in C++
8636 pub struct CVec_ThirtyTwoBytesZ {
8637         /// The elements in the array.
8638         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
8639         pub data: *mut crate::c_types::ThirtyTwoBytes,
8640         /// The number of elements pointed to by `data`.
8641         pub datalen: usize
8642 }
8643 impl CVec_ThirtyTwoBytesZ {
8644         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::ThirtyTwoBytes> {
8645                 if self.datalen == 0 { return Vec::new(); }
8646                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
8647                 self.data = core::ptr::null_mut();
8648                 self.datalen = 0;
8649                 ret
8650         }
8651         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::ThirtyTwoBytes] {
8652                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
8653         }
8654 }
8655 impl From<Vec<crate::c_types::ThirtyTwoBytes>> for CVec_ThirtyTwoBytesZ {
8656         fn from(v: Vec<crate::c_types::ThirtyTwoBytes>) -> Self {
8657                 let datalen = v.len();
8658                 let data = Box::into_raw(v.into_boxed_slice());
8659                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
8660         }
8661 }
8662 #[no_mangle]
8663 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
8664 pub extern "C" fn CVec_ThirtyTwoBytesZ_free(_res: CVec_ThirtyTwoBytesZ) { }
8665 impl Drop for CVec_ThirtyTwoBytesZ {
8666         fn drop(&mut self) {
8667                 if self.datalen == 0 { return; }
8668                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
8669         }
8670 }
8671 impl Clone for CVec_ThirtyTwoBytesZ {
8672         fn clone(&self) -> Self {
8673                 let mut res = Vec::new();
8674                 if self.datalen == 0 { return Self::from(res); }
8675                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
8676                 Self::from(res)
8677         }
8678 }
8679 #[repr(C)]
8680 /// A tuple of 2 elements. See the individual fields for the types contained.
8681 pub struct C2Tuple_PaymentHashPaymentSecretZ {
8682         /// The element at position 0
8683         pub a: crate::c_types::ThirtyTwoBytes,
8684         /// The element at position 1
8685         pub b: crate::c_types::ThirtyTwoBytes,
8686 }
8687 impl From<(crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes)> for C2Tuple_PaymentHashPaymentSecretZ {
8688         fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes)) -> Self {
8689                 Self {
8690                         a: tup.0,
8691                         b: tup.1,
8692                 }
8693         }
8694 }
8695 impl C2Tuple_PaymentHashPaymentSecretZ {
8696         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes) {
8697                 (self.a, self.b)
8698         }
8699 }
8700 impl Clone for C2Tuple_PaymentHashPaymentSecretZ {
8701         fn clone(&self) -> Self {
8702                 Self {
8703                         a: Clone::clone(&self.a),
8704                         b: Clone::clone(&self.b),
8705                 }
8706         }
8707 }
8708 #[no_mangle]
8709 /// Creates a new tuple which has the same data as `orig`
8710 /// but with all dynamically-allocated buffers duplicated in new buffers.
8711 pub extern "C" fn C2Tuple_PaymentHashPaymentSecretZ_clone(orig: &C2Tuple_PaymentHashPaymentSecretZ) -> C2Tuple_PaymentHashPaymentSecretZ { Clone::clone(&orig) }
8712 /// Creates a new C2Tuple_PaymentHashPaymentSecretZ from the contained elements.
8713 #[no_mangle]
8714 pub extern "C" fn C2Tuple_PaymentHashPaymentSecretZ_new(a: crate::c_types::ThirtyTwoBytes, b: crate::c_types::ThirtyTwoBytes) -> C2Tuple_PaymentHashPaymentSecretZ {
8715         C2Tuple_PaymentHashPaymentSecretZ { a, b, }
8716 }
8717
8718 #[no_mangle]
8719 /// Frees any resources used by the C2Tuple_PaymentHashPaymentSecretZ.
8720 pub extern "C" fn C2Tuple_PaymentHashPaymentSecretZ_free(_res: C2Tuple_PaymentHashPaymentSecretZ) { }
8721 #[repr(C)]
8722 /// The contents of CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ
8723 pub union CResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr {
8724         /// A pointer to the contents in the success state.
8725         /// Reading from this pointer when `result_ok` is not set is undefined.
8726         pub result: *mut crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ,
8727         /// Note that this value is always NULL, as there are no contents in the Err variant
8728         pub err: *mut core::ffi::c_void,
8729 }
8730 #[repr(C)]
8731 /// A CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ represents the result of a fallible operation,
8732 /// containing a crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ on success and a () on failure.
8733 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8734 pub struct CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ {
8735         /// The contents of this CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ, accessible via either
8736         /// `err` or `result` depending on the state of `result_ok`.
8737         pub contents: CResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr,
8738         /// Whether this CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ represents a success state.
8739         pub result_ok: bool,
8740 }
8741 #[no_mangle]
8742 /// Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ in the success state.
8743 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_ok(o: crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ) -> CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ {
8744         CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ {
8745                 contents: CResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr {
8746                         result: Box::into_raw(Box::new(o)),
8747                 },
8748                 result_ok: true,
8749         }
8750 }
8751 #[no_mangle]
8752 /// Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ in the error state.
8753 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_err() -> CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ {
8754         CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ {
8755                 contents: CResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr {
8756                         err: core::ptr::null_mut(),
8757                 },
8758                 result_ok: false,
8759         }
8760 }
8761 /// Checks if the given object is currently in the success state
8762 #[no_mangle]
8763 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_is_ok(o: &CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ) -> bool {
8764         o.result_ok
8765 }
8766 #[no_mangle]
8767 /// Frees any resources used by the CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ.
8768 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_free(_res: CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ) { }
8769 impl Drop for CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ {
8770         fn drop(&mut self) {
8771                 if self.result_ok {
8772                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
8773                                 let _ = unsafe { Box::from_raw(self.contents.result) };
8774                         }
8775                 } else {
8776                 }
8777         }
8778 }
8779 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ, ()>> for CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ {
8780         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ, ()>) -> Self {
8781                 let contents = if o.result_ok {
8782                         let result = unsafe { o.contents.result };
8783                         unsafe { o.contents.result = core::ptr::null_mut() };
8784                         CResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr { result }
8785                 } else {
8786                         let _ = unsafe { Box::from_raw(o.contents.err) };
8787                         o.contents.err = core::ptr::null_mut();
8788                         CResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr { err: core::ptr::null_mut() }
8789                 };
8790                 Self {
8791                         contents,
8792                         result_ok: o.result_ok,
8793                 }
8794         }
8795 }
8796 impl Clone for CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ {
8797         fn clone(&self) -> Self {
8798                 if self.result_ok {
8799                         Self { result_ok: true, contents: CResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr {
8800                                 result: Box::into_raw(Box::new(<crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ>::clone(unsafe { &*self.contents.result })))
8801                         } }
8802                 } else {
8803                         Self { result_ok: false, contents: CResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr {
8804                                 err: core::ptr::null_mut()
8805                         } }
8806                 }
8807         }
8808 }
8809 #[no_mangle]
8810 /// Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ which has the same data as `orig`
8811 /// but with all dynamically-allocated buffers duplicated in new buffers.
8812 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_clone(orig: &CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ) -> CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ { Clone::clone(&orig) }
8813 #[repr(C)]
8814 /// The contents of CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ
8815 pub union CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZPtr {
8816         /// A pointer to the contents in the success state.
8817         /// Reading from this pointer when `result_ok` is not set is undefined.
8818         pub result: *mut crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ,
8819         /// A pointer to the contents in the error state.
8820         /// Reading from this pointer when `result_ok` is set is undefined.
8821         pub err: *mut crate::lightning::util::errors::APIError,
8822 }
8823 #[repr(C)]
8824 /// A CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ represents the result of a fallible operation,
8825 /// containing a crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ on success and a crate::lightning::util::errors::APIError on failure.
8826 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8827 pub struct CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ {
8828         /// The contents of this CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ, accessible via either
8829         /// `err` or `result` depending on the state of `result_ok`.
8830         pub contents: CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZPtr,
8831         /// Whether this CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ represents a success state.
8832         pub result_ok: bool,
8833 }
8834 #[no_mangle]
8835 /// Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ in the success state.
8836 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_ok(o: crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ) -> CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ {
8837         CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ {
8838                 contents: CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZPtr {
8839                         result: Box::into_raw(Box::new(o)),
8840                 },
8841                 result_ok: true,
8842         }
8843 }
8844 #[no_mangle]
8845 /// Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ in the error state.
8846 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_err(e: crate::lightning::util::errors::APIError) -> CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ {
8847         CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ {
8848                 contents: CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZPtr {
8849                         err: Box::into_raw(Box::new(e)),
8850                 },
8851                 result_ok: false,
8852         }
8853 }
8854 /// Checks if the given object is currently in the success state
8855 #[no_mangle]
8856 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_is_ok(o: &CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ) -> bool {
8857         o.result_ok
8858 }
8859 #[no_mangle]
8860 /// Frees any resources used by the CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ.
8861 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_free(_res: CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ) { }
8862 impl Drop for CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ {
8863         fn drop(&mut self) {
8864                 if self.result_ok {
8865                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
8866                                 let _ = unsafe { Box::from_raw(self.contents.result) };
8867                         }
8868                 } else {
8869                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
8870                                 let _ = unsafe { Box::from_raw(self.contents.err) };
8871                         }
8872                 }
8873         }
8874 }
8875 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ, crate::lightning::util::errors::APIError>> for CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ {
8876         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ, crate::lightning::util::errors::APIError>) -> Self {
8877                 let contents = if o.result_ok {
8878                         let result = unsafe { o.contents.result };
8879                         unsafe { o.contents.result = core::ptr::null_mut() };
8880                         CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZPtr { result }
8881                 } else {
8882                         let err = unsafe { o.contents.err };
8883                         unsafe { o.contents.err = core::ptr::null_mut(); }
8884                         CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZPtr { err }
8885                 };
8886                 Self {
8887                         contents,
8888                         result_ok: o.result_ok,
8889                 }
8890         }
8891 }
8892 impl Clone for CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ {
8893         fn clone(&self) -> Self {
8894                 if self.result_ok {
8895                         Self { result_ok: true, contents: CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZPtr {
8896                                 result: Box::into_raw(Box::new(<crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ>::clone(unsafe { &*self.contents.result })))
8897                         } }
8898                 } else {
8899                         Self { result_ok: false, contents: CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZPtr {
8900                                 err: Box::into_raw(Box::new(<crate::lightning::util::errors::APIError>::clone(unsafe { &*self.contents.err })))
8901                         } }
8902                 }
8903         }
8904 }
8905 #[no_mangle]
8906 /// Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ which has the same data as `orig`
8907 /// but with all dynamically-allocated buffers duplicated in new buffers.
8908 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_clone(orig: &CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ) -> CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ { Clone::clone(&orig) }
8909 #[repr(C)]
8910 /// The contents of CResult_PaymentSecretNoneZ
8911 pub union CResult_PaymentSecretNoneZPtr {
8912         /// A pointer to the contents in the success state.
8913         /// Reading from this pointer when `result_ok` is not set is undefined.
8914         pub result: *mut crate::c_types::ThirtyTwoBytes,
8915         /// Note that this value is always NULL, as there are no contents in the Err variant
8916         pub err: *mut core::ffi::c_void,
8917 }
8918 #[repr(C)]
8919 /// A CResult_PaymentSecretNoneZ represents the result of a fallible operation,
8920 /// containing a crate::c_types::ThirtyTwoBytes on success and a () on failure.
8921 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8922 pub struct CResult_PaymentSecretNoneZ {
8923         /// The contents of this CResult_PaymentSecretNoneZ, accessible via either
8924         /// `err` or `result` depending on the state of `result_ok`.
8925         pub contents: CResult_PaymentSecretNoneZPtr,
8926         /// Whether this CResult_PaymentSecretNoneZ represents a success state.
8927         pub result_ok: bool,
8928 }
8929 #[no_mangle]
8930 /// Creates a new CResult_PaymentSecretNoneZ in the success state.
8931 pub extern "C" fn CResult_PaymentSecretNoneZ_ok(o: crate::c_types::ThirtyTwoBytes) -> CResult_PaymentSecretNoneZ {
8932         CResult_PaymentSecretNoneZ {
8933                 contents: CResult_PaymentSecretNoneZPtr {
8934                         result: Box::into_raw(Box::new(o)),
8935                 },
8936                 result_ok: true,
8937         }
8938 }
8939 #[no_mangle]
8940 /// Creates a new CResult_PaymentSecretNoneZ in the error state.
8941 pub extern "C" fn CResult_PaymentSecretNoneZ_err() -> CResult_PaymentSecretNoneZ {
8942         CResult_PaymentSecretNoneZ {
8943                 contents: CResult_PaymentSecretNoneZPtr {
8944                         err: core::ptr::null_mut(),
8945                 },
8946                 result_ok: false,
8947         }
8948 }
8949 /// Checks if the given object is currently in the success state
8950 #[no_mangle]
8951 pub extern "C" fn CResult_PaymentSecretNoneZ_is_ok(o: &CResult_PaymentSecretNoneZ) -> bool {
8952         o.result_ok
8953 }
8954 #[no_mangle]
8955 /// Frees any resources used by the CResult_PaymentSecretNoneZ.
8956 pub extern "C" fn CResult_PaymentSecretNoneZ_free(_res: CResult_PaymentSecretNoneZ) { }
8957 impl Drop for CResult_PaymentSecretNoneZ {
8958         fn drop(&mut self) {
8959                 if self.result_ok {
8960                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
8961                                 let _ = unsafe { Box::from_raw(self.contents.result) };
8962                         }
8963                 } else {
8964                 }
8965         }
8966 }
8967 impl From<crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, ()>> for CResult_PaymentSecretNoneZ {
8968         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, ()>) -> Self {
8969                 let contents = if o.result_ok {
8970                         let result = unsafe { o.contents.result };
8971                         unsafe { o.contents.result = core::ptr::null_mut() };
8972                         CResult_PaymentSecretNoneZPtr { result }
8973                 } else {
8974                         let _ = unsafe { Box::from_raw(o.contents.err) };
8975                         o.contents.err = core::ptr::null_mut();
8976                         CResult_PaymentSecretNoneZPtr { err: core::ptr::null_mut() }
8977                 };
8978                 Self {
8979                         contents,
8980                         result_ok: o.result_ok,
8981                 }
8982         }
8983 }
8984 impl Clone for CResult_PaymentSecretNoneZ {
8985         fn clone(&self) -> Self {
8986                 if self.result_ok {
8987                         Self { result_ok: true, contents: CResult_PaymentSecretNoneZPtr {
8988                                 result: Box::into_raw(Box::new(<crate::c_types::ThirtyTwoBytes>::clone(unsafe { &*self.contents.result })))
8989                         } }
8990                 } else {
8991                         Self { result_ok: false, contents: CResult_PaymentSecretNoneZPtr {
8992                                 err: core::ptr::null_mut()
8993                         } }
8994                 }
8995         }
8996 }
8997 #[no_mangle]
8998 /// Creates a new CResult_PaymentSecretNoneZ which has the same data as `orig`
8999 /// but with all dynamically-allocated buffers duplicated in new buffers.
9000 pub extern "C" fn CResult_PaymentSecretNoneZ_clone(orig: &CResult_PaymentSecretNoneZ) -> CResult_PaymentSecretNoneZ { Clone::clone(&orig) }
9001 #[repr(C)]
9002 /// The contents of CResult_PaymentSecretAPIErrorZ
9003 pub union CResult_PaymentSecretAPIErrorZPtr {
9004         /// A pointer to the contents in the success state.
9005         /// Reading from this pointer when `result_ok` is not set is undefined.
9006         pub result: *mut crate::c_types::ThirtyTwoBytes,
9007         /// A pointer to the contents in the error state.
9008         /// Reading from this pointer when `result_ok` is set is undefined.
9009         pub err: *mut crate::lightning::util::errors::APIError,
9010 }
9011 #[repr(C)]
9012 /// A CResult_PaymentSecretAPIErrorZ represents the result of a fallible operation,
9013 /// containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning::util::errors::APIError on failure.
9014 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9015 pub struct CResult_PaymentSecretAPIErrorZ {
9016         /// The contents of this CResult_PaymentSecretAPIErrorZ, accessible via either
9017         /// `err` or `result` depending on the state of `result_ok`.
9018         pub contents: CResult_PaymentSecretAPIErrorZPtr,
9019         /// Whether this CResult_PaymentSecretAPIErrorZ represents a success state.
9020         pub result_ok: bool,
9021 }
9022 #[no_mangle]
9023 /// Creates a new CResult_PaymentSecretAPIErrorZ in the success state.
9024 pub extern "C" fn CResult_PaymentSecretAPIErrorZ_ok(o: crate::c_types::ThirtyTwoBytes) -> CResult_PaymentSecretAPIErrorZ {
9025         CResult_PaymentSecretAPIErrorZ {
9026                 contents: CResult_PaymentSecretAPIErrorZPtr {
9027                         result: Box::into_raw(Box::new(o)),
9028                 },
9029                 result_ok: true,
9030         }
9031 }
9032 #[no_mangle]
9033 /// Creates a new CResult_PaymentSecretAPIErrorZ in the error state.
9034 pub extern "C" fn CResult_PaymentSecretAPIErrorZ_err(e: crate::lightning::util::errors::APIError) -> CResult_PaymentSecretAPIErrorZ {
9035         CResult_PaymentSecretAPIErrorZ {
9036                 contents: CResult_PaymentSecretAPIErrorZPtr {
9037                         err: Box::into_raw(Box::new(e)),
9038                 },
9039                 result_ok: false,
9040         }
9041 }
9042 /// Checks if the given object is currently in the success state
9043 #[no_mangle]
9044 pub extern "C" fn CResult_PaymentSecretAPIErrorZ_is_ok(o: &CResult_PaymentSecretAPIErrorZ) -> bool {
9045         o.result_ok
9046 }
9047 #[no_mangle]
9048 /// Frees any resources used by the CResult_PaymentSecretAPIErrorZ.
9049 pub extern "C" fn CResult_PaymentSecretAPIErrorZ_free(_res: CResult_PaymentSecretAPIErrorZ) { }
9050 impl Drop for CResult_PaymentSecretAPIErrorZ {
9051         fn drop(&mut self) {
9052                 if self.result_ok {
9053                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
9054                                 let _ = unsafe { Box::from_raw(self.contents.result) };
9055                         }
9056                 } else {
9057                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
9058                                 let _ = unsafe { Box::from_raw(self.contents.err) };
9059                         }
9060                 }
9061         }
9062 }
9063 impl From<crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::util::errors::APIError>> for CResult_PaymentSecretAPIErrorZ {
9064         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::util::errors::APIError>) -> Self {
9065                 let contents = if o.result_ok {
9066                         let result = unsafe { o.contents.result };
9067                         unsafe { o.contents.result = core::ptr::null_mut() };
9068                         CResult_PaymentSecretAPIErrorZPtr { result }
9069                 } else {
9070                         let err = unsafe { o.contents.err };
9071                         unsafe { o.contents.err = core::ptr::null_mut(); }
9072                         CResult_PaymentSecretAPIErrorZPtr { err }
9073                 };
9074                 Self {
9075                         contents,
9076                         result_ok: o.result_ok,
9077                 }
9078         }
9079 }
9080 impl Clone for CResult_PaymentSecretAPIErrorZ {
9081         fn clone(&self) -> Self {
9082                 if self.result_ok {
9083                         Self { result_ok: true, contents: CResult_PaymentSecretAPIErrorZPtr {
9084                                 result: Box::into_raw(Box::new(<crate::c_types::ThirtyTwoBytes>::clone(unsafe { &*self.contents.result })))
9085                         } }
9086                 } else {
9087                         Self { result_ok: false, contents: CResult_PaymentSecretAPIErrorZPtr {
9088                                 err: Box::into_raw(Box::new(<crate::lightning::util::errors::APIError>::clone(unsafe { &*self.contents.err })))
9089                         } }
9090                 }
9091         }
9092 }
9093 #[no_mangle]
9094 /// Creates a new CResult_PaymentSecretAPIErrorZ which has the same data as `orig`
9095 /// but with all dynamically-allocated buffers duplicated in new buffers.
9096 pub extern "C" fn CResult_PaymentSecretAPIErrorZ_clone(orig: &CResult_PaymentSecretAPIErrorZ) -> CResult_PaymentSecretAPIErrorZ { Clone::clone(&orig) }
9097 #[repr(C)]
9098 /// The contents of CResult_PaymentPreimageAPIErrorZ
9099 pub union CResult_PaymentPreimageAPIErrorZPtr {
9100         /// A pointer to the contents in the success state.
9101         /// Reading from this pointer when `result_ok` is not set is undefined.
9102         pub result: *mut crate::c_types::ThirtyTwoBytes,
9103         /// A pointer to the contents in the error state.
9104         /// Reading from this pointer when `result_ok` is set is undefined.
9105         pub err: *mut crate::lightning::util::errors::APIError,
9106 }
9107 #[repr(C)]
9108 /// A CResult_PaymentPreimageAPIErrorZ represents the result of a fallible operation,
9109 /// containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning::util::errors::APIError on failure.
9110 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9111 pub struct CResult_PaymentPreimageAPIErrorZ {
9112         /// The contents of this CResult_PaymentPreimageAPIErrorZ, accessible via either
9113         /// `err` or `result` depending on the state of `result_ok`.
9114         pub contents: CResult_PaymentPreimageAPIErrorZPtr,
9115         /// Whether this CResult_PaymentPreimageAPIErrorZ represents a success state.
9116         pub result_ok: bool,
9117 }
9118 #[no_mangle]
9119 /// Creates a new CResult_PaymentPreimageAPIErrorZ in the success state.
9120 pub extern "C" fn CResult_PaymentPreimageAPIErrorZ_ok(o: crate::c_types::ThirtyTwoBytes) -> CResult_PaymentPreimageAPIErrorZ {
9121         CResult_PaymentPreimageAPIErrorZ {
9122                 contents: CResult_PaymentPreimageAPIErrorZPtr {
9123                         result: Box::into_raw(Box::new(o)),
9124                 },
9125                 result_ok: true,
9126         }
9127 }
9128 #[no_mangle]
9129 /// Creates a new CResult_PaymentPreimageAPIErrorZ in the error state.
9130 pub extern "C" fn CResult_PaymentPreimageAPIErrorZ_err(e: crate::lightning::util::errors::APIError) -> CResult_PaymentPreimageAPIErrorZ {
9131         CResult_PaymentPreimageAPIErrorZ {
9132                 contents: CResult_PaymentPreimageAPIErrorZPtr {
9133                         err: Box::into_raw(Box::new(e)),
9134                 },
9135                 result_ok: false,
9136         }
9137 }
9138 /// Checks if the given object is currently in the success state
9139 #[no_mangle]
9140 pub extern "C" fn CResult_PaymentPreimageAPIErrorZ_is_ok(o: &CResult_PaymentPreimageAPIErrorZ) -> bool {
9141         o.result_ok
9142 }
9143 #[no_mangle]
9144 /// Frees any resources used by the CResult_PaymentPreimageAPIErrorZ.
9145 pub extern "C" fn CResult_PaymentPreimageAPIErrorZ_free(_res: CResult_PaymentPreimageAPIErrorZ) { }
9146 impl Drop for CResult_PaymentPreimageAPIErrorZ {
9147         fn drop(&mut self) {
9148                 if self.result_ok {
9149                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
9150                                 let _ = unsafe { Box::from_raw(self.contents.result) };
9151                         }
9152                 } else {
9153                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
9154                                 let _ = unsafe { Box::from_raw(self.contents.err) };
9155                         }
9156                 }
9157         }
9158 }
9159 impl From<crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::util::errors::APIError>> for CResult_PaymentPreimageAPIErrorZ {
9160         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::util::errors::APIError>) -> Self {
9161                 let contents = if o.result_ok {
9162                         let result = unsafe { o.contents.result };
9163                         unsafe { o.contents.result = core::ptr::null_mut() };
9164                         CResult_PaymentPreimageAPIErrorZPtr { result }
9165                 } else {
9166                         let err = unsafe { o.contents.err };
9167                         unsafe { o.contents.err = core::ptr::null_mut(); }
9168                         CResult_PaymentPreimageAPIErrorZPtr { err }
9169                 };
9170                 Self {
9171                         contents,
9172                         result_ok: o.result_ok,
9173                 }
9174         }
9175 }
9176 impl Clone for CResult_PaymentPreimageAPIErrorZ {
9177         fn clone(&self) -> Self {
9178                 if self.result_ok {
9179                         Self { result_ok: true, contents: CResult_PaymentPreimageAPIErrorZPtr {
9180                                 result: Box::into_raw(Box::new(<crate::c_types::ThirtyTwoBytes>::clone(unsafe { &*self.contents.result })))
9181                         } }
9182                 } else {
9183                         Self { result_ok: false, contents: CResult_PaymentPreimageAPIErrorZPtr {
9184                                 err: Box::into_raw(Box::new(<crate::lightning::util::errors::APIError>::clone(unsafe { &*self.contents.err })))
9185                         } }
9186                 }
9187         }
9188 }
9189 #[no_mangle]
9190 /// Creates a new CResult_PaymentPreimageAPIErrorZ which has the same data as `orig`
9191 /// but with all dynamically-allocated buffers duplicated in new buffers.
9192 pub extern "C" fn CResult_PaymentPreimageAPIErrorZ_clone(orig: &CResult_PaymentPreimageAPIErrorZ) -> CResult_PaymentPreimageAPIErrorZ { Clone::clone(&orig) }
9193 #[repr(C)]
9194 /// The contents of CResult_CounterpartyForwardingInfoDecodeErrorZ
9195 pub union CResult_CounterpartyForwardingInfoDecodeErrorZPtr {
9196         /// A pointer to the contents in the success state.
9197         /// Reading from this pointer when `result_ok` is not set is undefined.
9198         pub result: *mut crate::lightning::ln::channelmanager::CounterpartyForwardingInfo,
9199         /// A pointer to the contents in the error state.
9200         /// Reading from this pointer when `result_ok` is set is undefined.
9201         pub err: *mut crate::lightning::ln::msgs::DecodeError,
9202 }
9203 #[repr(C)]
9204 /// A CResult_CounterpartyForwardingInfoDecodeErrorZ represents the result of a fallible operation,
9205 /// containing a crate::lightning::ln::channelmanager::CounterpartyForwardingInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
9206 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9207 pub struct CResult_CounterpartyForwardingInfoDecodeErrorZ {
9208         /// The contents of this CResult_CounterpartyForwardingInfoDecodeErrorZ, accessible via either
9209         /// `err` or `result` depending on the state of `result_ok`.
9210         pub contents: CResult_CounterpartyForwardingInfoDecodeErrorZPtr,
9211         /// Whether this CResult_CounterpartyForwardingInfoDecodeErrorZ represents a success state.
9212         pub result_ok: bool,
9213 }
9214 #[no_mangle]
9215 /// Creates a new CResult_CounterpartyForwardingInfoDecodeErrorZ in the success state.
9216 pub extern "C" fn CResult_CounterpartyForwardingInfoDecodeErrorZ_ok(o: crate::lightning::ln::channelmanager::CounterpartyForwardingInfo) -> CResult_CounterpartyForwardingInfoDecodeErrorZ {
9217         CResult_CounterpartyForwardingInfoDecodeErrorZ {
9218                 contents: CResult_CounterpartyForwardingInfoDecodeErrorZPtr {
9219                         result: Box::into_raw(Box::new(o)),
9220                 },
9221                 result_ok: true,
9222         }
9223 }
9224 #[no_mangle]
9225 /// Creates a new CResult_CounterpartyForwardingInfoDecodeErrorZ in the error state.
9226 pub extern "C" fn CResult_CounterpartyForwardingInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_CounterpartyForwardingInfoDecodeErrorZ {
9227         CResult_CounterpartyForwardingInfoDecodeErrorZ {
9228                 contents: CResult_CounterpartyForwardingInfoDecodeErrorZPtr {
9229                         err: Box::into_raw(Box::new(e)),
9230                 },
9231                 result_ok: false,
9232         }
9233 }
9234 /// Checks if the given object is currently in the success state
9235 #[no_mangle]
9236 pub extern "C" fn CResult_CounterpartyForwardingInfoDecodeErrorZ_is_ok(o: &CResult_CounterpartyForwardingInfoDecodeErrorZ) -> bool {
9237         o.result_ok
9238 }
9239 #[no_mangle]
9240 /// Frees any resources used by the CResult_CounterpartyForwardingInfoDecodeErrorZ.
9241 pub extern "C" fn CResult_CounterpartyForwardingInfoDecodeErrorZ_free(_res: CResult_CounterpartyForwardingInfoDecodeErrorZ) { }
9242 impl Drop for CResult_CounterpartyForwardingInfoDecodeErrorZ {
9243         fn drop(&mut self) {
9244                 if self.result_ok {
9245                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
9246                                 let _ = unsafe { Box::from_raw(self.contents.result) };
9247                         }
9248                 } else {
9249                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
9250                                 let _ = unsafe { Box::from_raw(self.contents.err) };
9251                         }
9252                 }
9253         }
9254 }
9255 impl From<crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::CounterpartyForwardingInfo, crate::lightning::ln::msgs::DecodeError>> for CResult_CounterpartyForwardingInfoDecodeErrorZ {
9256         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::CounterpartyForwardingInfo, crate::lightning::ln::msgs::DecodeError>) -> Self {
9257                 let contents = if o.result_ok {
9258                         let result = unsafe { o.contents.result };
9259                         unsafe { o.contents.result = core::ptr::null_mut() };
9260                         CResult_CounterpartyForwardingInfoDecodeErrorZPtr { result }
9261                 } else {
9262                         let err = unsafe { o.contents.err };
9263                         unsafe { o.contents.err = core::ptr::null_mut(); }
9264                         CResult_CounterpartyForwardingInfoDecodeErrorZPtr { err }
9265                 };
9266                 Self {
9267                         contents,
9268                         result_ok: o.result_ok,
9269                 }
9270         }
9271 }
9272 impl Clone for CResult_CounterpartyForwardingInfoDecodeErrorZ {
9273         fn clone(&self) -> Self {
9274                 if self.result_ok {
9275                         Self { result_ok: true, contents: CResult_CounterpartyForwardingInfoDecodeErrorZPtr {
9276                                 result: Box::into_raw(Box::new(<crate::lightning::ln::channelmanager::CounterpartyForwardingInfo>::clone(unsafe { &*self.contents.result })))
9277                         } }
9278                 } else {
9279                         Self { result_ok: false, contents: CResult_CounterpartyForwardingInfoDecodeErrorZPtr {
9280                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
9281                         } }
9282                 }
9283         }
9284 }
9285 #[no_mangle]
9286 /// Creates a new CResult_CounterpartyForwardingInfoDecodeErrorZ which has the same data as `orig`
9287 /// but with all dynamically-allocated buffers duplicated in new buffers.
9288 pub extern "C" fn CResult_CounterpartyForwardingInfoDecodeErrorZ_clone(orig: &CResult_CounterpartyForwardingInfoDecodeErrorZ) -> CResult_CounterpartyForwardingInfoDecodeErrorZ { Clone::clone(&orig) }
9289 #[repr(C)]
9290 /// The contents of CResult_ChannelCounterpartyDecodeErrorZ
9291 pub union CResult_ChannelCounterpartyDecodeErrorZPtr {
9292         /// A pointer to the contents in the success state.
9293         /// Reading from this pointer when `result_ok` is not set is undefined.
9294         pub result: *mut crate::lightning::ln::channelmanager::ChannelCounterparty,
9295         /// A pointer to the contents in the error state.
9296         /// Reading from this pointer when `result_ok` is set is undefined.
9297         pub err: *mut crate::lightning::ln::msgs::DecodeError,
9298 }
9299 #[repr(C)]
9300 /// A CResult_ChannelCounterpartyDecodeErrorZ represents the result of a fallible operation,
9301 /// containing a crate::lightning::ln::channelmanager::ChannelCounterparty on success and a crate::lightning::ln::msgs::DecodeError on failure.
9302 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9303 pub struct CResult_ChannelCounterpartyDecodeErrorZ {
9304         /// The contents of this CResult_ChannelCounterpartyDecodeErrorZ, accessible via either
9305         /// `err` or `result` depending on the state of `result_ok`.
9306         pub contents: CResult_ChannelCounterpartyDecodeErrorZPtr,
9307         /// Whether this CResult_ChannelCounterpartyDecodeErrorZ represents a success state.
9308         pub result_ok: bool,
9309 }
9310 #[no_mangle]
9311 /// Creates a new CResult_ChannelCounterpartyDecodeErrorZ in the success state.
9312 pub extern "C" fn CResult_ChannelCounterpartyDecodeErrorZ_ok(o: crate::lightning::ln::channelmanager::ChannelCounterparty) -> CResult_ChannelCounterpartyDecodeErrorZ {
9313         CResult_ChannelCounterpartyDecodeErrorZ {
9314                 contents: CResult_ChannelCounterpartyDecodeErrorZPtr {
9315                         result: Box::into_raw(Box::new(o)),
9316                 },
9317                 result_ok: true,
9318         }
9319 }
9320 #[no_mangle]
9321 /// Creates a new CResult_ChannelCounterpartyDecodeErrorZ in the error state.
9322 pub extern "C" fn CResult_ChannelCounterpartyDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelCounterpartyDecodeErrorZ {
9323         CResult_ChannelCounterpartyDecodeErrorZ {
9324                 contents: CResult_ChannelCounterpartyDecodeErrorZPtr {
9325                         err: Box::into_raw(Box::new(e)),
9326                 },
9327                 result_ok: false,
9328         }
9329 }
9330 /// Checks if the given object is currently in the success state
9331 #[no_mangle]
9332 pub extern "C" fn CResult_ChannelCounterpartyDecodeErrorZ_is_ok(o: &CResult_ChannelCounterpartyDecodeErrorZ) -> bool {
9333         o.result_ok
9334 }
9335 #[no_mangle]
9336 /// Frees any resources used by the CResult_ChannelCounterpartyDecodeErrorZ.
9337 pub extern "C" fn CResult_ChannelCounterpartyDecodeErrorZ_free(_res: CResult_ChannelCounterpartyDecodeErrorZ) { }
9338 impl Drop for CResult_ChannelCounterpartyDecodeErrorZ {
9339         fn drop(&mut self) {
9340                 if self.result_ok {
9341                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
9342                                 let _ = unsafe { Box::from_raw(self.contents.result) };
9343                         }
9344                 } else {
9345                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
9346                                 let _ = unsafe { Box::from_raw(self.contents.err) };
9347                         }
9348                 }
9349         }
9350 }
9351 impl From<crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::ChannelCounterparty, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelCounterpartyDecodeErrorZ {
9352         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::ChannelCounterparty, crate::lightning::ln::msgs::DecodeError>) -> Self {
9353                 let contents = if o.result_ok {
9354                         let result = unsafe { o.contents.result };
9355                         unsafe { o.contents.result = core::ptr::null_mut() };
9356                         CResult_ChannelCounterpartyDecodeErrorZPtr { result }
9357                 } else {
9358                         let err = unsafe { o.contents.err };
9359                         unsafe { o.contents.err = core::ptr::null_mut(); }
9360                         CResult_ChannelCounterpartyDecodeErrorZPtr { err }
9361                 };
9362                 Self {
9363                         contents,
9364                         result_ok: o.result_ok,
9365                 }
9366         }
9367 }
9368 impl Clone for CResult_ChannelCounterpartyDecodeErrorZ {
9369         fn clone(&self) -> Self {
9370                 if self.result_ok {
9371                         Self { result_ok: true, contents: CResult_ChannelCounterpartyDecodeErrorZPtr {
9372                                 result: Box::into_raw(Box::new(<crate::lightning::ln::channelmanager::ChannelCounterparty>::clone(unsafe { &*self.contents.result })))
9373                         } }
9374                 } else {
9375                         Self { result_ok: false, contents: CResult_ChannelCounterpartyDecodeErrorZPtr {
9376                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
9377                         } }
9378                 }
9379         }
9380 }
9381 #[no_mangle]
9382 /// Creates a new CResult_ChannelCounterpartyDecodeErrorZ which has the same data as `orig`
9383 /// but with all dynamically-allocated buffers duplicated in new buffers.
9384 pub extern "C" fn CResult_ChannelCounterpartyDecodeErrorZ_clone(orig: &CResult_ChannelCounterpartyDecodeErrorZ) -> CResult_ChannelCounterpartyDecodeErrorZ { Clone::clone(&orig) }
9385 #[repr(C)]
9386 /// The contents of CResult_ChannelDetailsDecodeErrorZ
9387 pub union CResult_ChannelDetailsDecodeErrorZPtr {
9388         /// A pointer to the contents in the success state.
9389         /// Reading from this pointer when `result_ok` is not set is undefined.
9390         pub result: *mut crate::lightning::ln::channelmanager::ChannelDetails,
9391         /// A pointer to the contents in the error state.
9392         /// Reading from this pointer when `result_ok` is set is undefined.
9393         pub err: *mut crate::lightning::ln::msgs::DecodeError,
9394 }
9395 #[repr(C)]
9396 /// A CResult_ChannelDetailsDecodeErrorZ represents the result of a fallible operation,
9397 /// containing a crate::lightning::ln::channelmanager::ChannelDetails on success and a crate::lightning::ln::msgs::DecodeError on failure.
9398 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9399 pub struct CResult_ChannelDetailsDecodeErrorZ {
9400         /// The contents of this CResult_ChannelDetailsDecodeErrorZ, accessible via either
9401         /// `err` or `result` depending on the state of `result_ok`.
9402         pub contents: CResult_ChannelDetailsDecodeErrorZPtr,
9403         /// Whether this CResult_ChannelDetailsDecodeErrorZ represents a success state.
9404         pub result_ok: bool,
9405 }
9406 #[no_mangle]
9407 /// Creates a new CResult_ChannelDetailsDecodeErrorZ in the success state.
9408 pub extern "C" fn CResult_ChannelDetailsDecodeErrorZ_ok(o: crate::lightning::ln::channelmanager::ChannelDetails) -> CResult_ChannelDetailsDecodeErrorZ {
9409         CResult_ChannelDetailsDecodeErrorZ {
9410                 contents: CResult_ChannelDetailsDecodeErrorZPtr {
9411                         result: Box::into_raw(Box::new(o)),
9412                 },
9413                 result_ok: true,
9414         }
9415 }
9416 #[no_mangle]
9417 /// Creates a new CResult_ChannelDetailsDecodeErrorZ in the error state.
9418 pub extern "C" fn CResult_ChannelDetailsDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelDetailsDecodeErrorZ {
9419         CResult_ChannelDetailsDecodeErrorZ {
9420                 contents: CResult_ChannelDetailsDecodeErrorZPtr {
9421                         err: Box::into_raw(Box::new(e)),
9422                 },
9423                 result_ok: false,
9424         }
9425 }
9426 /// Checks if the given object is currently in the success state
9427 #[no_mangle]
9428 pub extern "C" fn CResult_ChannelDetailsDecodeErrorZ_is_ok(o: &CResult_ChannelDetailsDecodeErrorZ) -> bool {
9429         o.result_ok
9430 }
9431 #[no_mangle]
9432 /// Frees any resources used by the CResult_ChannelDetailsDecodeErrorZ.
9433 pub extern "C" fn CResult_ChannelDetailsDecodeErrorZ_free(_res: CResult_ChannelDetailsDecodeErrorZ) { }
9434 impl Drop for CResult_ChannelDetailsDecodeErrorZ {
9435         fn drop(&mut self) {
9436                 if self.result_ok {
9437                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
9438                                 let _ = unsafe { Box::from_raw(self.contents.result) };
9439                         }
9440                 } else {
9441                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
9442                                 let _ = unsafe { Box::from_raw(self.contents.err) };
9443                         }
9444                 }
9445         }
9446 }
9447 impl From<crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::ChannelDetails, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelDetailsDecodeErrorZ {
9448         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::ChannelDetails, crate::lightning::ln::msgs::DecodeError>) -> Self {
9449                 let contents = if o.result_ok {
9450                         let result = unsafe { o.contents.result };
9451                         unsafe { o.contents.result = core::ptr::null_mut() };
9452                         CResult_ChannelDetailsDecodeErrorZPtr { result }
9453                 } else {
9454                         let err = unsafe { o.contents.err };
9455                         unsafe { o.contents.err = core::ptr::null_mut(); }
9456                         CResult_ChannelDetailsDecodeErrorZPtr { err }
9457                 };
9458                 Self {
9459                         contents,
9460                         result_ok: o.result_ok,
9461                 }
9462         }
9463 }
9464 impl Clone for CResult_ChannelDetailsDecodeErrorZ {
9465         fn clone(&self) -> Self {
9466                 if self.result_ok {
9467                         Self { result_ok: true, contents: CResult_ChannelDetailsDecodeErrorZPtr {
9468                                 result: Box::into_raw(Box::new(<crate::lightning::ln::channelmanager::ChannelDetails>::clone(unsafe { &*self.contents.result })))
9469                         } }
9470                 } else {
9471                         Self { result_ok: false, contents: CResult_ChannelDetailsDecodeErrorZPtr {
9472                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
9473                         } }
9474                 }
9475         }
9476 }
9477 #[no_mangle]
9478 /// Creates a new CResult_ChannelDetailsDecodeErrorZ which has the same data as `orig`
9479 /// but with all dynamically-allocated buffers duplicated in new buffers.
9480 pub extern "C" fn CResult_ChannelDetailsDecodeErrorZ_clone(orig: &CResult_ChannelDetailsDecodeErrorZ) -> CResult_ChannelDetailsDecodeErrorZ { Clone::clone(&orig) }
9481 #[repr(C)]
9482 /// The contents of CResult_PhantomRouteHintsDecodeErrorZ
9483 pub union CResult_PhantomRouteHintsDecodeErrorZPtr {
9484         /// A pointer to the contents in the success state.
9485         /// Reading from this pointer when `result_ok` is not set is undefined.
9486         pub result: *mut crate::lightning::ln::channelmanager::PhantomRouteHints,
9487         /// A pointer to the contents in the error state.
9488         /// Reading from this pointer when `result_ok` is set is undefined.
9489         pub err: *mut crate::lightning::ln::msgs::DecodeError,
9490 }
9491 #[repr(C)]
9492 /// A CResult_PhantomRouteHintsDecodeErrorZ represents the result of a fallible operation,
9493 /// containing a crate::lightning::ln::channelmanager::PhantomRouteHints on success and a crate::lightning::ln::msgs::DecodeError on failure.
9494 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9495 pub struct CResult_PhantomRouteHintsDecodeErrorZ {
9496         /// The contents of this CResult_PhantomRouteHintsDecodeErrorZ, accessible via either
9497         /// `err` or `result` depending on the state of `result_ok`.
9498         pub contents: CResult_PhantomRouteHintsDecodeErrorZPtr,
9499         /// Whether this CResult_PhantomRouteHintsDecodeErrorZ represents a success state.
9500         pub result_ok: bool,
9501 }
9502 #[no_mangle]
9503 /// Creates a new CResult_PhantomRouteHintsDecodeErrorZ in the success state.
9504 pub extern "C" fn CResult_PhantomRouteHintsDecodeErrorZ_ok(o: crate::lightning::ln::channelmanager::PhantomRouteHints) -> CResult_PhantomRouteHintsDecodeErrorZ {
9505         CResult_PhantomRouteHintsDecodeErrorZ {
9506                 contents: CResult_PhantomRouteHintsDecodeErrorZPtr {
9507                         result: Box::into_raw(Box::new(o)),
9508                 },
9509                 result_ok: true,
9510         }
9511 }
9512 #[no_mangle]
9513 /// Creates a new CResult_PhantomRouteHintsDecodeErrorZ in the error state.
9514 pub extern "C" fn CResult_PhantomRouteHintsDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_PhantomRouteHintsDecodeErrorZ {
9515         CResult_PhantomRouteHintsDecodeErrorZ {
9516                 contents: CResult_PhantomRouteHintsDecodeErrorZPtr {
9517                         err: Box::into_raw(Box::new(e)),
9518                 },
9519                 result_ok: false,
9520         }
9521 }
9522 /// Checks if the given object is currently in the success state
9523 #[no_mangle]
9524 pub extern "C" fn CResult_PhantomRouteHintsDecodeErrorZ_is_ok(o: &CResult_PhantomRouteHintsDecodeErrorZ) -> bool {
9525         o.result_ok
9526 }
9527 #[no_mangle]
9528 /// Frees any resources used by the CResult_PhantomRouteHintsDecodeErrorZ.
9529 pub extern "C" fn CResult_PhantomRouteHintsDecodeErrorZ_free(_res: CResult_PhantomRouteHintsDecodeErrorZ) { }
9530 impl Drop for CResult_PhantomRouteHintsDecodeErrorZ {
9531         fn drop(&mut self) {
9532                 if self.result_ok {
9533                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
9534                                 let _ = unsafe { Box::from_raw(self.contents.result) };
9535                         }
9536                 } else {
9537                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
9538                                 let _ = unsafe { Box::from_raw(self.contents.err) };
9539                         }
9540                 }
9541         }
9542 }
9543 impl From<crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::PhantomRouteHints, crate::lightning::ln::msgs::DecodeError>> for CResult_PhantomRouteHintsDecodeErrorZ {
9544         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::PhantomRouteHints, crate::lightning::ln::msgs::DecodeError>) -> Self {
9545                 let contents = if o.result_ok {
9546                         let result = unsafe { o.contents.result };
9547                         unsafe { o.contents.result = core::ptr::null_mut() };
9548                         CResult_PhantomRouteHintsDecodeErrorZPtr { result }
9549                 } else {
9550                         let err = unsafe { o.contents.err };
9551                         unsafe { o.contents.err = core::ptr::null_mut(); }
9552                         CResult_PhantomRouteHintsDecodeErrorZPtr { err }
9553                 };
9554                 Self {
9555                         contents,
9556                         result_ok: o.result_ok,
9557                 }
9558         }
9559 }
9560 impl Clone for CResult_PhantomRouteHintsDecodeErrorZ {
9561         fn clone(&self) -> Self {
9562                 if self.result_ok {
9563                         Self { result_ok: true, contents: CResult_PhantomRouteHintsDecodeErrorZPtr {
9564                                 result: Box::into_raw(Box::new(<crate::lightning::ln::channelmanager::PhantomRouteHints>::clone(unsafe { &*self.contents.result })))
9565                         } }
9566                 } else {
9567                         Self { result_ok: false, contents: CResult_PhantomRouteHintsDecodeErrorZPtr {
9568                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
9569                         } }
9570                 }
9571         }
9572 }
9573 #[no_mangle]
9574 /// Creates a new CResult_PhantomRouteHintsDecodeErrorZ which has the same data as `orig`
9575 /// but with all dynamically-allocated buffers duplicated in new buffers.
9576 pub extern "C" fn CResult_PhantomRouteHintsDecodeErrorZ_clone(orig: &CResult_PhantomRouteHintsDecodeErrorZ) -> CResult_PhantomRouteHintsDecodeErrorZ { Clone::clone(&orig) }
9577 #[repr(C)]
9578 /// A dynamically-allocated array of crate::lightning::chain::channelmonitor::ChannelMonitors of arbitrary size.
9579 /// This corresponds to std::vector in C++
9580 pub struct CVec_ChannelMonitorZ {
9581         /// The elements in the array.
9582         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
9583         pub data: *mut crate::lightning::chain::channelmonitor::ChannelMonitor,
9584         /// The number of elements pointed to by `data`.
9585         pub datalen: usize
9586 }
9587 impl CVec_ChannelMonitorZ {
9588         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::chain::channelmonitor::ChannelMonitor> {
9589                 if self.datalen == 0 { return Vec::new(); }
9590                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
9591                 self.data = core::ptr::null_mut();
9592                 self.datalen = 0;
9593                 ret
9594         }
9595         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::chain::channelmonitor::ChannelMonitor] {
9596                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
9597         }
9598 }
9599 impl From<Vec<crate::lightning::chain::channelmonitor::ChannelMonitor>> for CVec_ChannelMonitorZ {
9600         fn from(v: Vec<crate::lightning::chain::channelmonitor::ChannelMonitor>) -> Self {
9601                 let datalen = v.len();
9602                 let data = Box::into_raw(v.into_boxed_slice());
9603                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
9604         }
9605 }
9606 #[no_mangle]
9607 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
9608 pub extern "C" fn CVec_ChannelMonitorZ_free(_res: CVec_ChannelMonitorZ) { }
9609 impl Drop for CVec_ChannelMonitorZ {
9610         fn drop(&mut self) {
9611                 if self.datalen == 0 { return; }
9612                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
9613         }
9614 }
9615 #[repr(C)]
9616 /// A tuple of 2 elements. See the individual fields for the types contained.
9617 pub struct C2Tuple_BlockHashChannelManagerZ {
9618         /// The element at position 0
9619         pub a: crate::c_types::ThirtyTwoBytes,
9620         /// The element at position 1
9621         pub b: crate::lightning::ln::channelmanager::ChannelManager,
9622 }
9623 impl From<(crate::c_types::ThirtyTwoBytes, crate::lightning::ln::channelmanager::ChannelManager)> for C2Tuple_BlockHashChannelManagerZ {
9624         fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::lightning::ln::channelmanager::ChannelManager)) -> Self {
9625                 Self {
9626                         a: tup.0,
9627                         b: tup.1,
9628                 }
9629         }
9630 }
9631 impl C2Tuple_BlockHashChannelManagerZ {
9632         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::lightning::ln::channelmanager::ChannelManager) {
9633                 (self.a, self.b)
9634         }
9635 }
9636 /// Creates a new C2Tuple_BlockHashChannelManagerZ from the contained elements.
9637 #[no_mangle]
9638 pub extern "C" fn C2Tuple_BlockHashChannelManagerZ_new(a: crate::c_types::ThirtyTwoBytes, b: crate::lightning::ln::channelmanager::ChannelManager) -> C2Tuple_BlockHashChannelManagerZ {
9639         C2Tuple_BlockHashChannelManagerZ { a, b, }
9640 }
9641
9642 #[no_mangle]
9643 /// Frees any resources used by the C2Tuple_BlockHashChannelManagerZ.
9644 pub extern "C" fn C2Tuple_BlockHashChannelManagerZ_free(_res: C2Tuple_BlockHashChannelManagerZ) { }
9645 #[repr(C)]
9646 /// The contents of CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ
9647 pub union CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr {
9648         /// A pointer to the contents in the success state.
9649         /// Reading from this pointer when `result_ok` is not set is undefined.
9650         pub result: *mut crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ,
9651         /// A pointer to the contents in the error state.
9652         /// Reading from this pointer when `result_ok` is set is undefined.
9653         pub err: *mut crate::lightning::ln::msgs::DecodeError,
9654 }
9655 #[repr(C)]
9656 /// A CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ represents the result of a fallible operation,
9657 /// containing a crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
9658 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9659 pub struct CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
9660         /// The contents of this CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ, accessible via either
9661         /// `err` or `result` depending on the state of `result_ok`.
9662         pub contents: CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr,
9663         /// Whether this CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ represents a success state.
9664         pub result_ok: bool,
9665 }
9666 #[no_mangle]
9667 /// Creates a new CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ in the success state.
9668 pub extern "C" fn CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_ok(o: crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ) -> CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
9669         CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
9670                 contents: CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr {
9671                         result: Box::into_raw(Box::new(o)),
9672                 },
9673                 result_ok: true,
9674         }
9675 }
9676 #[no_mangle]
9677 /// Creates a new CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ in the error state.
9678 pub extern "C" fn CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
9679         CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
9680                 contents: CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr {
9681                         err: Box::into_raw(Box::new(e)),
9682                 },
9683                 result_ok: false,
9684         }
9685 }
9686 /// Checks if the given object is currently in the success state
9687 #[no_mangle]
9688 pub extern "C" fn CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_is_ok(o: &CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ) -> bool {
9689         o.result_ok
9690 }
9691 #[no_mangle]
9692 /// Frees any resources used by the CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ.
9693 pub extern "C" fn CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_free(_res: CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ) { }
9694 impl Drop for CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
9695         fn drop(&mut self) {
9696                 if self.result_ok {
9697                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
9698                                 let _ = unsafe { Box::from_raw(self.contents.result) };
9699                         }
9700                 } else {
9701                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
9702                                 let _ = unsafe { Box::from_raw(self.contents.err) };
9703                         }
9704                 }
9705         }
9706 }
9707 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ, crate::lightning::ln::msgs::DecodeError>> for CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
9708         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
9709                 let contents = if o.result_ok {
9710                         let result = unsafe { o.contents.result };
9711                         unsafe { o.contents.result = core::ptr::null_mut() };
9712                         CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr { result }
9713                 } else {
9714                         let err = unsafe { o.contents.err };
9715                         unsafe { o.contents.err = core::ptr::null_mut(); }
9716                         CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr { err }
9717                 };
9718                 Self {
9719                         contents,
9720                         result_ok: o.result_ok,
9721                 }
9722         }
9723 }
9724 #[repr(C)]
9725 /// The contents of CResult_ChannelConfigDecodeErrorZ
9726 pub union CResult_ChannelConfigDecodeErrorZPtr {
9727         /// A pointer to the contents in the success state.
9728         /// Reading from this pointer when `result_ok` is not set is undefined.
9729         pub result: *mut crate::lightning::util::config::ChannelConfig,
9730         /// A pointer to the contents in the error state.
9731         /// Reading from this pointer when `result_ok` is set is undefined.
9732         pub err: *mut crate::lightning::ln::msgs::DecodeError,
9733 }
9734 #[repr(C)]
9735 /// A CResult_ChannelConfigDecodeErrorZ represents the result of a fallible operation,
9736 /// containing a crate::lightning::util::config::ChannelConfig on success and a crate::lightning::ln::msgs::DecodeError on failure.
9737 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9738 pub struct CResult_ChannelConfigDecodeErrorZ {
9739         /// The contents of this CResult_ChannelConfigDecodeErrorZ, accessible via either
9740         /// `err` or `result` depending on the state of `result_ok`.
9741         pub contents: CResult_ChannelConfigDecodeErrorZPtr,
9742         /// Whether this CResult_ChannelConfigDecodeErrorZ represents a success state.
9743         pub result_ok: bool,
9744 }
9745 #[no_mangle]
9746 /// Creates a new CResult_ChannelConfigDecodeErrorZ in the success state.
9747 pub extern "C" fn CResult_ChannelConfigDecodeErrorZ_ok(o: crate::lightning::util::config::ChannelConfig) -> CResult_ChannelConfigDecodeErrorZ {
9748         CResult_ChannelConfigDecodeErrorZ {
9749                 contents: CResult_ChannelConfigDecodeErrorZPtr {
9750                         result: Box::into_raw(Box::new(o)),
9751                 },
9752                 result_ok: true,
9753         }
9754 }
9755 #[no_mangle]
9756 /// Creates a new CResult_ChannelConfigDecodeErrorZ in the error state.
9757 pub extern "C" fn CResult_ChannelConfigDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelConfigDecodeErrorZ {
9758         CResult_ChannelConfigDecodeErrorZ {
9759                 contents: CResult_ChannelConfigDecodeErrorZPtr {
9760                         err: Box::into_raw(Box::new(e)),
9761                 },
9762                 result_ok: false,
9763         }
9764 }
9765 /// Checks if the given object is currently in the success state
9766 #[no_mangle]
9767 pub extern "C" fn CResult_ChannelConfigDecodeErrorZ_is_ok(o: &CResult_ChannelConfigDecodeErrorZ) -> bool {
9768         o.result_ok
9769 }
9770 #[no_mangle]
9771 /// Frees any resources used by the CResult_ChannelConfigDecodeErrorZ.
9772 pub extern "C" fn CResult_ChannelConfigDecodeErrorZ_free(_res: CResult_ChannelConfigDecodeErrorZ) { }
9773 impl Drop for CResult_ChannelConfigDecodeErrorZ {
9774         fn drop(&mut self) {
9775                 if self.result_ok {
9776                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
9777                                 let _ = unsafe { Box::from_raw(self.contents.result) };
9778                         }
9779                 } else {
9780                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
9781                                 let _ = unsafe { Box::from_raw(self.contents.err) };
9782                         }
9783                 }
9784         }
9785 }
9786 impl From<crate::c_types::CResultTempl<crate::lightning::util::config::ChannelConfig, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelConfigDecodeErrorZ {
9787         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::util::config::ChannelConfig, crate::lightning::ln::msgs::DecodeError>) -> Self {
9788                 let contents = if o.result_ok {
9789                         let result = unsafe { o.contents.result };
9790                         unsafe { o.contents.result = core::ptr::null_mut() };
9791                         CResult_ChannelConfigDecodeErrorZPtr { result }
9792                 } else {
9793                         let err = unsafe { o.contents.err };
9794                         unsafe { o.contents.err = core::ptr::null_mut(); }
9795                         CResult_ChannelConfigDecodeErrorZPtr { err }
9796                 };
9797                 Self {
9798                         contents,
9799                         result_ok: o.result_ok,
9800                 }
9801         }
9802 }
9803 impl Clone for CResult_ChannelConfigDecodeErrorZ {
9804         fn clone(&self) -> Self {
9805                 if self.result_ok {
9806                         Self { result_ok: true, contents: CResult_ChannelConfigDecodeErrorZPtr {
9807                                 result: Box::into_raw(Box::new(<crate::lightning::util::config::ChannelConfig>::clone(unsafe { &*self.contents.result })))
9808                         } }
9809                 } else {
9810                         Self { result_ok: false, contents: CResult_ChannelConfigDecodeErrorZPtr {
9811                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
9812                         } }
9813                 }
9814         }
9815 }
9816 #[no_mangle]
9817 /// Creates a new CResult_ChannelConfigDecodeErrorZ which has the same data as `orig`
9818 /// but with all dynamically-allocated buffers duplicated in new buffers.
9819 pub extern "C" fn CResult_ChannelConfigDecodeErrorZ_clone(orig: &CResult_ChannelConfigDecodeErrorZ) -> CResult_ChannelConfigDecodeErrorZ { Clone::clone(&orig) }
9820 #[repr(C)]
9821 /// The contents of CResult_OutPointDecodeErrorZ
9822 pub union CResult_OutPointDecodeErrorZPtr {
9823         /// A pointer to the contents in the success state.
9824         /// Reading from this pointer when `result_ok` is not set is undefined.
9825         pub result: *mut crate::lightning::chain::transaction::OutPoint,
9826         /// A pointer to the contents in the error state.
9827         /// Reading from this pointer when `result_ok` is set is undefined.
9828         pub err: *mut crate::lightning::ln::msgs::DecodeError,
9829 }
9830 #[repr(C)]
9831 /// A CResult_OutPointDecodeErrorZ represents the result of a fallible operation,
9832 /// containing a crate::lightning::chain::transaction::OutPoint on success and a crate::lightning::ln::msgs::DecodeError on failure.
9833 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9834 pub struct CResult_OutPointDecodeErrorZ {
9835         /// The contents of this CResult_OutPointDecodeErrorZ, accessible via either
9836         /// `err` or `result` depending on the state of `result_ok`.
9837         pub contents: CResult_OutPointDecodeErrorZPtr,
9838         /// Whether this CResult_OutPointDecodeErrorZ represents a success state.
9839         pub result_ok: bool,
9840 }
9841 #[no_mangle]
9842 /// Creates a new CResult_OutPointDecodeErrorZ in the success state.
9843 pub extern "C" fn CResult_OutPointDecodeErrorZ_ok(o: crate::lightning::chain::transaction::OutPoint) -> CResult_OutPointDecodeErrorZ {
9844         CResult_OutPointDecodeErrorZ {
9845                 contents: CResult_OutPointDecodeErrorZPtr {
9846                         result: Box::into_raw(Box::new(o)),
9847                 },
9848                 result_ok: true,
9849         }
9850 }
9851 #[no_mangle]
9852 /// Creates a new CResult_OutPointDecodeErrorZ in the error state.
9853 pub extern "C" fn CResult_OutPointDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_OutPointDecodeErrorZ {
9854         CResult_OutPointDecodeErrorZ {
9855                 contents: CResult_OutPointDecodeErrorZPtr {
9856                         err: Box::into_raw(Box::new(e)),
9857                 },
9858                 result_ok: false,
9859         }
9860 }
9861 /// Checks if the given object is currently in the success state
9862 #[no_mangle]
9863 pub extern "C" fn CResult_OutPointDecodeErrorZ_is_ok(o: &CResult_OutPointDecodeErrorZ) -> bool {
9864         o.result_ok
9865 }
9866 #[no_mangle]
9867 /// Frees any resources used by the CResult_OutPointDecodeErrorZ.
9868 pub extern "C" fn CResult_OutPointDecodeErrorZ_free(_res: CResult_OutPointDecodeErrorZ) { }
9869 impl Drop for CResult_OutPointDecodeErrorZ {
9870         fn drop(&mut self) {
9871                 if self.result_ok {
9872                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
9873                                 let _ = unsafe { Box::from_raw(self.contents.result) };
9874                         }
9875                 } else {
9876                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
9877                                 let _ = unsafe { Box::from_raw(self.contents.err) };
9878                         }
9879                 }
9880         }
9881 }
9882 impl From<crate::c_types::CResultTempl<crate::lightning::chain::transaction::OutPoint, crate::lightning::ln::msgs::DecodeError>> for CResult_OutPointDecodeErrorZ {
9883         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::transaction::OutPoint, crate::lightning::ln::msgs::DecodeError>) -> Self {
9884                 let contents = if o.result_ok {
9885                         let result = unsafe { o.contents.result };
9886                         unsafe { o.contents.result = core::ptr::null_mut() };
9887                         CResult_OutPointDecodeErrorZPtr { result }
9888                 } else {
9889                         let err = unsafe { o.contents.err };
9890                         unsafe { o.contents.err = core::ptr::null_mut(); }
9891                         CResult_OutPointDecodeErrorZPtr { err }
9892                 };
9893                 Self {
9894                         contents,
9895                         result_ok: o.result_ok,
9896                 }
9897         }
9898 }
9899 impl Clone for CResult_OutPointDecodeErrorZ {
9900         fn clone(&self) -> Self {
9901                 if self.result_ok {
9902                         Self { result_ok: true, contents: CResult_OutPointDecodeErrorZPtr {
9903                                 result: Box::into_raw(Box::new(<crate::lightning::chain::transaction::OutPoint>::clone(unsafe { &*self.contents.result })))
9904                         } }
9905                 } else {
9906                         Self { result_ok: false, contents: CResult_OutPointDecodeErrorZPtr {
9907                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
9908                         } }
9909                 }
9910         }
9911 }
9912 #[no_mangle]
9913 /// Creates a new CResult_OutPointDecodeErrorZ which has the same data as `orig`
9914 /// but with all dynamically-allocated buffers duplicated in new buffers.
9915 pub extern "C" fn CResult_OutPointDecodeErrorZ_clone(orig: &CResult_OutPointDecodeErrorZ) -> CResult_OutPointDecodeErrorZ { Clone::clone(&orig) }
9916 #[repr(C)]
9917 /// An enum which can either contain a crate::lightning::ln::wire::Type or not
9918 pub enum COption_TypeZ {
9919         /// When we're in this state, this COption_TypeZ contains a crate::lightning::ln::wire::Type
9920         Some(crate::lightning::ln::wire::Type),
9921         /// When we're in this state, this COption_TypeZ contains nothing
9922         None
9923 }
9924 impl COption_TypeZ {
9925         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
9926                 if let Self::None = self { false } else { true }
9927         }
9928         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
9929                 !self.is_some()
9930         }
9931         #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::ln::wire::Type {
9932                 if let Self::Some(v) = self { v } else { unreachable!() }
9933         }
9934 }
9935 #[no_mangle]
9936 /// Constructs a new COption_TypeZ containing a crate::lightning::ln::wire::Type
9937 pub extern "C" fn COption_TypeZ_some(o: crate::lightning::ln::wire::Type) -> COption_TypeZ {
9938         COption_TypeZ::Some(o)
9939 }
9940 #[no_mangle]
9941 /// Constructs a new COption_TypeZ containing nothing
9942 pub extern "C" fn COption_TypeZ_none() -> COption_TypeZ {
9943         COption_TypeZ::None
9944 }
9945 #[no_mangle]
9946 /// Frees any resources associated with the crate::lightning::ln::wire::Type, if we are in the Some state
9947 pub extern "C" fn COption_TypeZ_free(_res: COption_TypeZ) { }
9948 #[repr(C)]
9949 /// The contents of CResult_COption_TypeZDecodeErrorZ
9950 pub union CResult_COption_TypeZDecodeErrorZPtr {
9951         /// A pointer to the contents in the success state.
9952         /// Reading from this pointer when `result_ok` is not set is undefined.
9953         pub result: *mut crate::c_types::derived::COption_TypeZ,
9954         /// A pointer to the contents in the error state.
9955         /// Reading from this pointer when `result_ok` is set is undefined.
9956         pub err: *mut crate::lightning::ln::msgs::DecodeError,
9957 }
9958 #[repr(C)]
9959 /// A CResult_COption_TypeZDecodeErrorZ represents the result of a fallible operation,
9960 /// containing a crate::c_types::derived::COption_TypeZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
9961 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9962 pub struct CResult_COption_TypeZDecodeErrorZ {
9963         /// The contents of this CResult_COption_TypeZDecodeErrorZ, accessible via either
9964         /// `err` or `result` depending on the state of `result_ok`.
9965         pub contents: CResult_COption_TypeZDecodeErrorZPtr,
9966         /// Whether this CResult_COption_TypeZDecodeErrorZ represents a success state.
9967         pub result_ok: bool,
9968 }
9969 #[no_mangle]
9970 /// Creates a new CResult_COption_TypeZDecodeErrorZ in the success state.
9971 pub extern "C" fn CResult_COption_TypeZDecodeErrorZ_ok(o: crate::c_types::derived::COption_TypeZ) -> CResult_COption_TypeZDecodeErrorZ {
9972         CResult_COption_TypeZDecodeErrorZ {
9973                 contents: CResult_COption_TypeZDecodeErrorZPtr {
9974                         result: Box::into_raw(Box::new(o)),
9975                 },
9976                 result_ok: true,
9977         }
9978 }
9979 #[no_mangle]
9980 /// Creates a new CResult_COption_TypeZDecodeErrorZ in the error state.
9981 pub extern "C" fn CResult_COption_TypeZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_TypeZDecodeErrorZ {
9982         CResult_COption_TypeZDecodeErrorZ {
9983                 contents: CResult_COption_TypeZDecodeErrorZPtr {
9984                         err: Box::into_raw(Box::new(e)),
9985                 },
9986                 result_ok: false,
9987         }
9988 }
9989 /// Checks if the given object is currently in the success state
9990 #[no_mangle]
9991 pub extern "C" fn CResult_COption_TypeZDecodeErrorZ_is_ok(o: &CResult_COption_TypeZDecodeErrorZ) -> bool {
9992         o.result_ok
9993 }
9994 #[no_mangle]
9995 /// Frees any resources used by the CResult_COption_TypeZDecodeErrorZ.
9996 pub extern "C" fn CResult_COption_TypeZDecodeErrorZ_free(_res: CResult_COption_TypeZDecodeErrorZ) { }
9997 impl Drop for CResult_COption_TypeZDecodeErrorZ {
9998         fn drop(&mut self) {
9999                 if self.result_ok {
10000                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
10001                                 let _ = unsafe { Box::from_raw(self.contents.result) };
10002                         }
10003                 } else {
10004                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
10005                                 let _ = unsafe { Box::from_raw(self.contents.err) };
10006                         }
10007                 }
10008         }
10009 }
10010 impl From<crate::c_types::CResultTempl<crate::c_types::derived::COption_TypeZ, crate::lightning::ln::msgs::DecodeError>> for CResult_COption_TypeZDecodeErrorZ {
10011         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::COption_TypeZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
10012                 let contents = if o.result_ok {
10013                         let result = unsafe { o.contents.result };
10014                         unsafe { o.contents.result = core::ptr::null_mut() };
10015                         CResult_COption_TypeZDecodeErrorZPtr { result }
10016                 } else {
10017                         let err = unsafe { o.contents.err };
10018                         unsafe { o.contents.err = core::ptr::null_mut(); }
10019                         CResult_COption_TypeZDecodeErrorZPtr { err }
10020                 };
10021                 Self {
10022                         contents,
10023                         result_ok: o.result_ok,
10024                 }
10025         }
10026 }
10027 #[repr(C)]
10028 /// The contents of CResult_PaymentIdPaymentErrorZ
10029 pub union CResult_PaymentIdPaymentErrorZPtr {
10030         /// A pointer to the contents in the success state.
10031         /// Reading from this pointer when `result_ok` is not set is undefined.
10032         pub result: *mut crate::c_types::ThirtyTwoBytes,
10033         /// A pointer to the contents in the error state.
10034         /// Reading from this pointer when `result_ok` is set is undefined.
10035         pub err: *mut crate::lightning_invoice::payment::PaymentError,
10036 }
10037 #[repr(C)]
10038 /// A CResult_PaymentIdPaymentErrorZ represents the result of a fallible operation,
10039 /// containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning_invoice::payment::PaymentError on failure.
10040 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10041 pub struct CResult_PaymentIdPaymentErrorZ {
10042         /// The contents of this CResult_PaymentIdPaymentErrorZ, accessible via either
10043         /// `err` or `result` depending on the state of `result_ok`.
10044         pub contents: CResult_PaymentIdPaymentErrorZPtr,
10045         /// Whether this CResult_PaymentIdPaymentErrorZ represents a success state.
10046         pub result_ok: bool,
10047 }
10048 #[no_mangle]
10049 /// Creates a new CResult_PaymentIdPaymentErrorZ in the success state.
10050 pub extern "C" fn CResult_PaymentIdPaymentErrorZ_ok(o: crate::c_types::ThirtyTwoBytes) -> CResult_PaymentIdPaymentErrorZ {
10051         CResult_PaymentIdPaymentErrorZ {
10052                 contents: CResult_PaymentIdPaymentErrorZPtr {
10053                         result: Box::into_raw(Box::new(o)),
10054                 },
10055                 result_ok: true,
10056         }
10057 }
10058 #[no_mangle]
10059 /// Creates a new CResult_PaymentIdPaymentErrorZ in the error state.
10060 pub extern "C" fn CResult_PaymentIdPaymentErrorZ_err(e: crate::lightning_invoice::payment::PaymentError) -> CResult_PaymentIdPaymentErrorZ {
10061         CResult_PaymentIdPaymentErrorZ {
10062                 contents: CResult_PaymentIdPaymentErrorZPtr {
10063                         err: Box::into_raw(Box::new(e)),
10064                 },
10065                 result_ok: false,
10066         }
10067 }
10068 /// Checks if the given object is currently in the success state
10069 #[no_mangle]
10070 pub extern "C" fn CResult_PaymentIdPaymentErrorZ_is_ok(o: &CResult_PaymentIdPaymentErrorZ) -> bool {
10071         o.result_ok
10072 }
10073 #[no_mangle]
10074 /// Frees any resources used by the CResult_PaymentIdPaymentErrorZ.
10075 pub extern "C" fn CResult_PaymentIdPaymentErrorZ_free(_res: CResult_PaymentIdPaymentErrorZ) { }
10076 impl Drop for CResult_PaymentIdPaymentErrorZ {
10077         fn drop(&mut self) {
10078                 if self.result_ok {
10079                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
10080                                 let _ = unsafe { Box::from_raw(self.contents.result) };
10081                         }
10082                 } else {
10083                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
10084                                 let _ = unsafe { Box::from_raw(self.contents.err) };
10085                         }
10086                 }
10087         }
10088 }
10089 impl From<crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning_invoice::payment::PaymentError>> for CResult_PaymentIdPaymentErrorZ {
10090         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning_invoice::payment::PaymentError>) -> Self {
10091                 let contents = if o.result_ok {
10092                         let result = unsafe { o.contents.result };
10093                         unsafe { o.contents.result = core::ptr::null_mut() };
10094                         CResult_PaymentIdPaymentErrorZPtr { result }
10095                 } else {
10096                         let err = unsafe { o.contents.err };
10097                         unsafe { o.contents.err = core::ptr::null_mut(); }
10098                         CResult_PaymentIdPaymentErrorZPtr { err }
10099                 };
10100                 Self {
10101                         contents,
10102                         result_ok: o.result_ok,
10103                 }
10104         }
10105 }
10106 impl Clone for CResult_PaymentIdPaymentErrorZ {
10107         fn clone(&self) -> Self {
10108                 if self.result_ok {
10109                         Self { result_ok: true, contents: CResult_PaymentIdPaymentErrorZPtr {
10110                                 result: Box::into_raw(Box::new(<crate::c_types::ThirtyTwoBytes>::clone(unsafe { &*self.contents.result })))
10111                         } }
10112                 } else {
10113                         Self { result_ok: false, contents: CResult_PaymentIdPaymentErrorZPtr {
10114                                 err: Box::into_raw(Box::new(<crate::lightning_invoice::payment::PaymentError>::clone(unsafe { &*self.contents.err })))
10115                         } }
10116                 }
10117         }
10118 }
10119 #[no_mangle]
10120 /// Creates a new CResult_PaymentIdPaymentErrorZ which has the same data as `orig`
10121 /// but with all dynamically-allocated buffers duplicated in new buffers.
10122 pub extern "C" fn CResult_PaymentIdPaymentErrorZ_clone(orig: &CResult_PaymentIdPaymentErrorZ) -> CResult_PaymentIdPaymentErrorZ { Clone::clone(&orig) }
10123 #[repr(C)]
10124 /// The contents of CResult_InFlightHtlcsDecodeErrorZ
10125 pub union CResult_InFlightHtlcsDecodeErrorZPtr {
10126         /// A pointer to the contents in the success state.
10127         /// Reading from this pointer when `result_ok` is not set is undefined.
10128         pub result: *mut crate::lightning_invoice::payment::InFlightHtlcs,
10129         /// A pointer to the contents in the error state.
10130         /// Reading from this pointer when `result_ok` is set is undefined.
10131         pub err: *mut crate::lightning::ln::msgs::DecodeError,
10132 }
10133 #[repr(C)]
10134 /// A CResult_InFlightHtlcsDecodeErrorZ represents the result of a fallible operation,
10135 /// containing a crate::lightning_invoice::payment::InFlightHtlcs on success and a crate::lightning::ln::msgs::DecodeError on failure.
10136 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10137 pub struct CResult_InFlightHtlcsDecodeErrorZ {
10138         /// The contents of this CResult_InFlightHtlcsDecodeErrorZ, accessible via either
10139         /// `err` or `result` depending on the state of `result_ok`.
10140         pub contents: CResult_InFlightHtlcsDecodeErrorZPtr,
10141         /// Whether this CResult_InFlightHtlcsDecodeErrorZ represents a success state.
10142         pub result_ok: bool,
10143 }
10144 #[no_mangle]
10145 /// Creates a new CResult_InFlightHtlcsDecodeErrorZ in the success state.
10146 pub extern "C" fn CResult_InFlightHtlcsDecodeErrorZ_ok(o: crate::lightning_invoice::payment::InFlightHtlcs) -> CResult_InFlightHtlcsDecodeErrorZ {
10147         CResult_InFlightHtlcsDecodeErrorZ {
10148                 contents: CResult_InFlightHtlcsDecodeErrorZPtr {
10149                         result: Box::into_raw(Box::new(o)),
10150                 },
10151                 result_ok: true,
10152         }
10153 }
10154 #[no_mangle]
10155 /// Creates a new CResult_InFlightHtlcsDecodeErrorZ in the error state.
10156 pub extern "C" fn CResult_InFlightHtlcsDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_InFlightHtlcsDecodeErrorZ {
10157         CResult_InFlightHtlcsDecodeErrorZ {
10158                 contents: CResult_InFlightHtlcsDecodeErrorZPtr {
10159                         err: Box::into_raw(Box::new(e)),
10160                 },
10161                 result_ok: false,
10162         }
10163 }
10164 /// Checks if the given object is currently in the success state
10165 #[no_mangle]
10166 pub extern "C" fn CResult_InFlightHtlcsDecodeErrorZ_is_ok(o: &CResult_InFlightHtlcsDecodeErrorZ) -> bool {
10167         o.result_ok
10168 }
10169 #[no_mangle]
10170 /// Frees any resources used by the CResult_InFlightHtlcsDecodeErrorZ.
10171 pub extern "C" fn CResult_InFlightHtlcsDecodeErrorZ_free(_res: CResult_InFlightHtlcsDecodeErrorZ) { }
10172 impl Drop for CResult_InFlightHtlcsDecodeErrorZ {
10173         fn drop(&mut self) {
10174                 if self.result_ok {
10175                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
10176                                 let _ = unsafe { Box::from_raw(self.contents.result) };
10177                         }
10178                 } else {
10179                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
10180                                 let _ = unsafe { Box::from_raw(self.contents.err) };
10181                         }
10182                 }
10183         }
10184 }
10185 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::payment::InFlightHtlcs, crate::lightning::ln::msgs::DecodeError>> for CResult_InFlightHtlcsDecodeErrorZ {
10186         fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::payment::InFlightHtlcs, crate::lightning::ln::msgs::DecodeError>) -> Self {
10187                 let contents = if o.result_ok {
10188                         let result = unsafe { o.contents.result };
10189                         unsafe { o.contents.result = core::ptr::null_mut() };
10190                         CResult_InFlightHtlcsDecodeErrorZPtr { result }
10191                 } else {
10192                         let err = unsafe { o.contents.err };
10193                         unsafe { o.contents.err = core::ptr::null_mut(); }
10194                         CResult_InFlightHtlcsDecodeErrorZPtr { err }
10195                 };
10196                 Self {
10197                         contents,
10198                         result_ok: o.result_ok,
10199                 }
10200         }
10201 }
10202 #[repr(C)]
10203 /// The contents of CResult_SiPrefixParseErrorZ
10204 pub union CResult_SiPrefixParseErrorZPtr {
10205         /// A pointer to the contents in the success state.
10206         /// Reading from this pointer when `result_ok` is not set is undefined.
10207         pub result: *mut crate::lightning_invoice::SiPrefix,
10208         /// A pointer to the contents in the error state.
10209         /// Reading from this pointer when `result_ok` is set is undefined.
10210         pub err: *mut crate::lightning_invoice::ParseError,
10211 }
10212 #[repr(C)]
10213 /// A CResult_SiPrefixParseErrorZ represents the result of a fallible operation,
10214 /// containing a crate::lightning_invoice::SiPrefix on success and a crate::lightning_invoice::ParseError on failure.
10215 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10216 pub struct CResult_SiPrefixParseErrorZ {
10217         /// The contents of this CResult_SiPrefixParseErrorZ, accessible via either
10218         /// `err` or `result` depending on the state of `result_ok`.
10219         pub contents: CResult_SiPrefixParseErrorZPtr,
10220         /// Whether this CResult_SiPrefixParseErrorZ represents a success state.
10221         pub result_ok: bool,
10222 }
10223 #[no_mangle]
10224 /// Creates a new CResult_SiPrefixParseErrorZ in the success state.
10225 pub extern "C" fn CResult_SiPrefixParseErrorZ_ok(o: crate::lightning_invoice::SiPrefix) -> CResult_SiPrefixParseErrorZ {
10226         CResult_SiPrefixParseErrorZ {
10227                 contents: CResult_SiPrefixParseErrorZPtr {
10228                         result: Box::into_raw(Box::new(o)),
10229                 },
10230                 result_ok: true,
10231         }
10232 }
10233 #[no_mangle]
10234 /// Creates a new CResult_SiPrefixParseErrorZ in the error state.
10235 pub extern "C" fn CResult_SiPrefixParseErrorZ_err(e: crate::lightning_invoice::ParseError) -> CResult_SiPrefixParseErrorZ {
10236         CResult_SiPrefixParseErrorZ {
10237                 contents: CResult_SiPrefixParseErrorZPtr {
10238                         err: Box::into_raw(Box::new(e)),
10239                 },
10240                 result_ok: false,
10241         }
10242 }
10243 /// Checks if the given object is currently in the success state
10244 #[no_mangle]
10245 pub extern "C" fn CResult_SiPrefixParseErrorZ_is_ok(o: &CResult_SiPrefixParseErrorZ) -> bool {
10246         o.result_ok
10247 }
10248 #[no_mangle]
10249 /// Frees any resources used by the CResult_SiPrefixParseErrorZ.
10250 pub extern "C" fn CResult_SiPrefixParseErrorZ_free(_res: CResult_SiPrefixParseErrorZ) { }
10251 impl Drop for CResult_SiPrefixParseErrorZ {
10252         fn drop(&mut self) {
10253                 if self.result_ok {
10254                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
10255                                 let _ = unsafe { Box::from_raw(self.contents.result) };
10256                         }
10257                 } else {
10258                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
10259                                 let _ = unsafe { Box::from_raw(self.contents.err) };
10260                         }
10261                 }
10262         }
10263 }
10264 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::SiPrefix, crate::lightning_invoice::ParseError>> for CResult_SiPrefixParseErrorZ {
10265         fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::SiPrefix, crate::lightning_invoice::ParseError>) -> Self {
10266                 let contents = if o.result_ok {
10267                         let result = unsafe { o.contents.result };
10268                         unsafe { o.contents.result = core::ptr::null_mut() };
10269                         CResult_SiPrefixParseErrorZPtr { result }
10270                 } else {
10271                         let err = unsafe { o.contents.err };
10272                         unsafe { o.contents.err = core::ptr::null_mut(); }
10273                         CResult_SiPrefixParseErrorZPtr { err }
10274                 };
10275                 Self {
10276                         contents,
10277                         result_ok: o.result_ok,
10278                 }
10279         }
10280 }
10281 impl Clone for CResult_SiPrefixParseErrorZ {
10282         fn clone(&self) -> Self {
10283                 if self.result_ok {
10284                         Self { result_ok: true, contents: CResult_SiPrefixParseErrorZPtr {
10285                                 result: Box::into_raw(Box::new(<crate::lightning_invoice::SiPrefix>::clone(unsafe { &*self.contents.result })))
10286                         } }
10287                 } else {
10288                         Self { result_ok: false, contents: CResult_SiPrefixParseErrorZPtr {
10289                                 err: Box::into_raw(Box::new(<crate::lightning_invoice::ParseError>::clone(unsafe { &*self.contents.err })))
10290                         } }
10291                 }
10292         }
10293 }
10294 #[no_mangle]
10295 /// Creates a new CResult_SiPrefixParseErrorZ which has the same data as `orig`
10296 /// but with all dynamically-allocated buffers duplicated in new buffers.
10297 pub extern "C" fn CResult_SiPrefixParseErrorZ_clone(orig: &CResult_SiPrefixParseErrorZ) -> CResult_SiPrefixParseErrorZ { Clone::clone(&orig) }
10298 #[repr(C)]
10299 /// The contents of CResult_InvoiceParseOrSemanticErrorZ
10300 pub union CResult_InvoiceParseOrSemanticErrorZPtr {
10301         /// A pointer to the contents in the success state.
10302         /// Reading from this pointer when `result_ok` is not set is undefined.
10303         pub result: *mut crate::lightning_invoice::Invoice,
10304         /// A pointer to the contents in the error state.
10305         /// Reading from this pointer when `result_ok` is set is undefined.
10306         pub err: *mut crate::lightning_invoice::ParseOrSemanticError,
10307 }
10308 #[repr(C)]
10309 /// A CResult_InvoiceParseOrSemanticErrorZ represents the result of a fallible operation,
10310 /// containing a crate::lightning_invoice::Invoice on success and a crate::lightning_invoice::ParseOrSemanticError on failure.
10311 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10312 pub struct CResult_InvoiceParseOrSemanticErrorZ {
10313         /// The contents of this CResult_InvoiceParseOrSemanticErrorZ, accessible via either
10314         /// `err` or `result` depending on the state of `result_ok`.
10315         pub contents: CResult_InvoiceParseOrSemanticErrorZPtr,
10316         /// Whether this CResult_InvoiceParseOrSemanticErrorZ represents a success state.
10317         pub result_ok: bool,
10318 }
10319 #[no_mangle]
10320 /// Creates a new CResult_InvoiceParseOrSemanticErrorZ in the success state.
10321 pub extern "C" fn CResult_InvoiceParseOrSemanticErrorZ_ok(o: crate::lightning_invoice::Invoice) -> CResult_InvoiceParseOrSemanticErrorZ {
10322         CResult_InvoiceParseOrSemanticErrorZ {
10323                 contents: CResult_InvoiceParseOrSemanticErrorZPtr {
10324                         result: Box::into_raw(Box::new(o)),
10325                 },
10326                 result_ok: true,
10327         }
10328 }
10329 #[no_mangle]
10330 /// Creates a new CResult_InvoiceParseOrSemanticErrorZ in the error state.
10331 pub extern "C" fn CResult_InvoiceParseOrSemanticErrorZ_err(e: crate::lightning_invoice::ParseOrSemanticError) -> CResult_InvoiceParseOrSemanticErrorZ {
10332         CResult_InvoiceParseOrSemanticErrorZ {
10333                 contents: CResult_InvoiceParseOrSemanticErrorZPtr {
10334                         err: Box::into_raw(Box::new(e)),
10335                 },
10336                 result_ok: false,
10337         }
10338 }
10339 /// Checks if the given object is currently in the success state
10340 #[no_mangle]
10341 pub extern "C" fn CResult_InvoiceParseOrSemanticErrorZ_is_ok(o: &CResult_InvoiceParseOrSemanticErrorZ) -> bool {
10342         o.result_ok
10343 }
10344 #[no_mangle]
10345 /// Frees any resources used by the CResult_InvoiceParseOrSemanticErrorZ.
10346 pub extern "C" fn CResult_InvoiceParseOrSemanticErrorZ_free(_res: CResult_InvoiceParseOrSemanticErrorZ) { }
10347 impl Drop for CResult_InvoiceParseOrSemanticErrorZ {
10348         fn drop(&mut self) {
10349                 if self.result_ok {
10350                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
10351                                 let _ = unsafe { Box::from_raw(self.contents.result) };
10352                         }
10353                 } else {
10354                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
10355                                 let _ = unsafe { Box::from_raw(self.contents.err) };
10356                         }
10357                 }
10358         }
10359 }
10360 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::Invoice, crate::lightning_invoice::ParseOrSemanticError>> for CResult_InvoiceParseOrSemanticErrorZ {
10361         fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::Invoice, crate::lightning_invoice::ParseOrSemanticError>) -> Self {
10362                 let contents = if o.result_ok {
10363                         let result = unsafe { o.contents.result };
10364                         unsafe { o.contents.result = core::ptr::null_mut() };
10365                         CResult_InvoiceParseOrSemanticErrorZPtr { result }
10366                 } else {
10367                         let err = unsafe { o.contents.err };
10368                         unsafe { o.contents.err = core::ptr::null_mut(); }
10369                         CResult_InvoiceParseOrSemanticErrorZPtr { err }
10370                 };
10371                 Self {
10372                         contents,
10373                         result_ok: o.result_ok,
10374                 }
10375         }
10376 }
10377 impl Clone for CResult_InvoiceParseOrSemanticErrorZ {
10378         fn clone(&self) -> Self {
10379                 if self.result_ok {
10380                         Self { result_ok: true, contents: CResult_InvoiceParseOrSemanticErrorZPtr {
10381                                 result: Box::into_raw(Box::new(<crate::lightning_invoice::Invoice>::clone(unsafe { &*self.contents.result })))
10382                         } }
10383                 } else {
10384                         Self { result_ok: false, contents: CResult_InvoiceParseOrSemanticErrorZPtr {
10385                                 err: Box::into_raw(Box::new(<crate::lightning_invoice::ParseOrSemanticError>::clone(unsafe { &*self.contents.err })))
10386                         } }
10387                 }
10388         }
10389 }
10390 #[no_mangle]
10391 /// Creates a new CResult_InvoiceParseOrSemanticErrorZ which has the same data as `orig`
10392 /// but with all dynamically-allocated buffers duplicated in new buffers.
10393 pub extern "C" fn CResult_InvoiceParseOrSemanticErrorZ_clone(orig: &CResult_InvoiceParseOrSemanticErrorZ) -> CResult_InvoiceParseOrSemanticErrorZ { Clone::clone(&orig) }
10394 #[repr(C)]
10395 /// The contents of CResult_SignedRawInvoiceParseErrorZ
10396 pub union CResult_SignedRawInvoiceParseErrorZPtr {
10397         /// A pointer to the contents in the success state.
10398         /// Reading from this pointer when `result_ok` is not set is undefined.
10399         pub result: *mut crate::lightning_invoice::SignedRawInvoice,
10400         /// A pointer to the contents in the error state.
10401         /// Reading from this pointer when `result_ok` is set is undefined.
10402         pub err: *mut crate::lightning_invoice::ParseError,
10403 }
10404 #[repr(C)]
10405 /// A CResult_SignedRawInvoiceParseErrorZ represents the result of a fallible operation,
10406 /// containing a crate::lightning_invoice::SignedRawInvoice on success and a crate::lightning_invoice::ParseError on failure.
10407 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10408 pub struct CResult_SignedRawInvoiceParseErrorZ {
10409         /// The contents of this CResult_SignedRawInvoiceParseErrorZ, accessible via either
10410         /// `err` or `result` depending on the state of `result_ok`.
10411         pub contents: CResult_SignedRawInvoiceParseErrorZPtr,
10412         /// Whether this CResult_SignedRawInvoiceParseErrorZ represents a success state.
10413         pub result_ok: bool,
10414 }
10415 #[no_mangle]
10416 /// Creates a new CResult_SignedRawInvoiceParseErrorZ in the success state.
10417 pub extern "C" fn CResult_SignedRawInvoiceParseErrorZ_ok(o: crate::lightning_invoice::SignedRawInvoice) -> CResult_SignedRawInvoiceParseErrorZ {
10418         CResult_SignedRawInvoiceParseErrorZ {
10419                 contents: CResult_SignedRawInvoiceParseErrorZPtr {
10420                         result: Box::into_raw(Box::new(o)),
10421                 },
10422                 result_ok: true,
10423         }
10424 }
10425 #[no_mangle]
10426 /// Creates a new CResult_SignedRawInvoiceParseErrorZ in the error state.
10427 pub extern "C" fn CResult_SignedRawInvoiceParseErrorZ_err(e: crate::lightning_invoice::ParseError) -> CResult_SignedRawInvoiceParseErrorZ {
10428         CResult_SignedRawInvoiceParseErrorZ {
10429                 contents: CResult_SignedRawInvoiceParseErrorZPtr {
10430                         err: Box::into_raw(Box::new(e)),
10431                 },
10432                 result_ok: false,
10433         }
10434 }
10435 /// Checks if the given object is currently in the success state
10436 #[no_mangle]
10437 pub extern "C" fn CResult_SignedRawInvoiceParseErrorZ_is_ok(o: &CResult_SignedRawInvoiceParseErrorZ) -> bool {
10438         o.result_ok
10439 }
10440 #[no_mangle]
10441 /// Frees any resources used by the CResult_SignedRawInvoiceParseErrorZ.
10442 pub extern "C" fn CResult_SignedRawInvoiceParseErrorZ_free(_res: CResult_SignedRawInvoiceParseErrorZ) { }
10443 impl Drop for CResult_SignedRawInvoiceParseErrorZ {
10444         fn drop(&mut self) {
10445                 if self.result_ok {
10446                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
10447                                 let _ = unsafe { Box::from_raw(self.contents.result) };
10448                         }
10449                 } else {
10450                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
10451                                 let _ = unsafe { Box::from_raw(self.contents.err) };
10452                         }
10453                 }
10454         }
10455 }
10456 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::SignedRawInvoice, crate::lightning_invoice::ParseError>> for CResult_SignedRawInvoiceParseErrorZ {
10457         fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::SignedRawInvoice, crate::lightning_invoice::ParseError>) -> Self {
10458                 let contents = if o.result_ok {
10459                         let result = unsafe { o.contents.result };
10460                         unsafe { o.contents.result = core::ptr::null_mut() };
10461                         CResult_SignedRawInvoiceParseErrorZPtr { result }
10462                 } else {
10463                         let err = unsafe { o.contents.err };
10464                         unsafe { o.contents.err = core::ptr::null_mut(); }
10465                         CResult_SignedRawInvoiceParseErrorZPtr { err }
10466                 };
10467                 Self {
10468                         contents,
10469                         result_ok: o.result_ok,
10470                 }
10471         }
10472 }
10473 impl Clone for CResult_SignedRawInvoiceParseErrorZ {
10474         fn clone(&self) -> Self {
10475                 if self.result_ok {
10476                         Self { result_ok: true, contents: CResult_SignedRawInvoiceParseErrorZPtr {
10477                                 result: Box::into_raw(Box::new(<crate::lightning_invoice::SignedRawInvoice>::clone(unsafe { &*self.contents.result })))
10478                         } }
10479                 } else {
10480                         Self { result_ok: false, contents: CResult_SignedRawInvoiceParseErrorZPtr {
10481                                 err: Box::into_raw(Box::new(<crate::lightning_invoice::ParseError>::clone(unsafe { &*self.contents.err })))
10482                         } }
10483                 }
10484         }
10485 }
10486 #[no_mangle]
10487 /// Creates a new CResult_SignedRawInvoiceParseErrorZ which has the same data as `orig`
10488 /// but with all dynamically-allocated buffers duplicated in new buffers.
10489 pub extern "C" fn CResult_SignedRawInvoiceParseErrorZ_clone(orig: &CResult_SignedRawInvoiceParseErrorZ) -> CResult_SignedRawInvoiceParseErrorZ { Clone::clone(&orig) }
10490 #[repr(C)]
10491 /// A tuple of 3 elements. See the individual fields for the types contained.
10492 pub struct C3Tuple_RawInvoice_u832InvoiceSignatureZ {
10493         /// The element at position 0
10494         pub a: crate::lightning_invoice::RawInvoice,
10495         /// The element at position 1
10496         pub b: crate::c_types::ThirtyTwoBytes,
10497         /// The element at position 2
10498         pub c: crate::lightning_invoice::InvoiceSignature,
10499 }
10500 impl From<(crate::lightning_invoice::RawInvoice, crate::c_types::ThirtyTwoBytes, crate::lightning_invoice::InvoiceSignature)> for C3Tuple_RawInvoice_u832InvoiceSignatureZ {
10501         fn from (tup: (crate::lightning_invoice::RawInvoice, crate::c_types::ThirtyTwoBytes, crate::lightning_invoice::InvoiceSignature)) -> Self {
10502                 Self {
10503                         a: tup.0,
10504                         b: tup.1,
10505                         c: tup.2,
10506                 }
10507         }
10508 }
10509 impl C3Tuple_RawInvoice_u832InvoiceSignatureZ {
10510         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::lightning_invoice::RawInvoice, crate::c_types::ThirtyTwoBytes, crate::lightning_invoice::InvoiceSignature) {
10511                 (self.a, self.b, self.c)
10512         }
10513 }
10514 impl Clone for C3Tuple_RawInvoice_u832InvoiceSignatureZ {
10515         fn clone(&self) -> Self {
10516                 Self {
10517                         a: Clone::clone(&self.a),
10518                         b: Clone::clone(&self.b),
10519                         c: Clone::clone(&self.c),
10520                 }
10521         }
10522 }
10523 #[no_mangle]
10524 /// Creates a new tuple which has the same data as `orig`
10525 /// but with all dynamically-allocated buffers duplicated in new buffers.
10526 pub extern "C" fn C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone(orig: &C3Tuple_RawInvoice_u832InvoiceSignatureZ) -> C3Tuple_RawInvoice_u832InvoiceSignatureZ { Clone::clone(&orig) }
10527 /// Creates a new C3Tuple_RawInvoice_u832InvoiceSignatureZ from the contained elements.
10528 #[no_mangle]
10529 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 {
10530         C3Tuple_RawInvoice_u832InvoiceSignatureZ { a, b, c, }
10531 }
10532
10533 #[no_mangle]
10534 /// Frees any resources used by the C3Tuple_RawInvoice_u832InvoiceSignatureZ.
10535 pub extern "C" fn C3Tuple_RawInvoice_u832InvoiceSignatureZ_free(_res: C3Tuple_RawInvoice_u832InvoiceSignatureZ) { }
10536 #[repr(C)]
10537 /// The contents of CResult_PayeePubKeyErrorZ
10538 pub union CResult_PayeePubKeyErrorZPtr {
10539         /// A pointer to the contents in the success state.
10540         /// Reading from this pointer when `result_ok` is not set is undefined.
10541         pub result: *mut crate::lightning_invoice::PayeePubKey,
10542         /// A pointer to the contents in the error state.
10543         /// Reading from this pointer when `result_ok` is set is undefined.
10544         pub err: *mut crate::c_types::Secp256k1Error,
10545 }
10546 #[repr(C)]
10547 /// A CResult_PayeePubKeyErrorZ represents the result of a fallible operation,
10548 /// containing a crate::lightning_invoice::PayeePubKey on success and a crate::c_types::Secp256k1Error on failure.
10549 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10550 pub struct CResult_PayeePubKeyErrorZ {
10551         /// The contents of this CResult_PayeePubKeyErrorZ, accessible via either
10552         /// `err` or `result` depending on the state of `result_ok`.
10553         pub contents: CResult_PayeePubKeyErrorZPtr,
10554         /// Whether this CResult_PayeePubKeyErrorZ represents a success state.
10555         pub result_ok: bool,
10556 }
10557 #[no_mangle]
10558 /// Creates a new CResult_PayeePubKeyErrorZ in the success state.
10559 pub extern "C" fn CResult_PayeePubKeyErrorZ_ok(o: crate::lightning_invoice::PayeePubKey) -> CResult_PayeePubKeyErrorZ {
10560         CResult_PayeePubKeyErrorZ {
10561                 contents: CResult_PayeePubKeyErrorZPtr {
10562                         result: Box::into_raw(Box::new(o)),
10563                 },
10564                 result_ok: true,
10565         }
10566 }
10567 #[no_mangle]
10568 /// Creates a new CResult_PayeePubKeyErrorZ in the error state.
10569 pub extern "C" fn CResult_PayeePubKeyErrorZ_err(e: crate::c_types::Secp256k1Error) -> CResult_PayeePubKeyErrorZ {
10570         CResult_PayeePubKeyErrorZ {
10571                 contents: CResult_PayeePubKeyErrorZPtr {
10572                         err: Box::into_raw(Box::new(e)),
10573                 },
10574                 result_ok: false,
10575         }
10576 }
10577 /// Checks if the given object is currently in the success state
10578 #[no_mangle]
10579 pub extern "C" fn CResult_PayeePubKeyErrorZ_is_ok(o: &CResult_PayeePubKeyErrorZ) -> bool {
10580         o.result_ok
10581 }
10582 #[no_mangle]
10583 /// Frees any resources used by the CResult_PayeePubKeyErrorZ.
10584 pub extern "C" fn CResult_PayeePubKeyErrorZ_free(_res: CResult_PayeePubKeyErrorZ) { }
10585 impl Drop for CResult_PayeePubKeyErrorZ {
10586         fn drop(&mut self) {
10587                 if self.result_ok {
10588                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
10589                                 let _ = unsafe { Box::from_raw(self.contents.result) };
10590                         }
10591                 } else {
10592                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
10593                                 let _ = unsafe { Box::from_raw(self.contents.err) };
10594                         }
10595                 }
10596         }
10597 }
10598 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::PayeePubKey, crate::c_types::Secp256k1Error>> for CResult_PayeePubKeyErrorZ {
10599         fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::PayeePubKey, crate::c_types::Secp256k1Error>) -> Self {
10600                 let contents = if o.result_ok {
10601                         let result = unsafe { o.contents.result };
10602                         unsafe { o.contents.result = core::ptr::null_mut() };
10603                         CResult_PayeePubKeyErrorZPtr { result }
10604                 } else {
10605                         let err = unsafe { o.contents.err };
10606                         unsafe { o.contents.err = core::ptr::null_mut(); }
10607                         CResult_PayeePubKeyErrorZPtr { err }
10608                 };
10609                 Self {
10610                         contents,
10611                         result_ok: o.result_ok,
10612                 }
10613         }
10614 }
10615 impl Clone for CResult_PayeePubKeyErrorZ {
10616         fn clone(&self) -> Self {
10617                 if self.result_ok {
10618                         Self { result_ok: true, contents: CResult_PayeePubKeyErrorZPtr {
10619                                 result: Box::into_raw(Box::new(<crate::lightning_invoice::PayeePubKey>::clone(unsafe { &*self.contents.result })))
10620                         } }
10621                 } else {
10622                         Self { result_ok: false, contents: CResult_PayeePubKeyErrorZPtr {
10623                                 err: Box::into_raw(Box::new(<crate::c_types::Secp256k1Error>::clone(unsafe { &*self.contents.err })))
10624                         } }
10625                 }
10626         }
10627 }
10628 #[no_mangle]
10629 /// Creates a new CResult_PayeePubKeyErrorZ which has the same data as `orig`
10630 /// but with all dynamically-allocated buffers duplicated in new buffers.
10631 pub extern "C" fn CResult_PayeePubKeyErrorZ_clone(orig: &CResult_PayeePubKeyErrorZ) -> CResult_PayeePubKeyErrorZ { Clone::clone(&orig) }
10632 #[repr(C)]
10633 /// A dynamically-allocated array of crate::lightning_invoice::PrivateRoutes of arbitrary size.
10634 /// This corresponds to std::vector in C++
10635 pub struct CVec_PrivateRouteZ {
10636         /// The elements in the array.
10637         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
10638         pub data: *mut crate::lightning_invoice::PrivateRoute,
10639         /// The number of elements pointed to by `data`.
10640         pub datalen: usize
10641 }
10642 impl CVec_PrivateRouteZ {
10643         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning_invoice::PrivateRoute> {
10644                 if self.datalen == 0 { return Vec::new(); }
10645                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
10646                 self.data = core::ptr::null_mut();
10647                 self.datalen = 0;
10648                 ret
10649         }
10650         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning_invoice::PrivateRoute] {
10651                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
10652         }
10653 }
10654 impl From<Vec<crate::lightning_invoice::PrivateRoute>> for CVec_PrivateRouteZ {
10655         fn from(v: Vec<crate::lightning_invoice::PrivateRoute>) -> Self {
10656                 let datalen = v.len();
10657                 let data = Box::into_raw(v.into_boxed_slice());
10658                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
10659         }
10660 }
10661 #[no_mangle]
10662 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
10663 pub extern "C" fn CVec_PrivateRouteZ_free(_res: CVec_PrivateRouteZ) { }
10664 impl Drop for CVec_PrivateRouteZ {
10665         fn drop(&mut self) {
10666                 if self.datalen == 0 { return; }
10667                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
10668         }
10669 }
10670 impl Clone for CVec_PrivateRouteZ {
10671         fn clone(&self) -> Self {
10672                 let mut res = Vec::new();
10673                 if self.datalen == 0 { return Self::from(res); }
10674                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
10675                 Self::from(res)
10676         }
10677 }
10678 #[repr(C)]
10679 /// The contents of CResult_PositiveTimestampCreationErrorZ
10680 pub union CResult_PositiveTimestampCreationErrorZPtr {
10681         /// A pointer to the contents in the success state.
10682         /// Reading from this pointer when `result_ok` is not set is undefined.
10683         pub result: *mut crate::lightning_invoice::PositiveTimestamp,
10684         /// A pointer to the contents in the error state.
10685         /// Reading from this pointer when `result_ok` is set is undefined.
10686         pub err: *mut crate::lightning_invoice::CreationError,
10687 }
10688 #[repr(C)]
10689 /// A CResult_PositiveTimestampCreationErrorZ represents the result of a fallible operation,
10690 /// containing a crate::lightning_invoice::PositiveTimestamp on success and a crate::lightning_invoice::CreationError on failure.
10691 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10692 pub struct CResult_PositiveTimestampCreationErrorZ {
10693         /// The contents of this CResult_PositiveTimestampCreationErrorZ, accessible via either
10694         /// `err` or `result` depending on the state of `result_ok`.
10695         pub contents: CResult_PositiveTimestampCreationErrorZPtr,
10696         /// Whether this CResult_PositiveTimestampCreationErrorZ represents a success state.
10697         pub result_ok: bool,
10698 }
10699 #[no_mangle]
10700 /// Creates a new CResult_PositiveTimestampCreationErrorZ in the success state.
10701 pub extern "C" fn CResult_PositiveTimestampCreationErrorZ_ok(o: crate::lightning_invoice::PositiveTimestamp) -> CResult_PositiveTimestampCreationErrorZ {
10702         CResult_PositiveTimestampCreationErrorZ {
10703                 contents: CResult_PositiveTimestampCreationErrorZPtr {
10704                         result: Box::into_raw(Box::new(o)),
10705                 },
10706                 result_ok: true,
10707         }
10708 }
10709 #[no_mangle]
10710 /// Creates a new CResult_PositiveTimestampCreationErrorZ in the error state.
10711 pub extern "C" fn CResult_PositiveTimestampCreationErrorZ_err(e: crate::lightning_invoice::CreationError) -> CResult_PositiveTimestampCreationErrorZ {
10712         CResult_PositiveTimestampCreationErrorZ {
10713                 contents: CResult_PositiveTimestampCreationErrorZPtr {
10714                         err: Box::into_raw(Box::new(e)),
10715                 },
10716                 result_ok: false,
10717         }
10718 }
10719 /// Checks if the given object is currently in the success state
10720 #[no_mangle]
10721 pub extern "C" fn CResult_PositiveTimestampCreationErrorZ_is_ok(o: &CResult_PositiveTimestampCreationErrorZ) -> bool {
10722         o.result_ok
10723 }
10724 #[no_mangle]
10725 /// Frees any resources used by the CResult_PositiveTimestampCreationErrorZ.
10726 pub extern "C" fn CResult_PositiveTimestampCreationErrorZ_free(_res: CResult_PositiveTimestampCreationErrorZ) { }
10727 impl Drop for CResult_PositiveTimestampCreationErrorZ {
10728         fn drop(&mut self) {
10729                 if self.result_ok {
10730                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
10731                                 let _ = unsafe { Box::from_raw(self.contents.result) };
10732                         }
10733                 } else {
10734                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
10735                                 let _ = unsafe { Box::from_raw(self.contents.err) };
10736                         }
10737                 }
10738         }
10739 }
10740 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::PositiveTimestamp, crate::lightning_invoice::CreationError>> for CResult_PositiveTimestampCreationErrorZ {
10741         fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::PositiveTimestamp, crate::lightning_invoice::CreationError>) -> Self {
10742                 let contents = if o.result_ok {
10743                         let result = unsafe { o.contents.result };
10744                         unsafe { o.contents.result = core::ptr::null_mut() };
10745                         CResult_PositiveTimestampCreationErrorZPtr { result }
10746                 } else {
10747                         let err = unsafe { o.contents.err };
10748                         unsafe { o.contents.err = core::ptr::null_mut(); }
10749                         CResult_PositiveTimestampCreationErrorZPtr { err }
10750                 };
10751                 Self {
10752                         contents,
10753                         result_ok: o.result_ok,
10754                 }
10755         }
10756 }
10757 impl Clone for CResult_PositiveTimestampCreationErrorZ {
10758         fn clone(&self) -> Self {
10759                 if self.result_ok {
10760                         Self { result_ok: true, contents: CResult_PositiveTimestampCreationErrorZPtr {
10761                                 result: Box::into_raw(Box::new(<crate::lightning_invoice::PositiveTimestamp>::clone(unsafe { &*self.contents.result })))
10762                         } }
10763                 } else {
10764                         Self { result_ok: false, contents: CResult_PositiveTimestampCreationErrorZPtr {
10765                                 err: Box::into_raw(Box::new(<crate::lightning_invoice::CreationError>::clone(unsafe { &*self.contents.err })))
10766                         } }
10767                 }
10768         }
10769 }
10770 #[no_mangle]
10771 /// Creates a new CResult_PositiveTimestampCreationErrorZ which has the same data as `orig`
10772 /// but with all dynamically-allocated buffers duplicated in new buffers.
10773 pub extern "C" fn CResult_PositiveTimestampCreationErrorZ_clone(orig: &CResult_PositiveTimestampCreationErrorZ) -> CResult_PositiveTimestampCreationErrorZ { Clone::clone(&orig) }
10774 #[repr(C)]
10775 /// The contents of CResult_NoneSemanticErrorZ
10776 pub union CResult_NoneSemanticErrorZPtr {
10777         /// Note that this value is always NULL, as there are no contents in the OK variant
10778         pub result: *mut core::ffi::c_void,
10779         /// A pointer to the contents in the error state.
10780         /// Reading from this pointer when `result_ok` is set is undefined.
10781         pub err: *mut crate::lightning_invoice::SemanticError,
10782 }
10783 #[repr(C)]
10784 /// A CResult_NoneSemanticErrorZ represents the result of a fallible operation,
10785 /// containing a () on success and a crate::lightning_invoice::SemanticError on failure.
10786 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10787 pub struct CResult_NoneSemanticErrorZ {
10788         /// The contents of this CResult_NoneSemanticErrorZ, accessible via either
10789         /// `err` or `result` depending on the state of `result_ok`.
10790         pub contents: CResult_NoneSemanticErrorZPtr,
10791         /// Whether this CResult_NoneSemanticErrorZ represents a success state.
10792         pub result_ok: bool,
10793 }
10794 #[no_mangle]
10795 /// Creates a new CResult_NoneSemanticErrorZ in the success state.
10796 pub extern "C" fn CResult_NoneSemanticErrorZ_ok() -> CResult_NoneSemanticErrorZ {
10797         CResult_NoneSemanticErrorZ {
10798                 contents: CResult_NoneSemanticErrorZPtr {
10799                         result: core::ptr::null_mut(),
10800                 },
10801                 result_ok: true,
10802         }
10803 }
10804 #[no_mangle]
10805 /// Creates a new CResult_NoneSemanticErrorZ in the error state.
10806 pub extern "C" fn CResult_NoneSemanticErrorZ_err(e: crate::lightning_invoice::SemanticError) -> CResult_NoneSemanticErrorZ {
10807         CResult_NoneSemanticErrorZ {
10808                 contents: CResult_NoneSemanticErrorZPtr {
10809                         err: Box::into_raw(Box::new(e)),
10810                 },
10811                 result_ok: false,
10812         }
10813 }
10814 /// Checks if the given object is currently in the success state
10815 #[no_mangle]
10816 pub extern "C" fn CResult_NoneSemanticErrorZ_is_ok(o: &CResult_NoneSemanticErrorZ) -> bool {
10817         o.result_ok
10818 }
10819 #[no_mangle]
10820 /// Frees any resources used by the CResult_NoneSemanticErrorZ.
10821 pub extern "C" fn CResult_NoneSemanticErrorZ_free(_res: CResult_NoneSemanticErrorZ) { }
10822 impl Drop for CResult_NoneSemanticErrorZ {
10823         fn drop(&mut self) {
10824                 if self.result_ok {
10825                 } else {
10826                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
10827                                 let _ = unsafe { Box::from_raw(self.contents.err) };
10828                         }
10829                 }
10830         }
10831 }
10832 impl From<crate::c_types::CResultTempl<(), crate::lightning_invoice::SemanticError>> for CResult_NoneSemanticErrorZ {
10833         fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning_invoice::SemanticError>) -> Self {
10834                 let contents = if o.result_ok {
10835                         let _ = unsafe { Box::from_raw(o.contents.result) };
10836                         o.contents.result = core::ptr::null_mut();
10837                         CResult_NoneSemanticErrorZPtr { result: core::ptr::null_mut() }
10838                 } else {
10839                         let err = unsafe { o.contents.err };
10840                         unsafe { o.contents.err = core::ptr::null_mut(); }
10841                         CResult_NoneSemanticErrorZPtr { err }
10842                 };
10843                 Self {
10844                         contents,
10845                         result_ok: o.result_ok,
10846                 }
10847         }
10848 }
10849 impl Clone for CResult_NoneSemanticErrorZ {
10850         fn clone(&self) -> Self {
10851                 if self.result_ok {
10852                         Self { result_ok: true, contents: CResult_NoneSemanticErrorZPtr {
10853                                 result: core::ptr::null_mut()
10854                         } }
10855                 } else {
10856                         Self { result_ok: false, contents: CResult_NoneSemanticErrorZPtr {
10857                                 err: Box::into_raw(Box::new(<crate::lightning_invoice::SemanticError>::clone(unsafe { &*self.contents.err })))
10858                         } }
10859                 }
10860         }
10861 }
10862 #[no_mangle]
10863 /// Creates a new CResult_NoneSemanticErrorZ which has the same data as `orig`
10864 /// but with all dynamically-allocated buffers duplicated in new buffers.
10865 pub extern "C" fn CResult_NoneSemanticErrorZ_clone(orig: &CResult_NoneSemanticErrorZ) -> CResult_NoneSemanticErrorZ { Clone::clone(&orig) }
10866 #[repr(C)]
10867 /// The contents of CResult_InvoiceSemanticErrorZ
10868 pub union CResult_InvoiceSemanticErrorZPtr {
10869         /// A pointer to the contents in the success state.
10870         /// Reading from this pointer when `result_ok` is not set is undefined.
10871         pub result: *mut crate::lightning_invoice::Invoice,
10872         /// A pointer to the contents in the error state.
10873         /// Reading from this pointer when `result_ok` is set is undefined.
10874         pub err: *mut crate::lightning_invoice::SemanticError,
10875 }
10876 #[repr(C)]
10877 /// A CResult_InvoiceSemanticErrorZ represents the result of a fallible operation,
10878 /// containing a crate::lightning_invoice::Invoice on success and a crate::lightning_invoice::SemanticError on failure.
10879 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10880 pub struct CResult_InvoiceSemanticErrorZ {
10881         /// The contents of this CResult_InvoiceSemanticErrorZ, accessible via either
10882         /// `err` or `result` depending on the state of `result_ok`.
10883         pub contents: CResult_InvoiceSemanticErrorZPtr,
10884         /// Whether this CResult_InvoiceSemanticErrorZ represents a success state.
10885         pub result_ok: bool,
10886 }
10887 #[no_mangle]
10888 /// Creates a new CResult_InvoiceSemanticErrorZ in the success state.
10889 pub extern "C" fn CResult_InvoiceSemanticErrorZ_ok(o: crate::lightning_invoice::Invoice) -> CResult_InvoiceSemanticErrorZ {
10890         CResult_InvoiceSemanticErrorZ {
10891                 contents: CResult_InvoiceSemanticErrorZPtr {
10892                         result: Box::into_raw(Box::new(o)),
10893                 },
10894                 result_ok: true,
10895         }
10896 }
10897 #[no_mangle]
10898 /// Creates a new CResult_InvoiceSemanticErrorZ in the error state.
10899 pub extern "C" fn CResult_InvoiceSemanticErrorZ_err(e: crate::lightning_invoice::SemanticError) -> CResult_InvoiceSemanticErrorZ {
10900         CResult_InvoiceSemanticErrorZ {
10901                 contents: CResult_InvoiceSemanticErrorZPtr {
10902                         err: Box::into_raw(Box::new(e)),
10903                 },
10904                 result_ok: false,
10905         }
10906 }
10907 /// Checks if the given object is currently in the success state
10908 #[no_mangle]
10909 pub extern "C" fn CResult_InvoiceSemanticErrorZ_is_ok(o: &CResult_InvoiceSemanticErrorZ) -> bool {
10910         o.result_ok
10911 }
10912 #[no_mangle]
10913 /// Frees any resources used by the CResult_InvoiceSemanticErrorZ.
10914 pub extern "C" fn CResult_InvoiceSemanticErrorZ_free(_res: CResult_InvoiceSemanticErrorZ) { }
10915 impl Drop for CResult_InvoiceSemanticErrorZ {
10916         fn drop(&mut self) {
10917                 if self.result_ok {
10918                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
10919                                 let _ = unsafe { Box::from_raw(self.contents.result) };
10920                         }
10921                 } else {
10922                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
10923                                 let _ = unsafe { Box::from_raw(self.contents.err) };
10924                         }
10925                 }
10926         }
10927 }
10928 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::Invoice, crate::lightning_invoice::SemanticError>> for CResult_InvoiceSemanticErrorZ {
10929         fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::Invoice, crate::lightning_invoice::SemanticError>) -> Self {
10930                 let contents = if o.result_ok {
10931                         let result = unsafe { o.contents.result };
10932                         unsafe { o.contents.result = core::ptr::null_mut() };
10933                         CResult_InvoiceSemanticErrorZPtr { result }
10934                 } else {
10935                         let err = unsafe { o.contents.err };
10936                         unsafe { o.contents.err = core::ptr::null_mut(); }
10937                         CResult_InvoiceSemanticErrorZPtr { err }
10938                 };
10939                 Self {
10940                         contents,
10941                         result_ok: o.result_ok,
10942                 }
10943         }
10944 }
10945 impl Clone for CResult_InvoiceSemanticErrorZ {
10946         fn clone(&self) -> Self {
10947                 if self.result_ok {
10948                         Self { result_ok: true, contents: CResult_InvoiceSemanticErrorZPtr {
10949                                 result: Box::into_raw(Box::new(<crate::lightning_invoice::Invoice>::clone(unsafe { &*self.contents.result })))
10950                         } }
10951                 } else {
10952                         Self { result_ok: false, contents: CResult_InvoiceSemanticErrorZPtr {
10953                                 err: Box::into_raw(Box::new(<crate::lightning_invoice::SemanticError>::clone(unsafe { &*self.contents.err })))
10954                         } }
10955                 }
10956         }
10957 }
10958 #[no_mangle]
10959 /// Creates a new CResult_InvoiceSemanticErrorZ which has the same data as `orig`
10960 /// but with all dynamically-allocated buffers duplicated in new buffers.
10961 pub extern "C" fn CResult_InvoiceSemanticErrorZ_clone(orig: &CResult_InvoiceSemanticErrorZ) -> CResult_InvoiceSemanticErrorZ { Clone::clone(&orig) }
10962 #[repr(C)]
10963 /// The contents of CResult_DescriptionCreationErrorZ
10964 pub union CResult_DescriptionCreationErrorZPtr {
10965         /// A pointer to the contents in the success state.
10966         /// Reading from this pointer when `result_ok` is not set is undefined.
10967         pub result: *mut crate::lightning_invoice::Description,
10968         /// A pointer to the contents in the error state.
10969         /// Reading from this pointer when `result_ok` is set is undefined.
10970         pub err: *mut crate::lightning_invoice::CreationError,
10971 }
10972 #[repr(C)]
10973 /// A CResult_DescriptionCreationErrorZ represents the result of a fallible operation,
10974 /// containing a crate::lightning_invoice::Description on success and a crate::lightning_invoice::CreationError on failure.
10975 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10976 pub struct CResult_DescriptionCreationErrorZ {
10977         /// The contents of this CResult_DescriptionCreationErrorZ, accessible via either
10978         /// `err` or `result` depending on the state of `result_ok`.
10979         pub contents: CResult_DescriptionCreationErrorZPtr,
10980         /// Whether this CResult_DescriptionCreationErrorZ represents a success state.
10981         pub result_ok: bool,
10982 }
10983 #[no_mangle]
10984 /// Creates a new CResult_DescriptionCreationErrorZ in the success state.
10985 pub extern "C" fn CResult_DescriptionCreationErrorZ_ok(o: crate::lightning_invoice::Description) -> CResult_DescriptionCreationErrorZ {
10986         CResult_DescriptionCreationErrorZ {
10987                 contents: CResult_DescriptionCreationErrorZPtr {
10988                         result: Box::into_raw(Box::new(o)),
10989                 },
10990                 result_ok: true,
10991         }
10992 }
10993 #[no_mangle]
10994 /// Creates a new CResult_DescriptionCreationErrorZ in the error state.
10995 pub extern "C" fn CResult_DescriptionCreationErrorZ_err(e: crate::lightning_invoice::CreationError) -> CResult_DescriptionCreationErrorZ {
10996         CResult_DescriptionCreationErrorZ {
10997                 contents: CResult_DescriptionCreationErrorZPtr {
10998                         err: Box::into_raw(Box::new(e)),
10999                 },
11000                 result_ok: false,
11001         }
11002 }
11003 /// Checks if the given object is currently in the success state
11004 #[no_mangle]
11005 pub extern "C" fn CResult_DescriptionCreationErrorZ_is_ok(o: &CResult_DescriptionCreationErrorZ) -> bool {
11006         o.result_ok
11007 }
11008 #[no_mangle]
11009 /// Frees any resources used by the CResult_DescriptionCreationErrorZ.
11010 pub extern "C" fn CResult_DescriptionCreationErrorZ_free(_res: CResult_DescriptionCreationErrorZ) { }
11011 impl Drop for CResult_DescriptionCreationErrorZ {
11012         fn drop(&mut self) {
11013                 if self.result_ok {
11014                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
11015                                 let _ = unsafe { Box::from_raw(self.contents.result) };
11016                         }
11017                 } else {
11018                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
11019                                 let _ = unsafe { Box::from_raw(self.contents.err) };
11020                         }
11021                 }
11022         }
11023 }
11024 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::Description, crate::lightning_invoice::CreationError>> for CResult_DescriptionCreationErrorZ {
11025         fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::Description, crate::lightning_invoice::CreationError>) -> Self {
11026                 let contents = if o.result_ok {
11027                         let result = unsafe { o.contents.result };
11028                         unsafe { o.contents.result = core::ptr::null_mut() };
11029                         CResult_DescriptionCreationErrorZPtr { result }
11030                 } else {
11031                         let err = unsafe { o.contents.err };
11032                         unsafe { o.contents.err = core::ptr::null_mut(); }
11033                         CResult_DescriptionCreationErrorZPtr { err }
11034                 };
11035                 Self {
11036                         contents,
11037                         result_ok: o.result_ok,
11038                 }
11039         }
11040 }
11041 impl Clone for CResult_DescriptionCreationErrorZ {
11042         fn clone(&self) -> Self {
11043                 if self.result_ok {
11044                         Self { result_ok: true, contents: CResult_DescriptionCreationErrorZPtr {
11045                                 result: Box::into_raw(Box::new(<crate::lightning_invoice::Description>::clone(unsafe { &*self.contents.result })))
11046                         } }
11047                 } else {
11048                         Self { result_ok: false, contents: CResult_DescriptionCreationErrorZPtr {
11049                                 err: Box::into_raw(Box::new(<crate::lightning_invoice::CreationError>::clone(unsafe { &*self.contents.err })))
11050                         } }
11051                 }
11052         }
11053 }
11054 #[no_mangle]
11055 /// Creates a new CResult_DescriptionCreationErrorZ which has the same data as `orig`
11056 /// but with all dynamically-allocated buffers duplicated in new buffers.
11057 pub extern "C" fn CResult_DescriptionCreationErrorZ_clone(orig: &CResult_DescriptionCreationErrorZ) -> CResult_DescriptionCreationErrorZ { Clone::clone(&orig) }
11058 #[repr(C)]
11059 /// The contents of CResult_PrivateRouteCreationErrorZ
11060 pub union CResult_PrivateRouteCreationErrorZPtr {
11061         /// A pointer to the contents in the success state.
11062         /// Reading from this pointer when `result_ok` is not set is undefined.
11063         pub result: *mut crate::lightning_invoice::PrivateRoute,
11064         /// A pointer to the contents in the error state.
11065         /// Reading from this pointer when `result_ok` is set is undefined.
11066         pub err: *mut crate::lightning_invoice::CreationError,
11067 }
11068 #[repr(C)]
11069 /// A CResult_PrivateRouteCreationErrorZ represents the result of a fallible operation,
11070 /// containing a crate::lightning_invoice::PrivateRoute on success and a crate::lightning_invoice::CreationError on failure.
11071 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11072 pub struct CResult_PrivateRouteCreationErrorZ {
11073         /// The contents of this CResult_PrivateRouteCreationErrorZ, accessible via either
11074         /// `err` or `result` depending on the state of `result_ok`.
11075         pub contents: CResult_PrivateRouteCreationErrorZPtr,
11076         /// Whether this CResult_PrivateRouteCreationErrorZ represents a success state.
11077         pub result_ok: bool,
11078 }
11079 #[no_mangle]
11080 /// Creates a new CResult_PrivateRouteCreationErrorZ in the success state.
11081 pub extern "C" fn CResult_PrivateRouteCreationErrorZ_ok(o: crate::lightning_invoice::PrivateRoute) -> CResult_PrivateRouteCreationErrorZ {
11082         CResult_PrivateRouteCreationErrorZ {
11083                 contents: CResult_PrivateRouteCreationErrorZPtr {
11084                         result: Box::into_raw(Box::new(o)),
11085                 },
11086                 result_ok: true,
11087         }
11088 }
11089 #[no_mangle]
11090 /// Creates a new CResult_PrivateRouteCreationErrorZ in the error state.
11091 pub extern "C" fn CResult_PrivateRouteCreationErrorZ_err(e: crate::lightning_invoice::CreationError) -> CResult_PrivateRouteCreationErrorZ {
11092         CResult_PrivateRouteCreationErrorZ {
11093                 contents: CResult_PrivateRouteCreationErrorZPtr {
11094                         err: Box::into_raw(Box::new(e)),
11095                 },
11096                 result_ok: false,
11097         }
11098 }
11099 /// Checks if the given object is currently in the success state
11100 #[no_mangle]
11101 pub extern "C" fn CResult_PrivateRouteCreationErrorZ_is_ok(o: &CResult_PrivateRouteCreationErrorZ) -> bool {
11102         o.result_ok
11103 }
11104 #[no_mangle]
11105 /// Frees any resources used by the CResult_PrivateRouteCreationErrorZ.
11106 pub extern "C" fn CResult_PrivateRouteCreationErrorZ_free(_res: CResult_PrivateRouteCreationErrorZ) { }
11107 impl Drop for CResult_PrivateRouteCreationErrorZ {
11108         fn drop(&mut self) {
11109                 if self.result_ok {
11110                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
11111                                 let _ = unsafe { Box::from_raw(self.contents.result) };
11112                         }
11113                 } else {
11114                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
11115                                 let _ = unsafe { Box::from_raw(self.contents.err) };
11116                         }
11117                 }
11118         }
11119 }
11120 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::PrivateRoute, crate::lightning_invoice::CreationError>> for CResult_PrivateRouteCreationErrorZ {
11121         fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::PrivateRoute, crate::lightning_invoice::CreationError>) -> Self {
11122                 let contents = if o.result_ok {
11123                         let result = unsafe { o.contents.result };
11124                         unsafe { o.contents.result = core::ptr::null_mut() };
11125                         CResult_PrivateRouteCreationErrorZPtr { result }
11126                 } else {
11127                         let err = unsafe { o.contents.err };
11128                         unsafe { o.contents.err = core::ptr::null_mut(); }
11129                         CResult_PrivateRouteCreationErrorZPtr { err }
11130                 };
11131                 Self {
11132                         contents,
11133                         result_ok: o.result_ok,
11134                 }
11135         }
11136 }
11137 impl Clone for CResult_PrivateRouteCreationErrorZ {
11138         fn clone(&self) -> Self {
11139                 if self.result_ok {
11140                         Self { result_ok: true, contents: CResult_PrivateRouteCreationErrorZPtr {
11141                                 result: Box::into_raw(Box::new(<crate::lightning_invoice::PrivateRoute>::clone(unsafe { &*self.contents.result })))
11142                         } }
11143                 } else {
11144                         Self { result_ok: false, contents: CResult_PrivateRouteCreationErrorZPtr {
11145                                 err: Box::into_raw(Box::new(<crate::lightning_invoice::CreationError>::clone(unsafe { &*self.contents.err })))
11146                         } }
11147                 }
11148         }
11149 }
11150 #[no_mangle]
11151 /// Creates a new CResult_PrivateRouteCreationErrorZ which has the same data as `orig`
11152 /// but with all dynamically-allocated buffers duplicated in new buffers.
11153 pub extern "C" fn CResult_PrivateRouteCreationErrorZ_clone(orig: &CResult_PrivateRouteCreationErrorZ) -> CResult_PrivateRouteCreationErrorZ { Clone::clone(&orig) }
11154 #[repr(C)]
11155 /// The contents of CResult_StringErrorZ
11156 pub union CResult_StringErrorZPtr {
11157         /// A pointer to the contents in the success state.
11158         /// Reading from this pointer when `result_ok` is not set is undefined.
11159         pub result: *mut crate::c_types::Str,
11160         /// A pointer to the contents in the error state.
11161         /// Reading from this pointer when `result_ok` is set is undefined.
11162         pub err: *mut crate::c_types::Secp256k1Error,
11163 }
11164 #[repr(C)]
11165 /// A CResult_StringErrorZ represents the result of a fallible operation,
11166 /// containing a crate::c_types::Str on success and a crate::c_types::Secp256k1Error on failure.
11167 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11168 pub struct CResult_StringErrorZ {
11169         /// The contents of this CResult_StringErrorZ, accessible via either
11170         /// `err` or `result` depending on the state of `result_ok`.
11171         pub contents: CResult_StringErrorZPtr,
11172         /// Whether this CResult_StringErrorZ represents a success state.
11173         pub result_ok: bool,
11174 }
11175 #[no_mangle]
11176 /// Creates a new CResult_StringErrorZ in the success state.
11177 pub extern "C" fn CResult_StringErrorZ_ok(o: crate::c_types::Str) -> CResult_StringErrorZ {
11178         CResult_StringErrorZ {
11179                 contents: CResult_StringErrorZPtr {
11180                         result: Box::into_raw(Box::new(o)),
11181                 },
11182                 result_ok: true,
11183         }
11184 }
11185 #[no_mangle]
11186 /// Creates a new CResult_StringErrorZ in the error state.
11187 pub extern "C" fn CResult_StringErrorZ_err(e: crate::c_types::Secp256k1Error) -> CResult_StringErrorZ {
11188         CResult_StringErrorZ {
11189                 contents: CResult_StringErrorZPtr {
11190                         err: Box::into_raw(Box::new(e)),
11191                 },
11192                 result_ok: false,
11193         }
11194 }
11195 /// Checks if the given object is currently in the success state
11196 #[no_mangle]
11197 pub extern "C" fn CResult_StringErrorZ_is_ok(o: &CResult_StringErrorZ) -> bool {
11198         o.result_ok
11199 }
11200 #[no_mangle]
11201 /// Frees any resources used by the CResult_StringErrorZ.
11202 pub extern "C" fn CResult_StringErrorZ_free(_res: CResult_StringErrorZ) { }
11203 impl Drop for CResult_StringErrorZ {
11204         fn drop(&mut self) {
11205                 if self.result_ok {
11206                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
11207                                 let _ = unsafe { Box::from_raw(self.contents.result) };
11208                         }
11209                 } else {
11210                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
11211                                 let _ = unsafe { Box::from_raw(self.contents.err) };
11212                         }
11213                 }
11214         }
11215 }
11216 impl From<crate::c_types::CResultTempl<crate::c_types::Str, crate::c_types::Secp256k1Error>> for CResult_StringErrorZ {
11217         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::Str, crate::c_types::Secp256k1Error>) -> Self {
11218                 let contents = if o.result_ok {
11219                         let result = unsafe { o.contents.result };
11220                         unsafe { o.contents.result = core::ptr::null_mut() };
11221                         CResult_StringErrorZPtr { result }
11222                 } else {
11223                         let err = unsafe { o.contents.err };
11224                         unsafe { o.contents.err = core::ptr::null_mut(); }
11225                         CResult_StringErrorZPtr { err }
11226                 };
11227                 Self {
11228                         contents,
11229                         result_ok: o.result_ok,
11230                 }
11231         }
11232 }
11233 impl Clone for CResult_StringErrorZ {
11234         fn clone(&self) -> Self {
11235                 if self.result_ok {
11236                         Self { result_ok: true, contents: CResult_StringErrorZPtr {
11237                                 result: Box::into_raw(Box::new(<crate::c_types::Str>::clone(unsafe { &*self.contents.result })))
11238                         } }
11239                 } else {
11240                         Self { result_ok: false, contents: CResult_StringErrorZPtr {
11241                                 err: Box::into_raw(Box::new(<crate::c_types::Secp256k1Error>::clone(unsafe { &*self.contents.err })))
11242                         } }
11243                 }
11244         }
11245 }
11246 #[no_mangle]
11247 /// Creates a new CResult_StringErrorZ which has the same data as `orig`
11248 /// but with all dynamically-allocated buffers duplicated in new buffers.
11249 pub extern "C" fn CResult_StringErrorZ_clone(orig: &CResult_StringErrorZ) -> CResult_StringErrorZ { Clone::clone(&orig) }
11250 #[repr(C)]
11251 /// The contents of CResult_ChannelMonitorUpdateDecodeErrorZ
11252 pub union CResult_ChannelMonitorUpdateDecodeErrorZPtr {
11253         /// A pointer to the contents in the success state.
11254         /// Reading from this pointer when `result_ok` is not set is undefined.
11255         pub result: *mut crate::lightning::chain::channelmonitor::ChannelMonitorUpdate,
11256         /// A pointer to the contents in the error state.
11257         /// Reading from this pointer when `result_ok` is set is undefined.
11258         pub err: *mut crate::lightning::ln::msgs::DecodeError,
11259 }
11260 #[repr(C)]
11261 /// A CResult_ChannelMonitorUpdateDecodeErrorZ represents the result of a fallible operation,
11262 /// containing a crate::lightning::chain::channelmonitor::ChannelMonitorUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
11263 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11264 pub struct CResult_ChannelMonitorUpdateDecodeErrorZ {
11265         /// The contents of this CResult_ChannelMonitorUpdateDecodeErrorZ, accessible via either
11266         /// `err` or `result` depending on the state of `result_ok`.
11267         pub contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr,
11268         /// Whether this CResult_ChannelMonitorUpdateDecodeErrorZ represents a success state.
11269         pub result_ok: bool,
11270 }
11271 #[no_mangle]
11272 /// Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ in the success state.
11273 pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_ok(o: crate::lightning::chain::channelmonitor::ChannelMonitorUpdate) -> CResult_ChannelMonitorUpdateDecodeErrorZ {
11274         CResult_ChannelMonitorUpdateDecodeErrorZ {
11275                 contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr {
11276                         result: Box::into_raw(Box::new(o)),
11277                 },
11278                 result_ok: true,
11279         }
11280 }
11281 #[no_mangle]
11282 /// Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ in the error state.
11283 pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelMonitorUpdateDecodeErrorZ {
11284         CResult_ChannelMonitorUpdateDecodeErrorZ {
11285                 contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr {
11286                         err: Box::into_raw(Box::new(e)),
11287                 },
11288                 result_ok: false,
11289         }
11290 }
11291 /// Checks if the given object is currently in the success state
11292 #[no_mangle]
11293 pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_is_ok(o: &CResult_ChannelMonitorUpdateDecodeErrorZ) -> bool {
11294         o.result_ok
11295 }
11296 #[no_mangle]
11297 /// Frees any resources used by the CResult_ChannelMonitorUpdateDecodeErrorZ.
11298 pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_free(_res: CResult_ChannelMonitorUpdateDecodeErrorZ) { }
11299 impl Drop for CResult_ChannelMonitorUpdateDecodeErrorZ {
11300         fn drop(&mut self) {
11301                 if self.result_ok {
11302                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
11303                                 let _ = unsafe { Box::from_raw(self.contents.result) };
11304                         }
11305                 } else {
11306                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
11307                                 let _ = unsafe { Box::from_raw(self.contents.err) };
11308                         }
11309                 }
11310         }
11311 }
11312 impl From<crate::c_types::CResultTempl<crate::lightning::chain::channelmonitor::ChannelMonitorUpdate, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelMonitorUpdateDecodeErrorZ {
11313         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::channelmonitor::ChannelMonitorUpdate, crate::lightning::ln::msgs::DecodeError>) -> Self {
11314                 let contents = if o.result_ok {
11315                         let result = unsafe { o.contents.result };
11316                         unsafe { o.contents.result = core::ptr::null_mut() };
11317                         CResult_ChannelMonitorUpdateDecodeErrorZPtr { result }
11318                 } else {
11319                         let err = unsafe { o.contents.err };
11320                         unsafe { o.contents.err = core::ptr::null_mut(); }
11321                         CResult_ChannelMonitorUpdateDecodeErrorZPtr { err }
11322                 };
11323                 Self {
11324                         contents,
11325                         result_ok: o.result_ok,
11326                 }
11327         }
11328 }
11329 impl Clone for CResult_ChannelMonitorUpdateDecodeErrorZ {
11330         fn clone(&self) -> Self {
11331                 if self.result_ok {
11332                         Self { result_ok: true, contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr {
11333                                 result: Box::into_raw(Box::new(<crate::lightning::chain::channelmonitor::ChannelMonitorUpdate>::clone(unsafe { &*self.contents.result })))
11334                         } }
11335                 } else {
11336                         Self { result_ok: false, contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr {
11337                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
11338                         } }
11339                 }
11340         }
11341 }
11342 #[no_mangle]
11343 /// Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ which has the same data as `orig`
11344 /// but with all dynamically-allocated buffers duplicated in new buffers.
11345 pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_clone(orig: &CResult_ChannelMonitorUpdateDecodeErrorZ) -> CResult_ChannelMonitorUpdateDecodeErrorZ { Clone::clone(&orig) }
11346 #[repr(C)]
11347 #[derive(Clone)]
11348 /// An enum which can either contain a crate::lightning::chain::channelmonitor::MonitorEvent or not
11349 pub enum COption_MonitorEventZ {
11350         /// When we're in this state, this COption_MonitorEventZ contains a crate::lightning::chain::channelmonitor::MonitorEvent
11351         Some(crate::lightning::chain::channelmonitor::MonitorEvent),
11352         /// When we're in this state, this COption_MonitorEventZ contains nothing
11353         None
11354 }
11355 impl COption_MonitorEventZ {
11356         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
11357                 if let Self::None = self { false } else { true }
11358         }
11359         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
11360                 !self.is_some()
11361         }
11362         #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::chain::channelmonitor::MonitorEvent {
11363                 if let Self::Some(v) = self { v } else { unreachable!() }
11364         }
11365 }
11366 #[no_mangle]
11367 /// Constructs a new COption_MonitorEventZ containing a crate::lightning::chain::channelmonitor::MonitorEvent
11368 pub extern "C" fn COption_MonitorEventZ_some(o: crate::lightning::chain::channelmonitor::MonitorEvent) -> COption_MonitorEventZ {
11369         COption_MonitorEventZ::Some(o)
11370 }
11371 #[no_mangle]
11372 /// Constructs a new COption_MonitorEventZ containing nothing
11373 pub extern "C" fn COption_MonitorEventZ_none() -> COption_MonitorEventZ {
11374         COption_MonitorEventZ::None
11375 }
11376 #[no_mangle]
11377 /// Frees any resources associated with the crate::lightning::chain::channelmonitor::MonitorEvent, if we are in the Some state
11378 pub extern "C" fn COption_MonitorEventZ_free(_res: COption_MonitorEventZ) { }
11379 #[no_mangle]
11380 /// Creates a new COption_MonitorEventZ which has the same data as `orig`
11381 /// but with all dynamically-allocated buffers duplicated in new buffers.
11382 pub extern "C" fn COption_MonitorEventZ_clone(orig: &COption_MonitorEventZ) -> COption_MonitorEventZ { Clone::clone(&orig) }
11383 #[repr(C)]
11384 /// The contents of CResult_COption_MonitorEventZDecodeErrorZ
11385 pub union CResult_COption_MonitorEventZDecodeErrorZPtr {
11386         /// A pointer to the contents in the success state.
11387         /// Reading from this pointer when `result_ok` is not set is undefined.
11388         pub result: *mut crate::c_types::derived::COption_MonitorEventZ,
11389         /// A pointer to the contents in the error state.
11390         /// Reading from this pointer when `result_ok` is set is undefined.
11391         pub err: *mut crate::lightning::ln::msgs::DecodeError,
11392 }
11393 #[repr(C)]
11394 /// A CResult_COption_MonitorEventZDecodeErrorZ represents the result of a fallible operation,
11395 /// containing a crate::c_types::derived::COption_MonitorEventZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
11396 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11397 pub struct CResult_COption_MonitorEventZDecodeErrorZ {
11398         /// The contents of this CResult_COption_MonitorEventZDecodeErrorZ, accessible via either
11399         /// `err` or `result` depending on the state of `result_ok`.
11400         pub contents: CResult_COption_MonitorEventZDecodeErrorZPtr,
11401         /// Whether this CResult_COption_MonitorEventZDecodeErrorZ represents a success state.
11402         pub result_ok: bool,
11403 }
11404 #[no_mangle]
11405 /// Creates a new CResult_COption_MonitorEventZDecodeErrorZ in the success state.
11406 pub extern "C" fn CResult_COption_MonitorEventZDecodeErrorZ_ok(o: crate::c_types::derived::COption_MonitorEventZ) -> CResult_COption_MonitorEventZDecodeErrorZ {
11407         CResult_COption_MonitorEventZDecodeErrorZ {
11408                 contents: CResult_COption_MonitorEventZDecodeErrorZPtr {
11409                         result: Box::into_raw(Box::new(o)),
11410                 },
11411                 result_ok: true,
11412         }
11413 }
11414 #[no_mangle]
11415 /// Creates a new CResult_COption_MonitorEventZDecodeErrorZ in the error state.
11416 pub extern "C" fn CResult_COption_MonitorEventZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_MonitorEventZDecodeErrorZ {
11417         CResult_COption_MonitorEventZDecodeErrorZ {
11418                 contents: CResult_COption_MonitorEventZDecodeErrorZPtr {
11419                         err: Box::into_raw(Box::new(e)),
11420                 },
11421                 result_ok: false,
11422         }
11423 }
11424 /// Checks if the given object is currently in the success state
11425 #[no_mangle]
11426 pub extern "C" fn CResult_COption_MonitorEventZDecodeErrorZ_is_ok(o: &CResult_COption_MonitorEventZDecodeErrorZ) -> bool {
11427         o.result_ok
11428 }
11429 #[no_mangle]
11430 /// Frees any resources used by the CResult_COption_MonitorEventZDecodeErrorZ.
11431 pub extern "C" fn CResult_COption_MonitorEventZDecodeErrorZ_free(_res: CResult_COption_MonitorEventZDecodeErrorZ) { }
11432 impl Drop for CResult_COption_MonitorEventZDecodeErrorZ {
11433         fn drop(&mut self) {
11434                 if self.result_ok {
11435                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
11436                                 let _ = unsafe { Box::from_raw(self.contents.result) };
11437                         }
11438                 } else {
11439                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
11440                                 let _ = unsafe { Box::from_raw(self.contents.err) };
11441                         }
11442                 }
11443         }
11444 }
11445 impl From<crate::c_types::CResultTempl<crate::c_types::derived::COption_MonitorEventZ, crate::lightning::ln::msgs::DecodeError>> for CResult_COption_MonitorEventZDecodeErrorZ {
11446         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::COption_MonitorEventZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
11447                 let contents = if o.result_ok {
11448                         let result = unsafe { o.contents.result };
11449                         unsafe { o.contents.result = core::ptr::null_mut() };
11450                         CResult_COption_MonitorEventZDecodeErrorZPtr { result }
11451                 } else {
11452                         let err = unsafe { o.contents.err };
11453                         unsafe { o.contents.err = core::ptr::null_mut(); }
11454                         CResult_COption_MonitorEventZDecodeErrorZPtr { err }
11455                 };
11456                 Self {
11457                         contents,
11458                         result_ok: o.result_ok,
11459                 }
11460         }
11461 }
11462 impl Clone for CResult_COption_MonitorEventZDecodeErrorZ {
11463         fn clone(&self) -> Self {
11464                 if self.result_ok {
11465                         Self { result_ok: true, contents: CResult_COption_MonitorEventZDecodeErrorZPtr {
11466                                 result: Box::into_raw(Box::new(<crate::c_types::derived::COption_MonitorEventZ>::clone(unsafe { &*self.contents.result })))
11467                         } }
11468                 } else {
11469                         Self { result_ok: false, contents: CResult_COption_MonitorEventZDecodeErrorZPtr {
11470                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
11471                         } }
11472                 }
11473         }
11474 }
11475 #[no_mangle]
11476 /// Creates a new CResult_COption_MonitorEventZDecodeErrorZ which has the same data as `orig`
11477 /// but with all dynamically-allocated buffers duplicated in new buffers.
11478 pub extern "C" fn CResult_COption_MonitorEventZDecodeErrorZ_clone(orig: &CResult_COption_MonitorEventZDecodeErrorZ) -> CResult_COption_MonitorEventZDecodeErrorZ { Clone::clone(&orig) }
11479 #[repr(C)]
11480 /// The contents of CResult_HTLCUpdateDecodeErrorZ
11481 pub union CResult_HTLCUpdateDecodeErrorZPtr {
11482         /// A pointer to the contents in the success state.
11483         /// Reading from this pointer when `result_ok` is not set is undefined.
11484         pub result: *mut crate::lightning::chain::channelmonitor::HTLCUpdate,
11485         /// A pointer to the contents in the error state.
11486         /// Reading from this pointer when `result_ok` is set is undefined.
11487         pub err: *mut crate::lightning::ln::msgs::DecodeError,
11488 }
11489 #[repr(C)]
11490 /// A CResult_HTLCUpdateDecodeErrorZ represents the result of a fallible operation,
11491 /// containing a crate::lightning::chain::channelmonitor::HTLCUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
11492 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11493 pub struct CResult_HTLCUpdateDecodeErrorZ {
11494         /// The contents of this CResult_HTLCUpdateDecodeErrorZ, accessible via either
11495         /// `err` or `result` depending on the state of `result_ok`.
11496         pub contents: CResult_HTLCUpdateDecodeErrorZPtr,
11497         /// Whether this CResult_HTLCUpdateDecodeErrorZ represents a success state.
11498         pub result_ok: bool,
11499 }
11500 #[no_mangle]
11501 /// Creates a new CResult_HTLCUpdateDecodeErrorZ in the success state.
11502 pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_ok(o: crate::lightning::chain::channelmonitor::HTLCUpdate) -> CResult_HTLCUpdateDecodeErrorZ {
11503         CResult_HTLCUpdateDecodeErrorZ {
11504                 contents: CResult_HTLCUpdateDecodeErrorZPtr {
11505                         result: Box::into_raw(Box::new(o)),
11506                 },
11507                 result_ok: true,
11508         }
11509 }
11510 #[no_mangle]
11511 /// Creates a new CResult_HTLCUpdateDecodeErrorZ in the error state.
11512 pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_HTLCUpdateDecodeErrorZ {
11513         CResult_HTLCUpdateDecodeErrorZ {
11514                 contents: CResult_HTLCUpdateDecodeErrorZPtr {
11515                         err: Box::into_raw(Box::new(e)),
11516                 },
11517                 result_ok: false,
11518         }
11519 }
11520 /// Checks if the given object is currently in the success state
11521 #[no_mangle]
11522 pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_is_ok(o: &CResult_HTLCUpdateDecodeErrorZ) -> bool {
11523         o.result_ok
11524 }
11525 #[no_mangle]
11526 /// Frees any resources used by the CResult_HTLCUpdateDecodeErrorZ.
11527 pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_free(_res: CResult_HTLCUpdateDecodeErrorZ) { }
11528 impl Drop for CResult_HTLCUpdateDecodeErrorZ {
11529         fn drop(&mut self) {
11530                 if self.result_ok {
11531                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
11532                                 let _ = unsafe { Box::from_raw(self.contents.result) };
11533                         }
11534                 } else {
11535                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
11536                                 let _ = unsafe { Box::from_raw(self.contents.err) };
11537                         }
11538                 }
11539         }
11540 }
11541 impl From<crate::c_types::CResultTempl<crate::lightning::chain::channelmonitor::HTLCUpdate, crate::lightning::ln::msgs::DecodeError>> for CResult_HTLCUpdateDecodeErrorZ {
11542         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::channelmonitor::HTLCUpdate, crate::lightning::ln::msgs::DecodeError>) -> Self {
11543                 let contents = if o.result_ok {
11544                         let result = unsafe { o.contents.result };
11545                         unsafe { o.contents.result = core::ptr::null_mut() };
11546                         CResult_HTLCUpdateDecodeErrorZPtr { result }
11547                 } else {
11548                         let err = unsafe { o.contents.err };
11549                         unsafe { o.contents.err = core::ptr::null_mut(); }
11550                         CResult_HTLCUpdateDecodeErrorZPtr { err }
11551                 };
11552                 Self {
11553                         contents,
11554                         result_ok: o.result_ok,
11555                 }
11556         }
11557 }
11558 impl Clone for CResult_HTLCUpdateDecodeErrorZ {
11559         fn clone(&self) -> Self {
11560                 if self.result_ok {
11561                         Self { result_ok: true, contents: CResult_HTLCUpdateDecodeErrorZPtr {
11562                                 result: Box::into_raw(Box::new(<crate::lightning::chain::channelmonitor::HTLCUpdate>::clone(unsafe { &*self.contents.result })))
11563                         } }
11564                 } else {
11565                         Self { result_ok: false, contents: CResult_HTLCUpdateDecodeErrorZPtr {
11566                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
11567                         } }
11568                 }
11569         }
11570 }
11571 #[no_mangle]
11572 /// Creates a new CResult_HTLCUpdateDecodeErrorZ which has the same data as `orig`
11573 /// but with all dynamically-allocated buffers duplicated in new buffers.
11574 pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_clone(orig: &CResult_HTLCUpdateDecodeErrorZ) -> CResult_HTLCUpdateDecodeErrorZ { Clone::clone(&orig) }
11575 #[repr(C)]
11576 /// A tuple of 2 elements. See the individual fields for the types contained.
11577 pub struct C2Tuple_OutPointScriptZ {
11578         /// The element at position 0
11579         pub a: crate::lightning::chain::transaction::OutPoint,
11580         /// The element at position 1
11581         pub b: crate::c_types::derived::CVec_u8Z,
11582 }
11583 impl From<(crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_u8Z)> for C2Tuple_OutPointScriptZ {
11584         fn from (tup: (crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_u8Z)) -> Self {
11585                 Self {
11586                         a: tup.0,
11587                         b: tup.1,
11588                 }
11589         }
11590 }
11591 impl C2Tuple_OutPointScriptZ {
11592         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_u8Z) {
11593                 (self.a, self.b)
11594         }
11595 }
11596 impl Clone for C2Tuple_OutPointScriptZ {
11597         fn clone(&self) -> Self {
11598                 Self {
11599                         a: Clone::clone(&self.a),
11600                         b: Clone::clone(&self.b),
11601                 }
11602         }
11603 }
11604 #[no_mangle]
11605 /// Creates a new tuple which has the same data as `orig`
11606 /// but with all dynamically-allocated buffers duplicated in new buffers.
11607 pub extern "C" fn C2Tuple_OutPointScriptZ_clone(orig: &C2Tuple_OutPointScriptZ) -> C2Tuple_OutPointScriptZ { Clone::clone(&orig) }
11608 /// Creates a new C2Tuple_OutPointScriptZ from the contained elements.
11609 #[no_mangle]
11610 pub extern "C" fn C2Tuple_OutPointScriptZ_new(a: crate::lightning::chain::transaction::OutPoint, b: crate::c_types::derived::CVec_u8Z) -> C2Tuple_OutPointScriptZ {
11611         C2Tuple_OutPointScriptZ { a, b, }
11612 }
11613
11614 #[no_mangle]
11615 /// Frees any resources used by the C2Tuple_OutPointScriptZ.
11616 pub extern "C" fn C2Tuple_OutPointScriptZ_free(_res: C2Tuple_OutPointScriptZ) { }
11617 #[repr(C)]
11618 /// A tuple of 2 elements. See the individual fields for the types contained.
11619 pub struct C2Tuple_u32ScriptZ {
11620         /// The element at position 0
11621         pub a: u32,
11622         /// The element at position 1
11623         pub b: crate::c_types::derived::CVec_u8Z,
11624 }
11625 impl From<(u32, crate::c_types::derived::CVec_u8Z)> for C2Tuple_u32ScriptZ {
11626         fn from (tup: (u32, crate::c_types::derived::CVec_u8Z)) -> Self {
11627                 Self {
11628                         a: tup.0,
11629                         b: tup.1,
11630                 }
11631         }
11632 }
11633 impl C2Tuple_u32ScriptZ {
11634         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (u32, crate::c_types::derived::CVec_u8Z) {
11635                 (self.a, self.b)
11636         }
11637 }
11638 impl Clone for C2Tuple_u32ScriptZ {
11639         fn clone(&self) -> Self {
11640                 Self {
11641                         a: Clone::clone(&self.a),
11642                         b: Clone::clone(&self.b),
11643                 }
11644         }
11645 }
11646 #[no_mangle]
11647 /// Creates a new tuple which has the same data as `orig`
11648 /// but with all dynamically-allocated buffers duplicated in new buffers.
11649 pub extern "C" fn C2Tuple_u32ScriptZ_clone(orig: &C2Tuple_u32ScriptZ) -> C2Tuple_u32ScriptZ { Clone::clone(&orig) }
11650 /// Creates a new C2Tuple_u32ScriptZ from the contained elements.
11651 #[no_mangle]
11652 pub extern "C" fn C2Tuple_u32ScriptZ_new(a: u32, b: crate::c_types::derived::CVec_u8Z) -> C2Tuple_u32ScriptZ {
11653         C2Tuple_u32ScriptZ { a, b, }
11654 }
11655
11656 #[no_mangle]
11657 /// Frees any resources used by the C2Tuple_u32ScriptZ.
11658 pub extern "C" fn C2Tuple_u32ScriptZ_free(_res: C2Tuple_u32ScriptZ) { }
11659 #[repr(C)]
11660 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_u32ScriptZs of arbitrary size.
11661 /// This corresponds to std::vector in C++
11662 pub struct CVec_C2Tuple_u32ScriptZZ {
11663         /// The elements in the array.
11664         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
11665         pub data: *mut crate::c_types::derived::C2Tuple_u32ScriptZ,
11666         /// The number of elements pointed to by `data`.
11667         pub datalen: usize
11668 }
11669 impl CVec_C2Tuple_u32ScriptZZ {
11670         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_u32ScriptZ> {
11671                 if self.datalen == 0 { return Vec::new(); }
11672                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
11673                 self.data = core::ptr::null_mut();
11674                 self.datalen = 0;
11675                 ret
11676         }
11677         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_u32ScriptZ] {
11678                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
11679         }
11680 }
11681 impl From<Vec<crate::c_types::derived::C2Tuple_u32ScriptZ>> for CVec_C2Tuple_u32ScriptZZ {
11682         fn from(v: Vec<crate::c_types::derived::C2Tuple_u32ScriptZ>) -> Self {
11683                 let datalen = v.len();
11684                 let data = Box::into_raw(v.into_boxed_slice());
11685                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
11686         }
11687 }
11688 #[no_mangle]
11689 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
11690 pub extern "C" fn CVec_C2Tuple_u32ScriptZZ_free(_res: CVec_C2Tuple_u32ScriptZZ) { }
11691 impl Drop for CVec_C2Tuple_u32ScriptZZ {
11692         fn drop(&mut self) {
11693                 if self.datalen == 0 { return; }
11694                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
11695         }
11696 }
11697 impl Clone for CVec_C2Tuple_u32ScriptZZ {
11698         fn clone(&self) -> Self {
11699                 let mut res = Vec::new();
11700                 if self.datalen == 0 { return Self::from(res); }
11701                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
11702                 Self::from(res)
11703         }
11704 }
11705 #[repr(C)]
11706 /// A tuple of 2 elements. See the individual fields for the types contained.
11707 pub struct C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ {
11708         /// The element at position 0
11709         pub a: crate::c_types::ThirtyTwoBytes,
11710         /// The element at position 1
11711         pub b: crate::c_types::derived::CVec_C2Tuple_u32ScriptZZ,
11712 }
11713 impl From<(crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32ScriptZZ)> for C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ {
11714         fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32ScriptZZ)) -> Self {
11715                 Self {
11716                         a: tup.0,
11717                         b: tup.1,
11718                 }
11719         }
11720 }
11721 impl C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ {
11722         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32ScriptZZ) {
11723                 (self.a, self.b)
11724         }
11725 }
11726 impl Clone for C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ {
11727         fn clone(&self) -> Self {
11728                 Self {
11729                         a: Clone::clone(&self.a),
11730                         b: Clone::clone(&self.b),
11731                 }
11732         }
11733 }
11734 #[no_mangle]
11735 /// Creates a new tuple which has the same data as `orig`
11736 /// but with all dynamically-allocated buffers duplicated in new buffers.
11737 pub extern "C" fn C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone(orig: &C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ) -> C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ { Clone::clone(&orig) }
11738 /// Creates a new C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ from the contained elements.
11739 #[no_mangle]
11740 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 {
11741         C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ { a, b, }
11742 }
11743
11744 #[no_mangle]
11745 /// Frees any resources used by the C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ.
11746 pub extern "C" fn C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_free(_res: C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ) { }
11747 #[repr(C)]
11748 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZs of arbitrary size.
11749 /// This corresponds to std::vector in C++
11750 pub struct CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ {
11751         /// The elements in the array.
11752         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
11753         pub data: *mut crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ,
11754         /// The number of elements pointed to by `data`.
11755         pub datalen: usize
11756 }
11757 impl CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ {
11758         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ> {
11759                 if self.datalen == 0 { return Vec::new(); }
11760                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
11761                 self.data = core::ptr::null_mut();
11762                 self.datalen = 0;
11763                 ret
11764         }
11765         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ] {
11766                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
11767         }
11768 }
11769 impl From<Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ>> for CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ {
11770         fn from(v: Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ>) -> Self {
11771                 let datalen = v.len();
11772                 let data = Box::into_raw(v.into_boxed_slice());
11773                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
11774         }
11775 }
11776 #[no_mangle]
11777 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
11778 pub extern "C" fn CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ_free(_res: CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ) { }
11779 impl Drop for CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ {
11780         fn drop(&mut self) {
11781                 if self.datalen == 0 { return; }
11782                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
11783         }
11784 }
11785 impl Clone for CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ {
11786         fn clone(&self) -> Self {
11787                 let mut res = Vec::new();
11788                 if self.datalen == 0 { return Self::from(res); }
11789                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
11790                 Self::from(res)
11791         }
11792 }
11793 #[repr(C)]
11794 /// A dynamically-allocated array of crate::lightning::util::events::Events of arbitrary size.
11795 /// This corresponds to std::vector in C++
11796 pub struct CVec_EventZ {
11797         /// The elements in the array.
11798         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
11799         pub data: *mut crate::lightning::util::events::Event,
11800         /// The number of elements pointed to by `data`.
11801         pub datalen: usize
11802 }
11803 impl CVec_EventZ {
11804         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::util::events::Event> {
11805                 if self.datalen == 0 { return Vec::new(); }
11806                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
11807                 self.data = core::ptr::null_mut();
11808                 self.datalen = 0;
11809                 ret
11810         }
11811         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::util::events::Event] {
11812                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
11813         }
11814 }
11815 impl From<Vec<crate::lightning::util::events::Event>> for CVec_EventZ {
11816         fn from(v: Vec<crate::lightning::util::events::Event>) -> Self {
11817                 let datalen = v.len();
11818                 let data = Box::into_raw(v.into_boxed_slice());
11819                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
11820         }
11821 }
11822 #[no_mangle]
11823 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
11824 pub extern "C" fn CVec_EventZ_free(_res: CVec_EventZ) { }
11825 impl Drop for CVec_EventZ {
11826         fn drop(&mut self) {
11827                 if self.datalen == 0 { return; }
11828                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
11829         }
11830 }
11831 impl Clone for CVec_EventZ {
11832         fn clone(&self) -> Self {
11833                 let mut res = Vec::new();
11834                 if self.datalen == 0 { return Self::from(res); }
11835                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
11836                 Self::from(res)
11837         }
11838 }
11839 #[repr(C)]
11840 /// A dynamically-allocated array of crate::c_types::Transactions of arbitrary size.
11841 /// This corresponds to std::vector in C++
11842 pub struct CVec_TransactionZ {
11843         /// The elements in the array.
11844         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
11845         pub data: *mut crate::c_types::Transaction,
11846         /// The number of elements pointed to by `data`.
11847         pub datalen: usize
11848 }
11849 impl CVec_TransactionZ {
11850         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::Transaction> {
11851                 if self.datalen == 0 { return Vec::new(); }
11852                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
11853                 self.data = core::ptr::null_mut();
11854                 self.datalen = 0;
11855                 ret
11856         }
11857         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::Transaction] {
11858                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
11859         }
11860 }
11861 impl From<Vec<crate::c_types::Transaction>> for CVec_TransactionZ {
11862         fn from(v: Vec<crate::c_types::Transaction>) -> Self {
11863                 let datalen = v.len();
11864                 let data = Box::into_raw(v.into_boxed_slice());
11865                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
11866         }
11867 }
11868 #[no_mangle]
11869 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
11870 pub extern "C" fn CVec_TransactionZ_free(_res: CVec_TransactionZ) { }
11871 impl Drop for CVec_TransactionZ {
11872         fn drop(&mut self) {
11873                 if self.datalen == 0 { return; }
11874                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
11875         }
11876 }
11877 impl Clone for CVec_TransactionZ {
11878         fn clone(&self) -> Self {
11879                 let mut res = Vec::new();
11880                 if self.datalen == 0 { return Self::from(res); }
11881                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
11882                 Self::from(res)
11883         }
11884 }
11885 #[repr(C)]
11886 /// A tuple of 2 elements. See the individual fields for the types contained.
11887 pub struct C2Tuple_u32TxOutZ {
11888         /// The element at position 0
11889         pub a: u32,
11890         /// The element at position 1
11891         pub b: crate::c_types::TxOut,
11892 }
11893 impl From<(u32, crate::c_types::TxOut)> for C2Tuple_u32TxOutZ {
11894         fn from (tup: (u32, crate::c_types::TxOut)) -> Self {
11895                 Self {
11896                         a: tup.0,
11897                         b: tup.1,
11898                 }
11899         }
11900 }
11901 impl C2Tuple_u32TxOutZ {
11902         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (u32, crate::c_types::TxOut) {
11903                 (self.a, self.b)
11904         }
11905 }
11906 impl Clone for C2Tuple_u32TxOutZ {
11907         fn clone(&self) -> Self {
11908                 Self {
11909                         a: Clone::clone(&self.a),
11910                         b: Clone::clone(&self.b),
11911                 }
11912         }
11913 }
11914 #[no_mangle]
11915 /// Creates a new tuple which has the same data as `orig`
11916 /// but with all dynamically-allocated buffers duplicated in new buffers.
11917 pub extern "C" fn C2Tuple_u32TxOutZ_clone(orig: &C2Tuple_u32TxOutZ) -> C2Tuple_u32TxOutZ { Clone::clone(&orig) }
11918 /// Creates a new C2Tuple_u32TxOutZ from the contained elements.
11919 #[no_mangle]
11920 pub extern "C" fn C2Tuple_u32TxOutZ_new(a: u32, b: crate::c_types::TxOut) -> C2Tuple_u32TxOutZ {
11921         C2Tuple_u32TxOutZ { a, b, }
11922 }
11923
11924 #[no_mangle]
11925 /// Frees any resources used by the C2Tuple_u32TxOutZ.
11926 pub extern "C" fn C2Tuple_u32TxOutZ_free(_res: C2Tuple_u32TxOutZ) { }
11927 #[repr(C)]
11928 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_u32TxOutZs of arbitrary size.
11929 /// This corresponds to std::vector in C++
11930 pub struct CVec_C2Tuple_u32TxOutZZ {
11931         /// The elements in the array.
11932         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
11933         pub data: *mut crate::c_types::derived::C2Tuple_u32TxOutZ,
11934         /// The number of elements pointed to by `data`.
11935         pub datalen: usize
11936 }
11937 impl CVec_C2Tuple_u32TxOutZZ {
11938         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_u32TxOutZ> {
11939                 if self.datalen == 0 { return Vec::new(); }
11940                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
11941                 self.data = core::ptr::null_mut();
11942                 self.datalen = 0;
11943                 ret
11944         }
11945         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_u32TxOutZ] {
11946                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
11947         }
11948 }
11949 impl From<Vec<crate::c_types::derived::C2Tuple_u32TxOutZ>> for CVec_C2Tuple_u32TxOutZZ {
11950         fn from(v: Vec<crate::c_types::derived::C2Tuple_u32TxOutZ>) -> Self {
11951                 let datalen = v.len();
11952                 let data = Box::into_raw(v.into_boxed_slice());
11953                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
11954         }
11955 }
11956 #[no_mangle]
11957 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
11958 pub extern "C" fn CVec_C2Tuple_u32TxOutZZ_free(_res: CVec_C2Tuple_u32TxOutZZ) { }
11959 impl Drop for CVec_C2Tuple_u32TxOutZZ {
11960         fn drop(&mut self) {
11961                 if self.datalen == 0 { return; }
11962                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
11963         }
11964 }
11965 impl Clone for CVec_C2Tuple_u32TxOutZZ {
11966         fn clone(&self) -> Self {
11967                 let mut res = Vec::new();
11968                 if self.datalen == 0 { return Self::from(res); }
11969                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
11970                 Self::from(res)
11971         }
11972 }
11973 #[repr(C)]
11974 /// A tuple of 2 elements. See the individual fields for the types contained.
11975 pub struct C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ {
11976         /// The element at position 0
11977         pub a: crate::c_types::ThirtyTwoBytes,
11978         /// The element at position 1
11979         pub b: crate::c_types::derived::CVec_C2Tuple_u32TxOutZZ,
11980 }
11981 impl From<(crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32TxOutZZ)> for C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ {
11982         fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32TxOutZZ)) -> Self {
11983                 Self {
11984                         a: tup.0,
11985                         b: tup.1,
11986                 }
11987         }
11988 }
11989 impl C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ {
11990         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32TxOutZZ) {
11991                 (self.a, self.b)
11992         }
11993 }
11994 impl Clone for C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ {
11995         fn clone(&self) -> Self {
11996                 Self {
11997                         a: Clone::clone(&self.a),
11998                         b: Clone::clone(&self.b),
11999                 }
12000         }
12001 }
12002 #[no_mangle]
12003 /// Creates a new tuple which has the same data as `orig`
12004 /// but with all dynamically-allocated buffers duplicated in new buffers.
12005 pub extern "C" fn C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone(orig: &C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ) -> C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ { Clone::clone(&orig) }
12006 /// Creates a new C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ from the contained elements.
12007 #[no_mangle]
12008 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 {
12009         C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ { a, b, }
12010 }
12011
12012 #[no_mangle]
12013 /// Frees any resources used by the C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ.
12014 pub extern "C" fn C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_free(_res: C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ) { }
12015 #[repr(C)]
12016 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZs of arbitrary size.
12017 /// This corresponds to std::vector in C++
12018 pub struct CVec_TransactionOutputsZ {
12019         /// The elements in the array.
12020         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
12021         pub data: *mut crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ,
12022         /// The number of elements pointed to by `data`.
12023         pub datalen: usize
12024 }
12025 impl CVec_TransactionOutputsZ {
12026         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ> {
12027                 if self.datalen == 0 { return Vec::new(); }
12028                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
12029                 self.data = core::ptr::null_mut();
12030                 self.datalen = 0;
12031                 ret
12032         }
12033         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ] {
12034                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
12035         }
12036 }
12037 impl From<Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ>> for CVec_TransactionOutputsZ {
12038         fn from(v: Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ>) -> Self {
12039                 let datalen = v.len();
12040                 let data = Box::into_raw(v.into_boxed_slice());
12041                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
12042         }
12043 }
12044 #[no_mangle]
12045 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
12046 pub extern "C" fn CVec_TransactionOutputsZ_free(_res: CVec_TransactionOutputsZ) { }
12047 impl Drop for CVec_TransactionOutputsZ {
12048         fn drop(&mut self) {
12049                 if self.datalen == 0 { return; }
12050                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
12051         }
12052 }
12053 impl Clone for CVec_TransactionOutputsZ {
12054         fn clone(&self) -> Self {
12055                 let mut res = Vec::new();
12056                 if self.datalen == 0 { return Self::from(res); }
12057                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
12058                 Self::from(res)
12059         }
12060 }
12061 #[repr(C)]
12062 /// A dynamically-allocated array of crate::lightning::chain::channelmonitor::Balances of arbitrary size.
12063 /// This corresponds to std::vector in C++
12064 pub struct CVec_BalanceZ {
12065         /// The elements in the array.
12066         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
12067         pub data: *mut crate::lightning::chain::channelmonitor::Balance,
12068         /// The number of elements pointed to by `data`.
12069         pub datalen: usize
12070 }
12071 impl CVec_BalanceZ {
12072         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::chain::channelmonitor::Balance> {
12073                 if self.datalen == 0 { return Vec::new(); }
12074                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
12075                 self.data = core::ptr::null_mut();
12076                 self.datalen = 0;
12077                 ret
12078         }
12079         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::chain::channelmonitor::Balance] {
12080                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
12081         }
12082 }
12083 impl From<Vec<crate::lightning::chain::channelmonitor::Balance>> for CVec_BalanceZ {
12084         fn from(v: Vec<crate::lightning::chain::channelmonitor::Balance>) -> Self {
12085                 let datalen = v.len();
12086                 let data = Box::into_raw(v.into_boxed_slice());
12087                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
12088         }
12089 }
12090 #[no_mangle]
12091 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
12092 pub extern "C" fn CVec_BalanceZ_free(_res: CVec_BalanceZ) { }
12093 impl Drop for CVec_BalanceZ {
12094         fn drop(&mut self) {
12095                 if self.datalen == 0 { return; }
12096                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
12097         }
12098 }
12099 impl Clone for CVec_BalanceZ {
12100         fn clone(&self) -> Self {
12101                 let mut res = Vec::new();
12102                 if self.datalen == 0 { return Self::from(res); }
12103                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
12104                 Self::from(res)
12105         }
12106 }
12107 #[repr(C)]
12108 /// The contents of CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ
12109 pub union CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr {
12110         /// A pointer to the contents in the success state.
12111         /// Reading from this pointer when `result_ok` is not set is undefined.
12112         pub result: *mut crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ,
12113         /// A pointer to the contents in the error state.
12114         /// Reading from this pointer when `result_ok` is set is undefined.
12115         pub err: *mut crate::lightning::ln::msgs::DecodeError,
12116 }
12117 #[repr(C)]
12118 /// A CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ represents the result of a fallible operation,
12119 /// containing a crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
12120 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12121 pub struct CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
12122         /// The contents of this CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ, accessible via either
12123         /// `err` or `result` depending on the state of `result_ok`.
12124         pub contents: CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr,
12125         /// Whether this CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ represents a success state.
12126         pub result_ok: bool,
12127 }
12128 #[no_mangle]
12129 /// Creates a new CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ in the success state.
12130 pub extern "C" fn CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_ok(o: crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ) -> CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
12131         CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
12132                 contents: CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr {
12133                         result: Box::into_raw(Box::new(o)),
12134                 },
12135                 result_ok: true,
12136         }
12137 }
12138 #[no_mangle]
12139 /// Creates a new CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ in the error state.
12140 pub extern "C" fn CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
12141         CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
12142                 contents: CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr {
12143                         err: Box::into_raw(Box::new(e)),
12144                 },
12145                 result_ok: false,
12146         }
12147 }
12148 /// Checks if the given object is currently in the success state
12149 #[no_mangle]
12150 pub extern "C" fn CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_is_ok(o: &CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ) -> bool {
12151         o.result_ok
12152 }
12153 #[no_mangle]
12154 /// Frees any resources used by the CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ.
12155 pub extern "C" fn CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_free(_res: CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ) { }
12156 impl Drop for CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
12157         fn drop(&mut self) {
12158                 if self.result_ok {
12159                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
12160                                 let _ = unsafe { Box::from_raw(self.contents.result) };
12161                         }
12162                 } else {
12163                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
12164                                 let _ = unsafe { Box::from_raw(self.contents.err) };
12165                         }
12166                 }
12167         }
12168 }
12169 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ, crate::lightning::ln::msgs::DecodeError>> for CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
12170         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
12171                 let contents = if o.result_ok {
12172                         let result = unsafe { o.contents.result };
12173                         unsafe { o.contents.result = core::ptr::null_mut() };
12174                         CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr { result }
12175                 } else {
12176                         let err = unsafe { o.contents.err };
12177                         unsafe { o.contents.err = core::ptr::null_mut(); }
12178                         CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr { err }
12179                 };
12180                 Self {
12181                         contents,
12182                         result_ok: o.result_ok,
12183                 }
12184         }
12185 }
12186 #[repr(C)]
12187 /// A tuple of 2 elements. See the individual fields for the types contained.
12188 pub struct C2Tuple_PublicKeyTypeZ {
12189         /// The element at position 0
12190         pub a: crate::c_types::PublicKey,
12191         /// The element at position 1
12192         pub b: crate::lightning::ln::wire::Type,
12193 }
12194 impl From<(crate::c_types::PublicKey, crate::lightning::ln::wire::Type)> for C2Tuple_PublicKeyTypeZ {
12195         fn from (tup: (crate::c_types::PublicKey, crate::lightning::ln::wire::Type)) -> Self {
12196                 Self {
12197                         a: tup.0,
12198                         b: tup.1,
12199                 }
12200         }
12201 }
12202 impl C2Tuple_PublicKeyTypeZ {
12203         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::PublicKey, crate::lightning::ln::wire::Type) {
12204                 (self.a, self.b)
12205         }
12206 }
12207 /// Creates a new C2Tuple_PublicKeyTypeZ from the contained elements.
12208 #[no_mangle]
12209 pub extern "C" fn C2Tuple_PublicKeyTypeZ_new(a: crate::c_types::PublicKey, b: crate::lightning::ln::wire::Type) -> C2Tuple_PublicKeyTypeZ {
12210         C2Tuple_PublicKeyTypeZ { a, b, }
12211 }
12212
12213 #[no_mangle]
12214 /// Frees any resources used by the C2Tuple_PublicKeyTypeZ.
12215 pub extern "C" fn C2Tuple_PublicKeyTypeZ_free(_res: C2Tuple_PublicKeyTypeZ) { }
12216 #[repr(C)]
12217 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_PublicKeyTypeZs of arbitrary size.
12218 /// This corresponds to std::vector in C++
12219 pub struct CVec_C2Tuple_PublicKeyTypeZZ {
12220         /// The elements in the array.
12221         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
12222         pub data: *mut crate::c_types::derived::C2Tuple_PublicKeyTypeZ,
12223         /// The number of elements pointed to by `data`.
12224         pub datalen: usize
12225 }
12226 impl CVec_C2Tuple_PublicKeyTypeZZ {
12227         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_PublicKeyTypeZ> {
12228                 if self.datalen == 0 { return Vec::new(); }
12229                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
12230                 self.data = core::ptr::null_mut();
12231                 self.datalen = 0;
12232                 ret
12233         }
12234         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_PublicKeyTypeZ] {
12235                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
12236         }
12237 }
12238 impl From<Vec<crate::c_types::derived::C2Tuple_PublicKeyTypeZ>> for CVec_C2Tuple_PublicKeyTypeZZ {
12239         fn from(v: Vec<crate::c_types::derived::C2Tuple_PublicKeyTypeZ>) -> Self {
12240                 let datalen = v.len();
12241                 let data = Box::into_raw(v.into_boxed_slice());
12242                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
12243         }
12244 }
12245 #[no_mangle]
12246 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
12247 pub extern "C" fn CVec_C2Tuple_PublicKeyTypeZZ_free(_res: CVec_C2Tuple_PublicKeyTypeZZ) { }
12248 impl Drop for CVec_C2Tuple_PublicKeyTypeZZ {
12249         fn drop(&mut self) {
12250                 if self.datalen == 0 { return; }
12251                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
12252         }
12253 }
12254 #[repr(C)]
12255 /// An enum which can either contain a crate::lightning::onion_message::packet::CustomOnionMessageContents or not
12256 pub enum COption_CustomOnionMessageContentsZ {
12257         /// When we're in this state, this COption_CustomOnionMessageContentsZ contains a crate::lightning::onion_message::packet::CustomOnionMessageContents
12258         Some(crate::lightning::onion_message::packet::CustomOnionMessageContents),
12259         /// When we're in this state, this COption_CustomOnionMessageContentsZ contains nothing
12260         None
12261 }
12262 impl COption_CustomOnionMessageContentsZ {
12263         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
12264                 if let Self::None = self { false } else { true }
12265         }
12266         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
12267                 !self.is_some()
12268         }
12269         #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::onion_message::packet::CustomOnionMessageContents {
12270                 if let Self::Some(v) = self { v } else { unreachable!() }
12271         }
12272 }
12273 #[no_mangle]
12274 /// Constructs a new COption_CustomOnionMessageContentsZ containing a crate::lightning::onion_message::packet::CustomOnionMessageContents
12275 pub extern "C" fn COption_CustomOnionMessageContentsZ_some(o: crate::lightning::onion_message::packet::CustomOnionMessageContents) -> COption_CustomOnionMessageContentsZ {
12276         COption_CustomOnionMessageContentsZ::Some(o)
12277 }
12278 #[no_mangle]
12279 /// Constructs a new COption_CustomOnionMessageContentsZ containing nothing
12280 pub extern "C" fn COption_CustomOnionMessageContentsZ_none() -> COption_CustomOnionMessageContentsZ {
12281         COption_CustomOnionMessageContentsZ::None
12282 }
12283 #[no_mangle]
12284 /// Frees any resources associated with the crate::lightning::onion_message::packet::CustomOnionMessageContents, if we are in the Some state
12285 pub extern "C" fn COption_CustomOnionMessageContentsZ_free(_res: COption_CustomOnionMessageContentsZ) { }
12286 #[repr(C)]
12287 /// The contents of CResult_COption_CustomOnionMessageContentsZDecodeErrorZ
12288 pub union CResult_COption_CustomOnionMessageContentsZDecodeErrorZPtr {
12289         /// A pointer to the contents in the success state.
12290         /// Reading from this pointer when `result_ok` is not set is undefined.
12291         pub result: *mut crate::c_types::derived::COption_CustomOnionMessageContentsZ,
12292         /// A pointer to the contents in the error state.
12293         /// Reading from this pointer when `result_ok` is set is undefined.
12294         pub err: *mut crate::lightning::ln::msgs::DecodeError,
12295 }
12296 #[repr(C)]
12297 /// A CResult_COption_CustomOnionMessageContentsZDecodeErrorZ represents the result of a fallible operation,
12298 /// containing a crate::c_types::derived::COption_CustomOnionMessageContentsZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
12299 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12300 pub struct CResult_COption_CustomOnionMessageContentsZDecodeErrorZ {
12301         /// The contents of this CResult_COption_CustomOnionMessageContentsZDecodeErrorZ, accessible via either
12302         /// `err` or `result` depending on the state of `result_ok`.
12303         pub contents: CResult_COption_CustomOnionMessageContentsZDecodeErrorZPtr,
12304         /// Whether this CResult_COption_CustomOnionMessageContentsZDecodeErrorZ represents a success state.
12305         pub result_ok: bool,
12306 }
12307 #[no_mangle]
12308 /// Creates a new CResult_COption_CustomOnionMessageContentsZDecodeErrorZ in the success state.
12309 pub extern "C" fn CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_ok(o: crate::c_types::derived::COption_CustomOnionMessageContentsZ) -> CResult_COption_CustomOnionMessageContentsZDecodeErrorZ {
12310         CResult_COption_CustomOnionMessageContentsZDecodeErrorZ {
12311                 contents: CResult_COption_CustomOnionMessageContentsZDecodeErrorZPtr {
12312                         result: Box::into_raw(Box::new(o)),
12313                 },
12314                 result_ok: true,
12315         }
12316 }
12317 #[no_mangle]
12318 /// Creates a new CResult_COption_CustomOnionMessageContentsZDecodeErrorZ in the error state.
12319 pub extern "C" fn CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_CustomOnionMessageContentsZDecodeErrorZ {
12320         CResult_COption_CustomOnionMessageContentsZDecodeErrorZ {
12321                 contents: CResult_COption_CustomOnionMessageContentsZDecodeErrorZPtr {
12322                         err: Box::into_raw(Box::new(e)),
12323                 },
12324                 result_ok: false,
12325         }
12326 }
12327 /// Checks if the given object is currently in the success state
12328 #[no_mangle]
12329 pub extern "C" fn CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_is_ok(o: &CResult_COption_CustomOnionMessageContentsZDecodeErrorZ) -> bool {
12330         o.result_ok
12331 }
12332 #[no_mangle]
12333 /// Frees any resources used by the CResult_COption_CustomOnionMessageContentsZDecodeErrorZ.
12334 pub extern "C" fn CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_free(_res: CResult_COption_CustomOnionMessageContentsZDecodeErrorZ) { }
12335 impl Drop for CResult_COption_CustomOnionMessageContentsZDecodeErrorZ {
12336         fn drop(&mut self) {
12337                 if self.result_ok {
12338                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
12339                                 let _ = unsafe { Box::from_raw(self.contents.result) };
12340                         }
12341                 } else {
12342                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
12343                                 let _ = unsafe { Box::from_raw(self.contents.err) };
12344                         }
12345                 }
12346         }
12347 }
12348 impl From<crate::c_types::CResultTempl<crate::c_types::derived::COption_CustomOnionMessageContentsZ, crate::lightning::ln::msgs::DecodeError>> for CResult_COption_CustomOnionMessageContentsZDecodeErrorZ {
12349         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::COption_CustomOnionMessageContentsZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
12350                 let contents = if o.result_ok {
12351                         let result = unsafe { o.contents.result };
12352                         unsafe { o.contents.result = core::ptr::null_mut() };
12353                         CResult_COption_CustomOnionMessageContentsZDecodeErrorZPtr { result }
12354                 } else {
12355                         let err = unsafe { o.contents.err };
12356                         unsafe { o.contents.err = core::ptr::null_mut(); }
12357                         CResult_COption_CustomOnionMessageContentsZDecodeErrorZPtr { err }
12358                 };
12359                 Self {
12360                         contents,
12361                         result_ok: o.result_ok,
12362                 }
12363         }
12364 }
12365 #[repr(C)]
12366 #[derive(Clone)]
12367 /// An enum which can either contain a crate::lightning::ln::msgs::NetAddress or not
12368 pub enum COption_NetAddressZ {
12369         /// When we're in this state, this COption_NetAddressZ contains a crate::lightning::ln::msgs::NetAddress
12370         Some(crate::lightning::ln::msgs::NetAddress),
12371         /// When we're in this state, this COption_NetAddressZ contains nothing
12372         None
12373 }
12374 impl COption_NetAddressZ {
12375         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
12376                 if let Self::None = self { false } else { true }
12377         }
12378         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
12379                 !self.is_some()
12380         }
12381         #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::ln::msgs::NetAddress {
12382                 if let Self::Some(v) = self { v } else { unreachable!() }
12383         }
12384 }
12385 #[no_mangle]
12386 /// Constructs a new COption_NetAddressZ containing a crate::lightning::ln::msgs::NetAddress
12387 pub extern "C" fn COption_NetAddressZ_some(o: crate::lightning::ln::msgs::NetAddress) -> COption_NetAddressZ {
12388         COption_NetAddressZ::Some(o)
12389 }
12390 #[no_mangle]
12391 /// Constructs a new COption_NetAddressZ containing nothing
12392 pub extern "C" fn COption_NetAddressZ_none() -> COption_NetAddressZ {
12393         COption_NetAddressZ::None
12394 }
12395 #[no_mangle]
12396 /// Frees any resources associated with the crate::lightning::ln::msgs::NetAddress, if we are in the Some state
12397 pub extern "C" fn COption_NetAddressZ_free(_res: COption_NetAddressZ) { }
12398 #[no_mangle]
12399 /// Creates a new COption_NetAddressZ which has the same data as `orig`
12400 /// but with all dynamically-allocated buffers duplicated in new buffers.
12401 pub extern "C" fn COption_NetAddressZ_clone(orig: &COption_NetAddressZ) -> COption_NetAddressZ { Clone::clone(&orig) }
12402 #[repr(C)]
12403 /// The contents of CResult_CVec_u8ZPeerHandleErrorZ
12404 pub union CResult_CVec_u8ZPeerHandleErrorZPtr {
12405         /// A pointer to the contents in the success state.
12406         /// Reading from this pointer when `result_ok` is not set is undefined.
12407         pub result: *mut crate::c_types::derived::CVec_u8Z,
12408         /// A pointer to the contents in the error state.
12409         /// Reading from this pointer when `result_ok` is set is undefined.
12410         pub err: *mut crate::lightning::ln::peer_handler::PeerHandleError,
12411 }
12412 #[repr(C)]
12413 /// A CResult_CVec_u8ZPeerHandleErrorZ represents the result of a fallible operation,
12414 /// containing a crate::c_types::derived::CVec_u8Z on success and a crate::lightning::ln::peer_handler::PeerHandleError on failure.
12415 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12416 pub struct CResult_CVec_u8ZPeerHandleErrorZ {
12417         /// The contents of this CResult_CVec_u8ZPeerHandleErrorZ, accessible via either
12418         /// `err` or `result` depending on the state of `result_ok`.
12419         pub contents: CResult_CVec_u8ZPeerHandleErrorZPtr,
12420         /// Whether this CResult_CVec_u8ZPeerHandleErrorZ represents a success state.
12421         pub result_ok: bool,
12422 }
12423 #[no_mangle]
12424 /// Creates a new CResult_CVec_u8ZPeerHandleErrorZ in the success state.
12425 pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_ok(o: crate::c_types::derived::CVec_u8Z) -> CResult_CVec_u8ZPeerHandleErrorZ {
12426         CResult_CVec_u8ZPeerHandleErrorZ {
12427                 contents: CResult_CVec_u8ZPeerHandleErrorZPtr {
12428                         result: Box::into_raw(Box::new(o)),
12429                 },
12430                 result_ok: true,
12431         }
12432 }
12433 #[no_mangle]
12434 /// Creates a new CResult_CVec_u8ZPeerHandleErrorZ in the error state.
12435 pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_err(e: crate::lightning::ln::peer_handler::PeerHandleError) -> CResult_CVec_u8ZPeerHandleErrorZ {
12436         CResult_CVec_u8ZPeerHandleErrorZ {
12437                 contents: CResult_CVec_u8ZPeerHandleErrorZPtr {
12438                         err: Box::into_raw(Box::new(e)),
12439                 },
12440                 result_ok: false,
12441         }
12442 }
12443 /// Checks if the given object is currently in the success state
12444 #[no_mangle]
12445 pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_is_ok(o: &CResult_CVec_u8ZPeerHandleErrorZ) -> bool {
12446         o.result_ok
12447 }
12448 #[no_mangle]
12449 /// Frees any resources used by the CResult_CVec_u8ZPeerHandleErrorZ.
12450 pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_free(_res: CResult_CVec_u8ZPeerHandleErrorZ) { }
12451 impl Drop for CResult_CVec_u8ZPeerHandleErrorZ {
12452         fn drop(&mut self) {
12453                 if self.result_ok {
12454                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
12455                                 let _ = unsafe { Box::from_raw(self.contents.result) };
12456                         }
12457                 } else {
12458                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
12459                                 let _ = unsafe { Box::from_raw(self.contents.err) };
12460                         }
12461                 }
12462         }
12463 }
12464 impl From<crate::c_types::CResultTempl<crate::c_types::derived::CVec_u8Z, crate::lightning::ln::peer_handler::PeerHandleError>> for CResult_CVec_u8ZPeerHandleErrorZ {
12465         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CVec_u8Z, crate::lightning::ln::peer_handler::PeerHandleError>) -> Self {
12466                 let contents = if o.result_ok {
12467                         let result = unsafe { o.contents.result };
12468                         unsafe { o.contents.result = core::ptr::null_mut() };
12469                         CResult_CVec_u8ZPeerHandleErrorZPtr { result }
12470                 } else {
12471                         let err = unsafe { o.contents.err };
12472                         unsafe { o.contents.err = core::ptr::null_mut(); }
12473                         CResult_CVec_u8ZPeerHandleErrorZPtr { err }
12474                 };
12475                 Self {
12476                         contents,
12477                         result_ok: o.result_ok,
12478                 }
12479         }
12480 }
12481 impl Clone for CResult_CVec_u8ZPeerHandleErrorZ {
12482         fn clone(&self) -> Self {
12483                 if self.result_ok {
12484                         Self { result_ok: true, contents: CResult_CVec_u8ZPeerHandleErrorZPtr {
12485                                 result: Box::into_raw(Box::new(<crate::c_types::derived::CVec_u8Z>::clone(unsafe { &*self.contents.result })))
12486                         } }
12487                 } else {
12488                         Self { result_ok: false, contents: CResult_CVec_u8ZPeerHandleErrorZPtr {
12489                                 err: Box::into_raw(Box::new(<crate::lightning::ln::peer_handler::PeerHandleError>::clone(unsafe { &*self.contents.err })))
12490                         } }
12491                 }
12492         }
12493 }
12494 #[no_mangle]
12495 /// Creates a new CResult_CVec_u8ZPeerHandleErrorZ which has the same data as `orig`
12496 /// but with all dynamically-allocated buffers duplicated in new buffers.
12497 pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_clone(orig: &CResult_CVec_u8ZPeerHandleErrorZ) -> CResult_CVec_u8ZPeerHandleErrorZ { Clone::clone(&orig) }
12498 #[repr(C)]
12499 /// The contents of CResult_NonePeerHandleErrorZ
12500 pub union CResult_NonePeerHandleErrorZPtr {
12501         /// Note that this value is always NULL, as there are no contents in the OK variant
12502         pub result: *mut core::ffi::c_void,
12503         /// A pointer to the contents in the error state.
12504         /// Reading from this pointer when `result_ok` is set is undefined.
12505         pub err: *mut crate::lightning::ln::peer_handler::PeerHandleError,
12506 }
12507 #[repr(C)]
12508 /// A CResult_NonePeerHandleErrorZ represents the result of a fallible operation,
12509 /// containing a () on success and a crate::lightning::ln::peer_handler::PeerHandleError on failure.
12510 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12511 pub struct CResult_NonePeerHandleErrorZ {
12512         /// The contents of this CResult_NonePeerHandleErrorZ, accessible via either
12513         /// `err` or `result` depending on the state of `result_ok`.
12514         pub contents: CResult_NonePeerHandleErrorZPtr,
12515         /// Whether this CResult_NonePeerHandleErrorZ represents a success state.
12516         pub result_ok: bool,
12517 }
12518 #[no_mangle]
12519 /// Creates a new CResult_NonePeerHandleErrorZ in the success state.
12520 pub extern "C" fn CResult_NonePeerHandleErrorZ_ok() -> CResult_NonePeerHandleErrorZ {
12521         CResult_NonePeerHandleErrorZ {
12522                 contents: CResult_NonePeerHandleErrorZPtr {
12523                         result: core::ptr::null_mut(),
12524                 },
12525                 result_ok: true,
12526         }
12527 }
12528 #[no_mangle]
12529 /// Creates a new CResult_NonePeerHandleErrorZ in the error state.
12530 pub extern "C" fn CResult_NonePeerHandleErrorZ_err(e: crate::lightning::ln::peer_handler::PeerHandleError) -> CResult_NonePeerHandleErrorZ {
12531         CResult_NonePeerHandleErrorZ {
12532                 contents: CResult_NonePeerHandleErrorZPtr {
12533                         err: Box::into_raw(Box::new(e)),
12534                 },
12535                 result_ok: false,
12536         }
12537 }
12538 /// Checks if the given object is currently in the success state
12539 #[no_mangle]
12540 pub extern "C" fn CResult_NonePeerHandleErrorZ_is_ok(o: &CResult_NonePeerHandleErrorZ) -> bool {
12541         o.result_ok
12542 }
12543 #[no_mangle]
12544 /// Frees any resources used by the CResult_NonePeerHandleErrorZ.
12545 pub extern "C" fn CResult_NonePeerHandleErrorZ_free(_res: CResult_NonePeerHandleErrorZ) { }
12546 impl Drop for CResult_NonePeerHandleErrorZ {
12547         fn drop(&mut self) {
12548                 if self.result_ok {
12549                 } else {
12550                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
12551                                 let _ = unsafe { Box::from_raw(self.contents.err) };
12552                         }
12553                 }
12554         }
12555 }
12556 impl From<crate::c_types::CResultTempl<(), crate::lightning::ln::peer_handler::PeerHandleError>> for CResult_NonePeerHandleErrorZ {
12557         fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::ln::peer_handler::PeerHandleError>) -> Self {
12558                 let contents = if o.result_ok {
12559                         let _ = unsafe { Box::from_raw(o.contents.result) };
12560                         o.contents.result = core::ptr::null_mut();
12561                         CResult_NonePeerHandleErrorZPtr { result: core::ptr::null_mut() }
12562                 } else {
12563                         let err = unsafe { o.contents.err };
12564                         unsafe { o.contents.err = core::ptr::null_mut(); }
12565                         CResult_NonePeerHandleErrorZPtr { err }
12566                 };
12567                 Self {
12568                         contents,
12569                         result_ok: o.result_ok,
12570                 }
12571         }
12572 }
12573 impl Clone for CResult_NonePeerHandleErrorZ {
12574         fn clone(&self) -> Self {
12575                 if self.result_ok {
12576                         Self { result_ok: true, contents: CResult_NonePeerHandleErrorZPtr {
12577                                 result: core::ptr::null_mut()
12578                         } }
12579                 } else {
12580                         Self { result_ok: false, contents: CResult_NonePeerHandleErrorZPtr {
12581                                 err: Box::into_raw(Box::new(<crate::lightning::ln::peer_handler::PeerHandleError>::clone(unsafe { &*self.contents.err })))
12582                         } }
12583                 }
12584         }
12585 }
12586 #[no_mangle]
12587 /// Creates a new CResult_NonePeerHandleErrorZ which has the same data as `orig`
12588 /// but with all dynamically-allocated buffers duplicated in new buffers.
12589 pub extern "C" fn CResult_NonePeerHandleErrorZ_clone(orig: &CResult_NonePeerHandleErrorZ) -> CResult_NonePeerHandleErrorZ { Clone::clone(&orig) }
12590 #[repr(C)]
12591 /// The contents of CResult_boolPeerHandleErrorZ
12592 pub union CResult_boolPeerHandleErrorZPtr {
12593         /// A pointer to the contents in the success state.
12594         /// Reading from this pointer when `result_ok` is not set is undefined.
12595         pub result: *mut bool,
12596         /// A pointer to the contents in the error state.
12597         /// Reading from this pointer when `result_ok` is set is undefined.
12598         pub err: *mut crate::lightning::ln::peer_handler::PeerHandleError,
12599 }
12600 #[repr(C)]
12601 /// A CResult_boolPeerHandleErrorZ represents the result of a fallible operation,
12602 /// containing a bool on success and a crate::lightning::ln::peer_handler::PeerHandleError on failure.
12603 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12604 pub struct CResult_boolPeerHandleErrorZ {
12605         /// The contents of this CResult_boolPeerHandleErrorZ, accessible via either
12606         /// `err` or `result` depending on the state of `result_ok`.
12607         pub contents: CResult_boolPeerHandleErrorZPtr,
12608         /// Whether this CResult_boolPeerHandleErrorZ represents a success state.
12609         pub result_ok: bool,
12610 }
12611 #[no_mangle]
12612 /// Creates a new CResult_boolPeerHandleErrorZ in the success state.
12613 pub extern "C" fn CResult_boolPeerHandleErrorZ_ok(o: bool) -> CResult_boolPeerHandleErrorZ {
12614         CResult_boolPeerHandleErrorZ {
12615                 contents: CResult_boolPeerHandleErrorZPtr {
12616                         result: Box::into_raw(Box::new(o)),
12617                 },
12618                 result_ok: true,
12619         }
12620 }
12621 #[no_mangle]
12622 /// Creates a new CResult_boolPeerHandleErrorZ in the error state.
12623 pub extern "C" fn CResult_boolPeerHandleErrorZ_err(e: crate::lightning::ln::peer_handler::PeerHandleError) -> CResult_boolPeerHandleErrorZ {
12624         CResult_boolPeerHandleErrorZ {
12625                 contents: CResult_boolPeerHandleErrorZPtr {
12626                         err: Box::into_raw(Box::new(e)),
12627                 },
12628                 result_ok: false,
12629         }
12630 }
12631 /// Checks if the given object is currently in the success state
12632 #[no_mangle]
12633 pub extern "C" fn CResult_boolPeerHandleErrorZ_is_ok(o: &CResult_boolPeerHandleErrorZ) -> bool {
12634         o.result_ok
12635 }
12636 #[no_mangle]
12637 /// Frees any resources used by the CResult_boolPeerHandleErrorZ.
12638 pub extern "C" fn CResult_boolPeerHandleErrorZ_free(_res: CResult_boolPeerHandleErrorZ) { }
12639 impl Drop for CResult_boolPeerHandleErrorZ {
12640         fn drop(&mut self) {
12641                 if self.result_ok {
12642                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
12643                                 let _ = unsafe { Box::from_raw(self.contents.result) };
12644                         }
12645                 } else {
12646                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
12647                                 let _ = unsafe { Box::from_raw(self.contents.err) };
12648                         }
12649                 }
12650         }
12651 }
12652 impl From<crate::c_types::CResultTempl<bool, crate::lightning::ln::peer_handler::PeerHandleError>> for CResult_boolPeerHandleErrorZ {
12653         fn from(mut o: crate::c_types::CResultTempl<bool, crate::lightning::ln::peer_handler::PeerHandleError>) -> Self {
12654                 let contents = if o.result_ok {
12655                         let result = unsafe { o.contents.result };
12656                         unsafe { o.contents.result = core::ptr::null_mut() };
12657                         CResult_boolPeerHandleErrorZPtr { result }
12658                 } else {
12659                         let err = unsafe { o.contents.err };
12660                         unsafe { o.contents.err = core::ptr::null_mut(); }
12661                         CResult_boolPeerHandleErrorZPtr { err }
12662                 };
12663                 Self {
12664                         contents,
12665                         result_ok: o.result_ok,
12666                 }
12667         }
12668 }
12669 impl Clone for CResult_boolPeerHandleErrorZ {
12670         fn clone(&self) -> Self {
12671                 if self.result_ok {
12672                         Self { result_ok: true, contents: CResult_boolPeerHandleErrorZPtr {
12673                                 result: Box::into_raw(Box::new(<bool>::clone(unsafe { &*self.contents.result })))
12674                         } }
12675                 } else {
12676                         Self { result_ok: false, contents: CResult_boolPeerHandleErrorZPtr {
12677                                 err: Box::into_raw(Box::new(<crate::lightning::ln::peer_handler::PeerHandleError>::clone(unsafe { &*self.contents.err })))
12678                         } }
12679                 }
12680         }
12681 }
12682 #[no_mangle]
12683 /// Creates a new CResult_boolPeerHandleErrorZ which has the same data as `orig`
12684 /// but with all dynamically-allocated buffers duplicated in new buffers.
12685 pub extern "C" fn CResult_boolPeerHandleErrorZ_clone(orig: &CResult_boolPeerHandleErrorZ) -> CResult_boolPeerHandleErrorZ { Clone::clone(&orig) }
12686 #[repr(C)]
12687 /// The contents of CResult_NoneSendErrorZ
12688 pub union CResult_NoneSendErrorZPtr {
12689         /// Note that this value is always NULL, as there are no contents in the OK variant
12690         pub result: *mut core::ffi::c_void,
12691         /// A pointer to the contents in the error state.
12692         /// Reading from this pointer when `result_ok` is set is undefined.
12693         pub err: *mut crate::lightning::onion_message::messenger::SendError,
12694 }
12695 #[repr(C)]
12696 /// A CResult_NoneSendErrorZ represents the result of a fallible operation,
12697 /// containing a () on success and a crate::lightning::onion_message::messenger::SendError on failure.
12698 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12699 pub struct CResult_NoneSendErrorZ {
12700         /// The contents of this CResult_NoneSendErrorZ, accessible via either
12701         /// `err` or `result` depending on the state of `result_ok`.
12702         pub contents: CResult_NoneSendErrorZPtr,
12703         /// Whether this CResult_NoneSendErrorZ represents a success state.
12704         pub result_ok: bool,
12705 }
12706 #[no_mangle]
12707 /// Creates a new CResult_NoneSendErrorZ in the success state.
12708 pub extern "C" fn CResult_NoneSendErrorZ_ok() -> CResult_NoneSendErrorZ {
12709         CResult_NoneSendErrorZ {
12710                 contents: CResult_NoneSendErrorZPtr {
12711                         result: core::ptr::null_mut(),
12712                 },
12713                 result_ok: true,
12714         }
12715 }
12716 #[no_mangle]
12717 /// Creates a new CResult_NoneSendErrorZ in the error state.
12718 pub extern "C" fn CResult_NoneSendErrorZ_err(e: crate::lightning::onion_message::messenger::SendError) -> CResult_NoneSendErrorZ {
12719         CResult_NoneSendErrorZ {
12720                 contents: CResult_NoneSendErrorZPtr {
12721                         err: Box::into_raw(Box::new(e)),
12722                 },
12723                 result_ok: false,
12724         }
12725 }
12726 /// Checks if the given object is currently in the success state
12727 #[no_mangle]
12728 pub extern "C" fn CResult_NoneSendErrorZ_is_ok(o: &CResult_NoneSendErrorZ) -> bool {
12729         o.result_ok
12730 }
12731 #[no_mangle]
12732 /// Frees any resources used by the CResult_NoneSendErrorZ.
12733 pub extern "C" fn CResult_NoneSendErrorZ_free(_res: CResult_NoneSendErrorZ) { }
12734 impl Drop for CResult_NoneSendErrorZ {
12735         fn drop(&mut self) {
12736                 if self.result_ok {
12737                 } else {
12738                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
12739                                 let _ = unsafe { Box::from_raw(self.contents.err) };
12740                         }
12741                 }
12742         }
12743 }
12744 impl From<crate::c_types::CResultTempl<(), crate::lightning::onion_message::messenger::SendError>> for CResult_NoneSendErrorZ {
12745         fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::onion_message::messenger::SendError>) -> Self {
12746                 let contents = if o.result_ok {
12747                         let _ = unsafe { Box::from_raw(o.contents.result) };
12748                         o.contents.result = core::ptr::null_mut();
12749                         CResult_NoneSendErrorZPtr { result: core::ptr::null_mut() }
12750                 } else {
12751                         let err = unsafe { o.contents.err };
12752                         unsafe { o.contents.err = core::ptr::null_mut(); }
12753                         CResult_NoneSendErrorZPtr { err }
12754                 };
12755                 Self {
12756                         contents,
12757                         result_ok: o.result_ok,
12758                 }
12759         }
12760 }
12761 #[repr(C)]
12762 /// The contents of CResult_u32GraphSyncErrorZ
12763 pub union CResult_u32GraphSyncErrorZPtr {
12764         /// A pointer to the contents in the success state.
12765         /// Reading from this pointer when `result_ok` is not set is undefined.
12766         pub result: *mut u32,
12767         /// A pointer to the contents in the error state.
12768         /// Reading from this pointer when `result_ok` is set is undefined.
12769         pub err: *mut crate::lightning_rapid_gossip_sync::error::GraphSyncError,
12770 }
12771 #[repr(C)]
12772 /// A CResult_u32GraphSyncErrorZ represents the result of a fallible operation,
12773 /// containing a u32 on success and a crate::lightning_rapid_gossip_sync::error::GraphSyncError on failure.
12774 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12775 pub struct CResult_u32GraphSyncErrorZ {
12776         /// The contents of this CResult_u32GraphSyncErrorZ, accessible via either
12777         /// `err` or `result` depending on the state of `result_ok`.
12778         pub contents: CResult_u32GraphSyncErrorZPtr,
12779         /// Whether this CResult_u32GraphSyncErrorZ represents a success state.
12780         pub result_ok: bool,
12781 }
12782 #[no_mangle]
12783 /// Creates a new CResult_u32GraphSyncErrorZ in the success state.
12784 pub extern "C" fn CResult_u32GraphSyncErrorZ_ok(o: u32) -> CResult_u32GraphSyncErrorZ {
12785         CResult_u32GraphSyncErrorZ {
12786                 contents: CResult_u32GraphSyncErrorZPtr {
12787                         result: Box::into_raw(Box::new(o)),
12788                 },
12789                 result_ok: true,
12790         }
12791 }
12792 #[no_mangle]
12793 /// Creates a new CResult_u32GraphSyncErrorZ in the error state.
12794 pub extern "C" fn CResult_u32GraphSyncErrorZ_err(e: crate::lightning_rapid_gossip_sync::error::GraphSyncError) -> CResult_u32GraphSyncErrorZ {
12795         CResult_u32GraphSyncErrorZ {
12796                 contents: CResult_u32GraphSyncErrorZPtr {
12797                         err: Box::into_raw(Box::new(e)),
12798                 },
12799                 result_ok: false,
12800         }
12801 }
12802 /// Checks if the given object is currently in the success state
12803 #[no_mangle]
12804 pub extern "C" fn CResult_u32GraphSyncErrorZ_is_ok(o: &CResult_u32GraphSyncErrorZ) -> bool {
12805         o.result_ok
12806 }
12807 #[no_mangle]
12808 /// Frees any resources used by the CResult_u32GraphSyncErrorZ.
12809 pub extern "C" fn CResult_u32GraphSyncErrorZ_free(_res: CResult_u32GraphSyncErrorZ) { }
12810 impl Drop for CResult_u32GraphSyncErrorZ {
12811         fn drop(&mut self) {
12812                 if self.result_ok {
12813                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
12814                                 let _ = unsafe { Box::from_raw(self.contents.result) };
12815                         }
12816                 } else {
12817                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
12818                                 let _ = unsafe { Box::from_raw(self.contents.err) };
12819                         }
12820                 }
12821         }
12822 }
12823 impl From<crate::c_types::CResultTempl<u32, crate::lightning_rapid_gossip_sync::error::GraphSyncError>> for CResult_u32GraphSyncErrorZ {
12824         fn from(mut o: crate::c_types::CResultTempl<u32, crate::lightning_rapid_gossip_sync::error::GraphSyncError>) -> Self {
12825                 let contents = if o.result_ok {
12826                         let result = unsafe { o.contents.result };
12827                         unsafe { o.contents.result = core::ptr::null_mut() };
12828                         CResult_u32GraphSyncErrorZPtr { result }
12829                 } else {
12830                         let err = unsafe { o.contents.err };
12831                         unsafe { o.contents.err = core::ptr::null_mut(); }
12832                         CResult_u32GraphSyncErrorZPtr { err }
12833                 };
12834                 Self {
12835                         contents,
12836                         result_ok: o.result_ok,
12837                 }
12838         }
12839 }
12840 #[repr(C)]
12841 /// The contents of CResult_NetAddressDecodeErrorZ
12842 pub union CResult_NetAddressDecodeErrorZPtr {
12843         /// A pointer to the contents in the success state.
12844         /// Reading from this pointer when `result_ok` is not set is undefined.
12845         pub result: *mut crate::lightning::ln::msgs::NetAddress,
12846         /// A pointer to the contents in the error state.
12847         /// Reading from this pointer when `result_ok` is set is undefined.
12848         pub err: *mut crate::lightning::ln::msgs::DecodeError,
12849 }
12850 #[repr(C)]
12851 /// A CResult_NetAddressDecodeErrorZ represents the result of a fallible operation,
12852 /// containing a crate::lightning::ln::msgs::NetAddress on success and a crate::lightning::ln::msgs::DecodeError on failure.
12853 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12854 pub struct CResult_NetAddressDecodeErrorZ {
12855         /// The contents of this CResult_NetAddressDecodeErrorZ, accessible via either
12856         /// `err` or `result` depending on the state of `result_ok`.
12857         pub contents: CResult_NetAddressDecodeErrorZPtr,
12858         /// Whether this CResult_NetAddressDecodeErrorZ represents a success state.
12859         pub result_ok: bool,
12860 }
12861 #[no_mangle]
12862 /// Creates a new CResult_NetAddressDecodeErrorZ in the success state.
12863 pub extern "C" fn CResult_NetAddressDecodeErrorZ_ok(o: crate::lightning::ln::msgs::NetAddress) -> CResult_NetAddressDecodeErrorZ {
12864         CResult_NetAddressDecodeErrorZ {
12865                 contents: CResult_NetAddressDecodeErrorZPtr {
12866                         result: Box::into_raw(Box::new(o)),
12867                 },
12868                 result_ok: true,
12869         }
12870 }
12871 #[no_mangle]
12872 /// Creates a new CResult_NetAddressDecodeErrorZ in the error state.
12873 pub extern "C" fn CResult_NetAddressDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NetAddressDecodeErrorZ {
12874         CResult_NetAddressDecodeErrorZ {
12875                 contents: CResult_NetAddressDecodeErrorZPtr {
12876                         err: Box::into_raw(Box::new(e)),
12877                 },
12878                 result_ok: false,
12879         }
12880 }
12881 /// Checks if the given object is currently in the success state
12882 #[no_mangle]
12883 pub extern "C" fn CResult_NetAddressDecodeErrorZ_is_ok(o: &CResult_NetAddressDecodeErrorZ) -> bool {
12884         o.result_ok
12885 }
12886 #[no_mangle]
12887 /// Frees any resources used by the CResult_NetAddressDecodeErrorZ.
12888 pub extern "C" fn CResult_NetAddressDecodeErrorZ_free(_res: CResult_NetAddressDecodeErrorZ) { }
12889 impl Drop for CResult_NetAddressDecodeErrorZ {
12890         fn drop(&mut self) {
12891                 if self.result_ok {
12892                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
12893                                 let _ = unsafe { Box::from_raw(self.contents.result) };
12894                         }
12895                 } else {
12896                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
12897                                 let _ = unsafe { Box::from_raw(self.contents.err) };
12898                         }
12899                 }
12900         }
12901 }
12902 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::NetAddress, crate::lightning::ln::msgs::DecodeError>> for CResult_NetAddressDecodeErrorZ {
12903         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::NetAddress, crate::lightning::ln::msgs::DecodeError>) -> Self {
12904                 let contents = if o.result_ok {
12905                         let result = unsafe { o.contents.result };
12906                         unsafe { o.contents.result = core::ptr::null_mut() };
12907                         CResult_NetAddressDecodeErrorZPtr { result }
12908                 } else {
12909                         let err = unsafe { o.contents.err };
12910                         unsafe { o.contents.err = core::ptr::null_mut(); }
12911                         CResult_NetAddressDecodeErrorZPtr { err }
12912                 };
12913                 Self {
12914                         contents,
12915                         result_ok: o.result_ok,
12916                 }
12917         }
12918 }
12919 impl Clone for CResult_NetAddressDecodeErrorZ {
12920         fn clone(&self) -> Self {
12921                 if self.result_ok {
12922                         Self { result_ok: true, contents: CResult_NetAddressDecodeErrorZPtr {
12923                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::NetAddress>::clone(unsafe { &*self.contents.result })))
12924                         } }
12925                 } else {
12926                         Self { result_ok: false, contents: CResult_NetAddressDecodeErrorZPtr {
12927                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
12928                         } }
12929                 }
12930         }
12931 }
12932 #[no_mangle]
12933 /// Creates a new CResult_NetAddressDecodeErrorZ which has the same data as `orig`
12934 /// but with all dynamically-allocated buffers duplicated in new buffers.
12935 pub extern "C" fn CResult_NetAddressDecodeErrorZ_clone(orig: &CResult_NetAddressDecodeErrorZ) -> CResult_NetAddressDecodeErrorZ { Clone::clone(&orig) }
12936 #[repr(C)]
12937 /// A dynamically-allocated array of crate::lightning::ln::msgs::UpdateAddHTLCs of arbitrary size.
12938 /// This corresponds to std::vector in C++
12939 pub struct CVec_UpdateAddHTLCZ {
12940         /// The elements in the array.
12941         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
12942         pub data: *mut crate::lightning::ln::msgs::UpdateAddHTLC,
12943         /// The number of elements pointed to by `data`.
12944         pub datalen: usize
12945 }
12946 impl CVec_UpdateAddHTLCZ {
12947         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::UpdateAddHTLC> {
12948                 if self.datalen == 0 { return Vec::new(); }
12949                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
12950                 self.data = core::ptr::null_mut();
12951                 self.datalen = 0;
12952                 ret
12953         }
12954         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::UpdateAddHTLC] {
12955                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
12956         }
12957 }
12958 impl From<Vec<crate::lightning::ln::msgs::UpdateAddHTLC>> for CVec_UpdateAddHTLCZ {
12959         fn from(v: Vec<crate::lightning::ln::msgs::UpdateAddHTLC>) -> Self {
12960                 let datalen = v.len();
12961                 let data = Box::into_raw(v.into_boxed_slice());
12962                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
12963         }
12964 }
12965 #[no_mangle]
12966 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
12967 pub extern "C" fn CVec_UpdateAddHTLCZ_free(_res: CVec_UpdateAddHTLCZ) { }
12968 impl Drop for CVec_UpdateAddHTLCZ {
12969         fn drop(&mut self) {
12970                 if self.datalen == 0 { return; }
12971                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
12972         }
12973 }
12974 impl Clone for CVec_UpdateAddHTLCZ {
12975         fn clone(&self) -> Self {
12976                 let mut res = Vec::new();
12977                 if self.datalen == 0 { return Self::from(res); }
12978                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
12979                 Self::from(res)
12980         }
12981 }
12982 #[repr(C)]
12983 /// A dynamically-allocated array of crate::lightning::ln::msgs::UpdateFulfillHTLCs of arbitrary size.
12984 /// This corresponds to std::vector in C++
12985 pub struct CVec_UpdateFulfillHTLCZ {
12986         /// The elements in the array.
12987         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
12988         pub data: *mut crate::lightning::ln::msgs::UpdateFulfillHTLC,
12989         /// The number of elements pointed to by `data`.
12990         pub datalen: usize
12991 }
12992 impl CVec_UpdateFulfillHTLCZ {
12993         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::UpdateFulfillHTLC> {
12994                 if self.datalen == 0 { return Vec::new(); }
12995                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
12996                 self.data = core::ptr::null_mut();
12997                 self.datalen = 0;
12998                 ret
12999         }
13000         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::UpdateFulfillHTLC] {
13001                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
13002         }
13003 }
13004 impl From<Vec<crate::lightning::ln::msgs::UpdateFulfillHTLC>> for CVec_UpdateFulfillHTLCZ {
13005         fn from(v: Vec<crate::lightning::ln::msgs::UpdateFulfillHTLC>) -> Self {
13006                 let datalen = v.len();
13007                 let data = Box::into_raw(v.into_boxed_slice());
13008                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
13009         }
13010 }
13011 #[no_mangle]
13012 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
13013 pub extern "C" fn CVec_UpdateFulfillHTLCZ_free(_res: CVec_UpdateFulfillHTLCZ) { }
13014 impl Drop for CVec_UpdateFulfillHTLCZ {
13015         fn drop(&mut self) {
13016                 if self.datalen == 0 { return; }
13017                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
13018         }
13019 }
13020 impl Clone for CVec_UpdateFulfillHTLCZ {
13021         fn clone(&self) -> Self {
13022                 let mut res = Vec::new();
13023                 if self.datalen == 0 { return Self::from(res); }
13024                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
13025                 Self::from(res)
13026         }
13027 }
13028 #[repr(C)]
13029 /// A dynamically-allocated array of crate::lightning::ln::msgs::UpdateFailHTLCs of arbitrary size.
13030 /// This corresponds to std::vector in C++
13031 pub struct CVec_UpdateFailHTLCZ {
13032         /// The elements in the array.
13033         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
13034         pub data: *mut crate::lightning::ln::msgs::UpdateFailHTLC,
13035         /// The number of elements pointed to by `data`.
13036         pub datalen: usize
13037 }
13038 impl CVec_UpdateFailHTLCZ {
13039         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::UpdateFailHTLC> {
13040                 if self.datalen == 0 { return Vec::new(); }
13041                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
13042                 self.data = core::ptr::null_mut();
13043                 self.datalen = 0;
13044                 ret
13045         }
13046         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::UpdateFailHTLC] {
13047                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
13048         }
13049 }
13050 impl From<Vec<crate::lightning::ln::msgs::UpdateFailHTLC>> for CVec_UpdateFailHTLCZ {
13051         fn from(v: Vec<crate::lightning::ln::msgs::UpdateFailHTLC>) -> Self {
13052                 let datalen = v.len();
13053                 let data = Box::into_raw(v.into_boxed_slice());
13054                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
13055         }
13056 }
13057 #[no_mangle]
13058 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
13059 pub extern "C" fn CVec_UpdateFailHTLCZ_free(_res: CVec_UpdateFailHTLCZ) { }
13060 impl Drop for CVec_UpdateFailHTLCZ {
13061         fn drop(&mut self) {
13062                 if self.datalen == 0 { return; }
13063                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
13064         }
13065 }
13066 impl Clone for CVec_UpdateFailHTLCZ {
13067         fn clone(&self) -> Self {
13068                 let mut res = Vec::new();
13069                 if self.datalen == 0 { return Self::from(res); }
13070                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
13071                 Self::from(res)
13072         }
13073 }
13074 #[repr(C)]
13075 /// A dynamically-allocated array of crate::lightning::ln::msgs::UpdateFailMalformedHTLCs of arbitrary size.
13076 /// This corresponds to std::vector in C++
13077 pub struct CVec_UpdateFailMalformedHTLCZ {
13078         /// The elements in the array.
13079         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
13080         pub data: *mut crate::lightning::ln::msgs::UpdateFailMalformedHTLC,
13081         /// The number of elements pointed to by `data`.
13082         pub datalen: usize
13083 }
13084 impl CVec_UpdateFailMalformedHTLCZ {
13085         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::UpdateFailMalformedHTLC> {
13086                 if self.datalen == 0 { return Vec::new(); }
13087                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
13088                 self.data = core::ptr::null_mut();
13089                 self.datalen = 0;
13090                 ret
13091         }
13092         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::UpdateFailMalformedHTLC] {
13093                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
13094         }
13095 }
13096 impl From<Vec<crate::lightning::ln::msgs::UpdateFailMalformedHTLC>> for CVec_UpdateFailMalformedHTLCZ {
13097         fn from(v: Vec<crate::lightning::ln::msgs::UpdateFailMalformedHTLC>) -> Self {
13098                 let datalen = v.len();
13099                 let data = Box::into_raw(v.into_boxed_slice());
13100                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
13101         }
13102 }
13103 #[no_mangle]
13104 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
13105 pub extern "C" fn CVec_UpdateFailMalformedHTLCZ_free(_res: CVec_UpdateFailMalformedHTLCZ) { }
13106 impl Drop for CVec_UpdateFailMalformedHTLCZ {
13107         fn drop(&mut self) {
13108                 if self.datalen == 0 { return; }
13109                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
13110         }
13111 }
13112 impl Clone for CVec_UpdateFailMalformedHTLCZ {
13113         fn clone(&self) -> Self {
13114                 let mut res = Vec::new();
13115                 if self.datalen == 0 { return Self::from(res); }
13116                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
13117                 Self::from(res)
13118         }
13119 }
13120 #[repr(C)]
13121 /// The contents of CResult_AcceptChannelDecodeErrorZ
13122 pub union CResult_AcceptChannelDecodeErrorZPtr {
13123         /// A pointer to the contents in the success state.
13124         /// Reading from this pointer when `result_ok` is not set is undefined.
13125         pub result: *mut crate::lightning::ln::msgs::AcceptChannel,
13126         /// A pointer to the contents in the error state.
13127         /// Reading from this pointer when `result_ok` is set is undefined.
13128         pub err: *mut crate::lightning::ln::msgs::DecodeError,
13129 }
13130 #[repr(C)]
13131 /// A CResult_AcceptChannelDecodeErrorZ represents the result of a fallible operation,
13132 /// containing a crate::lightning::ln::msgs::AcceptChannel on success and a crate::lightning::ln::msgs::DecodeError on failure.
13133 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13134 pub struct CResult_AcceptChannelDecodeErrorZ {
13135         /// The contents of this CResult_AcceptChannelDecodeErrorZ, accessible via either
13136         /// `err` or `result` depending on the state of `result_ok`.
13137         pub contents: CResult_AcceptChannelDecodeErrorZPtr,
13138         /// Whether this CResult_AcceptChannelDecodeErrorZ represents a success state.
13139         pub result_ok: bool,
13140 }
13141 #[no_mangle]
13142 /// Creates a new CResult_AcceptChannelDecodeErrorZ in the success state.
13143 pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_ok(o: crate::lightning::ln::msgs::AcceptChannel) -> CResult_AcceptChannelDecodeErrorZ {
13144         CResult_AcceptChannelDecodeErrorZ {
13145                 contents: CResult_AcceptChannelDecodeErrorZPtr {
13146                         result: Box::into_raw(Box::new(o)),
13147                 },
13148                 result_ok: true,
13149         }
13150 }
13151 #[no_mangle]
13152 /// Creates a new CResult_AcceptChannelDecodeErrorZ in the error state.
13153 pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_AcceptChannelDecodeErrorZ {
13154         CResult_AcceptChannelDecodeErrorZ {
13155                 contents: CResult_AcceptChannelDecodeErrorZPtr {
13156                         err: Box::into_raw(Box::new(e)),
13157                 },
13158                 result_ok: false,
13159         }
13160 }
13161 /// Checks if the given object is currently in the success state
13162 #[no_mangle]
13163 pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_is_ok(o: &CResult_AcceptChannelDecodeErrorZ) -> bool {
13164         o.result_ok
13165 }
13166 #[no_mangle]
13167 /// Frees any resources used by the CResult_AcceptChannelDecodeErrorZ.
13168 pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_free(_res: CResult_AcceptChannelDecodeErrorZ) { }
13169 impl Drop for CResult_AcceptChannelDecodeErrorZ {
13170         fn drop(&mut self) {
13171                 if self.result_ok {
13172                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
13173                                 let _ = unsafe { Box::from_raw(self.contents.result) };
13174                         }
13175                 } else {
13176                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
13177                                 let _ = unsafe { Box::from_raw(self.contents.err) };
13178                         }
13179                 }
13180         }
13181 }
13182 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::AcceptChannel, crate::lightning::ln::msgs::DecodeError>> for CResult_AcceptChannelDecodeErrorZ {
13183         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::AcceptChannel, crate::lightning::ln::msgs::DecodeError>) -> Self {
13184                 let contents = if o.result_ok {
13185                         let result = unsafe { o.contents.result };
13186                         unsafe { o.contents.result = core::ptr::null_mut() };
13187                         CResult_AcceptChannelDecodeErrorZPtr { result }
13188                 } else {
13189                         let err = unsafe { o.contents.err };
13190                         unsafe { o.contents.err = core::ptr::null_mut(); }
13191                         CResult_AcceptChannelDecodeErrorZPtr { err }
13192                 };
13193                 Self {
13194                         contents,
13195                         result_ok: o.result_ok,
13196                 }
13197         }
13198 }
13199 impl Clone for CResult_AcceptChannelDecodeErrorZ {
13200         fn clone(&self) -> Self {
13201                 if self.result_ok {
13202                         Self { result_ok: true, contents: CResult_AcceptChannelDecodeErrorZPtr {
13203                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::AcceptChannel>::clone(unsafe { &*self.contents.result })))
13204                         } }
13205                 } else {
13206                         Self { result_ok: false, contents: CResult_AcceptChannelDecodeErrorZPtr {
13207                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13208                         } }
13209                 }
13210         }
13211 }
13212 #[no_mangle]
13213 /// Creates a new CResult_AcceptChannelDecodeErrorZ which has the same data as `orig`
13214 /// but with all dynamically-allocated buffers duplicated in new buffers.
13215 pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_clone(orig: &CResult_AcceptChannelDecodeErrorZ) -> CResult_AcceptChannelDecodeErrorZ { Clone::clone(&orig) }
13216 #[repr(C)]
13217 /// The contents of CResult_AnnouncementSignaturesDecodeErrorZ
13218 pub union CResult_AnnouncementSignaturesDecodeErrorZPtr {
13219         /// A pointer to the contents in the success state.
13220         /// Reading from this pointer when `result_ok` is not set is undefined.
13221         pub result: *mut crate::lightning::ln::msgs::AnnouncementSignatures,
13222         /// A pointer to the contents in the error state.
13223         /// Reading from this pointer when `result_ok` is set is undefined.
13224         pub err: *mut crate::lightning::ln::msgs::DecodeError,
13225 }
13226 #[repr(C)]
13227 /// A CResult_AnnouncementSignaturesDecodeErrorZ represents the result of a fallible operation,
13228 /// containing a crate::lightning::ln::msgs::AnnouncementSignatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
13229 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13230 pub struct CResult_AnnouncementSignaturesDecodeErrorZ {
13231         /// The contents of this CResult_AnnouncementSignaturesDecodeErrorZ, accessible via either
13232         /// `err` or `result` depending on the state of `result_ok`.
13233         pub contents: CResult_AnnouncementSignaturesDecodeErrorZPtr,
13234         /// Whether this CResult_AnnouncementSignaturesDecodeErrorZ represents a success state.
13235         pub result_ok: bool,
13236 }
13237 #[no_mangle]
13238 /// Creates a new CResult_AnnouncementSignaturesDecodeErrorZ in the success state.
13239 pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_ok(o: crate::lightning::ln::msgs::AnnouncementSignatures) -> CResult_AnnouncementSignaturesDecodeErrorZ {
13240         CResult_AnnouncementSignaturesDecodeErrorZ {
13241                 contents: CResult_AnnouncementSignaturesDecodeErrorZPtr {
13242                         result: Box::into_raw(Box::new(o)),
13243                 },
13244                 result_ok: true,
13245         }
13246 }
13247 #[no_mangle]
13248 /// Creates a new CResult_AnnouncementSignaturesDecodeErrorZ in the error state.
13249 pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_AnnouncementSignaturesDecodeErrorZ {
13250         CResult_AnnouncementSignaturesDecodeErrorZ {
13251                 contents: CResult_AnnouncementSignaturesDecodeErrorZPtr {
13252                         err: Box::into_raw(Box::new(e)),
13253                 },
13254                 result_ok: false,
13255         }
13256 }
13257 /// Checks if the given object is currently in the success state
13258 #[no_mangle]
13259 pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_is_ok(o: &CResult_AnnouncementSignaturesDecodeErrorZ) -> bool {
13260         o.result_ok
13261 }
13262 #[no_mangle]
13263 /// Frees any resources used by the CResult_AnnouncementSignaturesDecodeErrorZ.
13264 pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_free(_res: CResult_AnnouncementSignaturesDecodeErrorZ) { }
13265 impl Drop for CResult_AnnouncementSignaturesDecodeErrorZ {
13266         fn drop(&mut self) {
13267                 if self.result_ok {
13268                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
13269                                 let _ = unsafe { Box::from_raw(self.contents.result) };
13270                         }
13271                 } else {
13272                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
13273                                 let _ = unsafe { Box::from_raw(self.contents.err) };
13274                         }
13275                 }
13276         }
13277 }
13278 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::AnnouncementSignatures, crate::lightning::ln::msgs::DecodeError>> for CResult_AnnouncementSignaturesDecodeErrorZ {
13279         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::AnnouncementSignatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
13280                 let contents = if o.result_ok {
13281                         let result = unsafe { o.contents.result };
13282                         unsafe { o.contents.result = core::ptr::null_mut() };
13283                         CResult_AnnouncementSignaturesDecodeErrorZPtr { result }
13284                 } else {
13285                         let err = unsafe { o.contents.err };
13286                         unsafe { o.contents.err = core::ptr::null_mut(); }
13287                         CResult_AnnouncementSignaturesDecodeErrorZPtr { err }
13288                 };
13289                 Self {
13290                         contents,
13291                         result_ok: o.result_ok,
13292                 }
13293         }
13294 }
13295 impl Clone for CResult_AnnouncementSignaturesDecodeErrorZ {
13296         fn clone(&self) -> Self {
13297                 if self.result_ok {
13298                         Self { result_ok: true, contents: CResult_AnnouncementSignaturesDecodeErrorZPtr {
13299                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::AnnouncementSignatures>::clone(unsafe { &*self.contents.result })))
13300                         } }
13301                 } else {
13302                         Self { result_ok: false, contents: CResult_AnnouncementSignaturesDecodeErrorZPtr {
13303                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13304                         } }
13305                 }
13306         }
13307 }
13308 #[no_mangle]
13309 /// Creates a new CResult_AnnouncementSignaturesDecodeErrorZ which has the same data as `orig`
13310 /// but with all dynamically-allocated buffers duplicated in new buffers.
13311 pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_clone(orig: &CResult_AnnouncementSignaturesDecodeErrorZ) -> CResult_AnnouncementSignaturesDecodeErrorZ { Clone::clone(&orig) }
13312 #[repr(C)]
13313 /// The contents of CResult_ChannelReestablishDecodeErrorZ
13314 pub union CResult_ChannelReestablishDecodeErrorZPtr {
13315         /// A pointer to the contents in the success state.
13316         /// Reading from this pointer when `result_ok` is not set is undefined.
13317         pub result: *mut crate::lightning::ln::msgs::ChannelReestablish,
13318         /// A pointer to the contents in the error state.
13319         /// Reading from this pointer when `result_ok` is set is undefined.
13320         pub err: *mut crate::lightning::ln::msgs::DecodeError,
13321 }
13322 #[repr(C)]
13323 /// A CResult_ChannelReestablishDecodeErrorZ represents the result of a fallible operation,
13324 /// containing a crate::lightning::ln::msgs::ChannelReestablish on success and a crate::lightning::ln::msgs::DecodeError on failure.
13325 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13326 pub struct CResult_ChannelReestablishDecodeErrorZ {
13327         /// The contents of this CResult_ChannelReestablishDecodeErrorZ, accessible via either
13328         /// `err` or `result` depending on the state of `result_ok`.
13329         pub contents: CResult_ChannelReestablishDecodeErrorZPtr,
13330         /// Whether this CResult_ChannelReestablishDecodeErrorZ represents a success state.
13331         pub result_ok: bool,
13332 }
13333 #[no_mangle]
13334 /// Creates a new CResult_ChannelReestablishDecodeErrorZ in the success state.
13335 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ChannelReestablish) -> CResult_ChannelReestablishDecodeErrorZ {
13336         CResult_ChannelReestablishDecodeErrorZ {
13337                 contents: CResult_ChannelReestablishDecodeErrorZPtr {
13338                         result: Box::into_raw(Box::new(o)),
13339                 },
13340                 result_ok: true,
13341         }
13342 }
13343 #[no_mangle]
13344 /// Creates a new CResult_ChannelReestablishDecodeErrorZ in the error state.
13345 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelReestablishDecodeErrorZ {
13346         CResult_ChannelReestablishDecodeErrorZ {
13347                 contents: CResult_ChannelReestablishDecodeErrorZPtr {
13348                         err: Box::into_raw(Box::new(e)),
13349                 },
13350                 result_ok: false,
13351         }
13352 }
13353 /// Checks if the given object is currently in the success state
13354 #[no_mangle]
13355 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_is_ok(o: &CResult_ChannelReestablishDecodeErrorZ) -> bool {
13356         o.result_ok
13357 }
13358 #[no_mangle]
13359 /// Frees any resources used by the CResult_ChannelReestablishDecodeErrorZ.
13360 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_free(_res: CResult_ChannelReestablishDecodeErrorZ) { }
13361 impl Drop for CResult_ChannelReestablishDecodeErrorZ {
13362         fn drop(&mut self) {
13363                 if self.result_ok {
13364                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
13365                                 let _ = unsafe { Box::from_raw(self.contents.result) };
13366                         }
13367                 } else {
13368                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
13369                                 let _ = unsafe { Box::from_raw(self.contents.err) };
13370                         }
13371                 }
13372         }
13373 }
13374 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelReestablish, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelReestablishDecodeErrorZ {
13375         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelReestablish, crate::lightning::ln::msgs::DecodeError>) -> Self {
13376                 let contents = if o.result_ok {
13377                         let result = unsafe { o.contents.result };
13378                         unsafe { o.contents.result = core::ptr::null_mut() };
13379                         CResult_ChannelReestablishDecodeErrorZPtr { result }
13380                 } else {
13381                         let err = unsafe { o.contents.err };
13382                         unsafe { o.contents.err = core::ptr::null_mut(); }
13383                         CResult_ChannelReestablishDecodeErrorZPtr { err }
13384                 };
13385                 Self {
13386                         contents,
13387                         result_ok: o.result_ok,
13388                 }
13389         }
13390 }
13391 impl Clone for CResult_ChannelReestablishDecodeErrorZ {
13392         fn clone(&self) -> Self {
13393                 if self.result_ok {
13394                         Self { result_ok: true, contents: CResult_ChannelReestablishDecodeErrorZPtr {
13395                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ChannelReestablish>::clone(unsafe { &*self.contents.result })))
13396                         } }
13397                 } else {
13398                         Self { result_ok: false, contents: CResult_ChannelReestablishDecodeErrorZPtr {
13399                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13400                         } }
13401                 }
13402         }
13403 }
13404 #[no_mangle]
13405 /// Creates a new CResult_ChannelReestablishDecodeErrorZ which has the same data as `orig`
13406 /// but with all dynamically-allocated buffers duplicated in new buffers.
13407 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_clone(orig: &CResult_ChannelReestablishDecodeErrorZ) -> CResult_ChannelReestablishDecodeErrorZ { Clone::clone(&orig) }
13408 #[repr(C)]
13409 /// The contents of CResult_ClosingSignedDecodeErrorZ
13410 pub union CResult_ClosingSignedDecodeErrorZPtr {
13411         /// A pointer to the contents in the success state.
13412         /// Reading from this pointer when `result_ok` is not set is undefined.
13413         pub result: *mut crate::lightning::ln::msgs::ClosingSigned,
13414         /// A pointer to the contents in the error state.
13415         /// Reading from this pointer when `result_ok` is set is undefined.
13416         pub err: *mut crate::lightning::ln::msgs::DecodeError,
13417 }
13418 #[repr(C)]
13419 /// A CResult_ClosingSignedDecodeErrorZ represents the result of a fallible operation,
13420 /// containing a crate::lightning::ln::msgs::ClosingSigned on success and a crate::lightning::ln::msgs::DecodeError on failure.
13421 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13422 pub struct CResult_ClosingSignedDecodeErrorZ {
13423         /// The contents of this CResult_ClosingSignedDecodeErrorZ, accessible via either
13424         /// `err` or `result` depending on the state of `result_ok`.
13425         pub contents: CResult_ClosingSignedDecodeErrorZPtr,
13426         /// Whether this CResult_ClosingSignedDecodeErrorZ represents a success state.
13427         pub result_ok: bool,
13428 }
13429 #[no_mangle]
13430 /// Creates a new CResult_ClosingSignedDecodeErrorZ in the success state.
13431 pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ClosingSigned) -> CResult_ClosingSignedDecodeErrorZ {
13432         CResult_ClosingSignedDecodeErrorZ {
13433                 contents: CResult_ClosingSignedDecodeErrorZPtr {
13434                         result: Box::into_raw(Box::new(o)),
13435                 },
13436                 result_ok: true,
13437         }
13438 }
13439 #[no_mangle]
13440 /// Creates a new CResult_ClosingSignedDecodeErrorZ in the error state.
13441 pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ClosingSignedDecodeErrorZ {
13442         CResult_ClosingSignedDecodeErrorZ {
13443                 contents: CResult_ClosingSignedDecodeErrorZPtr {
13444                         err: Box::into_raw(Box::new(e)),
13445                 },
13446                 result_ok: false,
13447         }
13448 }
13449 /// Checks if the given object is currently in the success state
13450 #[no_mangle]
13451 pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_is_ok(o: &CResult_ClosingSignedDecodeErrorZ) -> bool {
13452         o.result_ok
13453 }
13454 #[no_mangle]
13455 /// Frees any resources used by the CResult_ClosingSignedDecodeErrorZ.
13456 pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_free(_res: CResult_ClosingSignedDecodeErrorZ) { }
13457 impl Drop for CResult_ClosingSignedDecodeErrorZ {
13458         fn drop(&mut self) {
13459                 if self.result_ok {
13460                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
13461                                 let _ = unsafe { Box::from_raw(self.contents.result) };
13462                         }
13463                 } else {
13464                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
13465                                 let _ = unsafe { Box::from_raw(self.contents.err) };
13466                         }
13467                 }
13468         }
13469 }
13470 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ClosingSigned, crate::lightning::ln::msgs::DecodeError>> for CResult_ClosingSignedDecodeErrorZ {
13471         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ClosingSigned, crate::lightning::ln::msgs::DecodeError>) -> Self {
13472                 let contents = if o.result_ok {
13473                         let result = unsafe { o.contents.result };
13474                         unsafe { o.contents.result = core::ptr::null_mut() };
13475                         CResult_ClosingSignedDecodeErrorZPtr { result }
13476                 } else {
13477                         let err = unsafe { o.contents.err };
13478                         unsafe { o.contents.err = core::ptr::null_mut(); }
13479                         CResult_ClosingSignedDecodeErrorZPtr { err }
13480                 };
13481                 Self {
13482                         contents,
13483                         result_ok: o.result_ok,
13484                 }
13485         }
13486 }
13487 impl Clone for CResult_ClosingSignedDecodeErrorZ {
13488         fn clone(&self) -> Self {
13489                 if self.result_ok {
13490                         Self { result_ok: true, contents: CResult_ClosingSignedDecodeErrorZPtr {
13491                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ClosingSigned>::clone(unsafe { &*self.contents.result })))
13492                         } }
13493                 } else {
13494                         Self { result_ok: false, contents: CResult_ClosingSignedDecodeErrorZPtr {
13495                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13496                         } }
13497                 }
13498         }
13499 }
13500 #[no_mangle]
13501 /// Creates a new CResult_ClosingSignedDecodeErrorZ which has the same data as `orig`
13502 /// but with all dynamically-allocated buffers duplicated in new buffers.
13503 pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_clone(orig: &CResult_ClosingSignedDecodeErrorZ) -> CResult_ClosingSignedDecodeErrorZ { Clone::clone(&orig) }
13504 #[repr(C)]
13505 /// The contents of CResult_ClosingSignedFeeRangeDecodeErrorZ
13506 pub union CResult_ClosingSignedFeeRangeDecodeErrorZPtr {
13507         /// A pointer to the contents in the success state.
13508         /// Reading from this pointer when `result_ok` is not set is undefined.
13509         pub result: *mut crate::lightning::ln::msgs::ClosingSignedFeeRange,
13510         /// A pointer to the contents in the error state.
13511         /// Reading from this pointer when `result_ok` is set is undefined.
13512         pub err: *mut crate::lightning::ln::msgs::DecodeError,
13513 }
13514 #[repr(C)]
13515 /// A CResult_ClosingSignedFeeRangeDecodeErrorZ represents the result of a fallible operation,
13516 /// containing a crate::lightning::ln::msgs::ClosingSignedFeeRange on success and a crate::lightning::ln::msgs::DecodeError on failure.
13517 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13518 pub struct CResult_ClosingSignedFeeRangeDecodeErrorZ {
13519         /// The contents of this CResult_ClosingSignedFeeRangeDecodeErrorZ, accessible via either
13520         /// `err` or `result` depending on the state of `result_ok`.
13521         pub contents: CResult_ClosingSignedFeeRangeDecodeErrorZPtr,
13522         /// Whether this CResult_ClosingSignedFeeRangeDecodeErrorZ represents a success state.
13523         pub result_ok: bool,
13524 }
13525 #[no_mangle]
13526 /// Creates a new CResult_ClosingSignedFeeRangeDecodeErrorZ in the success state.
13527 pub extern "C" fn CResult_ClosingSignedFeeRangeDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ClosingSignedFeeRange) -> CResult_ClosingSignedFeeRangeDecodeErrorZ {
13528         CResult_ClosingSignedFeeRangeDecodeErrorZ {
13529                 contents: CResult_ClosingSignedFeeRangeDecodeErrorZPtr {
13530                         result: Box::into_raw(Box::new(o)),
13531                 },
13532                 result_ok: true,
13533         }
13534 }
13535 #[no_mangle]
13536 /// Creates a new CResult_ClosingSignedFeeRangeDecodeErrorZ in the error state.
13537 pub extern "C" fn CResult_ClosingSignedFeeRangeDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ClosingSignedFeeRangeDecodeErrorZ {
13538         CResult_ClosingSignedFeeRangeDecodeErrorZ {
13539                 contents: CResult_ClosingSignedFeeRangeDecodeErrorZPtr {
13540                         err: Box::into_raw(Box::new(e)),
13541                 },
13542                 result_ok: false,
13543         }
13544 }
13545 /// Checks if the given object is currently in the success state
13546 #[no_mangle]
13547 pub extern "C" fn CResult_ClosingSignedFeeRangeDecodeErrorZ_is_ok(o: &CResult_ClosingSignedFeeRangeDecodeErrorZ) -> bool {
13548         o.result_ok
13549 }
13550 #[no_mangle]
13551 /// Frees any resources used by the CResult_ClosingSignedFeeRangeDecodeErrorZ.
13552 pub extern "C" fn CResult_ClosingSignedFeeRangeDecodeErrorZ_free(_res: CResult_ClosingSignedFeeRangeDecodeErrorZ) { }
13553 impl Drop for CResult_ClosingSignedFeeRangeDecodeErrorZ {
13554         fn drop(&mut self) {
13555                 if self.result_ok {
13556                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
13557                                 let _ = unsafe { Box::from_raw(self.contents.result) };
13558                         }
13559                 } else {
13560                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
13561                                 let _ = unsafe { Box::from_raw(self.contents.err) };
13562                         }
13563                 }
13564         }
13565 }
13566 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ClosingSignedFeeRange, crate::lightning::ln::msgs::DecodeError>> for CResult_ClosingSignedFeeRangeDecodeErrorZ {
13567         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ClosingSignedFeeRange, crate::lightning::ln::msgs::DecodeError>) -> Self {
13568                 let contents = if o.result_ok {
13569                         let result = unsafe { o.contents.result };
13570                         unsafe { o.contents.result = core::ptr::null_mut() };
13571                         CResult_ClosingSignedFeeRangeDecodeErrorZPtr { result }
13572                 } else {
13573                         let err = unsafe { o.contents.err };
13574                         unsafe { o.contents.err = core::ptr::null_mut(); }
13575                         CResult_ClosingSignedFeeRangeDecodeErrorZPtr { err }
13576                 };
13577                 Self {
13578                         contents,
13579                         result_ok: o.result_ok,
13580                 }
13581         }
13582 }
13583 impl Clone for CResult_ClosingSignedFeeRangeDecodeErrorZ {
13584         fn clone(&self) -> Self {
13585                 if self.result_ok {
13586                         Self { result_ok: true, contents: CResult_ClosingSignedFeeRangeDecodeErrorZPtr {
13587                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ClosingSignedFeeRange>::clone(unsafe { &*self.contents.result })))
13588                         } }
13589                 } else {
13590                         Self { result_ok: false, contents: CResult_ClosingSignedFeeRangeDecodeErrorZPtr {
13591                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13592                         } }
13593                 }
13594         }
13595 }
13596 #[no_mangle]
13597 /// Creates a new CResult_ClosingSignedFeeRangeDecodeErrorZ which has the same data as `orig`
13598 /// but with all dynamically-allocated buffers duplicated in new buffers.
13599 pub extern "C" fn CResult_ClosingSignedFeeRangeDecodeErrorZ_clone(orig: &CResult_ClosingSignedFeeRangeDecodeErrorZ) -> CResult_ClosingSignedFeeRangeDecodeErrorZ { Clone::clone(&orig) }
13600 #[repr(C)]
13601 /// The contents of CResult_CommitmentSignedDecodeErrorZ
13602 pub union CResult_CommitmentSignedDecodeErrorZPtr {
13603         /// A pointer to the contents in the success state.
13604         /// Reading from this pointer when `result_ok` is not set is undefined.
13605         pub result: *mut crate::lightning::ln::msgs::CommitmentSigned,
13606         /// A pointer to the contents in the error state.
13607         /// Reading from this pointer when `result_ok` is set is undefined.
13608         pub err: *mut crate::lightning::ln::msgs::DecodeError,
13609 }
13610 #[repr(C)]
13611 /// A CResult_CommitmentSignedDecodeErrorZ represents the result of a fallible operation,
13612 /// containing a crate::lightning::ln::msgs::CommitmentSigned on success and a crate::lightning::ln::msgs::DecodeError on failure.
13613 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13614 pub struct CResult_CommitmentSignedDecodeErrorZ {
13615         /// The contents of this CResult_CommitmentSignedDecodeErrorZ, accessible via either
13616         /// `err` or `result` depending on the state of `result_ok`.
13617         pub contents: CResult_CommitmentSignedDecodeErrorZPtr,
13618         /// Whether this CResult_CommitmentSignedDecodeErrorZ represents a success state.
13619         pub result_ok: bool,
13620 }
13621 #[no_mangle]
13622 /// Creates a new CResult_CommitmentSignedDecodeErrorZ in the success state.
13623 pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_ok(o: crate::lightning::ln::msgs::CommitmentSigned) -> CResult_CommitmentSignedDecodeErrorZ {
13624         CResult_CommitmentSignedDecodeErrorZ {
13625                 contents: CResult_CommitmentSignedDecodeErrorZPtr {
13626                         result: Box::into_raw(Box::new(o)),
13627                 },
13628                 result_ok: true,
13629         }
13630 }
13631 #[no_mangle]
13632 /// Creates a new CResult_CommitmentSignedDecodeErrorZ in the error state.
13633 pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_CommitmentSignedDecodeErrorZ {
13634         CResult_CommitmentSignedDecodeErrorZ {
13635                 contents: CResult_CommitmentSignedDecodeErrorZPtr {
13636                         err: Box::into_raw(Box::new(e)),
13637                 },
13638                 result_ok: false,
13639         }
13640 }
13641 /// Checks if the given object is currently in the success state
13642 #[no_mangle]
13643 pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_is_ok(o: &CResult_CommitmentSignedDecodeErrorZ) -> bool {
13644         o.result_ok
13645 }
13646 #[no_mangle]
13647 /// Frees any resources used by the CResult_CommitmentSignedDecodeErrorZ.
13648 pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_free(_res: CResult_CommitmentSignedDecodeErrorZ) { }
13649 impl Drop for CResult_CommitmentSignedDecodeErrorZ {
13650         fn drop(&mut self) {
13651                 if self.result_ok {
13652                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
13653                                 let _ = unsafe { Box::from_raw(self.contents.result) };
13654                         }
13655                 } else {
13656                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
13657                                 let _ = unsafe { Box::from_raw(self.contents.err) };
13658                         }
13659                 }
13660         }
13661 }
13662 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::CommitmentSigned, crate::lightning::ln::msgs::DecodeError>> for CResult_CommitmentSignedDecodeErrorZ {
13663         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::CommitmentSigned, crate::lightning::ln::msgs::DecodeError>) -> Self {
13664                 let contents = if o.result_ok {
13665                         let result = unsafe { o.contents.result };
13666                         unsafe { o.contents.result = core::ptr::null_mut() };
13667                         CResult_CommitmentSignedDecodeErrorZPtr { result }
13668                 } else {
13669                         let err = unsafe { o.contents.err };
13670                         unsafe { o.contents.err = core::ptr::null_mut(); }
13671                         CResult_CommitmentSignedDecodeErrorZPtr { err }
13672                 };
13673                 Self {
13674                         contents,
13675                         result_ok: o.result_ok,
13676                 }
13677         }
13678 }
13679 impl Clone for CResult_CommitmentSignedDecodeErrorZ {
13680         fn clone(&self) -> Self {
13681                 if self.result_ok {
13682                         Self { result_ok: true, contents: CResult_CommitmentSignedDecodeErrorZPtr {
13683                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::CommitmentSigned>::clone(unsafe { &*self.contents.result })))
13684                         } }
13685                 } else {
13686                         Self { result_ok: false, contents: CResult_CommitmentSignedDecodeErrorZPtr {
13687                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13688                         } }
13689                 }
13690         }
13691 }
13692 #[no_mangle]
13693 /// Creates a new CResult_CommitmentSignedDecodeErrorZ which has the same data as `orig`
13694 /// but with all dynamically-allocated buffers duplicated in new buffers.
13695 pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_clone(orig: &CResult_CommitmentSignedDecodeErrorZ) -> CResult_CommitmentSignedDecodeErrorZ { Clone::clone(&orig) }
13696 #[repr(C)]
13697 /// The contents of CResult_FundingCreatedDecodeErrorZ
13698 pub union CResult_FundingCreatedDecodeErrorZPtr {
13699         /// A pointer to the contents in the success state.
13700         /// Reading from this pointer when `result_ok` is not set is undefined.
13701         pub result: *mut crate::lightning::ln::msgs::FundingCreated,
13702         /// A pointer to the contents in the error state.
13703         /// Reading from this pointer when `result_ok` is set is undefined.
13704         pub err: *mut crate::lightning::ln::msgs::DecodeError,
13705 }
13706 #[repr(C)]
13707 /// A CResult_FundingCreatedDecodeErrorZ represents the result of a fallible operation,
13708 /// containing a crate::lightning::ln::msgs::FundingCreated on success and a crate::lightning::ln::msgs::DecodeError on failure.
13709 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13710 pub struct CResult_FundingCreatedDecodeErrorZ {
13711         /// The contents of this CResult_FundingCreatedDecodeErrorZ, accessible via either
13712         /// `err` or `result` depending on the state of `result_ok`.
13713         pub contents: CResult_FundingCreatedDecodeErrorZPtr,
13714         /// Whether this CResult_FundingCreatedDecodeErrorZ represents a success state.
13715         pub result_ok: bool,
13716 }
13717 #[no_mangle]
13718 /// Creates a new CResult_FundingCreatedDecodeErrorZ in the success state.
13719 pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_ok(o: crate::lightning::ln::msgs::FundingCreated) -> CResult_FundingCreatedDecodeErrorZ {
13720         CResult_FundingCreatedDecodeErrorZ {
13721                 contents: CResult_FundingCreatedDecodeErrorZPtr {
13722                         result: Box::into_raw(Box::new(o)),
13723                 },
13724                 result_ok: true,
13725         }
13726 }
13727 #[no_mangle]
13728 /// Creates a new CResult_FundingCreatedDecodeErrorZ in the error state.
13729 pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_FundingCreatedDecodeErrorZ {
13730         CResult_FundingCreatedDecodeErrorZ {
13731                 contents: CResult_FundingCreatedDecodeErrorZPtr {
13732                         err: Box::into_raw(Box::new(e)),
13733                 },
13734                 result_ok: false,
13735         }
13736 }
13737 /// Checks if the given object is currently in the success state
13738 #[no_mangle]
13739 pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_is_ok(o: &CResult_FundingCreatedDecodeErrorZ) -> bool {
13740         o.result_ok
13741 }
13742 #[no_mangle]
13743 /// Frees any resources used by the CResult_FundingCreatedDecodeErrorZ.
13744 pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_free(_res: CResult_FundingCreatedDecodeErrorZ) { }
13745 impl Drop for CResult_FundingCreatedDecodeErrorZ {
13746         fn drop(&mut self) {
13747                 if self.result_ok {
13748                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
13749                                 let _ = unsafe { Box::from_raw(self.contents.result) };
13750                         }
13751                 } else {
13752                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
13753                                 let _ = unsafe { Box::from_raw(self.contents.err) };
13754                         }
13755                 }
13756         }
13757 }
13758 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::FundingCreated, crate::lightning::ln::msgs::DecodeError>> for CResult_FundingCreatedDecodeErrorZ {
13759         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::FundingCreated, crate::lightning::ln::msgs::DecodeError>) -> Self {
13760                 let contents = if o.result_ok {
13761                         let result = unsafe { o.contents.result };
13762                         unsafe { o.contents.result = core::ptr::null_mut() };
13763                         CResult_FundingCreatedDecodeErrorZPtr { result }
13764                 } else {
13765                         let err = unsafe { o.contents.err };
13766                         unsafe { o.contents.err = core::ptr::null_mut(); }
13767                         CResult_FundingCreatedDecodeErrorZPtr { err }
13768                 };
13769                 Self {
13770                         contents,
13771                         result_ok: o.result_ok,
13772                 }
13773         }
13774 }
13775 impl Clone for CResult_FundingCreatedDecodeErrorZ {
13776         fn clone(&self) -> Self {
13777                 if self.result_ok {
13778                         Self { result_ok: true, contents: CResult_FundingCreatedDecodeErrorZPtr {
13779                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::FundingCreated>::clone(unsafe { &*self.contents.result })))
13780                         } }
13781                 } else {
13782                         Self { result_ok: false, contents: CResult_FundingCreatedDecodeErrorZPtr {
13783                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13784                         } }
13785                 }
13786         }
13787 }
13788 #[no_mangle]
13789 /// Creates a new CResult_FundingCreatedDecodeErrorZ which has the same data as `orig`
13790 /// but with all dynamically-allocated buffers duplicated in new buffers.
13791 pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_clone(orig: &CResult_FundingCreatedDecodeErrorZ) -> CResult_FundingCreatedDecodeErrorZ { Clone::clone(&orig) }
13792 #[repr(C)]
13793 /// The contents of CResult_FundingSignedDecodeErrorZ
13794 pub union CResult_FundingSignedDecodeErrorZPtr {
13795         /// A pointer to the contents in the success state.
13796         /// Reading from this pointer when `result_ok` is not set is undefined.
13797         pub result: *mut crate::lightning::ln::msgs::FundingSigned,
13798         /// A pointer to the contents in the error state.
13799         /// Reading from this pointer when `result_ok` is set is undefined.
13800         pub err: *mut crate::lightning::ln::msgs::DecodeError,
13801 }
13802 #[repr(C)]
13803 /// A CResult_FundingSignedDecodeErrorZ represents the result of a fallible operation,
13804 /// containing a crate::lightning::ln::msgs::FundingSigned on success and a crate::lightning::ln::msgs::DecodeError on failure.
13805 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13806 pub struct CResult_FundingSignedDecodeErrorZ {
13807         /// The contents of this CResult_FundingSignedDecodeErrorZ, accessible via either
13808         /// `err` or `result` depending on the state of `result_ok`.
13809         pub contents: CResult_FundingSignedDecodeErrorZPtr,
13810         /// Whether this CResult_FundingSignedDecodeErrorZ represents a success state.
13811         pub result_ok: bool,
13812 }
13813 #[no_mangle]
13814 /// Creates a new CResult_FundingSignedDecodeErrorZ in the success state.
13815 pub extern "C" fn CResult_FundingSignedDecodeErrorZ_ok(o: crate::lightning::ln::msgs::FundingSigned) -> CResult_FundingSignedDecodeErrorZ {
13816         CResult_FundingSignedDecodeErrorZ {
13817                 contents: CResult_FundingSignedDecodeErrorZPtr {
13818                         result: Box::into_raw(Box::new(o)),
13819                 },
13820                 result_ok: true,
13821         }
13822 }
13823 #[no_mangle]
13824 /// Creates a new CResult_FundingSignedDecodeErrorZ in the error state.
13825 pub extern "C" fn CResult_FundingSignedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_FundingSignedDecodeErrorZ {
13826         CResult_FundingSignedDecodeErrorZ {
13827                 contents: CResult_FundingSignedDecodeErrorZPtr {
13828                         err: Box::into_raw(Box::new(e)),
13829                 },
13830                 result_ok: false,
13831         }
13832 }
13833 /// Checks if the given object is currently in the success state
13834 #[no_mangle]
13835 pub extern "C" fn CResult_FundingSignedDecodeErrorZ_is_ok(o: &CResult_FundingSignedDecodeErrorZ) -> bool {
13836         o.result_ok
13837 }
13838 #[no_mangle]
13839 /// Frees any resources used by the CResult_FundingSignedDecodeErrorZ.
13840 pub extern "C" fn CResult_FundingSignedDecodeErrorZ_free(_res: CResult_FundingSignedDecodeErrorZ) { }
13841 impl Drop for CResult_FundingSignedDecodeErrorZ {
13842         fn drop(&mut self) {
13843                 if self.result_ok {
13844                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
13845                                 let _ = unsafe { Box::from_raw(self.contents.result) };
13846                         }
13847                 } else {
13848                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
13849                                 let _ = unsafe { Box::from_raw(self.contents.err) };
13850                         }
13851                 }
13852         }
13853 }
13854 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::FundingSigned, crate::lightning::ln::msgs::DecodeError>> for CResult_FundingSignedDecodeErrorZ {
13855         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::FundingSigned, crate::lightning::ln::msgs::DecodeError>) -> Self {
13856                 let contents = if o.result_ok {
13857                         let result = unsafe { o.contents.result };
13858                         unsafe { o.contents.result = core::ptr::null_mut() };
13859                         CResult_FundingSignedDecodeErrorZPtr { result }
13860                 } else {
13861                         let err = unsafe { o.contents.err };
13862                         unsafe { o.contents.err = core::ptr::null_mut(); }
13863                         CResult_FundingSignedDecodeErrorZPtr { err }
13864                 };
13865                 Self {
13866                         contents,
13867                         result_ok: o.result_ok,
13868                 }
13869         }
13870 }
13871 impl Clone for CResult_FundingSignedDecodeErrorZ {
13872         fn clone(&self) -> Self {
13873                 if self.result_ok {
13874                         Self { result_ok: true, contents: CResult_FundingSignedDecodeErrorZPtr {
13875                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::FundingSigned>::clone(unsafe { &*self.contents.result })))
13876                         } }
13877                 } else {
13878                         Self { result_ok: false, contents: CResult_FundingSignedDecodeErrorZPtr {
13879                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13880                         } }
13881                 }
13882         }
13883 }
13884 #[no_mangle]
13885 /// Creates a new CResult_FundingSignedDecodeErrorZ which has the same data as `orig`
13886 /// but with all dynamically-allocated buffers duplicated in new buffers.
13887 pub extern "C" fn CResult_FundingSignedDecodeErrorZ_clone(orig: &CResult_FundingSignedDecodeErrorZ) -> CResult_FundingSignedDecodeErrorZ { Clone::clone(&orig) }
13888 #[repr(C)]
13889 /// The contents of CResult_ChannelReadyDecodeErrorZ
13890 pub union CResult_ChannelReadyDecodeErrorZPtr {
13891         /// A pointer to the contents in the success state.
13892         /// Reading from this pointer when `result_ok` is not set is undefined.
13893         pub result: *mut crate::lightning::ln::msgs::ChannelReady,
13894         /// A pointer to the contents in the error state.
13895         /// Reading from this pointer when `result_ok` is set is undefined.
13896         pub err: *mut crate::lightning::ln::msgs::DecodeError,
13897 }
13898 #[repr(C)]
13899 /// A CResult_ChannelReadyDecodeErrorZ represents the result of a fallible operation,
13900 /// containing a crate::lightning::ln::msgs::ChannelReady on success and a crate::lightning::ln::msgs::DecodeError on failure.
13901 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13902 pub struct CResult_ChannelReadyDecodeErrorZ {
13903         /// The contents of this CResult_ChannelReadyDecodeErrorZ, accessible via either
13904         /// `err` or `result` depending on the state of `result_ok`.
13905         pub contents: CResult_ChannelReadyDecodeErrorZPtr,
13906         /// Whether this CResult_ChannelReadyDecodeErrorZ represents a success state.
13907         pub result_ok: bool,
13908 }
13909 #[no_mangle]
13910 /// Creates a new CResult_ChannelReadyDecodeErrorZ in the success state.
13911 pub extern "C" fn CResult_ChannelReadyDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ChannelReady) -> CResult_ChannelReadyDecodeErrorZ {
13912         CResult_ChannelReadyDecodeErrorZ {
13913                 contents: CResult_ChannelReadyDecodeErrorZPtr {
13914                         result: Box::into_raw(Box::new(o)),
13915                 },
13916                 result_ok: true,
13917         }
13918 }
13919 #[no_mangle]
13920 /// Creates a new CResult_ChannelReadyDecodeErrorZ in the error state.
13921 pub extern "C" fn CResult_ChannelReadyDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelReadyDecodeErrorZ {
13922         CResult_ChannelReadyDecodeErrorZ {
13923                 contents: CResult_ChannelReadyDecodeErrorZPtr {
13924                         err: Box::into_raw(Box::new(e)),
13925                 },
13926                 result_ok: false,
13927         }
13928 }
13929 /// Checks if the given object is currently in the success state
13930 #[no_mangle]
13931 pub extern "C" fn CResult_ChannelReadyDecodeErrorZ_is_ok(o: &CResult_ChannelReadyDecodeErrorZ) -> bool {
13932         o.result_ok
13933 }
13934 #[no_mangle]
13935 /// Frees any resources used by the CResult_ChannelReadyDecodeErrorZ.
13936 pub extern "C" fn CResult_ChannelReadyDecodeErrorZ_free(_res: CResult_ChannelReadyDecodeErrorZ) { }
13937 impl Drop for CResult_ChannelReadyDecodeErrorZ {
13938         fn drop(&mut self) {
13939                 if self.result_ok {
13940                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
13941                                 let _ = unsafe { Box::from_raw(self.contents.result) };
13942                         }
13943                 } else {
13944                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
13945                                 let _ = unsafe { Box::from_raw(self.contents.err) };
13946                         }
13947                 }
13948         }
13949 }
13950 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelReady, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelReadyDecodeErrorZ {
13951         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelReady, crate::lightning::ln::msgs::DecodeError>) -> Self {
13952                 let contents = if o.result_ok {
13953                         let result = unsafe { o.contents.result };
13954                         unsafe { o.contents.result = core::ptr::null_mut() };
13955                         CResult_ChannelReadyDecodeErrorZPtr { result }
13956                 } else {
13957                         let err = unsafe { o.contents.err };
13958                         unsafe { o.contents.err = core::ptr::null_mut(); }
13959                         CResult_ChannelReadyDecodeErrorZPtr { err }
13960                 };
13961                 Self {
13962                         contents,
13963                         result_ok: o.result_ok,
13964                 }
13965         }
13966 }
13967 impl Clone for CResult_ChannelReadyDecodeErrorZ {
13968         fn clone(&self) -> Self {
13969                 if self.result_ok {
13970                         Self { result_ok: true, contents: CResult_ChannelReadyDecodeErrorZPtr {
13971                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ChannelReady>::clone(unsafe { &*self.contents.result })))
13972                         } }
13973                 } else {
13974                         Self { result_ok: false, contents: CResult_ChannelReadyDecodeErrorZPtr {
13975                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13976                         } }
13977                 }
13978         }
13979 }
13980 #[no_mangle]
13981 /// Creates a new CResult_ChannelReadyDecodeErrorZ which has the same data as `orig`
13982 /// but with all dynamically-allocated buffers duplicated in new buffers.
13983 pub extern "C" fn CResult_ChannelReadyDecodeErrorZ_clone(orig: &CResult_ChannelReadyDecodeErrorZ) -> CResult_ChannelReadyDecodeErrorZ { Clone::clone(&orig) }
13984 #[repr(C)]
13985 /// The contents of CResult_InitDecodeErrorZ
13986 pub union CResult_InitDecodeErrorZPtr {
13987         /// A pointer to the contents in the success state.
13988         /// Reading from this pointer when `result_ok` is not set is undefined.
13989         pub result: *mut crate::lightning::ln::msgs::Init,
13990         /// A pointer to the contents in the error state.
13991         /// Reading from this pointer when `result_ok` is set is undefined.
13992         pub err: *mut crate::lightning::ln::msgs::DecodeError,
13993 }
13994 #[repr(C)]
13995 /// A CResult_InitDecodeErrorZ represents the result of a fallible operation,
13996 /// containing a crate::lightning::ln::msgs::Init on success and a crate::lightning::ln::msgs::DecodeError on failure.
13997 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13998 pub struct CResult_InitDecodeErrorZ {
13999         /// The contents of this CResult_InitDecodeErrorZ, accessible via either
14000         /// `err` or `result` depending on the state of `result_ok`.
14001         pub contents: CResult_InitDecodeErrorZPtr,
14002         /// Whether this CResult_InitDecodeErrorZ represents a success state.
14003         pub result_ok: bool,
14004 }
14005 #[no_mangle]
14006 /// Creates a new CResult_InitDecodeErrorZ in the success state.
14007 pub extern "C" fn CResult_InitDecodeErrorZ_ok(o: crate::lightning::ln::msgs::Init) -> CResult_InitDecodeErrorZ {
14008         CResult_InitDecodeErrorZ {
14009                 contents: CResult_InitDecodeErrorZPtr {
14010                         result: Box::into_raw(Box::new(o)),
14011                 },
14012                 result_ok: true,
14013         }
14014 }
14015 #[no_mangle]
14016 /// Creates a new CResult_InitDecodeErrorZ in the error state.
14017 pub extern "C" fn CResult_InitDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_InitDecodeErrorZ {
14018         CResult_InitDecodeErrorZ {
14019                 contents: CResult_InitDecodeErrorZPtr {
14020                         err: Box::into_raw(Box::new(e)),
14021                 },
14022                 result_ok: false,
14023         }
14024 }
14025 /// Checks if the given object is currently in the success state
14026 #[no_mangle]
14027 pub extern "C" fn CResult_InitDecodeErrorZ_is_ok(o: &CResult_InitDecodeErrorZ) -> bool {
14028         o.result_ok
14029 }
14030 #[no_mangle]
14031 /// Frees any resources used by the CResult_InitDecodeErrorZ.
14032 pub extern "C" fn CResult_InitDecodeErrorZ_free(_res: CResult_InitDecodeErrorZ) { }
14033 impl Drop for CResult_InitDecodeErrorZ {
14034         fn drop(&mut self) {
14035                 if self.result_ok {
14036                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
14037                                 let _ = unsafe { Box::from_raw(self.contents.result) };
14038                         }
14039                 } else {
14040                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
14041                                 let _ = unsafe { Box::from_raw(self.contents.err) };
14042                         }
14043                 }
14044         }
14045 }
14046 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::Init, crate::lightning::ln::msgs::DecodeError>> for CResult_InitDecodeErrorZ {
14047         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::Init, crate::lightning::ln::msgs::DecodeError>) -> Self {
14048                 let contents = if o.result_ok {
14049                         let result = unsafe { o.contents.result };
14050                         unsafe { o.contents.result = core::ptr::null_mut() };
14051                         CResult_InitDecodeErrorZPtr { result }
14052                 } else {
14053                         let err = unsafe { o.contents.err };
14054                         unsafe { o.contents.err = core::ptr::null_mut(); }
14055                         CResult_InitDecodeErrorZPtr { err }
14056                 };
14057                 Self {
14058                         contents,
14059                         result_ok: o.result_ok,
14060                 }
14061         }
14062 }
14063 impl Clone for CResult_InitDecodeErrorZ {
14064         fn clone(&self) -> Self {
14065                 if self.result_ok {
14066                         Self { result_ok: true, contents: CResult_InitDecodeErrorZPtr {
14067                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::Init>::clone(unsafe { &*self.contents.result })))
14068                         } }
14069                 } else {
14070                         Self { result_ok: false, contents: CResult_InitDecodeErrorZPtr {
14071                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14072                         } }
14073                 }
14074         }
14075 }
14076 #[no_mangle]
14077 /// Creates a new CResult_InitDecodeErrorZ which has the same data as `orig`
14078 /// but with all dynamically-allocated buffers duplicated in new buffers.
14079 pub extern "C" fn CResult_InitDecodeErrorZ_clone(orig: &CResult_InitDecodeErrorZ) -> CResult_InitDecodeErrorZ { Clone::clone(&orig) }
14080 #[repr(C)]
14081 /// The contents of CResult_OpenChannelDecodeErrorZ
14082 pub union CResult_OpenChannelDecodeErrorZPtr {
14083         /// A pointer to the contents in the success state.
14084         /// Reading from this pointer when `result_ok` is not set is undefined.
14085         pub result: *mut crate::lightning::ln::msgs::OpenChannel,
14086         /// A pointer to the contents in the error state.
14087         /// Reading from this pointer when `result_ok` is set is undefined.
14088         pub err: *mut crate::lightning::ln::msgs::DecodeError,
14089 }
14090 #[repr(C)]
14091 /// A CResult_OpenChannelDecodeErrorZ represents the result of a fallible operation,
14092 /// containing a crate::lightning::ln::msgs::OpenChannel on success and a crate::lightning::ln::msgs::DecodeError on failure.
14093 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14094 pub struct CResult_OpenChannelDecodeErrorZ {
14095         /// The contents of this CResult_OpenChannelDecodeErrorZ, accessible via either
14096         /// `err` or `result` depending on the state of `result_ok`.
14097         pub contents: CResult_OpenChannelDecodeErrorZPtr,
14098         /// Whether this CResult_OpenChannelDecodeErrorZ represents a success state.
14099         pub result_ok: bool,
14100 }
14101 #[no_mangle]
14102 /// Creates a new CResult_OpenChannelDecodeErrorZ in the success state.
14103 pub extern "C" fn CResult_OpenChannelDecodeErrorZ_ok(o: crate::lightning::ln::msgs::OpenChannel) -> CResult_OpenChannelDecodeErrorZ {
14104         CResult_OpenChannelDecodeErrorZ {
14105                 contents: CResult_OpenChannelDecodeErrorZPtr {
14106                         result: Box::into_raw(Box::new(o)),
14107                 },
14108                 result_ok: true,
14109         }
14110 }
14111 #[no_mangle]
14112 /// Creates a new CResult_OpenChannelDecodeErrorZ in the error state.
14113 pub extern "C" fn CResult_OpenChannelDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_OpenChannelDecodeErrorZ {
14114         CResult_OpenChannelDecodeErrorZ {
14115                 contents: CResult_OpenChannelDecodeErrorZPtr {
14116                         err: Box::into_raw(Box::new(e)),
14117                 },
14118                 result_ok: false,
14119         }
14120 }
14121 /// Checks if the given object is currently in the success state
14122 #[no_mangle]
14123 pub extern "C" fn CResult_OpenChannelDecodeErrorZ_is_ok(o: &CResult_OpenChannelDecodeErrorZ) -> bool {
14124         o.result_ok
14125 }
14126 #[no_mangle]
14127 /// Frees any resources used by the CResult_OpenChannelDecodeErrorZ.
14128 pub extern "C" fn CResult_OpenChannelDecodeErrorZ_free(_res: CResult_OpenChannelDecodeErrorZ) { }
14129 impl Drop for CResult_OpenChannelDecodeErrorZ {
14130         fn drop(&mut self) {
14131                 if self.result_ok {
14132                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
14133                                 let _ = unsafe { Box::from_raw(self.contents.result) };
14134                         }
14135                 } else {
14136                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
14137                                 let _ = unsafe { Box::from_raw(self.contents.err) };
14138                         }
14139                 }
14140         }
14141 }
14142 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::OpenChannel, crate::lightning::ln::msgs::DecodeError>> for CResult_OpenChannelDecodeErrorZ {
14143         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::OpenChannel, crate::lightning::ln::msgs::DecodeError>) -> Self {
14144                 let contents = if o.result_ok {
14145                         let result = unsafe { o.contents.result };
14146                         unsafe { o.contents.result = core::ptr::null_mut() };
14147                         CResult_OpenChannelDecodeErrorZPtr { result }
14148                 } else {
14149                         let err = unsafe { o.contents.err };
14150                         unsafe { o.contents.err = core::ptr::null_mut(); }
14151                         CResult_OpenChannelDecodeErrorZPtr { err }
14152                 };
14153                 Self {
14154                         contents,
14155                         result_ok: o.result_ok,
14156                 }
14157         }
14158 }
14159 impl Clone for CResult_OpenChannelDecodeErrorZ {
14160         fn clone(&self) -> Self {
14161                 if self.result_ok {
14162                         Self { result_ok: true, contents: CResult_OpenChannelDecodeErrorZPtr {
14163                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::OpenChannel>::clone(unsafe { &*self.contents.result })))
14164                         } }
14165                 } else {
14166                         Self { result_ok: false, contents: CResult_OpenChannelDecodeErrorZPtr {
14167                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14168                         } }
14169                 }
14170         }
14171 }
14172 #[no_mangle]
14173 /// Creates a new CResult_OpenChannelDecodeErrorZ which has the same data as `orig`
14174 /// but with all dynamically-allocated buffers duplicated in new buffers.
14175 pub extern "C" fn CResult_OpenChannelDecodeErrorZ_clone(orig: &CResult_OpenChannelDecodeErrorZ) -> CResult_OpenChannelDecodeErrorZ { Clone::clone(&orig) }
14176 #[repr(C)]
14177 /// The contents of CResult_RevokeAndACKDecodeErrorZ
14178 pub union CResult_RevokeAndACKDecodeErrorZPtr {
14179         /// A pointer to the contents in the success state.
14180         /// Reading from this pointer when `result_ok` is not set is undefined.
14181         pub result: *mut crate::lightning::ln::msgs::RevokeAndACK,
14182         /// A pointer to the contents in the error state.
14183         /// Reading from this pointer when `result_ok` is set is undefined.
14184         pub err: *mut crate::lightning::ln::msgs::DecodeError,
14185 }
14186 #[repr(C)]
14187 /// A CResult_RevokeAndACKDecodeErrorZ represents the result of a fallible operation,
14188 /// containing a crate::lightning::ln::msgs::RevokeAndACK on success and a crate::lightning::ln::msgs::DecodeError on failure.
14189 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14190 pub struct CResult_RevokeAndACKDecodeErrorZ {
14191         /// The contents of this CResult_RevokeAndACKDecodeErrorZ, accessible via either
14192         /// `err` or `result` depending on the state of `result_ok`.
14193         pub contents: CResult_RevokeAndACKDecodeErrorZPtr,
14194         /// Whether this CResult_RevokeAndACKDecodeErrorZ represents a success state.
14195         pub result_ok: bool,
14196 }
14197 #[no_mangle]
14198 /// Creates a new CResult_RevokeAndACKDecodeErrorZ in the success state.
14199 pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_ok(o: crate::lightning::ln::msgs::RevokeAndACK) -> CResult_RevokeAndACKDecodeErrorZ {
14200         CResult_RevokeAndACKDecodeErrorZ {
14201                 contents: CResult_RevokeAndACKDecodeErrorZPtr {
14202                         result: Box::into_raw(Box::new(o)),
14203                 },
14204                 result_ok: true,
14205         }
14206 }
14207 #[no_mangle]
14208 /// Creates a new CResult_RevokeAndACKDecodeErrorZ in the error state.
14209 pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RevokeAndACKDecodeErrorZ {
14210         CResult_RevokeAndACKDecodeErrorZ {
14211                 contents: CResult_RevokeAndACKDecodeErrorZPtr {
14212                         err: Box::into_raw(Box::new(e)),
14213                 },
14214                 result_ok: false,
14215         }
14216 }
14217 /// Checks if the given object is currently in the success state
14218 #[no_mangle]
14219 pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_is_ok(o: &CResult_RevokeAndACKDecodeErrorZ) -> bool {
14220         o.result_ok
14221 }
14222 #[no_mangle]
14223 /// Frees any resources used by the CResult_RevokeAndACKDecodeErrorZ.
14224 pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_free(_res: CResult_RevokeAndACKDecodeErrorZ) { }
14225 impl Drop for CResult_RevokeAndACKDecodeErrorZ {
14226         fn drop(&mut self) {
14227                 if self.result_ok {
14228                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
14229                                 let _ = unsafe { Box::from_raw(self.contents.result) };
14230                         }
14231                 } else {
14232                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
14233                                 let _ = unsafe { Box::from_raw(self.contents.err) };
14234                         }
14235                 }
14236         }
14237 }
14238 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::RevokeAndACK, crate::lightning::ln::msgs::DecodeError>> for CResult_RevokeAndACKDecodeErrorZ {
14239         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::RevokeAndACK, crate::lightning::ln::msgs::DecodeError>) -> Self {
14240                 let contents = if o.result_ok {
14241                         let result = unsafe { o.contents.result };
14242                         unsafe { o.contents.result = core::ptr::null_mut() };
14243                         CResult_RevokeAndACKDecodeErrorZPtr { result }
14244                 } else {
14245                         let err = unsafe { o.contents.err };
14246                         unsafe { o.contents.err = core::ptr::null_mut(); }
14247                         CResult_RevokeAndACKDecodeErrorZPtr { err }
14248                 };
14249                 Self {
14250                         contents,
14251                         result_ok: o.result_ok,
14252                 }
14253         }
14254 }
14255 impl Clone for CResult_RevokeAndACKDecodeErrorZ {
14256         fn clone(&self) -> Self {
14257                 if self.result_ok {
14258                         Self { result_ok: true, contents: CResult_RevokeAndACKDecodeErrorZPtr {
14259                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::RevokeAndACK>::clone(unsafe { &*self.contents.result })))
14260                         } }
14261                 } else {
14262                         Self { result_ok: false, contents: CResult_RevokeAndACKDecodeErrorZPtr {
14263                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14264                         } }
14265                 }
14266         }
14267 }
14268 #[no_mangle]
14269 /// Creates a new CResult_RevokeAndACKDecodeErrorZ which has the same data as `orig`
14270 /// but with all dynamically-allocated buffers duplicated in new buffers.
14271 pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_clone(orig: &CResult_RevokeAndACKDecodeErrorZ) -> CResult_RevokeAndACKDecodeErrorZ { Clone::clone(&orig) }
14272 #[repr(C)]
14273 /// The contents of CResult_ShutdownDecodeErrorZ
14274 pub union CResult_ShutdownDecodeErrorZPtr {
14275         /// A pointer to the contents in the success state.
14276         /// Reading from this pointer when `result_ok` is not set is undefined.
14277         pub result: *mut crate::lightning::ln::msgs::Shutdown,
14278         /// A pointer to the contents in the error state.
14279         /// Reading from this pointer when `result_ok` is set is undefined.
14280         pub err: *mut crate::lightning::ln::msgs::DecodeError,
14281 }
14282 #[repr(C)]
14283 /// A CResult_ShutdownDecodeErrorZ represents the result of a fallible operation,
14284 /// containing a crate::lightning::ln::msgs::Shutdown on success and a crate::lightning::ln::msgs::DecodeError on failure.
14285 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14286 pub struct CResult_ShutdownDecodeErrorZ {
14287         /// The contents of this CResult_ShutdownDecodeErrorZ, accessible via either
14288         /// `err` or `result` depending on the state of `result_ok`.
14289         pub contents: CResult_ShutdownDecodeErrorZPtr,
14290         /// Whether this CResult_ShutdownDecodeErrorZ represents a success state.
14291         pub result_ok: bool,
14292 }
14293 #[no_mangle]
14294 /// Creates a new CResult_ShutdownDecodeErrorZ in the success state.
14295 pub extern "C" fn CResult_ShutdownDecodeErrorZ_ok(o: crate::lightning::ln::msgs::Shutdown) -> CResult_ShutdownDecodeErrorZ {
14296         CResult_ShutdownDecodeErrorZ {
14297                 contents: CResult_ShutdownDecodeErrorZPtr {
14298                         result: Box::into_raw(Box::new(o)),
14299                 },
14300                 result_ok: true,
14301         }
14302 }
14303 #[no_mangle]
14304 /// Creates a new CResult_ShutdownDecodeErrorZ in the error state.
14305 pub extern "C" fn CResult_ShutdownDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ShutdownDecodeErrorZ {
14306         CResult_ShutdownDecodeErrorZ {
14307                 contents: CResult_ShutdownDecodeErrorZPtr {
14308                         err: Box::into_raw(Box::new(e)),
14309                 },
14310                 result_ok: false,
14311         }
14312 }
14313 /// Checks if the given object is currently in the success state
14314 #[no_mangle]
14315 pub extern "C" fn CResult_ShutdownDecodeErrorZ_is_ok(o: &CResult_ShutdownDecodeErrorZ) -> bool {
14316         o.result_ok
14317 }
14318 #[no_mangle]
14319 /// Frees any resources used by the CResult_ShutdownDecodeErrorZ.
14320 pub extern "C" fn CResult_ShutdownDecodeErrorZ_free(_res: CResult_ShutdownDecodeErrorZ) { }
14321 impl Drop for CResult_ShutdownDecodeErrorZ {
14322         fn drop(&mut self) {
14323                 if self.result_ok {
14324                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
14325                                 let _ = unsafe { Box::from_raw(self.contents.result) };
14326                         }
14327                 } else {
14328                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
14329                                 let _ = unsafe { Box::from_raw(self.contents.err) };
14330                         }
14331                 }
14332         }
14333 }
14334 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::Shutdown, crate::lightning::ln::msgs::DecodeError>> for CResult_ShutdownDecodeErrorZ {
14335         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::Shutdown, crate::lightning::ln::msgs::DecodeError>) -> Self {
14336                 let contents = if o.result_ok {
14337                         let result = unsafe { o.contents.result };
14338                         unsafe { o.contents.result = core::ptr::null_mut() };
14339                         CResult_ShutdownDecodeErrorZPtr { result }
14340                 } else {
14341                         let err = unsafe { o.contents.err };
14342                         unsafe { o.contents.err = core::ptr::null_mut(); }
14343                         CResult_ShutdownDecodeErrorZPtr { err }
14344                 };
14345                 Self {
14346                         contents,
14347                         result_ok: o.result_ok,
14348                 }
14349         }
14350 }
14351 impl Clone for CResult_ShutdownDecodeErrorZ {
14352         fn clone(&self) -> Self {
14353                 if self.result_ok {
14354                         Self { result_ok: true, contents: CResult_ShutdownDecodeErrorZPtr {
14355                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::Shutdown>::clone(unsafe { &*self.contents.result })))
14356                         } }
14357                 } else {
14358                         Self { result_ok: false, contents: CResult_ShutdownDecodeErrorZPtr {
14359                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14360                         } }
14361                 }
14362         }
14363 }
14364 #[no_mangle]
14365 /// Creates a new CResult_ShutdownDecodeErrorZ which has the same data as `orig`
14366 /// but with all dynamically-allocated buffers duplicated in new buffers.
14367 pub extern "C" fn CResult_ShutdownDecodeErrorZ_clone(orig: &CResult_ShutdownDecodeErrorZ) -> CResult_ShutdownDecodeErrorZ { Clone::clone(&orig) }
14368 #[repr(C)]
14369 /// The contents of CResult_UpdateFailHTLCDecodeErrorZ
14370 pub union CResult_UpdateFailHTLCDecodeErrorZPtr {
14371         /// A pointer to the contents in the success state.
14372         /// Reading from this pointer when `result_ok` is not set is undefined.
14373         pub result: *mut crate::lightning::ln::msgs::UpdateFailHTLC,
14374         /// A pointer to the contents in the error state.
14375         /// Reading from this pointer when `result_ok` is set is undefined.
14376         pub err: *mut crate::lightning::ln::msgs::DecodeError,
14377 }
14378 #[repr(C)]
14379 /// A CResult_UpdateFailHTLCDecodeErrorZ represents the result of a fallible operation,
14380 /// containing a crate::lightning::ln::msgs::UpdateFailHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
14381 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14382 pub struct CResult_UpdateFailHTLCDecodeErrorZ {
14383         /// The contents of this CResult_UpdateFailHTLCDecodeErrorZ, accessible via either
14384         /// `err` or `result` depending on the state of `result_ok`.
14385         pub contents: CResult_UpdateFailHTLCDecodeErrorZPtr,
14386         /// Whether this CResult_UpdateFailHTLCDecodeErrorZ represents a success state.
14387         pub result_ok: bool,
14388 }
14389 #[no_mangle]
14390 /// Creates a new CResult_UpdateFailHTLCDecodeErrorZ in the success state.
14391 pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateFailHTLC) -> CResult_UpdateFailHTLCDecodeErrorZ {
14392         CResult_UpdateFailHTLCDecodeErrorZ {
14393                 contents: CResult_UpdateFailHTLCDecodeErrorZPtr {
14394                         result: Box::into_raw(Box::new(o)),
14395                 },
14396                 result_ok: true,
14397         }
14398 }
14399 #[no_mangle]
14400 /// Creates a new CResult_UpdateFailHTLCDecodeErrorZ in the error state.
14401 pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateFailHTLCDecodeErrorZ {
14402         CResult_UpdateFailHTLCDecodeErrorZ {
14403                 contents: CResult_UpdateFailHTLCDecodeErrorZPtr {
14404                         err: Box::into_raw(Box::new(e)),
14405                 },
14406                 result_ok: false,
14407         }
14408 }
14409 /// Checks if the given object is currently in the success state
14410 #[no_mangle]
14411 pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_is_ok(o: &CResult_UpdateFailHTLCDecodeErrorZ) -> bool {
14412         o.result_ok
14413 }
14414 #[no_mangle]
14415 /// Frees any resources used by the CResult_UpdateFailHTLCDecodeErrorZ.
14416 pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_free(_res: CResult_UpdateFailHTLCDecodeErrorZ) { }
14417 impl Drop for CResult_UpdateFailHTLCDecodeErrorZ {
14418         fn drop(&mut self) {
14419                 if self.result_ok {
14420                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
14421                                 let _ = unsafe { Box::from_raw(self.contents.result) };
14422                         }
14423                 } else {
14424                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
14425                                 let _ = unsafe { Box::from_raw(self.contents.err) };
14426                         }
14427                 }
14428         }
14429 }
14430 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFailHTLC, crate::lightning::ln::msgs::DecodeError>> for CResult_UpdateFailHTLCDecodeErrorZ {
14431         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFailHTLC, crate::lightning::ln::msgs::DecodeError>) -> Self {
14432                 let contents = if o.result_ok {
14433                         let result = unsafe { o.contents.result };
14434                         unsafe { o.contents.result = core::ptr::null_mut() };
14435                         CResult_UpdateFailHTLCDecodeErrorZPtr { result }
14436                 } else {
14437                         let err = unsafe { o.contents.err };
14438                         unsafe { o.contents.err = core::ptr::null_mut(); }
14439                         CResult_UpdateFailHTLCDecodeErrorZPtr { err }
14440                 };
14441                 Self {
14442                         contents,
14443                         result_ok: o.result_ok,
14444                 }
14445         }
14446 }
14447 impl Clone for CResult_UpdateFailHTLCDecodeErrorZ {
14448         fn clone(&self) -> Self {
14449                 if self.result_ok {
14450                         Self { result_ok: true, contents: CResult_UpdateFailHTLCDecodeErrorZPtr {
14451                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UpdateFailHTLC>::clone(unsafe { &*self.contents.result })))
14452                         } }
14453                 } else {
14454                         Self { result_ok: false, contents: CResult_UpdateFailHTLCDecodeErrorZPtr {
14455                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14456                         } }
14457                 }
14458         }
14459 }
14460 #[no_mangle]
14461 /// Creates a new CResult_UpdateFailHTLCDecodeErrorZ which has the same data as `orig`
14462 /// but with all dynamically-allocated buffers duplicated in new buffers.
14463 pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_clone(orig: &CResult_UpdateFailHTLCDecodeErrorZ) -> CResult_UpdateFailHTLCDecodeErrorZ { Clone::clone(&orig) }
14464 #[repr(C)]
14465 /// The contents of CResult_UpdateFailMalformedHTLCDecodeErrorZ
14466 pub union CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
14467         /// A pointer to the contents in the success state.
14468         /// Reading from this pointer when `result_ok` is not set is undefined.
14469         pub result: *mut crate::lightning::ln::msgs::UpdateFailMalformedHTLC,
14470         /// A pointer to the contents in the error state.
14471         /// Reading from this pointer when `result_ok` is set is undefined.
14472         pub err: *mut crate::lightning::ln::msgs::DecodeError,
14473 }
14474 #[repr(C)]
14475 /// A CResult_UpdateFailMalformedHTLCDecodeErrorZ represents the result of a fallible operation,
14476 /// containing a crate::lightning::ln::msgs::UpdateFailMalformedHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
14477 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14478 pub struct CResult_UpdateFailMalformedHTLCDecodeErrorZ {
14479         /// The contents of this CResult_UpdateFailMalformedHTLCDecodeErrorZ, accessible via either
14480         /// `err` or `result` depending on the state of `result_ok`.
14481         pub contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr,
14482         /// Whether this CResult_UpdateFailMalformedHTLCDecodeErrorZ represents a success state.
14483         pub result_ok: bool,
14484 }
14485 #[no_mangle]
14486 /// Creates a new CResult_UpdateFailMalformedHTLCDecodeErrorZ in the success state.
14487 pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateFailMalformedHTLC) -> CResult_UpdateFailMalformedHTLCDecodeErrorZ {
14488         CResult_UpdateFailMalformedHTLCDecodeErrorZ {
14489                 contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
14490                         result: Box::into_raw(Box::new(o)),
14491                 },
14492                 result_ok: true,
14493         }
14494 }
14495 #[no_mangle]
14496 /// Creates a new CResult_UpdateFailMalformedHTLCDecodeErrorZ in the error state.
14497 pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateFailMalformedHTLCDecodeErrorZ {
14498         CResult_UpdateFailMalformedHTLCDecodeErrorZ {
14499                 contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
14500                         err: Box::into_raw(Box::new(e)),
14501                 },
14502                 result_ok: false,
14503         }
14504 }
14505 /// Checks if the given object is currently in the success state
14506 #[no_mangle]
14507 pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_is_ok(o: &CResult_UpdateFailMalformedHTLCDecodeErrorZ) -> bool {
14508         o.result_ok
14509 }
14510 #[no_mangle]
14511 /// Frees any resources used by the CResult_UpdateFailMalformedHTLCDecodeErrorZ.
14512 pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_free(_res: CResult_UpdateFailMalformedHTLCDecodeErrorZ) { }
14513 impl Drop for CResult_UpdateFailMalformedHTLCDecodeErrorZ {
14514         fn drop(&mut self) {
14515                 if self.result_ok {
14516                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
14517                                 let _ = unsafe { Box::from_raw(self.contents.result) };
14518                         }
14519                 } else {
14520                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
14521                                 let _ = unsafe { Box::from_raw(self.contents.err) };
14522                         }
14523                 }
14524         }
14525 }
14526 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFailMalformedHTLC, crate::lightning::ln::msgs::DecodeError>> for CResult_UpdateFailMalformedHTLCDecodeErrorZ {
14527         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFailMalformedHTLC, crate::lightning::ln::msgs::DecodeError>) -> Self {
14528                 let contents = if o.result_ok {
14529                         let result = unsafe { o.contents.result };
14530                         unsafe { o.contents.result = core::ptr::null_mut() };
14531                         CResult_UpdateFailMalformedHTLCDecodeErrorZPtr { result }
14532                 } else {
14533                         let err = unsafe { o.contents.err };
14534                         unsafe { o.contents.err = core::ptr::null_mut(); }
14535                         CResult_UpdateFailMalformedHTLCDecodeErrorZPtr { err }
14536                 };
14537                 Self {
14538                         contents,
14539                         result_ok: o.result_ok,
14540                 }
14541         }
14542 }
14543 impl Clone for CResult_UpdateFailMalformedHTLCDecodeErrorZ {
14544         fn clone(&self) -> Self {
14545                 if self.result_ok {
14546                         Self { result_ok: true, contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
14547                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UpdateFailMalformedHTLC>::clone(unsafe { &*self.contents.result })))
14548                         } }
14549                 } else {
14550                         Self { result_ok: false, contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
14551                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14552                         } }
14553                 }
14554         }
14555 }
14556 #[no_mangle]
14557 /// Creates a new CResult_UpdateFailMalformedHTLCDecodeErrorZ which has the same data as `orig`
14558 /// but with all dynamically-allocated buffers duplicated in new buffers.
14559 pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone(orig: &CResult_UpdateFailMalformedHTLCDecodeErrorZ) -> CResult_UpdateFailMalformedHTLCDecodeErrorZ { Clone::clone(&orig) }
14560 #[repr(C)]
14561 /// The contents of CResult_UpdateFeeDecodeErrorZ
14562 pub union CResult_UpdateFeeDecodeErrorZPtr {
14563         /// A pointer to the contents in the success state.
14564         /// Reading from this pointer when `result_ok` is not set is undefined.
14565         pub result: *mut crate::lightning::ln::msgs::UpdateFee,
14566         /// A pointer to the contents in the error state.
14567         /// Reading from this pointer when `result_ok` is set is undefined.
14568         pub err: *mut crate::lightning::ln::msgs::DecodeError,
14569 }
14570 #[repr(C)]
14571 /// A CResult_UpdateFeeDecodeErrorZ represents the result of a fallible operation,
14572 /// containing a crate::lightning::ln::msgs::UpdateFee on success and a crate::lightning::ln::msgs::DecodeError on failure.
14573 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14574 pub struct CResult_UpdateFeeDecodeErrorZ {
14575         /// The contents of this CResult_UpdateFeeDecodeErrorZ, accessible via either
14576         /// `err` or `result` depending on the state of `result_ok`.
14577         pub contents: CResult_UpdateFeeDecodeErrorZPtr,
14578         /// Whether this CResult_UpdateFeeDecodeErrorZ represents a success state.
14579         pub result_ok: bool,
14580 }
14581 #[no_mangle]
14582 /// Creates a new CResult_UpdateFeeDecodeErrorZ in the success state.
14583 pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateFee) -> CResult_UpdateFeeDecodeErrorZ {
14584         CResult_UpdateFeeDecodeErrorZ {
14585                 contents: CResult_UpdateFeeDecodeErrorZPtr {
14586                         result: Box::into_raw(Box::new(o)),
14587                 },
14588                 result_ok: true,
14589         }
14590 }
14591 #[no_mangle]
14592 /// Creates a new CResult_UpdateFeeDecodeErrorZ in the error state.
14593 pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateFeeDecodeErrorZ {
14594         CResult_UpdateFeeDecodeErrorZ {
14595                 contents: CResult_UpdateFeeDecodeErrorZPtr {
14596                         err: Box::into_raw(Box::new(e)),
14597                 },
14598                 result_ok: false,
14599         }
14600 }
14601 /// Checks if the given object is currently in the success state
14602 #[no_mangle]
14603 pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_is_ok(o: &CResult_UpdateFeeDecodeErrorZ) -> bool {
14604         o.result_ok
14605 }
14606 #[no_mangle]
14607 /// Frees any resources used by the CResult_UpdateFeeDecodeErrorZ.
14608 pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_free(_res: CResult_UpdateFeeDecodeErrorZ) { }
14609 impl Drop for CResult_UpdateFeeDecodeErrorZ {
14610         fn drop(&mut self) {
14611                 if self.result_ok {
14612                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
14613                                 let _ = unsafe { Box::from_raw(self.contents.result) };
14614                         }
14615                 } else {
14616                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
14617                                 let _ = unsafe { Box::from_raw(self.contents.err) };
14618                         }
14619                 }
14620         }
14621 }
14622 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFee, crate::lightning::ln::msgs::DecodeError>> for CResult_UpdateFeeDecodeErrorZ {
14623         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFee, crate::lightning::ln::msgs::DecodeError>) -> Self {
14624                 let contents = if o.result_ok {
14625                         let result = unsafe { o.contents.result };
14626                         unsafe { o.contents.result = core::ptr::null_mut() };
14627                         CResult_UpdateFeeDecodeErrorZPtr { result }
14628                 } else {
14629                         let err = unsafe { o.contents.err };
14630                         unsafe { o.contents.err = core::ptr::null_mut(); }
14631                         CResult_UpdateFeeDecodeErrorZPtr { err }
14632                 };
14633                 Self {
14634                         contents,
14635                         result_ok: o.result_ok,
14636                 }
14637         }
14638 }
14639 impl Clone for CResult_UpdateFeeDecodeErrorZ {
14640         fn clone(&self) -> Self {
14641                 if self.result_ok {
14642                         Self { result_ok: true, contents: CResult_UpdateFeeDecodeErrorZPtr {
14643                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UpdateFee>::clone(unsafe { &*self.contents.result })))
14644                         } }
14645                 } else {
14646                         Self { result_ok: false, contents: CResult_UpdateFeeDecodeErrorZPtr {
14647                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14648                         } }
14649                 }
14650         }
14651 }
14652 #[no_mangle]
14653 /// Creates a new CResult_UpdateFeeDecodeErrorZ which has the same data as `orig`
14654 /// but with all dynamically-allocated buffers duplicated in new buffers.
14655 pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_clone(orig: &CResult_UpdateFeeDecodeErrorZ) -> CResult_UpdateFeeDecodeErrorZ { Clone::clone(&orig) }
14656 #[repr(C)]
14657 /// The contents of CResult_UpdateFulfillHTLCDecodeErrorZ
14658 pub union CResult_UpdateFulfillHTLCDecodeErrorZPtr {
14659         /// A pointer to the contents in the success state.
14660         /// Reading from this pointer when `result_ok` is not set is undefined.
14661         pub result: *mut crate::lightning::ln::msgs::UpdateFulfillHTLC,
14662         /// A pointer to the contents in the error state.
14663         /// Reading from this pointer when `result_ok` is set is undefined.
14664         pub err: *mut crate::lightning::ln::msgs::DecodeError,
14665 }
14666 #[repr(C)]
14667 /// A CResult_UpdateFulfillHTLCDecodeErrorZ represents the result of a fallible operation,
14668 /// containing a crate::lightning::ln::msgs::UpdateFulfillHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
14669 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14670 pub struct CResult_UpdateFulfillHTLCDecodeErrorZ {
14671         /// The contents of this CResult_UpdateFulfillHTLCDecodeErrorZ, accessible via either
14672         /// `err` or `result` depending on the state of `result_ok`.
14673         pub contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr,
14674         /// Whether this CResult_UpdateFulfillHTLCDecodeErrorZ represents a success state.
14675         pub result_ok: bool,
14676 }
14677 #[no_mangle]
14678 /// Creates a new CResult_UpdateFulfillHTLCDecodeErrorZ in the success state.
14679 pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateFulfillHTLC) -> CResult_UpdateFulfillHTLCDecodeErrorZ {
14680         CResult_UpdateFulfillHTLCDecodeErrorZ {
14681                 contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr {
14682                         result: Box::into_raw(Box::new(o)),
14683                 },
14684                 result_ok: true,
14685         }
14686 }
14687 #[no_mangle]
14688 /// Creates a new CResult_UpdateFulfillHTLCDecodeErrorZ in the error state.
14689 pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateFulfillHTLCDecodeErrorZ {
14690         CResult_UpdateFulfillHTLCDecodeErrorZ {
14691                 contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr {
14692                         err: Box::into_raw(Box::new(e)),
14693                 },
14694                 result_ok: false,
14695         }
14696 }
14697 /// Checks if the given object is currently in the success state
14698 #[no_mangle]
14699 pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_is_ok(o: &CResult_UpdateFulfillHTLCDecodeErrorZ) -> bool {
14700         o.result_ok
14701 }
14702 #[no_mangle]
14703 /// Frees any resources used by the CResult_UpdateFulfillHTLCDecodeErrorZ.
14704 pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_free(_res: CResult_UpdateFulfillHTLCDecodeErrorZ) { }
14705 impl Drop for CResult_UpdateFulfillHTLCDecodeErrorZ {
14706         fn drop(&mut self) {
14707                 if self.result_ok {
14708                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
14709                                 let _ = unsafe { Box::from_raw(self.contents.result) };
14710                         }
14711                 } else {
14712                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
14713                                 let _ = unsafe { Box::from_raw(self.contents.err) };
14714                         }
14715                 }
14716         }
14717 }
14718 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFulfillHTLC, crate::lightning::ln::msgs::DecodeError>> for CResult_UpdateFulfillHTLCDecodeErrorZ {
14719         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFulfillHTLC, crate::lightning::ln::msgs::DecodeError>) -> Self {
14720                 let contents = if o.result_ok {
14721                         let result = unsafe { o.contents.result };
14722                         unsafe { o.contents.result = core::ptr::null_mut() };
14723                         CResult_UpdateFulfillHTLCDecodeErrorZPtr { result }
14724                 } else {
14725                         let err = unsafe { o.contents.err };
14726                         unsafe { o.contents.err = core::ptr::null_mut(); }
14727                         CResult_UpdateFulfillHTLCDecodeErrorZPtr { err }
14728                 };
14729                 Self {
14730                         contents,
14731                         result_ok: o.result_ok,
14732                 }
14733         }
14734 }
14735 impl Clone for CResult_UpdateFulfillHTLCDecodeErrorZ {
14736         fn clone(&self) -> Self {
14737                 if self.result_ok {
14738                         Self { result_ok: true, contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr {
14739                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UpdateFulfillHTLC>::clone(unsafe { &*self.contents.result })))
14740                         } }
14741                 } else {
14742                         Self { result_ok: false, contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr {
14743                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14744                         } }
14745                 }
14746         }
14747 }
14748 #[no_mangle]
14749 /// Creates a new CResult_UpdateFulfillHTLCDecodeErrorZ which has the same data as `orig`
14750 /// but with all dynamically-allocated buffers duplicated in new buffers.
14751 pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_clone(orig: &CResult_UpdateFulfillHTLCDecodeErrorZ) -> CResult_UpdateFulfillHTLCDecodeErrorZ { Clone::clone(&orig) }
14752 #[repr(C)]
14753 /// The contents of CResult_UpdateAddHTLCDecodeErrorZ
14754 pub union CResult_UpdateAddHTLCDecodeErrorZPtr {
14755         /// A pointer to the contents in the success state.
14756         /// Reading from this pointer when `result_ok` is not set is undefined.
14757         pub result: *mut crate::lightning::ln::msgs::UpdateAddHTLC,
14758         /// A pointer to the contents in the error state.
14759         /// Reading from this pointer when `result_ok` is set is undefined.
14760         pub err: *mut crate::lightning::ln::msgs::DecodeError,
14761 }
14762 #[repr(C)]
14763 /// A CResult_UpdateAddHTLCDecodeErrorZ represents the result of a fallible operation,
14764 /// containing a crate::lightning::ln::msgs::UpdateAddHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
14765 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14766 pub struct CResult_UpdateAddHTLCDecodeErrorZ {
14767         /// The contents of this CResult_UpdateAddHTLCDecodeErrorZ, accessible via either
14768         /// `err` or `result` depending on the state of `result_ok`.
14769         pub contents: CResult_UpdateAddHTLCDecodeErrorZPtr,
14770         /// Whether this CResult_UpdateAddHTLCDecodeErrorZ represents a success state.
14771         pub result_ok: bool,
14772 }
14773 #[no_mangle]
14774 /// Creates a new CResult_UpdateAddHTLCDecodeErrorZ in the success state.
14775 pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateAddHTLC) -> CResult_UpdateAddHTLCDecodeErrorZ {
14776         CResult_UpdateAddHTLCDecodeErrorZ {
14777                 contents: CResult_UpdateAddHTLCDecodeErrorZPtr {
14778                         result: Box::into_raw(Box::new(o)),
14779                 },
14780                 result_ok: true,
14781         }
14782 }
14783 #[no_mangle]
14784 /// Creates a new CResult_UpdateAddHTLCDecodeErrorZ in the error state.
14785 pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateAddHTLCDecodeErrorZ {
14786         CResult_UpdateAddHTLCDecodeErrorZ {
14787                 contents: CResult_UpdateAddHTLCDecodeErrorZPtr {
14788                         err: Box::into_raw(Box::new(e)),
14789                 },
14790                 result_ok: false,
14791         }
14792 }
14793 /// Checks if the given object is currently in the success state
14794 #[no_mangle]
14795 pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_is_ok(o: &CResult_UpdateAddHTLCDecodeErrorZ) -> bool {
14796         o.result_ok
14797 }
14798 #[no_mangle]
14799 /// Frees any resources used by the CResult_UpdateAddHTLCDecodeErrorZ.
14800 pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_free(_res: CResult_UpdateAddHTLCDecodeErrorZ) { }
14801 impl Drop for CResult_UpdateAddHTLCDecodeErrorZ {
14802         fn drop(&mut self) {
14803                 if self.result_ok {
14804                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
14805                                 let _ = unsafe { Box::from_raw(self.contents.result) };
14806                         }
14807                 } else {
14808                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
14809                                 let _ = unsafe { Box::from_raw(self.contents.err) };
14810                         }
14811                 }
14812         }
14813 }
14814 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateAddHTLC, crate::lightning::ln::msgs::DecodeError>> for CResult_UpdateAddHTLCDecodeErrorZ {
14815         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateAddHTLC, crate::lightning::ln::msgs::DecodeError>) -> Self {
14816                 let contents = if o.result_ok {
14817                         let result = unsafe { o.contents.result };
14818                         unsafe { o.contents.result = core::ptr::null_mut() };
14819                         CResult_UpdateAddHTLCDecodeErrorZPtr { result }
14820                 } else {
14821                         let err = unsafe { o.contents.err };
14822                         unsafe { o.contents.err = core::ptr::null_mut(); }
14823                         CResult_UpdateAddHTLCDecodeErrorZPtr { err }
14824                 };
14825                 Self {
14826                         contents,
14827                         result_ok: o.result_ok,
14828                 }
14829         }
14830 }
14831 impl Clone for CResult_UpdateAddHTLCDecodeErrorZ {
14832         fn clone(&self) -> Self {
14833                 if self.result_ok {
14834                         Self { result_ok: true, contents: CResult_UpdateAddHTLCDecodeErrorZPtr {
14835                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UpdateAddHTLC>::clone(unsafe { &*self.contents.result })))
14836                         } }
14837                 } else {
14838                         Self { result_ok: false, contents: CResult_UpdateAddHTLCDecodeErrorZPtr {
14839                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14840                         } }
14841                 }
14842         }
14843 }
14844 #[no_mangle]
14845 /// Creates a new CResult_UpdateAddHTLCDecodeErrorZ which has the same data as `orig`
14846 /// but with all dynamically-allocated buffers duplicated in new buffers.
14847 pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_clone(orig: &CResult_UpdateAddHTLCDecodeErrorZ) -> CResult_UpdateAddHTLCDecodeErrorZ { Clone::clone(&orig) }
14848 #[repr(C)]
14849 /// The contents of CResult_OnionMessageDecodeErrorZ
14850 pub union CResult_OnionMessageDecodeErrorZPtr {
14851         /// A pointer to the contents in the success state.
14852         /// Reading from this pointer when `result_ok` is not set is undefined.
14853         pub result: *mut crate::lightning::ln::msgs::OnionMessage,
14854         /// A pointer to the contents in the error state.
14855         /// Reading from this pointer when `result_ok` is set is undefined.
14856         pub err: *mut crate::lightning::ln::msgs::DecodeError,
14857 }
14858 #[repr(C)]
14859 /// A CResult_OnionMessageDecodeErrorZ represents the result of a fallible operation,
14860 /// containing a crate::lightning::ln::msgs::OnionMessage on success and a crate::lightning::ln::msgs::DecodeError on failure.
14861 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14862 pub struct CResult_OnionMessageDecodeErrorZ {
14863         /// The contents of this CResult_OnionMessageDecodeErrorZ, accessible via either
14864         /// `err` or `result` depending on the state of `result_ok`.
14865         pub contents: CResult_OnionMessageDecodeErrorZPtr,
14866         /// Whether this CResult_OnionMessageDecodeErrorZ represents a success state.
14867         pub result_ok: bool,
14868 }
14869 #[no_mangle]
14870 /// Creates a new CResult_OnionMessageDecodeErrorZ in the success state.
14871 pub extern "C" fn CResult_OnionMessageDecodeErrorZ_ok(o: crate::lightning::ln::msgs::OnionMessage) -> CResult_OnionMessageDecodeErrorZ {
14872         CResult_OnionMessageDecodeErrorZ {
14873                 contents: CResult_OnionMessageDecodeErrorZPtr {
14874                         result: Box::into_raw(Box::new(o)),
14875                 },
14876                 result_ok: true,
14877         }
14878 }
14879 #[no_mangle]
14880 /// Creates a new CResult_OnionMessageDecodeErrorZ in the error state.
14881 pub extern "C" fn CResult_OnionMessageDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_OnionMessageDecodeErrorZ {
14882         CResult_OnionMessageDecodeErrorZ {
14883                 contents: CResult_OnionMessageDecodeErrorZPtr {
14884                         err: Box::into_raw(Box::new(e)),
14885                 },
14886                 result_ok: false,
14887         }
14888 }
14889 /// Checks if the given object is currently in the success state
14890 #[no_mangle]
14891 pub extern "C" fn CResult_OnionMessageDecodeErrorZ_is_ok(o: &CResult_OnionMessageDecodeErrorZ) -> bool {
14892         o.result_ok
14893 }
14894 #[no_mangle]
14895 /// Frees any resources used by the CResult_OnionMessageDecodeErrorZ.
14896 pub extern "C" fn CResult_OnionMessageDecodeErrorZ_free(_res: CResult_OnionMessageDecodeErrorZ) { }
14897 impl Drop for CResult_OnionMessageDecodeErrorZ {
14898         fn drop(&mut self) {
14899                 if self.result_ok {
14900                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
14901                                 let _ = unsafe { Box::from_raw(self.contents.result) };
14902                         }
14903                 } else {
14904                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
14905                                 let _ = unsafe { Box::from_raw(self.contents.err) };
14906                         }
14907                 }
14908         }
14909 }
14910 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::OnionMessage, crate::lightning::ln::msgs::DecodeError>> for CResult_OnionMessageDecodeErrorZ {
14911         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::OnionMessage, crate::lightning::ln::msgs::DecodeError>) -> Self {
14912                 let contents = if o.result_ok {
14913                         let result = unsafe { o.contents.result };
14914                         unsafe { o.contents.result = core::ptr::null_mut() };
14915                         CResult_OnionMessageDecodeErrorZPtr { result }
14916                 } else {
14917                         let err = unsafe { o.contents.err };
14918                         unsafe { o.contents.err = core::ptr::null_mut(); }
14919                         CResult_OnionMessageDecodeErrorZPtr { err }
14920                 };
14921                 Self {
14922                         contents,
14923                         result_ok: o.result_ok,
14924                 }
14925         }
14926 }
14927 impl Clone for CResult_OnionMessageDecodeErrorZ {
14928         fn clone(&self) -> Self {
14929                 if self.result_ok {
14930                         Self { result_ok: true, contents: CResult_OnionMessageDecodeErrorZPtr {
14931                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::OnionMessage>::clone(unsafe { &*self.contents.result })))
14932                         } }
14933                 } else {
14934                         Self { result_ok: false, contents: CResult_OnionMessageDecodeErrorZPtr {
14935                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14936                         } }
14937                 }
14938         }
14939 }
14940 #[no_mangle]
14941 /// Creates a new CResult_OnionMessageDecodeErrorZ which has the same data as `orig`
14942 /// but with all dynamically-allocated buffers duplicated in new buffers.
14943 pub extern "C" fn CResult_OnionMessageDecodeErrorZ_clone(orig: &CResult_OnionMessageDecodeErrorZ) -> CResult_OnionMessageDecodeErrorZ { Clone::clone(&orig) }
14944 #[repr(C)]
14945 /// The contents of CResult_PingDecodeErrorZ
14946 pub union CResult_PingDecodeErrorZPtr {
14947         /// A pointer to the contents in the success state.
14948         /// Reading from this pointer when `result_ok` is not set is undefined.
14949         pub result: *mut crate::lightning::ln::msgs::Ping,
14950         /// A pointer to the contents in the error state.
14951         /// Reading from this pointer when `result_ok` is set is undefined.
14952         pub err: *mut crate::lightning::ln::msgs::DecodeError,
14953 }
14954 #[repr(C)]
14955 /// A CResult_PingDecodeErrorZ represents the result of a fallible operation,
14956 /// containing a crate::lightning::ln::msgs::Ping on success and a crate::lightning::ln::msgs::DecodeError on failure.
14957 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14958 pub struct CResult_PingDecodeErrorZ {
14959         /// The contents of this CResult_PingDecodeErrorZ, accessible via either
14960         /// `err` or `result` depending on the state of `result_ok`.
14961         pub contents: CResult_PingDecodeErrorZPtr,
14962         /// Whether this CResult_PingDecodeErrorZ represents a success state.
14963         pub result_ok: bool,
14964 }
14965 #[no_mangle]
14966 /// Creates a new CResult_PingDecodeErrorZ in the success state.
14967 pub extern "C" fn CResult_PingDecodeErrorZ_ok(o: crate::lightning::ln::msgs::Ping) -> CResult_PingDecodeErrorZ {
14968         CResult_PingDecodeErrorZ {
14969                 contents: CResult_PingDecodeErrorZPtr {
14970                         result: Box::into_raw(Box::new(o)),
14971                 },
14972                 result_ok: true,
14973         }
14974 }
14975 #[no_mangle]
14976 /// Creates a new CResult_PingDecodeErrorZ in the error state.
14977 pub extern "C" fn CResult_PingDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_PingDecodeErrorZ {
14978         CResult_PingDecodeErrorZ {
14979                 contents: CResult_PingDecodeErrorZPtr {
14980                         err: Box::into_raw(Box::new(e)),
14981                 },
14982                 result_ok: false,
14983         }
14984 }
14985 /// Checks if the given object is currently in the success state
14986 #[no_mangle]
14987 pub extern "C" fn CResult_PingDecodeErrorZ_is_ok(o: &CResult_PingDecodeErrorZ) -> bool {
14988         o.result_ok
14989 }
14990 #[no_mangle]
14991 /// Frees any resources used by the CResult_PingDecodeErrorZ.
14992 pub extern "C" fn CResult_PingDecodeErrorZ_free(_res: CResult_PingDecodeErrorZ) { }
14993 impl Drop for CResult_PingDecodeErrorZ {
14994         fn drop(&mut self) {
14995                 if self.result_ok {
14996                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
14997                                 let _ = unsafe { Box::from_raw(self.contents.result) };
14998                         }
14999                 } else {
15000                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
15001                                 let _ = unsafe { Box::from_raw(self.contents.err) };
15002                         }
15003                 }
15004         }
15005 }
15006 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::Ping, crate::lightning::ln::msgs::DecodeError>> for CResult_PingDecodeErrorZ {
15007         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::Ping, crate::lightning::ln::msgs::DecodeError>) -> Self {
15008                 let contents = if o.result_ok {
15009                         let result = unsafe { o.contents.result };
15010                         unsafe { o.contents.result = core::ptr::null_mut() };
15011                         CResult_PingDecodeErrorZPtr { result }
15012                 } else {
15013                         let err = unsafe { o.contents.err };
15014                         unsafe { o.contents.err = core::ptr::null_mut(); }
15015                         CResult_PingDecodeErrorZPtr { err }
15016                 };
15017                 Self {
15018                         contents,
15019                         result_ok: o.result_ok,
15020                 }
15021         }
15022 }
15023 impl Clone for CResult_PingDecodeErrorZ {
15024         fn clone(&self) -> Self {
15025                 if self.result_ok {
15026                         Self { result_ok: true, contents: CResult_PingDecodeErrorZPtr {
15027                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::Ping>::clone(unsafe { &*self.contents.result })))
15028                         } }
15029                 } else {
15030                         Self { result_ok: false, contents: CResult_PingDecodeErrorZPtr {
15031                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
15032                         } }
15033                 }
15034         }
15035 }
15036 #[no_mangle]
15037 /// Creates a new CResult_PingDecodeErrorZ which has the same data as `orig`
15038 /// but with all dynamically-allocated buffers duplicated in new buffers.
15039 pub extern "C" fn CResult_PingDecodeErrorZ_clone(orig: &CResult_PingDecodeErrorZ) -> CResult_PingDecodeErrorZ { Clone::clone(&orig) }
15040 #[repr(C)]
15041 /// The contents of CResult_PongDecodeErrorZ
15042 pub union CResult_PongDecodeErrorZPtr {
15043         /// A pointer to the contents in the success state.
15044         /// Reading from this pointer when `result_ok` is not set is undefined.
15045         pub result: *mut crate::lightning::ln::msgs::Pong,
15046         /// A pointer to the contents in the error state.
15047         /// Reading from this pointer when `result_ok` is set is undefined.
15048         pub err: *mut crate::lightning::ln::msgs::DecodeError,
15049 }
15050 #[repr(C)]
15051 /// A CResult_PongDecodeErrorZ represents the result of a fallible operation,
15052 /// containing a crate::lightning::ln::msgs::Pong on success and a crate::lightning::ln::msgs::DecodeError on failure.
15053 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
15054 pub struct CResult_PongDecodeErrorZ {
15055         /// The contents of this CResult_PongDecodeErrorZ, accessible via either
15056         /// `err` or `result` depending on the state of `result_ok`.
15057         pub contents: CResult_PongDecodeErrorZPtr,
15058         /// Whether this CResult_PongDecodeErrorZ represents a success state.
15059         pub result_ok: bool,
15060 }
15061 #[no_mangle]
15062 /// Creates a new CResult_PongDecodeErrorZ in the success state.
15063 pub extern "C" fn CResult_PongDecodeErrorZ_ok(o: crate::lightning::ln::msgs::Pong) -> CResult_PongDecodeErrorZ {
15064         CResult_PongDecodeErrorZ {
15065                 contents: CResult_PongDecodeErrorZPtr {
15066                         result: Box::into_raw(Box::new(o)),
15067                 },
15068                 result_ok: true,
15069         }
15070 }
15071 #[no_mangle]
15072 /// Creates a new CResult_PongDecodeErrorZ in the error state.
15073 pub extern "C" fn CResult_PongDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_PongDecodeErrorZ {
15074         CResult_PongDecodeErrorZ {
15075                 contents: CResult_PongDecodeErrorZPtr {
15076                         err: Box::into_raw(Box::new(e)),
15077                 },
15078                 result_ok: false,
15079         }
15080 }
15081 /// Checks if the given object is currently in the success state
15082 #[no_mangle]
15083 pub extern "C" fn CResult_PongDecodeErrorZ_is_ok(o: &CResult_PongDecodeErrorZ) -> bool {
15084         o.result_ok
15085 }
15086 #[no_mangle]
15087 /// Frees any resources used by the CResult_PongDecodeErrorZ.
15088 pub extern "C" fn CResult_PongDecodeErrorZ_free(_res: CResult_PongDecodeErrorZ) { }
15089 impl Drop for CResult_PongDecodeErrorZ {
15090         fn drop(&mut self) {
15091                 if self.result_ok {
15092                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
15093                                 let _ = unsafe { Box::from_raw(self.contents.result) };
15094                         }
15095                 } else {
15096                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
15097                                 let _ = unsafe { Box::from_raw(self.contents.err) };
15098                         }
15099                 }
15100         }
15101 }
15102 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::Pong, crate::lightning::ln::msgs::DecodeError>> for CResult_PongDecodeErrorZ {
15103         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::Pong, crate::lightning::ln::msgs::DecodeError>) -> Self {
15104                 let contents = if o.result_ok {
15105                         let result = unsafe { o.contents.result };
15106                         unsafe { o.contents.result = core::ptr::null_mut() };
15107                         CResult_PongDecodeErrorZPtr { result }
15108                 } else {
15109                         let err = unsafe { o.contents.err };
15110                         unsafe { o.contents.err = core::ptr::null_mut(); }
15111                         CResult_PongDecodeErrorZPtr { err }
15112                 };
15113                 Self {
15114                         contents,
15115                         result_ok: o.result_ok,
15116                 }
15117         }
15118 }
15119 impl Clone for CResult_PongDecodeErrorZ {
15120         fn clone(&self) -> Self {
15121                 if self.result_ok {
15122                         Self { result_ok: true, contents: CResult_PongDecodeErrorZPtr {
15123                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::Pong>::clone(unsafe { &*self.contents.result })))
15124                         } }
15125                 } else {
15126                         Self { result_ok: false, contents: CResult_PongDecodeErrorZPtr {
15127                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
15128                         } }
15129                 }
15130         }
15131 }
15132 #[no_mangle]
15133 /// Creates a new CResult_PongDecodeErrorZ which has the same data as `orig`
15134 /// but with all dynamically-allocated buffers duplicated in new buffers.
15135 pub extern "C" fn CResult_PongDecodeErrorZ_clone(orig: &CResult_PongDecodeErrorZ) -> CResult_PongDecodeErrorZ { Clone::clone(&orig) }
15136 #[repr(C)]
15137 /// The contents of CResult_UnsignedChannelAnnouncementDecodeErrorZ
15138 pub union CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
15139         /// A pointer to the contents in the success state.
15140         /// Reading from this pointer when `result_ok` is not set is undefined.
15141         pub result: *mut crate::lightning::ln::msgs::UnsignedChannelAnnouncement,
15142         /// A pointer to the contents in the error state.
15143         /// Reading from this pointer when `result_ok` is set is undefined.
15144         pub err: *mut crate::lightning::ln::msgs::DecodeError,
15145 }
15146 #[repr(C)]
15147 /// A CResult_UnsignedChannelAnnouncementDecodeErrorZ represents the result of a fallible operation,
15148 /// containing a crate::lightning::ln::msgs::UnsignedChannelAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
15149 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
15150 pub struct CResult_UnsignedChannelAnnouncementDecodeErrorZ {
15151         /// The contents of this CResult_UnsignedChannelAnnouncementDecodeErrorZ, accessible via either
15152         /// `err` or `result` depending on the state of `result_ok`.
15153         pub contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr,
15154         /// Whether this CResult_UnsignedChannelAnnouncementDecodeErrorZ represents a success state.
15155         pub result_ok: bool,
15156 }
15157 #[no_mangle]
15158 /// Creates a new CResult_UnsignedChannelAnnouncementDecodeErrorZ in the success state.
15159 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UnsignedChannelAnnouncement) -> CResult_UnsignedChannelAnnouncementDecodeErrorZ {
15160         CResult_UnsignedChannelAnnouncementDecodeErrorZ {
15161                 contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
15162                         result: Box::into_raw(Box::new(o)),
15163                 },
15164                 result_ok: true,
15165         }
15166 }
15167 #[no_mangle]
15168 /// Creates a new CResult_UnsignedChannelAnnouncementDecodeErrorZ in the error state.
15169 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UnsignedChannelAnnouncementDecodeErrorZ {
15170         CResult_UnsignedChannelAnnouncementDecodeErrorZ {
15171                 contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
15172                         err: Box::into_raw(Box::new(e)),
15173                 },
15174                 result_ok: false,
15175         }
15176 }
15177 /// Checks if the given object is currently in the success state
15178 #[no_mangle]
15179 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_is_ok(o: &CResult_UnsignedChannelAnnouncementDecodeErrorZ) -> bool {
15180         o.result_ok
15181 }
15182 #[no_mangle]
15183 /// Frees any resources used by the CResult_UnsignedChannelAnnouncementDecodeErrorZ.
15184 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_free(_res: CResult_UnsignedChannelAnnouncementDecodeErrorZ) { }
15185 impl Drop for CResult_UnsignedChannelAnnouncementDecodeErrorZ {
15186         fn drop(&mut self) {
15187                 if self.result_ok {
15188                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
15189                                 let _ = unsafe { Box::from_raw(self.contents.result) };
15190                         }
15191                 } else {
15192                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
15193                                 let _ = unsafe { Box::from_raw(self.contents.err) };
15194                         }
15195                 }
15196         }
15197 }
15198 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedChannelAnnouncement, crate::lightning::ln::msgs::DecodeError>> for CResult_UnsignedChannelAnnouncementDecodeErrorZ {
15199         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedChannelAnnouncement, crate::lightning::ln::msgs::DecodeError>) -> Self {
15200                 let contents = if o.result_ok {
15201                         let result = unsafe { o.contents.result };
15202                         unsafe { o.contents.result = core::ptr::null_mut() };
15203                         CResult_UnsignedChannelAnnouncementDecodeErrorZPtr { result }
15204                 } else {
15205                         let err = unsafe { o.contents.err };
15206                         unsafe { o.contents.err = core::ptr::null_mut(); }
15207                         CResult_UnsignedChannelAnnouncementDecodeErrorZPtr { err }
15208                 };
15209                 Self {
15210                         contents,
15211                         result_ok: o.result_ok,
15212                 }
15213         }
15214 }
15215 impl Clone for CResult_UnsignedChannelAnnouncementDecodeErrorZ {
15216         fn clone(&self) -> Self {
15217                 if self.result_ok {
15218                         Self { result_ok: true, contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
15219                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UnsignedChannelAnnouncement>::clone(unsafe { &*self.contents.result })))
15220                         } }
15221                 } else {
15222                         Self { result_ok: false, contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
15223                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
15224                         } }
15225                 }
15226         }
15227 }
15228 #[no_mangle]
15229 /// Creates a new CResult_UnsignedChannelAnnouncementDecodeErrorZ which has the same data as `orig`
15230 /// but with all dynamically-allocated buffers duplicated in new buffers.
15231 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone(orig: &CResult_UnsignedChannelAnnouncementDecodeErrorZ) -> CResult_UnsignedChannelAnnouncementDecodeErrorZ { Clone::clone(&orig) }
15232 #[repr(C)]
15233 /// The contents of CResult_ChannelAnnouncementDecodeErrorZ
15234 pub union CResult_ChannelAnnouncementDecodeErrorZPtr {
15235         /// A pointer to the contents in the success state.
15236         /// Reading from this pointer when `result_ok` is not set is undefined.
15237         pub result: *mut crate::lightning::ln::msgs::ChannelAnnouncement,
15238         /// A pointer to the contents in the error state.
15239         /// Reading from this pointer when `result_ok` is set is undefined.
15240         pub err: *mut crate::lightning::ln::msgs::DecodeError,
15241 }
15242 #[repr(C)]
15243 /// A CResult_ChannelAnnouncementDecodeErrorZ represents the result of a fallible operation,
15244 /// containing a crate::lightning::ln::msgs::ChannelAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
15245 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
15246 pub struct CResult_ChannelAnnouncementDecodeErrorZ {
15247         /// The contents of this CResult_ChannelAnnouncementDecodeErrorZ, accessible via either
15248         /// `err` or `result` depending on the state of `result_ok`.
15249         pub contents: CResult_ChannelAnnouncementDecodeErrorZPtr,
15250         /// Whether this CResult_ChannelAnnouncementDecodeErrorZ represents a success state.
15251         pub result_ok: bool,
15252 }
15253 #[no_mangle]
15254 /// Creates a new CResult_ChannelAnnouncementDecodeErrorZ in the success state.
15255 pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ChannelAnnouncement) -> CResult_ChannelAnnouncementDecodeErrorZ {
15256         CResult_ChannelAnnouncementDecodeErrorZ {
15257                 contents: CResult_ChannelAnnouncementDecodeErrorZPtr {
15258                         result: Box::into_raw(Box::new(o)),
15259                 },
15260                 result_ok: true,
15261         }
15262 }
15263 #[no_mangle]
15264 /// Creates a new CResult_ChannelAnnouncementDecodeErrorZ in the error state.
15265 pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelAnnouncementDecodeErrorZ {
15266         CResult_ChannelAnnouncementDecodeErrorZ {
15267                 contents: CResult_ChannelAnnouncementDecodeErrorZPtr {
15268                         err: Box::into_raw(Box::new(e)),
15269                 },
15270                 result_ok: false,
15271         }
15272 }
15273 /// Checks if the given object is currently in the success state
15274 #[no_mangle]
15275 pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_is_ok(o: &CResult_ChannelAnnouncementDecodeErrorZ) -> bool {
15276         o.result_ok
15277 }
15278 #[no_mangle]
15279 /// Frees any resources used by the CResult_ChannelAnnouncementDecodeErrorZ.
15280 pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_free(_res: CResult_ChannelAnnouncementDecodeErrorZ) { }
15281 impl Drop for CResult_ChannelAnnouncementDecodeErrorZ {
15282         fn drop(&mut self) {
15283                 if self.result_ok {
15284                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
15285                                 let _ = unsafe { Box::from_raw(self.contents.result) };
15286                         }
15287                 } else {
15288                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
15289                                 let _ = unsafe { Box::from_raw(self.contents.err) };
15290                         }
15291                 }
15292         }
15293 }
15294 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelAnnouncement, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelAnnouncementDecodeErrorZ {
15295         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelAnnouncement, crate::lightning::ln::msgs::DecodeError>) -> Self {
15296                 let contents = if o.result_ok {
15297                         let result = unsafe { o.contents.result };
15298                         unsafe { o.contents.result = core::ptr::null_mut() };
15299                         CResult_ChannelAnnouncementDecodeErrorZPtr { result }
15300                 } else {
15301                         let err = unsafe { o.contents.err };
15302                         unsafe { o.contents.err = core::ptr::null_mut(); }
15303                         CResult_ChannelAnnouncementDecodeErrorZPtr { err }
15304                 };
15305                 Self {
15306                         contents,
15307                         result_ok: o.result_ok,
15308                 }
15309         }
15310 }
15311 impl Clone for CResult_ChannelAnnouncementDecodeErrorZ {
15312         fn clone(&self) -> Self {
15313                 if self.result_ok {
15314                         Self { result_ok: true, contents: CResult_ChannelAnnouncementDecodeErrorZPtr {
15315                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ChannelAnnouncement>::clone(unsafe { &*self.contents.result })))
15316                         } }
15317                 } else {
15318                         Self { result_ok: false, contents: CResult_ChannelAnnouncementDecodeErrorZPtr {
15319                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
15320                         } }
15321                 }
15322         }
15323 }
15324 #[no_mangle]
15325 /// Creates a new CResult_ChannelAnnouncementDecodeErrorZ which has the same data as `orig`
15326 /// but with all dynamically-allocated buffers duplicated in new buffers.
15327 pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_clone(orig: &CResult_ChannelAnnouncementDecodeErrorZ) -> CResult_ChannelAnnouncementDecodeErrorZ { Clone::clone(&orig) }
15328 #[repr(C)]
15329 /// The contents of CResult_UnsignedChannelUpdateDecodeErrorZ
15330 pub union CResult_UnsignedChannelUpdateDecodeErrorZPtr {
15331         /// A pointer to the contents in the success state.
15332         /// Reading from this pointer when `result_ok` is not set is undefined.
15333         pub result: *mut crate::lightning::ln::msgs::UnsignedChannelUpdate,
15334         /// A pointer to the contents in the error state.
15335         /// Reading from this pointer when `result_ok` is set is undefined.
15336         pub err: *mut crate::lightning::ln::msgs::DecodeError,
15337 }
15338 #[repr(C)]
15339 /// A CResult_UnsignedChannelUpdateDecodeErrorZ represents the result of a fallible operation,
15340 /// containing a crate::lightning::ln::msgs::UnsignedChannelUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
15341 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
15342 pub struct CResult_UnsignedChannelUpdateDecodeErrorZ {
15343         /// The contents of this CResult_UnsignedChannelUpdateDecodeErrorZ, accessible via either
15344         /// `err` or `result` depending on the state of `result_ok`.
15345         pub contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr,
15346         /// Whether this CResult_UnsignedChannelUpdateDecodeErrorZ represents a success state.
15347         pub result_ok: bool,
15348 }
15349 #[no_mangle]
15350 /// Creates a new CResult_UnsignedChannelUpdateDecodeErrorZ in the success state.
15351 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UnsignedChannelUpdate) -> CResult_UnsignedChannelUpdateDecodeErrorZ {
15352         CResult_UnsignedChannelUpdateDecodeErrorZ {
15353                 contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr {
15354                         result: Box::into_raw(Box::new(o)),
15355                 },
15356                 result_ok: true,
15357         }
15358 }
15359 #[no_mangle]
15360 /// Creates a new CResult_UnsignedChannelUpdateDecodeErrorZ in the error state.
15361 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UnsignedChannelUpdateDecodeErrorZ {
15362         CResult_UnsignedChannelUpdateDecodeErrorZ {
15363                 contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr {
15364                         err: Box::into_raw(Box::new(e)),
15365                 },
15366                 result_ok: false,
15367         }
15368 }
15369 /// Checks if the given object is currently in the success state
15370 #[no_mangle]
15371 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_is_ok(o: &CResult_UnsignedChannelUpdateDecodeErrorZ) -> bool {
15372         o.result_ok
15373 }
15374 #[no_mangle]
15375 /// Frees any resources used by the CResult_UnsignedChannelUpdateDecodeErrorZ.
15376 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_free(_res: CResult_UnsignedChannelUpdateDecodeErrorZ) { }
15377 impl Drop for CResult_UnsignedChannelUpdateDecodeErrorZ {
15378         fn drop(&mut self) {
15379                 if self.result_ok {
15380                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
15381                                 let _ = unsafe { Box::from_raw(self.contents.result) };
15382                         }
15383                 } else {
15384                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
15385                                 let _ = unsafe { Box::from_raw(self.contents.err) };
15386                         }
15387                 }
15388         }
15389 }
15390 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedChannelUpdate, crate::lightning::ln::msgs::DecodeError>> for CResult_UnsignedChannelUpdateDecodeErrorZ {
15391         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedChannelUpdate, crate::lightning::ln::msgs::DecodeError>) -> Self {
15392                 let contents = if o.result_ok {
15393                         let result = unsafe { o.contents.result };
15394                         unsafe { o.contents.result = core::ptr::null_mut() };
15395                         CResult_UnsignedChannelUpdateDecodeErrorZPtr { result }
15396                 } else {
15397                         let err = unsafe { o.contents.err };
15398                         unsafe { o.contents.err = core::ptr::null_mut(); }
15399                         CResult_UnsignedChannelUpdateDecodeErrorZPtr { err }
15400                 };
15401                 Self {
15402                         contents,
15403                         result_ok: o.result_ok,
15404                 }
15405         }
15406 }
15407 impl Clone for CResult_UnsignedChannelUpdateDecodeErrorZ {
15408         fn clone(&self) -> Self {
15409                 if self.result_ok {
15410                         Self { result_ok: true, contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr {
15411                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UnsignedChannelUpdate>::clone(unsafe { &*self.contents.result })))
15412                         } }
15413                 } else {
15414                         Self { result_ok: false, contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr {
15415                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
15416                         } }
15417                 }
15418         }
15419 }
15420 #[no_mangle]
15421 /// Creates a new CResult_UnsignedChannelUpdateDecodeErrorZ which has the same data as `orig`
15422 /// but with all dynamically-allocated buffers duplicated in new buffers.
15423 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_clone(orig: &CResult_UnsignedChannelUpdateDecodeErrorZ) -> CResult_UnsignedChannelUpdateDecodeErrorZ { Clone::clone(&orig) }
15424 #[repr(C)]
15425 /// The contents of CResult_ChannelUpdateDecodeErrorZ
15426 pub union CResult_ChannelUpdateDecodeErrorZPtr {
15427         /// A pointer to the contents in the success state.
15428         /// Reading from this pointer when `result_ok` is not set is undefined.
15429         pub result: *mut crate::lightning::ln::msgs::ChannelUpdate,
15430         /// A pointer to the contents in the error state.
15431         /// Reading from this pointer when `result_ok` is set is undefined.
15432         pub err: *mut crate::lightning::ln::msgs::DecodeError,
15433 }
15434 #[repr(C)]
15435 /// A CResult_ChannelUpdateDecodeErrorZ represents the result of a fallible operation,
15436 /// containing a crate::lightning::ln::msgs::ChannelUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
15437 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
15438 pub struct CResult_ChannelUpdateDecodeErrorZ {
15439         /// The contents of this CResult_ChannelUpdateDecodeErrorZ, accessible via either
15440         /// `err` or `result` depending on the state of `result_ok`.
15441         pub contents: CResult_ChannelUpdateDecodeErrorZPtr,
15442         /// Whether this CResult_ChannelUpdateDecodeErrorZ represents a success state.
15443         pub result_ok: bool,
15444 }
15445 #[no_mangle]
15446 /// Creates a new CResult_ChannelUpdateDecodeErrorZ in the success state.
15447 pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ChannelUpdate) -> CResult_ChannelUpdateDecodeErrorZ {
15448         CResult_ChannelUpdateDecodeErrorZ {
15449                 contents: CResult_ChannelUpdateDecodeErrorZPtr {
15450                         result: Box::into_raw(Box::new(o)),
15451                 },
15452                 result_ok: true,
15453         }
15454 }
15455 #[no_mangle]
15456 /// Creates a new CResult_ChannelUpdateDecodeErrorZ in the error state.
15457 pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelUpdateDecodeErrorZ {
15458         CResult_ChannelUpdateDecodeErrorZ {
15459                 contents: CResult_ChannelUpdateDecodeErrorZPtr {
15460                         err: Box::into_raw(Box::new(e)),
15461                 },
15462                 result_ok: false,
15463         }
15464 }
15465 /// Checks if the given object is currently in the success state
15466 #[no_mangle]
15467 pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_is_ok(o: &CResult_ChannelUpdateDecodeErrorZ) -> bool {
15468         o.result_ok
15469 }
15470 #[no_mangle]
15471 /// Frees any resources used by the CResult_ChannelUpdateDecodeErrorZ.
15472 pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_free(_res: CResult_ChannelUpdateDecodeErrorZ) { }
15473 impl Drop for CResult_ChannelUpdateDecodeErrorZ {
15474         fn drop(&mut self) {
15475                 if self.result_ok {
15476                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
15477                                 let _ = unsafe { Box::from_raw(self.contents.result) };
15478                         }
15479                 } else {
15480                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
15481                                 let _ = unsafe { Box::from_raw(self.contents.err) };
15482                         }
15483                 }
15484         }
15485 }
15486 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelUpdate, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelUpdateDecodeErrorZ {
15487         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelUpdate, crate::lightning::ln::msgs::DecodeError>) -> Self {
15488                 let contents = if o.result_ok {
15489                         let result = unsafe { o.contents.result };
15490                         unsafe { o.contents.result = core::ptr::null_mut() };
15491                         CResult_ChannelUpdateDecodeErrorZPtr { result }
15492                 } else {
15493                         let err = unsafe { o.contents.err };
15494                         unsafe { o.contents.err = core::ptr::null_mut(); }
15495                         CResult_ChannelUpdateDecodeErrorZPtr { err }
15496                 };
15497                 Self {
15498                         contents,
15499                         result_ok: o.result_ok,
15500                 }
15501         }
15502 }
15503 impl Clone for CResult_ChannelUpdateDecodeErrorZ {
15504         fn clone(&self) -> Self {
15505                 if self.result_ok {
15506                         Self { result_ok: true, contents: CResult_ChannelUpdateDecodeErrorZPtr {
15507                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ChannelUpdate>::clone(unsafe { &*self.contents.result })))
15508                         } }
15509                 } else {
15510                         Self { result_ok: false, contents: CResult_ChannelUpdateDecodeErrorZPtr {
15511                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
15512                         } }
15513                 }
15514         }
15515 }
15516 #[no_mangle]
15517 /// Creates a new CResult_ChannelUpdateDecodeErrorZ which has the same data as `orig`
15518 /// but with all dynamically-allocated buffers duplicated in new buffers.
15519 pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_clone(orig: &CResult_ChannelUpdateDecodeErrorZ) -> CResult_ChannelUpdateDecodeErrorZ { Clone::clone(&orig) }
15520 #[repr(C)]
15521 /// The contents of CResult_ErrorMessageDecodeErrorZ
15522 pub union CResult_ErrorMessageDecodeErrorZPtr {
15523         /// A pointer to the contents in the success state.
15524         /// Reading from this pointer when `result_ok` is not set is undefined.
15525         pub result: *mut crate::lightning::ln::msgs::ErrorMessage,
15526         /// A pointer to the contents in the error state.
15527         /// Reading from this pointer when `result_ok` is set is undefined.
15528         pub err: *mut crate::lightning::ln::msgs::DecodeError,
15529 }
15530 #[repr(C)]
15531 /// A CResult_ErrorMessageDecodeErrorZ represents the result of a fallible operation,
15532 /// containing a crate::lightning::ln::msgs::ErrorMessage on success and a crate::lightning::ln::msgs::DecodeError on failure.
15533 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
15534 pub struct CResult_ErrorMessageDecodeErrorZ {
15535         /// The contents of this CResult_ErrorMessageDecodeErrorZ, accessible via either
15536         /// `err` or `result` depending on the state of `result_ok`.
15537         pub contents: CResult_ErrorMessageDecodeErrorZPtr,
15538         /// Whether this CResult_ErrorMessageDecodeErrorZ represents a success state.
15539         pub result_ok: bool,
15540 }
15541 #[no_mangle]
15542 /// Creates a new CResult_ErrorMessageDecodeErrorZ in the success state.
15543 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ErrorMessage) -> CResult_ErrorMessageDecodeErrorZ {
15544         CResult_ErrorMessageDecodeErrorZ {
15545                 contents: CResult_ErrorMessageDecodeErrorZPtr {
15546                         result: Box::into_raw(Box::new(o)),
15547                 },
15548                 result_ok: true,
15549         }
15550 }
15551 #[no_mangle]
15552 /// Creates a new CResult_ErrorMessageDecodeErrorZ in the error state.
15553 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ErrorMessageDecodeErrorZ {
15554         CResult_ErrorMessageDecodeErrorZ {
15555                 contents: CResult_ErrorMessageDecodeErrorZPtr {
15556                         err: Box::into_raw(Box::new(e)),
15557                 },
15558                 result_ok: false,
15559         }
15560 }
15561 /// Checks if the given object is currently in the success state
15562 #[no_mangle]
15563 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_is_ok(o: &CResult_ErrorMessageDecodeErrorZ) -> bool {
15564         o.result_ok
15565 }
15566 #[no_mangle]
15567 /// Frees any resources used by the CResult_ErrorMessageDecodeErrorZ.
15568 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_free(_res: CResult_ErrorMessageDecodeErrorZ) { }
15569 impl Drop for CResult_ErrorMessageDecodeErrorZ {
15570         fn drop(&mut self) {
15571                 if self.result_ok {
15572                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
15573                                 let _ = unsafe { Box::from_raw(self.contents.result) };
15574                         }
15575                 } else {
15576                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
15577                                 let _ = unsafe { Box::from_raw(self.contents.err) };
15578                         }
15579                 }
15580         }
15581 }
15582 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ErrorMessage, crate::lightning::ln::msgs::DecodeError>> for CResult_ErrorMessageDecodeErrorZ {
15583         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ErrorMessage, crate::lightning::ln::msgs::DecodeError>) -> Self {
15584                 let contents = if o.result_ok {
15585                         let result = unsafe { o.contents.result };
15586                         unsafe { o.contents.result = core::ptr::null_mut() };
15587                         CResult_ErrorMessageDecodeErrorZPtr { result }
15588                 } else {
15589                         let err = unsafe { o.contents.err };
15590                         unsafe { o.contents.err = core::ptr::null_mut(); }
15591                         CResult_ErrorMessageDecodeErrorZPtr { err }
15592                 };
15593                 Self {
15594                         contents,
15595                         result_ok: o.result_ok,
15596                 }
15597         }
15598 }
15599 impl Clone for CResult_ErrorMessageDecodeErrorZ {
15600         fn clone(&self) -> Self {
15601                 if self.result_ok {
15602                         Self { result_ok: true, contents: CResult_ErrorMessageDecodeErrorZPtr {
15603                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ErrorMessage>::clone(unsafe { &*self.contents.result })))
15604                         } }
15605                 } else {
15606                         Self { result_ok: false, contents: CResult_ErrorMessageDecodeErrorZPtr {
15607                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
15608                         } }
15609                 }
15610         }
15611 }
15612 #[no_mangle]
15613 /// Creates a new CResult_ErrorMessageDecodeErrorZ which has the same data as `orig`
15614 /// but with all dynamically-allocated buffers duplicated in new buffers.
15615 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_clone(orig: &CResult_ErrorMessageDecodeErrorZ) -> CResult_ErrorMessageDecodeErrorZ { Clone::clone(&orig) }
15616 #[repr(C)]
15617 /// The contents of CResult_WarningMessageDecodeErrorZ
15618 pub union CResult_WarningMessageDecodeErrorZPtr {
15619         /// A pointer to the contents in the success state.
15620         /// Reading from this pointer when `result_ok` is not set is undefined.
15621         pub result: *mut crate::lightning::ln::msgs::WarningMessage,
15622         /// A pointer to the contents in the error state.
15623         /// Reading from this pointer when `result_ok` is set is undefined.
15624         pub err: *mut crate::lightning::ln::msgs::DecodeError,
15625 }
15626 #[repr(C)]
15627 /// A CResult_WarningMessageDecodeErrorZ represents the result of a fallible operation,
15628 /// containing a crate::lightning::ln::msgs::WarningMessage on success and a crate::lightning::ln::msgs::DecodeError on failure.
15629 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
15630 pub struct CResult_WarningMessageDecodeErrorZ {
15631         /// The contents of this CResult_WarningMessageDecodeErrorZ, accessible via either
15632         /// `err` or `result` depending on the state of `result_ok`.
15633         pub contents: CResult_WarningMessageDecodeErrorZPtr,
15634         /// Whether this CResult_WarningMessageDecodeErrorZ represents a success state.
15635         pub result_ok: bool,
15636 }
15637 #[no_mangle]
15638 /// Creates a new CResult_WarningMessageDecodeErrorZ in the success state.
15639 pub extern "C" fn CResult_WarningMessageDecodeErrorZ_ok(o: crate::lightning::ln::msgs::WarningMessage) -> CResult_WarningMessageDecodeErrorZ {
15640         CResult_WarningMessageDecodeErrorZ {
15641                 contents: CResult_WarningMessageDecodeErrorZPtr {
15642                         result: Box::into_raw(Box::new(o)),
15643                 },
15644                 result_ok: true,
15645         }
15646 }
15647 #[no_mangle]
15648 /// Creates a new CResult_WarningMessageDecodeErrorZ in the error state.
15649 pub extern "C" fn CResult_WarningMessageDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_WarningMessageDecodeErrorZ {
15650         CResult_WarningMessageDecodeErrorZ {
15651                 contents: CResult_WarningMessageDecodeErrorZPtr {
15652                         err: Box::into_raw(Box::new(e)),
15653                 },
15654                 result_ok: false,
15655         }
15656 }
15657 /// Checks if the given object is currently in the success state
15658 #[no_mangle]
15659 pub extern "C" fn CResult_WarningMessageDecodeErrorZ_is_ok(o: &CResult_WarningMessageDecodeErrorZ) -> bool {
15660         o.result_ok
15661 }
15662 #[no_mangle]
15663 /// Frees any resources used by the CResult_WarningMessageDecodeErrorZ.
15664 pub extern "C" fn CResult_WarningMessageDecodeErrorZ_free(_res: CResult_WarningMessageDecodeErrorZ) { }
15665 impl Drop for CResult_WarningMessageDecodeErrorZ {
15666         fn drop(&mut self) {
15667                 if self.result_ok {
15668                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
15669                                 let _ = unsafe { Box::from_raw(self.contents.result) };
15670                         }
15671                 } else {
15672                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
15673                                 let _ = unsafe { Box::from_raw(self.contents.err) };
15674                         }
15675                 }
15676         }
15677 }
15678 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::WarningMessage, crate::lightning::ln::msgs::DecodeError>> for CResult_WarningMessageDecodeErrorZ {
15679         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::WarningMessage, crate::lightning::ln::msgs::DecodeError>) -> Self {
15680                 let contents = if o.result_ok {
15681                         let result = unsafe { o.contents.result };
15682                         unsafe { o.contents.result = core::ptr::null_mut() };
15683                         CResult_WarningMessageDecodeErrorZPtr { result }
15684                 } else {
15685                         let err = unsafe { o.contents.err };
15686                         unsafe { o.contents.err = core::ptr::null_mut(); }
15687                         CResult_WarningMessageDecodeErrorZPtr { err }
15688                 };
15689                 Self {
15690                         contents,
15691                         result_ok: o.result_ok,
15692                 }
15693         }
15694 }
15695 impl Clone for CResult_WarningMessageDecodeErrorZ {
15696         fn clone(&self) -> Self {
15697                 if self.result_ok {
15698                         Self { result_ok: true, contents: CResult_WarningMessageDecodeErrorZPtr {
15699                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::WarningMessage>::clone(unsafe { &*self.contents.result })))
15700                         } }
15701                 } else {
15702                         Self { result_ok: false, contents: CResult_WarningMessageDecodeErrorZPtr {
15703                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
15704                         } }
15705                 }
15706         }
15707 }
15708 #[no_mangle]
15709 /// Creates a new CResult_WarningMessageDecodeErrorZ which has the same data as `orig`
15710 /// but with all dynamically-allocated buffers duplicated in new buffers.
15711 pub extern "C" fn CResult_WarningMessageDecodeErrorZ_clone(orig: &CResult_WarningMessageDecodeErrorZ) -> CResult_WarningMessageDecodeErrorZ { Clone::clone(&orig) }
15712 #[repr(C)]
15713 /// The contents of CResult_UnsignedNodeAnnouncementDecodeErrorZ
15714 pub union CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
15715         /// A pointer to the contents in the success state.
15716         /// Reading from this pointer when `result_ok` is not set is undefined.
15717         pub result: *mut crate::lightning::ln::msgs::UnsignedNodeAnnouncement,
15718         /// A pointer to the contents in the error state.
15719         /// Reading from this pointer when `result_ok` is set is undefined.
15720         pub err: *mut crate::lightning::ln::msgs::DecodeError,
15721 }
15722 #[repr(C)]
15723 /// A CResult_UnsignedNodeAnnouncementDecodeErrorZ represents the result of a fallible operation,
15724 /// containing a crate::lightning::ln::msgs::UnsignedNodeAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
15725 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
15726 pub struct CResult_UnsignedNodeAnnouncementDecodeErrorZ {
15727         /// The contents of this CResult_UnsignedNodeAnnouncementDecodeErrorZ, accessible via either
15728         /// `err` or `result` depending on the state of `result_ok`.
15729         pub contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr,
15730         /// Whether this CResult_UnsignedNodeAnnouncementDecodeErrorZ represents a success state.
15731         pub result_ok: bool,
15732 }
15733 #[no_mangle]
15734 /// Creates a new CResult_UnsignedNodeAnnouncementDecodeErrorZ in the success state.
15735 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UnsignedNodeAnnouncement) -> CResult_UnsignedNodeAnnouncementDecodeErrorZ {
15736         CResult_UnsignedNodeAnnouncementDecodeErrorZ {
15737                 contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
15738                         result: Box::into_raw(Box::new(o)),
15739                 },
15740                 result_ok: true,
15741         }
15742 }
15743 #[no_mangle]
15744 /// Creates a new CResult_UnsignedNodeAnnouncementDecodeErrorZ in the error state.
15745 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UnsignedNodeAnnouncementDecodeErrorZ {
15746         CResult_UnsignedNodeAnnouncementDecodeErrorZ {
15747                 contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
15748                         err: Box::into_raw(Box::new(e)),
15749                 },
15750                 result_ok: false,
15751         }
15752 }
15753 /// Checks if the given object is currently in the success state
15754 #[no_mangle]
15755 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_is_ok(o: &CResult_UnsignedNodeAnnouncementDecodeErrorZ) -> bool {
15756         o.result_ok
15757 }
15758 #[no_mangle]
15759 /// Frees any resources used by the CResult_UnsignedNodeAnnouncementDecodeErrorZ.
15760 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_free(_res: CResult_UnsignedNodeAnnouncementDecodeErrorZ) { }
15761 impl Drop for CResult_UnsignedNodeAnnouncementDecodeErrorZ {
15762         fn drop(&mut self) {
15763                 if self.result_ok {
15764                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
15765                                 let _ = unsafe { Box::from_raw(self.contents.result) };
15766                         }
15767                 } else {
15768                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
15769                                 let _ = unsafe { Box::from_raw(self.contents.err) };
15770                         }
15771                 }
15772         }
15773 }
15774 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedNodeAnnouncement, crate::lightning::ln::msgs::DecodeError>> for CResult_UnsignedNodeAnnouncementDecodeErrorZ {
15775         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedNodeAnnouncement, crate::lightning::ln::msgs::DecodeError>) -> Self {
15776                 let contents = if o.result_ok {
15777                         let result = unsafe { o.contents.result };
15778                         unsafe { o.contents.result = core::ptr::null_mut() };
15779                         CResult_UnsignedNodeAnnouncementDecodeErrorZPtr { result }
15780                 } else {
15781                         let err = unsafe { o.contents.err };
15782                         unsafe { o.contents.err = core::ptr::null_mut(); }
15783                         CResult_UnsignedNodeAnnouncementDecodeErrorZPtr { err }
15784                 };
15785                 Self {
15786                         contents,
15787                         result_ok: o.result_ok,
15788                 }
15789         }
15790 }
15791 impl Clone for CResult_UnsignedNodeAnnouncementDecodeErrorZ {
15792         fn clone(&self) -> Self {
15793                 if self.result_ok {
15794                         Self { result_ok: true, contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
15795                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UnsignedNodeAnnouncement>::clone(unsafe { &*self.contents.result })))
15796                         } }
15797                 } else {
15798                         Self { result_ok: false, contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
15799                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
15800                         } }
15801                 }
15802         }
15803 }
15804 #[no_mangle]
15805 /// Creates a new CResult_UnsignedNodeAnnouncementDecodeErrorZ which has the same data as `orig`
15806 /// but with all dynamically-allocated buffers duplicated in new buffers.
15807 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone(orig: &CResult_UnsignedNodeAnnouncementDecodeErrorZ) -> CResult_UnsignedNodeAnnouncementDecodeErrorZ { Clone::clone(&orig) }
15808 #[repr(C)]
15809 /// The contents of CResult_NodeAnnouncementDecodeErrorZ
15810 pub union CResult_NodeAnnouncementDecodeErrorZPtr {
15811         /// A pointer to the contents in the success state.
15812         /// Reading from this pointer when `result_ok` is not set is undefined.
15813         pub result: *mut crate::lightning::ln::msgs::NodeAnnouncement,
15814         /// A pointer to the contents in the error state.
15815         /// Reading from this pointer when `result_ok` is set is undefined.
15816         pub err: *mut crate::lightning::ln::msgs::DecodeError,
15817 }
15818 #[repr(C)]
15819 /// A CResult_NodeAnnouncementDecodeErrorZ represents the result of a fallible operation,
15820 /// containing a crate::lightning::ln::msgs::NodeAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
15821 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
15822 pub struct CResult_NodeAnnouncementDecodeErrorZ {
15823         /// The contents of this CResult_NodeAnnouncementDecodeErrorZ, accessible via either
15824         /// `err` or `result` depending on the state of `result_ok`.
15825         pub contents: CResult_NodeAnnouncementDecodeErrorZPtr,
15826         /// Whether this CResult_NodeAnnouncementDecodeErrorZ represents a success state.
15827         pub result_ok: bool,
15828 }
15829 #[no_mangle]
15830 /// Creates a new CResult_NodeAnnouncementDecodeErrorZ in the success state.
15831 pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_ok(o: crate::lightning::ln::msgs::NodeAnnouncement) -> CResult_NodeAnnouncementDecodeErrorZ {
15832         CResult_NodeAnnouncementDecodeErrorZ {
15833                 contents: CResult_NodeAnnouncementDecodeErrorZPtr {
15834                         result: Box::into_raw(Box::new(o)),
15835                 },
15836                 result_ok: true,
15837         }
15838 }
15839 #[no_mangle]
15840 /// Creates a new CResult_NodeAnnouncementDecodeErrorZ in the error state.
15841 pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeAnnouncementDecodeErrorZ {
15842         CResult_NodeAnnouncementDecodeErrorZ {
15843                 contents: CResult_NodeAnnouncementDecodeErrorZPtr {
15844                         err: Box::into_raw(Box::new(e)),
15845                 },
15846                 result_ok: false,
15847         }
15848 }
15849 /// Checks if the given object is currently in the success state
15850 #[no_mangle]
15851 pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_is_ok(o: &CResult_NodeAnnouncementDecodeErrorZ) -> bool {
15852         o.result_ok
15853 }
15854 #[no_mangle]
15855 /// Frees any resources used by the CResult_NodeAnnouncementDecodeErrorZ.
15856 pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_free(_res: CResult_NodeAnnouncementDecodeErrorZ) { }
15857 impl Drop for CResult_NodeAnnouncementDecodeErrorZ {
15858         fn drop(&mut self) {
15859                 if self.result_ok {
15860                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
15861                                 let _ = unsafe { Box::from_raw(self.contents.result) };
15862                         }
15863                 } else {
15864                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
15865                                 let _ = unsafe { Box::from_raw(self.contents.err) };
15866                         }
15867                 }
15868         }
15869 }
15870 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::NodeAnnouncement, crate::lightning::ln::msgs::DecodeError>> for CResult_NodeAnnouncementDecodeErrorZ {
15871         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::NodeAnnouncement, crate::lightning::ln::msgs::DecodeError>) -> Self {
15872                 let contents = if o.result_ok {
15873                         let result = unsafe { o.contents.result };
15874                         unsafe { o.contents.result = core::ptr::null_mut() };
15875                         CResult_NodeAnnouncementDecodeErrorZPtr { result }
15876                 } else {
15877                         let err = unsafe { o.contents.err };
15878                         unsafe { o.contents.err = core::ptr::null_mut(); }
15879                         CResult_NodeAnnouncementDecodeErrorZPtr { err }
15880                 };
15881                 Self {
15882                         contents,
15883                         result_ok: o.result_ok,
15884                 }
15885         }
15886 }
15887 impl Clone for CResult_NodeAnnouncementDecodeErrorZ {
15888         fn clone(&self) -> Self {
15889                 if self.result_ok {
15890                         Self { result_ok: true, contents: CResult_NodeAnnouncementDecodeErrorZPtr {
15891                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::NodeAnnouncement>::clone(unsafe { &*self.contents.result })))
15892                         } }
15893                 } else {
15894                         Self { result_ok: false, contents: CResult_NodeAnnouncementDecodeErrorZPtr {
15895                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
15896                         } }
15897                 }
15898         }
15899 }
15900 #[no_mangle]
15901 /// Creates a new CResult_NodeAnnouncementDecodeErrorZ which has the same data as `orig`
15902 /// but with all dynamically-allocated buffers duplicated in new buffers.
15903 pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_clone(orig: &CResult_NodeAnnouncementDecodeErrorZ) -> CResult_NodeAnnouncementDecodeErrorZ { Clone::clone(&orig) }
15904 #[repr(C)]
15905 /// The contents of CResult_QueryShortChannelIdsDecodeErrorZ
15906 pub union CResult_QueryShortChannelIdsDecodeErrorZPtr {
15907         /// A pointer to the contents in the success state.
15908         /// Reading from this pointer when `result_ok` is not set is undefined.
15909         pub result: *mut crate::lightning::ln::msgs::QueryShortChannelIds,
15910         /// A pointer to the contents in the error state.
15911         /// Reading from this pointer when `result_ok` is set is undefined.
15912         pub err: *mut crate::lightning::ln::msgs::DecodeError,
15913 }
15914 #[repr(C)]
15915 /// A CResult_QueryShortChannelIdsDecodeErrorZ represents the result of a fallible operation,
15916 /// containing a crate::lightning::ln::msgs::QueryShortChannelIds on success and a crate::lightning::ln::msgs::DecodeError on failure.
15917 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
15918 pub struct CResult_QueryShortChannelIdsDecodeErrorZ {
15919         /// The contents of this CResult_QueryShortChannelIdsDecodeErrorZ, accessible via either
15920         /// `err` or `result` depending on the state of `result_ok`.
15921         pub contents: CResult_QueryShortChannelIdsDecodeErrorZPtr,
15922         /// Whether this CResult_QueryShortChannelIdsDecodeErrorZ represents a success state.
15923         pub result_ok: bool,
15924 }
15925 #[no_mangle]
15926 /// Creates a new CResult_QueryShortChannelIdsDecodeErrorZ in the success state.
15927 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_ok(o: crate::lightning::ln::msgs::QueryShortChannelIds) -> CResult_QueryShortChannelIdsDecodeErrorZ {
15928         CResult_QueryShortChannelIdsDecodeErrorZ {
15929                 contents: CResult_QueryShortChannelIdsDecodeErrorZPtr {
15930                         result: Box::into_raw(Box::new(o)),
15931                 },
15932                 result_ok: true,
15933         }
15934 }
15935 #[no_mangle]
15936 /// Creates a new CResult_QueryShortChannelIdsDecodeErrorZ in the error state.
15937 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_QueryShortChannelIdsDecodeErrorZ {
15938         CResult_QueryShortChannelIdsDecodeErrorZ {
15939                 contents: CResult_QueryShortChannelIdsDecodeErrorZPtr {
15940                         err: Box::into_raw(Box::new(e)),
15941                 },
15942                 result_ok: false,
15943         }
15944 }
15945 /// Checks if the given object is currently in the success state
15946 #[no_mangle]
15947 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_is_ok(o: &CResult_QueryShortChannelIdsDecodeErrorZ) -> bool {
15948         o.result_ok
15949 }
15950 #[no_mangle]
15951 /// Frees any resources used by the CResult_QueryShortChannelIdsDecodeErrorZ.
15952 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_free(_res: CResult_QueryShortChannelIdsDecodeErrorZ) { }
15953 impl Drop for CResult_QueryShortChannelIdsDecodeErrorZ {
15954         fn drop(&mut self) {
15955                 if self.result_ok {
15956                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
15957                                 let _ = unsafe { Box::from_raw(self.contents.result) };
15958                         }
15959                 } else {
15960                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
15961                                 let _ = unsafe { Box::from_raw(self.contents.err) };
15962                         }
15963                 }
15964         }
15965 }
15966 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::QueryShortChannelIds, crate::lightning::ln::msgs::DecodeError>> for CResult_QueryShortChannelIdsDecodeErrorZ {
15967         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::QueryShortChannelIds, crate::lightning::ln::msgs::DecodeError>) -> Self {
15968                 let contents = if o.result_ok {
15969                         let result = unsafe { o.contents.result };
15970                         unsafe { o.contents.result = core::ptr::null_mut() };
15971                         CResult_QueryShortChannelIdsDecodeErrorZPtr { result }
15972                 } else {
15973                         let err = unsafe { o.contents.err };
15974                         unsafe { o.contents.err = core::ptr::null_mut(); }
15975                         CResult_QueryShortChannelIdsDecodeErrorZPtr { err }
15976                 };
15977                 Self {
15978                         contents,
15979                         result_ok: o.result_ok,
15980                 }
15981         }
15982 }
15983 impl Clone for CResult_QueryShortChannelIdsDecodeErrorZ {
15984         fn clone(&self) -> Self {
15985                 if self.result_ok {
15986                         Self { result_ok: true, contents: CResult_QueryShortChannelIdsDecodeErrorZPtr {
15987                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::QueryShortChannelIds>::clone(unsafe { &*self.contents.result })))
15988                         } }
15989                 } else {
15990                         Self { result_ok: false, contents: CResult_QueryShortChannelIdsDecodeErrorZPtr {
15991                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
15992                         } }
15993                 }
15994         }
15995 }
15996 #[no_mangle]
15997 /// Creates a new CResult_QueryShortChannelIdsDecodeErrorZ which has the same data as `orig`
15998 /// but with all dynamically-allocated buffers duplicated in new buffers.
15999 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_clone(orig: &CResult_QueryShortChannelIdsDecodeErrorZ) -> CResult_QueryShortChannelIdsDecodeErrorZ { Clone::clone(&orig) }
16000 #[repr(C)]
16001 /// The contents of CResult_ReplyShortChannelIdsEndDecodeErrorZ
16002 pub union CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
16003         /// A pointer to the contents in the success state.
16004         /// Reading from this pointer when `result_ok` is not set is undefined.
16005         pub result: *mut crate::lightning::ln::msgs::ReplyShortChannelIdsEnd,
16006         /// A pointer to the contents in the error state.
16007         /// Reading from this pointer when `result_ok` is set is undefined.
16008         pub err: *mut crate::lightning::ln::msgs::DecodeError,
16009 }
16010 #[repr(C)]
16011 /// A CResult_ReplyShortChannelIdsEndDecodeErrorZ represents the result of a fallible operation,
16012 /// containing a crate::lightning::ln::msgs::ReplyShortChannelIdsEnd on success and a crate::lightning::ln::msgs::DecodeError on failure.
16013 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
16014 pub struct CResult_ReplyShortChannelIdsEndDecodeErrorZ {
16015         /// The contents of this CResult_ReplyShortChannelIdsEndDecodeErrorZ, accessible via either
16016         /// `err` or `result` depending on the state of `result_ok`.
16017         pub contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr,
16018         /// Whether this CResult_ReplyShortChannelIdsEndDecodeErrorZ represents a success state.
16019         pub result_ok: bool,
16020 }
16021 #[no_mangle]
16022 /// Creates a new CResult_ReplyShortChannelIdsEndDecodeErrorZ in the success state.
16023 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ReplyShortChannelIdsEnd) -> CResult_ReplyShortChannelIdsEndDecodeErrorZ {
16024         CResult_ReplyShortChannelIdsEndDecodeErrorZ {
16025                 contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
16026                         result: Box::into_raw(Box::new(o)),
16027                 },
16028                 result_ok: true,
16029         }
16030 }
16031 #[no_mangle]
16032 /// Creates a new CResult_ReplyShortChannelIdsEndDecodeErrorZ in the error state.
16033 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ReplyShortChannelIdsEndDecodeErrorZ {
16034         CResult_ReplyShortChannelIdsEndDecodeErrorZ {
16035                 contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
16036                         err: Box::into_raw(Box::new(e)),
16037                 },
16038                 result_ok: false,
16039         }
16040 }
16041 /// Checks if the given object is currently in the success state
16042 #[no_mangle]
16043 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_is_ok(o: &CResult_ReplyShortChannelIdsEndDecodeErrorZ) -> bool {
16044         o.result_ok
16045 }
16046 #[no_mangle]
16047 /// Frees any resources used by the CResult_ReplyShortChannelIdsEndDecodeErrorZ.
16048 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_free(_res: CResult_ReplyShortChannelIdsEndDecodeErrorZ) { }
16049 impl Drop for CResult_ReplyShortChannelIdsEndDecodeErrorZ {
16050         fn drop(&mut self) {
16051                 if self.result_ok {
16052                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
16053                                 let _ = unsafe { Box::from_raw(self.contents.result) };
16054                         }
16055                 } else {
16056                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
16057                                 let _ = unsafe { Box::from_raw(self.contents.err) };
16058                         }
16059                 }
16060         }
16061 }
16062 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ReplyShortChannelIdsEnd, crate::lightning::ln::msgs::DecodeError>> for CResult_ReplyShortChannelIdsEndDecodeErrorZ {
16063         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ReplyShortChannelIdsEnd, crate::lightning::ln::msgs::DecodeError>) -> Self {
16064                 let contents = if o.result_ok {
16065                         let result = unsafe { o.contents.result };
16066                         unsafe { o.contents.result = core::ptr::null_mut() };
16067                         CResult_ReplyShortChannelIdsEndDecodeErrorZPtr { result }
16068                 } else {
16069                         let err = unsafe { o.contents.err };
16070                         unsafe { o.contents.err = core::ptr::null_mut(); }
16071                         CResult_ReplyShortChannelIdsEndDecodeErrorZPtr { err }
16072                 };
16073                 Self {
16074                         contents,
16075                         result_ok: o.result_ok,
16076                 }
16077         }
16078 }
16079 impl Clone for CResult_ReplyShortChannelIdsEndDecodeErrorZ {
16080         fn clone(&self) -> Self {
16081                 if self.result_ok {
16082                         Self { result_ok: true, contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
16083                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ReplyShortChannelIdsEnd>::clone(unsafe { &*self.contents.result })))
16084                         } }
16085                 } else {
16086                         Self { result_ok: false, contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
16087                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
16088                         } }
16089                 }
16090         }
16091 }
16092 #[no_mangle]
16093 /// Creates a new CResult_ReplyShortChannelIdsEndDecodeErrorZ which has the same data as `orig`
16094 /// but with all dynamically-allocated buffers duplicated in new buffers.
16095 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone(orig: &CResult_ReplyShortChannelIdsEndDecodeErrorZ) -> CResult_ReplyShortChannelIdsEndDecodeErrorZ { Clone::clone(&orig) }
16096 #[repr(C)]
16097 /// The contents of CResult_QueryChannelRangeDecodeErrorZ
16098 pub union CResult_QueryChannelRangeDecodeErrorZPtr {
16099         /// A pointer to the contents in the success state.
16100         /// Reading from this pointer when `result_ok` is not set is undefined.
16101         pub result: *mut crate::lightning::ln::msgs::QueryChannelRange,
16102         /// A pointer to the contents in the error state.
16103         /// Reading from this pointer when `result_ok` is set is undefined.
16104         pub err: *mut crate::lightning::ln::msgs::DecodeError,
16105 }
16106 #[repr(C)]
16107 /// A CResult_QueryChannelRangeDecodeErrorZ represents the result of a fallible operation,
16108 /// containing a crate::lightning::ln::msgs::QueryChannelRange on success and a crate::lightning::ln::msgs::DecodeError on failure.
16109 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
16110 pub struct CResult_QueryChannelRangeDecodeErrorZ {
16111         /// The contents of this CResult_QueryChannelRangeDecodeErrorZ, accessible via either
16112         /// `err` or `result` depending on the state of `result_ok`.
16113         pub contents: CResult_QueryChannelRangeDecodeErrorZPtr,
16114         /// Whether this CResult_QueryChannelRangeDecodeErrorZ represents a success state.
16115         pub result_ok: bool,
16116 }
16117 #[no_mangle]
16118 /// Creates a new CResult_QueryChannelRangeDecodeErrorZ in the success state.
16119 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_ok(o: crate::lightning::ln::msgs::QueryChannelRange) -> CResult_QueryChannelRangeDecodeErrorZ {
16120         CResult_QueryChannelRangeDecodeErrorZ {
16121                 contents: CResult_QueryChannelRangeDecodeErrorZPtr {
16122                         result: Box::into_raw(Box::new(o)),
16123                 },
16124                 result_ok: true,
16125         }
16126 }
16127 #[no_mangle]
16128 /// Creates a new CResult_QueryChannelRangeDecodeErrorZ in the error state.
16129 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_QueryChannelRangeDecodeErrorZ {
16130         CResult_QueryChannelRangeDecodeErrorZ {
16131                 contents: CResult_QueryChannelRangeDecodeErrorZPtr {
16132                         err: Box::into_raw(Box::new(e)),
16133                 },
16134                 result_ok: false,
16135         }
16136 }
16137 /// Checks if the given object is currently in the success state
16138 #[no_mangle]
16139 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_is_ok(o: &CResult_QueryChannelRangeDecodeErrorZ) -> bool {
16140         o.result_ok
16141 }
16142 #[no_mangle]
16143 /// Frees any resources used by the CResult_QueryChannelRangeDecodeErrorZ.
16144 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_free(_res: CResult_QueryChannelRangeDecodeErrorZ) { }
16145 impl Drop for CResult_QueryChannelRangeDecodeErrorZ {
16146         fn drop(&mut self) {
16147                 if self.result_ok {
16148                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
16149                                 let _ = unsafe { Box::from_raw(self.contents.result) };
16150                         }
16151                 } else {
16152                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
16153                                 let _ = unsafe { Box::from_raw(self.contents.err) };
16154                         }
16155                 }
16156         }
16157 }
16158 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::QueryChannelRange, crate::lightning::ln::msgs::DecodeError>> for CResult_QueryChannelRangeDecodeErrorZ {
16159         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::QueryChannelRange, crate::lightning::ln::msgs::DecodeError>) -> Self {
16160                 let contents = if o.result_ok {
16161                         let result = unsafe { o.contents.result };
16162                         unsafe { o.contents.result = core::ptr::null_mut() };
16163                         CResult_QueryChannelRangeDecodeErrorZPtr { result }
16164                 } else {
16165                         let err = unsafe { o.contents.err };
16166                         unsafe { o.contents.err = core::ptr::null_mut(); }
16167                         CResult_QueryChannelRangeDecodeErrorZPtr { err }
16168                 };
16169                 Self {
16170                         contents,
16171                         result_ok: o.result_ok,
16172                 }
16173         }
16174 }
16175 impl Clone for CResult_QueryChannelRangeDecodeErrorZ {
16176         fn clone(&self) -> Self {
16177                 if self.result_ok {
16178                         Self { result_ok: true, contents: CResult_QueryChannelRangeDecodeErrorZPtr {
16179                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::QueryChannelRange>::clone(unsafe { &*self.contents.result })))
16180                         } }
16181                 } else {
16182                         Self { result_ok: false, contents: CResult_QueryChannelRangeDecodeErrorZPtr {
16183                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
16184                         } }
16185                 }
16186         }
16187 }
16188 #[no_mangle]
16189 /// Creates a new CResult_QueryChannelRangeDecodeErrorZ which has the same data as `orig`
16190 /// but with all dynamically-allocated buffers duplicated in new buffers.
16191 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_clone(orig: &CResult_QueryChannelRangeDecodeErrorZ) -> CResult_QueryChannelRangeDecodeErrorZ { Clone::clone(&orig) }
16192 #[repr(C)]
16193 /// The contents of CResult_ReplyChannelRangeDecodeErrorZ
16194 pub union CResult_ReplyChannelRangeDecodeErrorZPtr {
16195         /// A pointer to the contents in the success state.
16196         /// Reading from this pointer when `result_ok` is not set is undefined.
16197         pub result: *mut crate::lightning::ln::msgs::ReplyChannelRange,
16198         /// A pointer to the contents in the error state.
16199         /// Reading from this pointer when `result_ok` is set is undefined.
16200         pub err: *mut crate::lightning::ln::msgs::DecodeError,
16201 }
16202 #[repr(C)]
16203 /// A CResult_ReplyChannelRangeDecodeErrorZ represents the result of a fallible operation,
16204 /// containing a crate::lightning::ln::msgs::ReplyChannelRange on success and a crate::lightning::ln::msgs::DecodeError on failure.
16205 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
16206 pub struct CResult_ReplyChannelRangeDecodeErrorZ {
16207         /// The contents of this CResult_ReplyChannelRangeDecodeErrorZ, accessible via either
16208         /// `err` or `result` depending on the state of `result_ok`.
16209         pub contents: CResult_ReplyChannelRangeDecodeErrorZPtr,
16210         /// Whether this CResult_ReplyChannelRangeDecodeErrorZ represents a success state.
16211         pub result_ok: bool,
16212 }
16213 #[no_mangle]
16214 /// Creates a new CResult_ReplyChannelRangeDecodeErrorZ in the success state.
16215 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ReplyChannelRange) -> CResult_ReplyChannelRangeDecodeErrorZ {
16216         CResult_ReplyChannelRangeDecodeErrorZ {
16217                 contents: CResult_ReplyChannelRangeDecodeErrorZPtr {
16218                         result: Box::into_raw(Box::new(o)),
16219                 },
16220                 result_ok: true,
16221         }
16222 }
16223 #[no_mangle]
16224 /// Creates a new CResult_ReplyChannelRangeDecodeErrorZ in the error state.
16225 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ReplyChannelRangeDecodeErrorZ {
16226         CResult_ReplyChannelRangeDecodeErrorZ {
16227                 contents: CResult_ReplyChannelRangeDecodeErrorZPtr {
16228                         err: Box::into_raw(Box::new(e)),
16229                 },
16230                 result_ok: false,
16231         }
16232 }
16233 /// Checks if the given object is currently in the success state
16234 #[no_mangle]
16235 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_is_ok(o: &CResult_ReplyChannelRangeDecodeErrorZ) -> bool {
16236         o.result_ok
16237 }
16238 #[no_mangle]
16239 /// Frees any resources used by the CResult_ReplyChannelRangeDecodeErrorZ.
16240 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_free(_res: CResult_ReplyChannelRangeDecodeErrorZ) { }
16241 impl Drop for CResult_ReplyChannelRangeDecodeErrorZ {
16242         fn drop(&mut self) {
16243                 if self.result_ok {
16244                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
16245                                 let _ = unsafe { Box::from_raw(self.contents.result) };
16246                         }
16247                 } else {
16248                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
16249                                 let _ = unsafe { Box::from_raw(self.contents.err) };
16250                         }
16251                 }
16252         }
16253 }
16254 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ReplyChannelRange, crate::lightning::ln::msgs::DecodeError>> for CResult_ReplyChannelRangeDecodeErrorZ {
16255         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ReplyChannelRange, crate::lightning::ln::msgs::DecodeError>) -> Self {
16256                 let contents = if o.result_ok {
16257                         let result = unsafe { o.contents.result };
16258                         unsafe { o.contents.result = core::ptr::null_mut() };
16259                         CResult_ReplyChannelRangeDecodeErrorZPtr { result }
16260                 } else {
16261                         let err = unsafe { o.contents.err };
16262                         unsafe { o.contents.err = core::ptr::null_mut(); }
16263                         CResult_ReplyChannelRangeDecodeErrorZPtr { err }
16264                 };
16265                 Self {
16266                         contents,
16267                         result_ok: o.result_ok,
16268                 }
16269         }
16270 }
16271 impl Clone for CResult_ReplyChannelRangeDecodeErrorZ {
16272         fn clone(&self) -> Self {
16273                 if self.result_ok {
16274                         Self { result_ok: true, contents: CResult_ReplyChannelRangeDecodeErrorZPtr {
16275                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ReplyChannelRange>::clone(unsafe { &*self.contents.result })))
16276                         } }
16277                 } else {
16278                         Self { result_ok: false, contents: CResult_ReplyChannelRangeDecodeErrorZPtr {
16279                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
16280                         } }
16281                 }
16282         }
16283 }
16284 #[no_mangle]
16285 /// Creates a new CResult_ReplyChannelRangeDecodeErrorZ which has the same data as `orig`
16286 /// but with all dynamically-allocated buffers duplicated in new buffers.
16287 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_clone(orig: &CResult_ReplyChannelRangeDecodeErrorZ) -> CResult_ReplyChannelRangeDecodeErrorZ { Clone::clone(&orig) }
16288 #[repr(C)]
16289 /// The contents of CResult_GossipTimestampFilterDecodeErrorZ
16290 pub union CResult_GossipTimestampFilterDecodeErrorZPtr {
16291         /// A pointer to the contents in the success state.
16292         /// Reading from this pointer when `result_ok` is not set is undefined.
16293         pub result: *mut crate::lightning::ln::msgs::GossipTimestampFilter,
16294         /// A pointer to the contents in the error state.
16295         /// Reading from this pointer when `result_ok` is set is undefined.
16296         pub err: *mut crate::lightning::ln::msgs::DecodeError,
16297 }
16298 #[repr(C)]
16299 /// A CResult_GossipTimestampFilterDecodeErrorZ represents the result of a fallible operation,
16300 /// containing a crate::lightning::ln::msgs::GossipTimestampFilter on success and a crate::lightning::ln::msgs::DecodeError on failure.
16301 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
16302 pub struct CResult_GossipTimestampFilterDecodeErrorZ {
16303         /// The contents of this CResult_GossipTimestampFilterDecodeErrorZ, accessible via either
16304         /// `err` or `result` depending on the state of `result_ok`.
16305         pub contents: CResult_GossipTimestampFilterDecodeErrorZPtr,
16306         /// Whether this CResult_GossipTimestampFilterDecodeErrorZ represents a success state.
16307         pub result_ok: bool,
16308 }
16309 #[no_mangle]
16310 /// Creates a new CResult_GossipTimestampFilterDecodeErrorZ in the success state.
16311 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_ok(o: crate::lightning::ln::msgs::GossipTimestampFilter) -> CResult_GossipTimestampFilterDecodeErrorZ {
16312         CResult_GossipTimestampFilterDecodeErrorZ {
16313                 contents: CResult_GossipTimestampFilterDecodeErrorZPtr {
16314                         result: Box::into_raw(Box::new(o)),
16315                 },
16316                 result_ok: true,
16317         }
16318 }
16319 #[no_mangle]
16320 /// Creates a new CResult_GossipTimestampFilterDecodeErrorZ in the error state.
16321 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_GossipTimestampFilterDecodeErrorZ {
16322         CResult_GossipTimestampFilterDecodeErrorZ {
16323                 contents: CResult_GossipTimestampFilterDecodeErrorZPtr {
16324                         err: Box::into_raw(Box::new(e)),
16325                 },
16326                 result_ok: false,
16327         }
16328 }
16329 /// Checks if the given object is currently in the success state
16330 #[no_mangle]
16331 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_is_ok(o: &CResult_GossipTimestampFilterDecodeErrorZ) -> bool {
16332         o.result_ok
16333 }
16334 #[no_mangle]
16335 /// Frees any resources used by the CResult_GossipTimestampFilterDecodeErrorZ.
16336 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_free(_res: CResult_GossipTimestampFilterDecodeErrorZ) { }
16337 impl Drop for CResult_GossipTimestampFilterDecodeErrorZ {
16338         fn drop(&mut self) {
16339                 if self.result_ok {
16340                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
16341                                 let _ = unsafe { Box::from_raw(self.contents.result) };
16342                         }
16343                 } else {
16344                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
16345                                 let _ = unsafe { Box::from_raw(self.contents.err) };
16346                         }
16347                 }
16348         }
16349 }
16350 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::GossipTimestampFilter, crate::lightning::ln::msgs::DecodeError>> for CResult_GossipTimestampFilterDecodeErrorZ {
16351         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::GossipTimestampFilter, crate::lightning::ln::msgs::DecodeError>) -> Self {
16352                 let contents = if o.result_ok {
16353                         let result = unsafe { o.contents.result };
16354                         unsafe { o.contents.result = core::ptr::null_mut() };
16355                         CResult_GossipTimestampFilterDecodeErrorZPtr { result }
16356                 } else {
16357                         let err = unsafe { o.contents.err };
16358                         unsafe { o.contents.err = core::ptr::null_mut(); }
16359                         CResult_GossipTimestampFilterDecodeErrorZPtr { err }
16360                 };
16361                 Self {
16362                         contents,
16363                         result_ok: o.result_ok,
16364                 }
16365         }
16366 }
16367 impl Clone for CResult_GossipTimestampFilterDecodeErrorZ {
16368         fn clone(&self) -> Self {
16369                 if self.result_ok {
16370                         Self { result_ok: true, contents: CResult_GossipTimestampFilterDecodeErrorZPtr {
16371                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::GossipTimestampFilter>::clone(unsafe { &*self.contents.result })))
16372                         } }
16373                 } else {
16374                         Self { result_ok: false, contents: CResult_GossipTimestampFilterDecodeErrorZPtr {
16375                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
16376                         } }
16377                 }
16378         }
16379 }
16380 #[no_mangle]
16381 /// Creates a new CResult_GossipTimestampFilterDecodeErrorZ which has the same data as `orig`
16382 /// but with all dynamically-allocated buffers duplicated in new buffers.
16383 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_clone(orig: &CResult_GossipTimestampFilterDecodeErrorZ) -> CResult_GossipTimestampFilterDecodeErrorZ { Clone::clone(&orig) }
16384 #[repr(C)]
16385 /// A dynamically-allocated array of crate::lightning::ln::channelmanager::PhantomRouteHintss of arbitrary size.
16386 /// This corresponds to std::vector in C++
16387 pub struct CVec_PhantomRouteHintsZ {
16388         /// The elements in the array.
16389         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
16390         pub data: *mut crate::lightning::ln::channelmanager::PhantomRouteHints,
16391         /// The number of elements pointed to by `data`.
16392         pub datalen: usize
16393 }
16394 impl CVec_PhantomRouteHintsZ {
16395         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::channelmanager::PhantomRouteHints> {
16396                 if self.datalen == 0 { return Vec::new(); }
16397                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
16398                 self.data = core::ptr::null_mut();
16399                 self.datalen = 0;
16400                 ret
16401         }
16402         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::channelmanager::PhantomRouteHints] {
16403                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
16404         }
16405 }
16406 impl From<Vec<crate::lightning::ln::channelmanager::PhantomRouteHints>> for CVec_PhantomRouteHintsZ {
16407         fn from(v: Vec<crate::lightning::ln::channelmanager::PhantomRouteHints>) -> Self {
16408                 let datalen = v.len();
16409                 let data = Box::into_raw(v.into_boxed_slice());
16410                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
16411         }
16412 }
16413 #[no_mangle]
16414 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
16415 pub extern "C" fn CVec_PhantomRouteHintsZ_free(_res: CVec_PhantomRouteHintsZ) { }
16416 impl Drop for CVec_PhantomRouteHintsZ {
16417         fn drop(&mut self) {
16418                 if self.datalen == 0 { return; }
16419                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
16420         }
16421 }
16422 impl Clone for CVec_PhantomRouteHintsZ {
16423         fn clone(&self) -> Self {
16424                 let mut res = Vec::new();
16425                 if self.datalen == 0 { return Self::from(res); }
16426                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
16427                 Self::from(res)
16428         }
16429 }
16430 #[repr(C)]
16431 /// The contents of CResult_InvoiceSignOrCreationErrorZ
16432 pub union CResult_InvoiceSignOrCreationErrorZPtr {
16433         /// A pointer to the contents in the success state.
16434         /// Reading from this pointer when `result_ok` is not set is undefined.
16435         pub result: *mut crate::lightning_invoice::Invoice,
16436         /// A pointer to the contents in the error state.
16437         /// Reading from this pointer when `result_ok` is set is undefined.
16438         pub err: *mut crate::lightning_invoice::SignOrCreationError,
16439 }
16440 #[repr(C)]
16441 /// A CResult_InvoiceSignOrCreationErrorZ represents the result of a fallible operation,
16442 /// containing a crate::lightning_invoice::Invoice on success and a crate::lightning_invoice::SignOrCreationError on failure.
16443 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
16444 pub struct CResult_InvoiceSignOrCreationErrorZ {
16445         /// The contents of this CResult_InvoiceSignOrCreationErrorZ, accessible via either
16446         /// `err` or `result` depending on the state of `result_ok`.
16447         pub contents: CResult_InvoiceSignOrCreationErrorZPtr,
16448         /// Whether this CResult_InvoiceSignOrCreationErrorZ represents a success state.
16449         pub result_ok: bool,
16450 }
16451 #[no_mangle]
16452 /// Creates a new CResult_InvoiceSignOrCreationErrorZ in the success state.
16453 pub extern "C" fn CResult_InvoiceSignOrCreationErrorZ_ok(o: crate::lightning_invoice::Invoice) -> CResult_InvoiceSignOrCreationErrorZ {
16454         CResult_InvoiceSignOrCreationErrorZ {
16455                 contents: CResult_InvoiceSignOrCreationErrorZPtr {
16456                         result: Box::into_raw(Box::new(o)),
16457                 },
16458                 result_ok: true,
16459         }
16460 }
16461 #[no_mangle]
16462 /// Creates a new CResult_InvoiceSignOrCreationErrorZ in the error state.
16463 pub extern "C" fn CResult_InvoiceSignOrCreationErrorZ_err(e: crate::lightning_invoice::SignOrCreationError) -> CResult_InvoiceSignOrCreationErrorZ {
16464         CResult_InvoiceSignOrCreationErrorZ {
16465                 contents: CResult_InvoiceSignOrCreationErrorZPtr {
16466                         err: Box::into_raw(Box::new(e)),
16467                 },
16468                 result_ok: false,
16469         }
16470 }
16471 /// Checks if the given object is currently in the success state
16472 #[no_mangle]
16473 pub extern "C" fn CResult_InvoiceSignOrCreationErrorZ_is_ok(o: &CResult_InvoiceSignOrCreationErrorZ) -> bool {
16474         o.result_ok
16475 }
16476 #[no_mangle]
16477 /// Frees any resources used by the CResult_InvoiceSignOrCreationErrorZ.
16478 pub extern "C" fn CResult_InvoiceSignOrCreationErrorZ_free(_res: CResult_InvoiceSignOrCreationErrorZ) { }
16479 impl Drop for CResult_InvoiceSignOrCreationErrorZ {
16480         fn drop(&mut self) {
16481                 if self.result_ok {
16482                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
16483                                 let _ = unsafe { Box::from_raw(self.contents.result) };
16484                         }
16485                 } else {
16486                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
16487                                 let _ = unsafe { Box::from_raw(self.contents.err) };
16488                         }
16489                 }
16490         }
16491 }
16492 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::Invoice, crate::lightning_invoice::SignOrCreationError>> for CResult_InvoiceSignOrCreationErrorZ {
16493         fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::Invoice, crate::lightning_invoice::SignOrCreationError>) -> Self {
16494                 let contents = if o.result_ok {
16495                         let result = unsafe { o.contents.result };
16496                         unsafe { o.contents.result = core::ptr::null_mut() };
16497                         CResult_InvoiceSignOrCreationErrorZPtr { result }
16498                 } else {
16499                         let err = unsafe { o.contents.err };
16500                         unsafe { o.contents.err = core::ptr::null_mut(); }
16501                         CResult_InvoiceSignOrCreationErrorZPtr { err }
16502                 };
16503                 Self {
16504                         contents,
16505                         result_ok: o.result_ok,
16506                 }
16507         }
16508 }
16509 impl Clone for CResult_InvoiceSignOrCreationErrorZ {
16510         fn clone(&self) -> Self {
16511                 if self.result_ok {
16512                         Self { result_ok: true, contents: CResult_InvoiceSignOrCreationErrorZPtr {
16513                                 result: Box::into_raw(Box::new(<crate::lightning_invoice::Invoice>::clone(unsafe { &*self.contents.result })))
16514                         } }
16515                 } else {
16516                         Self { result_ok: false, contents: CResult_InvoiceSignOrCreationErrorZPtr {
16517                                 err: Box::into_raw(Box::new(<crate::lightning_invoice::SignOrCreationError>::clone(unsafe { &*self.contents.err })))
16518                         } }
16519                 }
16520         }
16521 }
16522 #[no_mangle]
16523 /// Creates a new CResult_InvoiceSignOrCreationErrorZ which has the same data as `orig`
16524 /// but with all dynamically-allocated buffers duplicated in new buffers.
16525 pub extern "C" fn CResult_InvoiceSignOrCreationErrorZ_clone(orig: &CResult_InvoiceSignOrCreationErrorZ) -> CResult_InvoiceSignOrCreationErrorZ { Clone::clone(&orig) }
16526 #[repr(C)]
16527 /// An enum which can either contain a crate::lightning::chain::Filter or not
16528 pub enum COption_FilterZ {
16529         /// When we're in this state, this COption_FilterZ contains a crate::lightning::chain::Filter
16530         Some(crate::lightning::chain::Filter),
16531         /// When we're in this state, this COption_FilterZ contains nothing
16532         None
16533 }
16534 impl COption_FilterZ {
16535         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
16536                 if let Self::None = self { false } else { true }
16537         }
16538         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
16539                 !self.is_some()
16540         }
16541         #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::chain::Filter {
16542                 if let Self::Some(v) = self { v } else { unreachable!() }
16543         }
16544 }
16545 #[no_mangle]
16546 /// Constructs a new COption_FilterZ containing a crate::lightning::chain::Filter
16547 pub extern "C" fn COption_FilterZ_some(o: crate::lightning::chain::Filter) -> COption_FilterZ {
16548         COption_FilterZ::Some(o)
16549 }
16550 #[no_mangle]
16551 /// Constructs a new COption_FilterZ containing nothing
16552 pub extern "C" fn COption_FilterZ_none() -> COption_FilterZ {
16553         COption_FilterZ::None
16554 }
16555 #[no_mangle]
16556 /// Frees any resources associated with the crate::lightning::chain::Filter, if we are in the Some state
16557 pub extern "C" fn COption_FilterZ_free(_res: COption_FilterZ) { }
16558 #[repr(C)]
16559 /// The contents of CResult_LockedChannelMonitorNoneZ
16560 pub union CResult_LockedChannelMonitorNoneZPtr {
16561         /// A pointer to the contents in the success state.
16562         /// Reading from this pointer when `result_ok` is not set is undefined.
16563         pub result: *mut crate::lightning::chain::chainmonitor::LockedChannelMonitor,
16564         /// Note that this value is always NULL, as there are no contents in the Err variant
16565         pub err: *mut core::ffi::c_void,
16566 }
16567 #[repr(C)]
16568 /// A CResult_LockedChannelMonitorNoneZ represents the result of a fallible operation,
16569 /// containing a crate::lightning::chain::chainmonitor::LockedChannelMonitor on success and a () on failure.
16570 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
16571 pub struct CResult_LockedChannelMonitorNoneZ {
16572         /// The contents of this CResult_LockedChannelMonitorNoneZ, accessible via either
16573         /// `err` or `result` depending on the state of `result_ok`.
16574         pub contents: CResult_LockedChannelMonitorNoneZPtr,
16575         /// Whether this CResult_LockedChannelMonitorNoneZ represents a success state.
16576         pub result_ok: bool,
16577 }
16578 #[no_mangle]
16579 /// Creates a new CResult_LockedChannelMonitorNoneZ in the success state.
16580 pub extern "C" fn CResult_LockedChannelMonitorNoneZ_ok(o: crate::lightning::chain::chainmonitor::LockedChannelMonitor) -> CResult_LockedChannelMonitorNoneZ {
16581         CResult_LockedChannelMonitorNoneZ {
16582                 contents: CResult_LockedChannelMonitorNoneZPtr {
16583                         result: Box::into_raw(Box::new(o)),
16584                 },
16585                 result_ok: true,
16586         }
16587 }
16588 #[no_mangle]
16589 /// Creates a new CResult_LockedChannelMonitorNoneZ in the error state.
16590 pub extern "C" fn CResult_LockedChannelMonitorNoneZ_err() -> CResult_LockedChannelMonitorNoneZ {
16591         CResult_LockedChannelMonitorNoneZ {
16592                 contents: CResult_LockedChannelMonitorNoneZPtr {
16593                         err: core::ptr::null_mut(),
16594                 },
16595                 result_ok: false,
16596         }
16597 }
16598 /// Checks if the given object is currently in the success state
16599 #[no_mangle]
16600 pub extern "C" fn CResult_LockedChannelMonitorNoneZ_is_ok(o: &CResult_LockedChannelMonitorNoneZ) -> bool {
16601         o.result_ok
16602 }
16603 #[no_mangle]
16604 /// Frees any resources used by the CResult_LockedChannelMonitorNoneZ.
16605 pub extern "C" fn CResult_LockedChannelMonitorNoneZ_free(_res: CResult_LockedChannelMonitorNoneZ) { }
16606 impl Drop for CResult_LockedChannelMonitorNoneZ {
16607         fn drop(&mut self) {
16608                 if self.result_ok {
16609                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
16610                                 let _ = unsafe { Box::from_raw(self.contents.result) };
16611                         }
16612                 } else {
16613                 }
16614         }
16615 }
16616 impl From<crate::c_types::CResultTempl<crate::lightning::chain::chainmonitor::LockedChannelMonitor, ()>> for CResult_LockedChannelMonitorNoneZ {
16617         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::chainmonitor::LockedChannelMonitor, ()>) -> Self {
16618                 let contents = if o.result_ok {
16619                         let result = unsafe { o.contents.result };
16620                         unsafe { o.contents.result = core::ptr::null_mut() };
16621                         CResult_LockedChannelMonitorNoneZPtr { result }
16622                 } else {
16623                         let _ = unsafe { Box::from_raw(o.contents.err) };
16624                         o.contents.err = core::ptr::null_mut();
16625                         CResult_LockedChannelMonitorNoneZPtr { err: core::ptr::null_mut() }
16626                 };
16627                 Self {
16628                         contents,
16629                         result_ok: o.result_ok,
16630                 }
16631         }
16632 }
16633 #[repr(C)]
16634 /// A dynamically-allocated array of crate::lightning::chain::transaction::OutPoints of arbitrary size.
16635 /// This corresponds to std::vector in C++
16636 pub struct CVec_OutPointZ {
16637         /// The elements in the array.
16638         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
16639         pub data: *mut crate::lightning::chain::transaction::OutPoint,
16640         /// The number of elements pointed to by `data`.
16641         pub datalen: usize
16642 }
16643 impl CVec_OutPointZ {
16644         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::chain::transaction::OutPoint> {
16645                 if self.datalen == 0 { return Vec::new(); }
16646                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
16647                 self.data = core::ptr::null_mut();
16648                 self.datalen = 0;
16649                 ret
16650         }
16651         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::chain::transaction::OutPoint] {
16652                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
16653         }
16654 }
16655 impl From<Vec<crate::lightning::chain::transaction::OutPoint>> for CVec_OutPointZ {
16656         fn from(v: Vec<crate::lightning::chain::transaction::OutPoint>) -> Self {
16657                 let datalen = v.len();
16658                 let data = Box::into_raw(v.into_boxed_slice());
16659                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
16660         }
16661 }
16662 #[no_mangle]
16663 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
16664 pub extern "C" fn CVec_OutPointZ_free(_res: CVec_OutPointZ) { }
16665 impl Drop for CVec_OutPointZ {
16666         fn drop(&mut self) {
16667                 if self.datalen == 0 { return; }
16668                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
16669         }
16670 }
16671 impl Clone for CVec_OutPointZ {
16672         fn clone(&self) -> Self {
16673                 let mut res = Vec::new();
16674                 if self.datalen == 0 { return Self::from(res); }
16675                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
16676                 Self::from(res)
16677         }
16678 }