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 /// The contents of CResult_NoneChannelMonitorUpdateErrZ
4040 pub union CResult_NoneChannelMonitorUpdateErrZPtr {
4041         /// Note that this value is always NULL, as there are no contents in the OK variant
4042         pub result: *mut core::ffi::c_void,
4043         /// A pointer to the contents in the error state.
4044         /// Reading from this pointer when `result_ok` is set is undefined.
4045         pub err: *mut crate::lightning::chain::ChannelMonitorUpdateErr,
4046 }
4047 #[repr(C)]
4048 /// A CResult_NoneChannelMonitorUpdateErrZ represents the result of a fallible operation,
4049 /// containing a () on success and a crate::lightning::chain::ChannelMonitorUpdateErr on failure.
4050 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4051 pub struct CResult_NoneChannelMonitorUpdateErrZ {
4052         /// The contents of this CResult_NoneChannelMonitorUpdateErrZ, accessible via either
4053         /// `err` or `result` depending on the state of `result_ok`.
4054         pub contents: CResult_NoneChannelMonitorUpdateErrZPtr,
4055         /// Whether this CResult_NoneChannelMonitorUpdateErrZ represents a success state.
4056         pub result_ok: bool,
4057 }
4058 #[no_mangle]
4059 /// Creates a new CResult_NoneChannelMonitorUpdateErrZ in the success state.
4060 pub extern "C" fn CResult_NoneChannelMonitorUpdateErrZ_ok() -> CResult_NoneChannelMonitorUpdateErrZ {
4061         CResult_NoneChannelMonitorUpdateErrZ {
4062                 contents: CResult_NoneChannelMonitorUpdateErrZPtr {
4063                         result: core::ptr::null_mut(),
4064                 },
4065                 result_ok: true,
4066         }
4067 }
4068 #[no_mangle]
4069 /// Creates a new CResult_NoneChannelMonitorUpdateErrZ in the error state.
4070 pub extern "C" fn CResult_NoneChannelMonitorUpdateErrZ_err(e: crate::lightning::chain::ChannelMonitorUpdateErr) -> CResult_NoneChannelMonitorUpdateErrZ {
4071         CResult_NoneChannelMonitorUpdateErrZ {
4072                 contents: CResult_NoneChannelMonitorUpdateErrZPtr {
4073                         err: Box::into_raw(Box::new(e)),
4074                 },
4075                 result_ok: false,
4076         }
4077 }
4078 /// Checks if the given object is currently in the success state
4079 #[no_mangle]
4080 pub extern "C" fn CResult_NoneChannelMonitorUpdateErrZ_is_ok(o: &CResult_NoneChannelMonitorUpdateErrZ) -> bool {
4081         o.result_ok
4082 }
4083 #[no_mangle]
4084 /// Frees any resources used by the CResult_NoneChannelMonitorUpdateErrZ.
4085 pub extern "C" fn CResult_NoneChannelMonitorUpdateErrZ_free(_res: CResult_NoneChannelMonitorUpdateErrZ) { }
4086 impl Drop for CResult_NoneChannelMonitorUpdateErrZ {
4087         fn drop(&mut self) {
4088                 if self.result_ok {
4089                 } else {
4090                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
4091                                 let _ = unsafe { Box::from_raw(self.contents.err) };
4092                         }
4093                 }
4094         }
4095 }
4096 impl From<crate::c_types::CResultTempl<(), crate::lightning::chain::ChannelMonitorUpdateErr>> for CResult_NoneChannelMonitorUpdateErrZ {
4097         fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::chain::ChannelMonitorUpdateErr>) -> Self {
4098                 let contents = if o.result_ok {
4099                         let _ = unsafe { Box::from_raw(o.contents.result) };
4100                         o.contents.result = core::ptr::null_mut();
4101                         CResult_NoneChannelMonitorUpdateErrZPtr { result: core::ptr::null_mut() }
4102                 } else {
4103                         let err = unsafe { o.contents.err };
4104                         unsafe { o.contents.err = core::ptr::null_mut(); }
4105                         CResult_NoneChannelMonitorUpdateErrZPtr { err }
4106                 };
4107                 Self {
4108                         contents,
4109                         result_ok: o.result_ok,
4110                 }
4111         }
4112 }
4113 impl Clone for CResult_NoneChannelMonitorUpdateErrZ {
4114         fn clone(&self) -> Self {
4115                 if self.result_ok {
4116                         Self { result_ok: true, contents: CResult_NoneChannelMonitorUpdateErrZPtr {
4117                                 result: core::ptr::null_mut()
4118                         } }
4119                 } else {
4120                         Self { result_ok: false, contents: CResult_NoneChannelMonitorUpdateErrZPtr {
4121                                 err: Box::into_raw(Box::new(<crate::lightning::chain::ChannelMonitorUpdateErr>::clone(unsafe { &*self.contents.err })))
4122                         } }
4123                 }
4124         }
4125 }
4126 #[no_mangle]
4127 /// Creates a new CResult_NoneChannelMonitorUpdateErrZ which has the same data as `orig`
4128 /// but with all dynamically-allocated buffers duplicated in new buffers.
4129 pub extern "C" fn CResult_NoneChannelMonitorUpdateErrZ_clone(orig: &CResult_NoneChannelMonitorUpdateErrZ) -> CResult_NoneChannelMonitorUpdateErrZ { Clone::clone(&orig) }
4130 #[repr(C)]
4131 /// A dynamically-allocated array of crate::lightning::chain::channelmonitor::MonitorEvents of arbitrary size.
4132 /// This corresponds to std::vector in C++
4133 pub struct CVec_MonitorEventZ {
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::lightning::chain::channelmonitor::MonitorEvent,
4137         /// The number of elements pointed to by `data`.
4138         pub datalen: usize
4139 }
4140 impl CVec_MonitorEventZ {
4141         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::chain::channelmonitor::MonitorEvent> {
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::lightning::chain::channelmonitor::MonitorEvent] {
4149                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
4150         }
4151 }
4152 impl From<Vec<crate::lightning::chain::channelmonitor::MonitorEvent>> for CVec_MonitorEventZ {
4153         fn from(v: Vec<crate::lightning::chain::channelmonitor::MonitorEvent>) -> 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_MonitorEventZ_free(_res: CVec_MonitorEventZ) { }
4162 impl Drop for CVec_MonitorEventZ {
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_MonitorEventZ {
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 /// A tuple of 3 elements. See the individual fields for the types contained.
4178 pub struct C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ {
4179         /// The element at position 0
4180         pub a: crate::lightning::chain::transaction::OutPoint,
4181         /// The element at position 1
4182         pub b: crate::c_types::derived::CVec_MonitorEventZ,
4183         /// The element at position 2
4184         pub c: crate::c_types::PublicKey,
4185 }
4186 impl From<(crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_MonitorEventZ, crate::c_types::PublicKey)> for C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ {
4187         fn from (tup: (crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_MonitorEventZ, crate::c_types::PublicKey)) -> Self {
4188                 Self {
4189                         a: tup.0,
4190                         b: tup.1,
4191                         c: tup.2,
4192                 }
4193         }
4194 }
4195 impl C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ {
4196         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_MonitorEventZ, crate::c_types::PublicKey) {
4197                 (self.a, self.b, self.c)
4198         }
4199 }
4200 impl Clone for C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ {
4201         fn clone(&self) -> Self {
4202                 Self {
4203                         a: Clone::clone(&self.a),
4204                         b: Clone::clone(&self.b),
4205                         c: Clone::clone(&self.c),
4206                 }
4207         }
4208 }
4209 #[no_mangle]
4210 /// Creates a new tuple which has the same data as `orig`
4211 /// but with all dynamically-allocated buffers duplicated in new buffers.
4212 pub extern "C" fn C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_clone(orig: &C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ) -> C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ { Clone::clone(&orig) }
4213 /// Creates a new C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ from the contained elements.
4214 #[no_mangle]
4215 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 {
4216         C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ { a, b, c, }
4217 }
4218
4219 #[no_mangle]
4220 /// Frees any resources used by the C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ.
4221 pub extern "C" fn C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_free(_res: C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ) { }
4222 #[repr(C)]
4223 /// A dynamically-allocated array of crate::c_types::derived::C3Tuple_OutPointCVec_MonitorEventZPublicKeyZs of arbitrary size.
4224 /// This corresponds to std::vector in C++
4225 pub struct CVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ {
4226         /// The elements in the array.
4227         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4228         pub data: *mut crate::c_types::derived::C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ,
4229         /// The number of elements pointed to by `data`.
4230         pub datalen: usize
4231 }
4232 impl CVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ {
4233         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ> {
4234                 if self.datalen == 0 { return Vec::new(); }
4235                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
4236                 self.data = core::ptr::null_mut();
4237                 self.datalen = 0;
4238                 ret
4239         }
4240         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ] {
4241                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
4242         }
4243 }
4244 impl From<Vec<crate::c_types::derived::C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ>> for CVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ {
4245         fn from(v: Vec<crate::c_types::derived::C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ>) -> Self {
4246                 let datalen = v.len();
4247                 let data = Box::into_raw(v.into_boxed_slice());
4248                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
4249         }
4250 }
4251 #[no_mangle]
4252 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
4253 pub extern "C" fn CVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ_free(_res: CVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ) { }
4254 impl Drop for CVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ {
4255         fn drop(&mut self) {
4256                 if self.datalen == 0 { return; }
4257                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
4258         }
4259 }
4260 impl Clone for CVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ {
4261         fn clone(&self) -> Self {
4262                 let mut res = Vec::new();
4263                 if self.datalen == 0 { return Self::from(res); }
4264                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
4265                 Self::from(res)
4266         }
4267 }
4268 #[repr(C)]
4269 /// The contents of CResult_FixedPenaltyScorerDecodeErrorZ
4270 pub union CResult_FixedPenaltyScorerDecodeErrorZPtr {
4271         /// A pointer to the contents in the success state.
4272         /// Reading from this pointer when `result_ok` is not set is undefined.
4273         pub result: *mut crate::lightning::routing::scoring::FixedPenaltyScorer,
4274         /// A pointer to the contents in the error state.
4275         /// Reading from this pointer when `result_ok` is set is undefined.
4276         pub err: *mut crate::lightning::ln::msgs::DecodeError,
4277 }
4278 #[repr(C)]
4279 /// A CResult_FixedPenaltyScorerDecodeErrorZ represents the result of a fallible operation,
4280 /// containing a crate::lightning::routing::scoring::FixedPenaltyScorer on success and a crate::lightning::ln::msgs::DecodeError on failure.
4281 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4282 pub struct CResult_FixedPenaltyScorerDecodeErrorZ {
4283         /// The contents of this CResult_FixedPenaltyScorerDecodeErrorZ, accessible via either
4284         /// `err` or `result` depending on the state of `result_ok`.
4285         pub contents: CResult_FixedPenaltyScorerDecodeErrorZPtr,
4286         /// Whether this CResult_FixedPenaltyScorerDecodeErrorZ represents a success state.
4287         pub result_ok: bool,
4288 }
4289 #[no_mangle]
4290 /// Creates a new CResult_FixedPenaltyScorerDecodeErrorZ in the success state.
4291 pub extern "C" fn CResult_FixedPenaltyScorerDecodeErrorZ_ok(o: crate::lightning::routing::scoring::FixedPenaltyScorer) -> CResult_FixedPenaltyScorerDecodeErrorZ {
4292         CResult_FixedPenaltyScorerDecodeErrorZ {
4293                 contents: CResult_FixedPenaltyScorerDecodeErrorZPtr {
4294                         result: Box::into_raw(Box::new(o)),
4295                 },
4296                 result_ok: true,
4297         }
4298 }
4299 #[no_mangle]
4300 /// Creates a new CResult_FixedPenaltyScorerDecodeErrorZ in the error state.
4301 pub extern "C" fn CResult_FixedPenaltyScorerDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_FixedPenaltyScorerDecodeErrorZ {
4302         CResult_FixedPenaltyScorerDecodeErrorZ {
4303                 contents: CResult_FixedPenaltyScorerDecodeErrorZPtr {
4304                         err: Box::into_raw(Box::new(e)),
4305                 },
4306                 result_ok: false,
4307         }
4308 }
4309 /// Checks if the given object is currently in the success state
4310 #[no_mangle]
4311 pub extern "C" fn CResult_FixedPenaltyScorerDecodeErrorZ_is_ok(o: &CResult_FixedPenaltyScorerDecodeErrorZ) -> bool {
4312         o.result_ok
4313 }
4314 #[no_mangle]
4315 /// Frees any resources used by the CResult_FixedPenaltyScorerDecodeErrorZ.
4316 pub extern "C" fn CResult_FixedPenaltyScorerDecodeErrorZ_free(_res: CResult_FixedPenaltyScorerDecodeErrorZ) { }
4317 impl Drop for CResult_FixedPenaltyScorerDecodeErrorZ {
4318         fn drop(&mut self) {
4319                 if self.result_ok {
4320                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
4321                                 let _ = unsafe { Box::from_raw(self.contents.result) };
4322                         }
4323                 } else {
4324                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
4325                                 let _ = unsafe { Box::from_raw(self.contents.err) };
4326                         }
4327                 }
4328         }
4329 }
4330 impl From<crate::c_types::CResultTempl<crate::lightning::routing::scoring::FixedPenaltyScorer, crate::lightning::ln::msgs::DecodeError>> for CResult_FixedPenaltyScorerDecodeErrorZ {
4331         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::scoring::FixedPenaltyScorer, crate::lightning::ln::msgs::DecodeError>) -> Self {
4332                 let contents = if o.result_ok {
4333                         let result = unsafe { o.contents.result };
4334                         unsafe { o.contents.result = core::ptr::null_mut() };
4335                         CResult_FixedPenaltyScorerDecodeErrorZPtr { result }
4336                 } else {
4337                         let err = unsafe { o.contents.err };
4338                         unsafe { o.contents.err = core::ptr::null_mut(); }
4339                         CResult_FixedPenaltyScorerDecodeErrorZPtr { err }
4340                 };
4341                 Self {
4342                         contents,
4343                         result_ok: o.result_ok,
4344                 }
4345         }
4346 }
4347 impl Clone for CResult_FixedPenaltyScorerDecodeErrorZ {
4348         fn clone(&self) -> Self {
4349                 if self.result_ok {
4350                         Self { result_ok: true, contents: CResult_FixedPenaltyScorerDecodeErrorZPtr {
4351                                 result: Box::into_raw(Box::new(<crate::lightning::routing::scoring::FixedPenaltyScorer>::clone(unsafe { &*self.contents.result })))
4352                         } }
4353                 } else {
4354                         Self { result_ok: false, contents: CResult_FixedPenaltyScorerDecodeErrorZPtr {
4355                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
4356                         } }
4357                 }
4358         }
4359 }
4360 #[no_mangle]
4361 /// Creates a new CResult_FixedPenaltyScorerDecodeErrorZ which has the same data as `orig`
4362 /// but with all dynamically-allocated buffers duplicated in new buffers.
4363 pub extern "C" fn CResult_FixedPenaltyScorerDecodeErrorZ_clone(orig: &CResult_FixedPenaltyScorerDecodeErrorZ) -> CResult_FixedPenaltyScorerDecodeErrorZ { Clone::clone(&orig) }
4364 #[repr(C)]
4365 /// A tuple of 2 elements. See the individual fields for the types contained.
4366 pub struct C2Tuple_u64u64Z {
4367         /// The element at position 0
4368         pub a: u64,
4369         /// The element at position 1
4370         pub b: u64,
4371 }
4372 impl From<(u64, u64)> for C2Tuple_u64u64Z {
4373         fn from (tup: (u64, u64)) -> Self {
4374                 Self {
4375                         a: tup.0,
4376                         b: tup.1,
4377                 }
4378         }
4379 }
4380 impl C2Tuple_u64u64Z {
4381         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (u64, u64) {
4382                 (self.a, self.b)
4383         }
4384 }
4385 impl Clone for C2Tuple_u64u64Z {
4386         fn clone(&self) -> Self {
4387                 Self {
4388                         a: Clone::clone(&self.a),
4389                         b: Clone::clone(&self.b),
4390                 }
4391         }
4392 }
4393 #[no_mangle]
4394 /// Creates a new tuple which has the same data as `orig`
4395 /// but with all dynamically-allocated buffers duplicated in new buffers.
4396 pub extern "C" fn C2Tuple_u64u64Z_clone(orig: &C2Tuple_u64u64Z) -> C2Tuple_u64u64Z { Clone::clone(&orig) }
4397 /// Creates a new C2Tuple_u64u64Z from the contained elements.
4398 #[no_mangle]
4399 pub extern "C" fn C2Tuple_u64u64Z_new(a: u64, b: u64) -> C2Tuple_u64u64Z {
4400         C2Tuple_u64u64Z { a, b, }
4401 }
4402
4403 #[no_mangle]
4404 /// Frees any resources used by the C2Tuple_u64u64Z.
4405 pub extern "C" fn C2Tuple_u64u64Z_free(_res: C2Tuple_u64u64Z) { }
4406 #[repr(C)]
4407 #[derive(Clone)]
4408 /// An enum which can either contain a crate::c_types::derived::C2Tuple_u64u64Z or not
4409 pub enum COption_C2Tuple_u64u64ZZ {
4410         /// When we're in this state, this COption_C2Tuple_u64u64ZZ contains a crate::c_types::derived::C2Tuple_u64u64Z
4411         Some(crate::c_types::derived::C2Tuple_u64u64Z),
4412         /// When we're in this state, this COption_C2Tuple_u64u64ZZ contains nothing
4413         None
4414 }
4415 impl COption_C2Tuple_u64u64ZZ {
4416         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
4417                 if let Self::None = self { false } else { true }
4418         }
4419         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
4420                 !self.is_some()
4421         }
4422         #[allow(unused)] pub(crate) fn take(mut self) -> crate::c_types::derived::C2Tuple_u64u64Z {
4423                 if let Self::Some(v) = self { v } else { unreachable!() }
4424         }
4425 }
4426 #[no_mangle]
4427 /// Constructs a new COption_C2Tuple_u64u64ZZ containing a crate::c_types::derived::C2Tuple_u64u64Z
4428 pub extern "C" fn COption_C2Tuple_u64u64ZZ_some(o: crate::c_types::derived::C2Tuple_u64u64Z) -> COption_C2Tuple_u64u64ZZ {
4429         COption_C2Tuple_u64u64ZZ::Some(o)
4430 }
4431 #[no_mangle]
4432 /// Constructs a new COption_C2Tuple_u64u64ZZ containing nothing
4433 pub extern "C" fn COption_C2Tuple_u64u64ZZ_none() -> COption_C2Tuple_u64u64ZZ {
4434         COption_C2Tuple_u64u64ZZ::None
4435 }
4436 #[no_mangle]
4437 /// Frees any resources associated with the crate::c_types::derived::C2Tuple_u64u64Z, if we are in the Some state
4438 pub extern "C" fn COption_C2Tuple_u64u64ZZ_free(_res: COption_C2Tuple_u64u64ZZ) { }
4439 #[no_mangle]
4440 /// Creates a new COption_C2Tuple_u64u64ZZ which has the same data as `orig`
4441 /// but with all dynamically-allocated buffers duplicated in new buffers.
4442 pub extern "C" fn COption_C2Tuple_u64u64ZZ_clone(orig: &COption_C2Tuple_u64u64ZZ) -> COption_C2Tuple_u64u64ZZ { Clone::clone(&orig) }
4443 #[repr(C)]
4444 /// A dynamically-allocated array of crate::lightning::routing::gossip::NodeIds of arbitrary size.
4445 /// This corresponds to std::vector in C++
4446 pub struct CVec_NodeIdZ {
4447         /// The elements in the array.
4448         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4449         pub data: *mut crate::lightning::routing::gossip::NodeId,
4450         /// The number of elements pointed to by `data`.
4451         pub datalen: usize
4452 }
4453 impl CVec_NodeIdZ {
4454         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::routing::gossip::NodeId> {
4455                 if self.datalen == 0 { return Vec::new(); }
4456                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
4457                 self.data = core::ptr::null_mut();
4458                 self.datalen = 0;
4459                 ret
4460         }
4461         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::routing::gossip::NodeId] {
4462                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
4463         }
4464 }
4465 impl From<Vec<crate::lightning::routing::gossip::NodeId>> for CVec_NodeIdZ {
4466         fn from(v: Vec<crate::lightning::routing::gossip::NodeId>) -> Self {
4467                 let datalen = v.len();
4468                 let data = Box::into_raw(v.into_boxed_slice());
4469                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
4470         }
4471 }
4472 #[no_mangle]
4473 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
4474 pub extern "C" fn CVec_NodeIdZ_free(_res: CVec_NodeIdZ) { }
4475 impl Drop for CVec_NodeIdZ {
4476         fn drop(&mut self) {
4477                 if self.datalen == 0 { return; }
4478                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
4479         }
4480 }
4481 impl Clone for CVec_NodeIdZ {
4482         fn clone(&self) -> Self {
4483                 let mut res = Vec::new();
4484                 if self.datalen == 0 { return Self::from(res); }
4485                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
4486                 Self::from(res)
4487         }
4488 }
4489 #[repr(C)]
4490 /// The contents of CResult_ProbabilisticScorerDecodeErrorZ
4491 pub union CResult_ProbabilisticScorerDecodeErrorZPtr {
4492         /// A pointer to the contents in the success state.
4493         /// Reading from this pointer when `result_ok` is not set is undefined.
4494         pub result: *mut crate::lightning::routing::scoring::ProbabilisticScorer,
4495         /// A pointer to the contents in the error state.
4496         /// Reading from this pointer when `result_ok` is set is undefined.
4497         pub err: *mut crate::lightning::ln::msgs::DecodeError,
4498 }
4499 #[repr(C)]
4500 /// A CResult_ProbabilisticScorerDecodeErrorZ represents the result of a fallible operation,
4501 /// containing a crate::lightning::routing::scoring::ProbabilisticScorer on success and a crate::lightning::ln::msgs::DecodeError on failure.
4502 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4503 pub struct CResult_ProbabilisticScorerDecodeErrorZ {
4504         /// The contents of this CResult_ProbabilisticScorerDecodeErrorZ, accessible via either
4505         /// `err` or `result` depending on the state of `result_ok`.
4506         pub contents: CResult_ProbabilisticScorerDecodeErrorZPtr,
4507         /// Whether this CResult_ProbabilisticScorerDecodeErrorZ represents a success state.
4508         pub result_ok: bool,
4509 }
4510 #[no_mangle]
4511 /// Creates a new CResult_ProbabilisticScorerDecodeErrorZ in the success state.
4512 pub extern "C" fn CResult_ProbabilisticScorerDecodeErrorZ_ok(o: crate::lightning::routing::scoring::ProbabilisticScorer) -> CResult_ProbabilisticScorerDecodeErrorZ {
4513         CResult_ProbabilisticScorerDecodeErrorZ {
4514                 contents: CResult_ProbabilisticScorerDecodeErrorZPtr {
4515                         result: Box::into_raw(Box::new(o)),
4516                 },
4517                 result_ok: true,
4518         }
4519 }
4520 #[no_mangle]
4521 /// Creates a new CResult_ProbabilisticScorerDecodeErrorZ in the error state.
4522 pub extern "C" fn CResult_ProbabilisticScorerDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ProbabilisticScorerDecodeErrorZ {
4523         CResult_ProbabilisticScorerDecodeErrorZ {
4524                 contents: CResult_ProbabilisticScorerDecodeErrorZPtr {
4525                         err: Box::into_raw(Box::new(e)),
4526                 },
4527                 result_ok: false,
4528         }
4529 }
4530 /// Checks if the given object is currently in the success state
4531 #[no_mangle]
4532 pub extern "C" fn CResult_ProbabilisticScorerDecodeErrorZ_is_ok(o: &CResult_ProbabilisticScorerDecodeErrorZ) -> bool {
4533         o.result_ok
4534 }
4535 #[no_mangle]
4536 /// Frees any resources used by the CResult_ProbabilisticScorerDecodeErrorZ.
4537 pub extern "C" fn CResult_ProbabilisticScorerDecodeErrorZ_free(_res: CResult_ProbabilisticScorerDecodeErrorZ) { }
4538 impl Drop for CResult_ProbabilisticScorerDecodeErrorZ {
4539         fn drop(&mut self) {
4540                 if self.result_ok {
4541                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
4542                                 let _ = unsafe { Box::from_raw(self.contents.result) };
4543                         }
4544                 } else {
4545                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
4546                                 let _ = unsafe { Box::from_raw(self.contents.err) };
4547                         }
4548                 }
4549         }
4550 }
4551 impl From<crate::c_types::CResultTempl<crate::lightning::routing::scoring::ProbabilisticScorer, crate::lightning::ln::msgs::DecodeError>> for CResult_ProbabilisticScorerDecodeErrorZ {
4552         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::scoring::ProbabilisticScorer, crate::lightning::ln::msgs::DecodeError>) -> Self {
4553                 let contents = if o.result_ok {
4554                         let result = unsafe { o.contents.result };
4555                         unsafe { o.contents.result = core::ptr::null_mut() };
4556                         CResult_ProbabilisticScorerDecodeErrorZPtr { result }
4557                 } else {
4558                         let err = unsafe { o.contents.err };
4559                         unsafe { o.contents.err = core::ptr::null_mut(); }
4560                         CResult_ProbabilisticScorerDecodeErrorZPtr { err }
4561                 };
4562                 Self {
4563                         contents,
4564                         result_ok: o.result_ok,
4565                 }
4566         }
4567 }
4568 #[repr(C)]
4569 /// The contents of CResult_InitFeaturesDecodeErrorZ
4570 pub union CResult_InitFeaturesDecodeErrorZPtr {
4571         /// A pointer to the contents in the success state.
4572         /// Reading from this pointer when `result_ok` is not set is undefined.
4573         pub result: *mut crate::lightning::ln::features::InitFeatures,
4574         /// A pointer to the contents in the error state.
4575         /// Reading from this pointer when `result_ok` is set is undefined.
4576         pub err: *mut crate::lightning::ln::msgs::DecodeError,
4577 }
4578 #[repr(C)]
4579 /// A CResult_InitFeaturesDecodeErrorZ represents the result of a fallible operation,
4580 /// containing a crate::lightning::ln::features::InitFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
4581 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4582 pub struct CResult_InitFeaturesDecodeErrorZ {
4583         /// The contents of this CResult_InitFeaturesDecodeErrorZ, accessible via either
4584         /// `err` or `result` depending on the state of `result_ok`.
4585         pub contents: CResult_InitFeaturesDecodeErrorZPtr,
4586         /// Whether this CResult_InitFeaturesDecodeErrorZ represents a success state.
4587         pub result_ok: bool,
4588 }
4589 #[no_mangle]
4590 /// Creates a new CResult_InitFeaturesDecodeErrorZ in the success state.
4591 pub extern "C" fn CResult_InitFeaturesDecodeErrorZ_ok(o: crate::lightning::ln::features::InitFeatures) -> CResult_InitFeaturesDecodeErrorZ {
4592         CResult_InitFeaturesDecodeErrorZ {
4593                 contents: CResult_InitFeaturesDecodeErrorZPtr {
4594                         result: Box::into_raw(Box::new(o)),
4595                 },
4596                 result_ok: true,
4597         }
4598 }
4599 #[no_mangle]
4600 /// Creates a new CResult_InitFeaturesDecodeErrorZ in the error state.
4601 pub extern "C" fn CResult_InitFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_InitFeaturesDecodeErrorZ {
4602         CResult_InitFeaturesDecodeErrorZ {
4603                 contents: CResult_InitFeaturesDecodeErrorZPtr {
4604                         err: Box::into_raw(Box::new(e)),
4605                 },
4606                 result_ok: false,
4607         }
4608 }
4609 /// Checks if the given object is currently in the success state
4610 #[no_mangle]
4611 pub extern "C" fn CResult_InitFeaturesDecodeErrorZ_is_ok(o: &CResult_InitFeaturesDecodeErrorZ) -> bool {
4612         o.result_ok
4613 }
4614 #[no_mangle]
4615 /// Frees any resources used by the CResult_InitFeaturesDecodeErrorZ.
4616 pub extern "C" fn CResult_InitFeaturesDecodeErrorZ_free(_res: CResult_InitFeaturesDecodeErrorZ) { }
4617 impl Drop for CResult_InitFeaturesDecodeErrorZ {
4618         fn drop(&mut self) {
4619                 if self.result_ok {
4620                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
4621                                 let _ = unsafe { Box::from_raw(self.contents.result) };
4622                         }
4623                 } else {
4624                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
4625                                 let _ = unsafe { Box::from_raw(self.contents.err) };
4626                         }
4627                 }
4628         }
4629 }
4630 impl From<crate::c_types::CResultTempl<crate::lightning::ln::features::InitFeatures, crate::lightning::ln::msgs::DecodeError>> for CResult_InitFeaturesDecodeErrorZ {
4631         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::features::InitFeatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
4632                 let contents = if o.result_ok {
4633                         let result = unsafe { o.contents.result };
4634                         unsafe { o.contents.result = core::ptr::null_mut() };
4635                         CResult_InitFeaturesDecodeErrorZPtr { result }
4636                 } else {
4637                         let err = unsafe { o.contents.err };
4638                         unsafe { o.contents.err = core::ptr::null_mut(); }
4639                         CResult_InitFeaturesDecodeErrorZPtr { err }
4640                 };
4641                 Self {
4642                         contents,
4643                         result_ok: o.result_ok,
4644                 }
4645         }
4646 }
4647 impl Clone for CResult_InitFeaturesDecodeErrorZ {
4648         fn clone(&self) -> Self {
4649                 if self.result_ok {
4650                         Self { result_ok: true, contents: CResult_InitFeaturesDecodeErrorZPtr {
4651                                 result: Box::into_raw(Box::new(<crate::lightning::ln::features::InitFeatures>::clone(unsafe { &*self.contents.result })))
4652                         } }
4653                 } else {
4654                         Self { result_ok: false, contents: CResult_InitFeaturesDecodeErrorZPtr {
4655                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
4656                         } }
4657                 }
4658         }
4659 }
4660 #[no_mangle]
4661 /// Creates a new CResult_InitFeaturesDecodeErrorZ which has the same data as `orig`
4662 /// but with all dynamically-allocated buffers duplicated in new buffers.
4663 pub extern "C" fn CResult_InitFeaturesDecodeErrorZ_clone(orig: &CResult_InitFeaturesDecodeErrorZ) -> CResult_InitFeaturesDecodeErrorZ { Clone::clone(&orig) }
4664 #[repr(C)]
4665 /// The contents of CResult_ChannelFeaturesDecodeErrorZ
4666 pub union CResult_ChannelFeaturesDecodeErrorZPtr {
4667         /// A pointer to the contents in the success state.
4668         /// Reading from this pointer when `result_ok` is not set is undefined.
4669         pub result: *mut crate::lightning::ln::features::ChannelFeatures,
4670         /// A pointer to the contents in the error state.
4671         /// Reading from this pointer when `result_ok` is set is undefined.
4672         pub err: *mut crate::lightning::ln::msgs::DecodeError,
4673 }
4674 #[repr(C)]
4675 /// A CResult_ChannelFeaturesDecodeErrorZ represents the result of a fallible operation,
4676 /// containing a crate::lightning::ln::features::ChannelFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
4677 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4678 pub struct CResult_ChannelFeaturesDecodeErrorZ {
4679         /// The contents of this CResult_ChannelFeaturesDecodeErrorZ, accessible via either
4680         /// `err` or `result` depending on the state of `result_ok`.
4681         pub contents: CResult_ChannelFeaturesDecodeErrorZPtr,
4682         /// Whether this CResult_ChannelFeaturesDecodeErrorZ represents a success state.
4683         pub result_ok: bool,
4684 }
4685 #[no_mangle]
4686 /// Creates a new CResult_ChannelFeaturesDecodeErrorZ in the success state.
4687 pub extern "C" fn CResult_ChannelFeaturesDecodeErrorZ_ok(o: crate::lightning::ln::features::ChannelFeatures) -> CResult_ChannelFeaturesDecodeErrorZ {
4688         CResult_ChannelFeaturesDecodeErrorZ {
4689                 contents: CResult_ChannelFeaturesDecodeErrorZPtr {
4690                         result: Box::into_raw(Box::new(o)),
4691                 },
4692                 result_ok: true,
4693         }
4694 }
4695 #[no_mangle]
4696 /// Creates a new CResult_ChannelFeaturesDecodeErrorZ in the error state.
4697 pub extern "C" fn CResult_ChannelFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelFeaturesDecodeErrorZ {
4698         CResult_ChannelFeaturesDecodeErrorZ {
4699                 contents: CResult_ChannelFeaturesDecodeErrorZPtr {
4700                         err: Box::into_raw(Box::new(e)),
4701                 },
4702                 result_ok: false,
4703         }
4704 }
4705 /// Checks if the given object is currently in the success state
4706 #[no_mangle]
4707 pub extern "C" fn CResult_ChannelFeaturesDecodeErrorZ_is_ok(o: &CResult_ChannelFeaturesDecodeErrorZ) -> bool {
4708         o.result_ok
4709 }
4710 #[no_mangle]
4711 /// Frees any resources used by the CResult_ChannelFeaturesDecodeErrorZ.
4712 pub extern "C" fn CResult_ChannelFeaturesDecodeErrorZ_free(_res: CResult_ChannelFeaturesDecodeErrorZ) { }
4713 impl Drop for CResult_ChannelFeaturesDecodeErrorZ {
4714         fn drop(&mut self) {
4715                 if self.result_ok {
4716                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
4717                                 let _ = unsafe { Box::from_raw(self.contents.result) };
4718                         }
4719                 } else {
4720                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
4721                                 let _ = unsafe { Box::from_raw(self.contents.err) };
4722                         }
4723                 }
4724         }
4725 }
4726 impl From<crate::c_types::CResultTempl<crate::lightning::ln::features::ChannelFeatures, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelFeaturesDecodeErrorZ {
4727         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::features::ChannelFeatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
4728                 let contents = if o.result_ok {
4729                         let result = unsafe { o.contents.result };
4730                         unsafe { o.contents.result = core::ptr::null_mut() };
4731                         CResult_ChannelFeaturesDecodeErrorZPtr { result }
4732                 } else {
4733                         let err = unsafe { o.contents.err };
4734                         unsafe { o.contents.err = core::ptr::null_mut(); }
4735                         CResult_ChannelFeaturesDecodeErrorZPtr { err }
4736                 };
4737                 Self {
4738                         contents,
4739                         result_ok: o.result_ok,
4740                 }
4741         }
4742 }
4743 impl Clone for CResult_ChannelFeaturesDecodeErrorZ {
4744         fn clone(&self) -> Self {
4745                 if self.result_ok {
4746                         Self { result_ok: true, contents: CResult_ChannelFeaturesDecodeErrorZPtr {
4747                                 result: Box::into_raw(Box::new(<crate::lightning::ln::features::ChannelFeatures>::clone(unsafe { &*self.contents.result })))
4748                         } }
4749                 } else {
4750                         Self { result_ok: false, contents: CResult_ChannelFeaturesDecodeErrorZPtr {
4751                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
4752                         } }
4753                 }
4754         }
4755 }
4756 #[no_mangle]
4757 /// Creates a new CResult_ChannelFeaturesDecodeErrorZ which has the same data as `orig`
4758 /// but with all dynamically-allocated buffers duplicated in new buffers.
4759 pub extern "C" fn CResult_ChannelFeaturesDecodeErrorZ_clone(orig: &CResult_ChannelFeaturesDecodeErrorZ) -> CResult_ChannelFeaturesDecodeErrorZ { Clone::clone(&orig) }
4760 #[repr(C)]
4761 /// The contents of CResult_NodeFeaturesDecodeErrorZ
4762 pub union CResult_NodeFeaturesDecodeErrorZPtr {
4763         /// A pointer to the contents in the success state.
4764         /// Reading from this pointer when `result_ok` is not set is undefined.
4765         pub result: *mut crate::lightning::ln::features::NodeFeatures,
4766         /// A pointer to the contents in the error state.
4767         /// Reading from this pointer when `result_ok` is set is undefined.
4768         pub err: *mut crate::lightning::ln::msgs::DecodeError,
4769 }
4770 #[repr(C)]
4771 /// A CResult_NodeFeaturesDecodeErrorZ represents the result of a fallible operation,
4772 /// containing a crate::lightning::ln::features::NodeFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
4773 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4774 pub struct CResult_NodeFeaturesDecodeErrorZ {
4775         /// The contents of this CResult_NodeFeaturesDecodeErrorZ, accessible via either
4776         /// `err` or `result` depending on the state of `result_ok`.
4777         pub contents: CResult_NodeFeaturesDecodeErrorZPtr,
4778         /// Whether this CResult_NodeFeaturesDecodeErrorZ represents a success state.
4779         pub result_ok: bool,
4780 }
4781 #[no_mangle]
4782 /// Creates a new CResult_NodeFeaturesDecodeErrorZ in the success state.
4783 pub extern "C" fn CResult_NodeFeaturesDecodeErrorZ_ok(o: crate::lightning::ln::features::NodeFeatures) -> CResult_NodeFeaturesDecodeErrorZ {
4784         CResult_NodeFeaturesDecodeErrorZ {
4785                 contents: CResult_NodeFeaturesDecodeErrorZPtr {
4786                         result: Box::into_raw(Box::new(o)),
4787                 },
4788                 result_ok: true,
4789         }
4790 }
4791 #[no_mangle]
4792 /// Creates a new CResult_NodeFeaturesDecodeErrorZ in the error state.
4793 pub extern "C" fn CResult_NodeFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeFeaturesDecodeErrorZ {
4794         CResult_NodeFeaturesDecodeErrorZ {
4795                 contents: CResult_NodeFeaturesDecodeErrorZPtr {
4796                         err: Box::into_raw(Box::new(e)),
4797                 },
4798                 result_ok: false,
4799         }
4800 }
4801 /// Checks if the given object is currently in the success state
4802 #[no_mangle]
4803 pub extern "C" fn CResult_NodeFeaturesDecodeErrorZ_is_ok(o: &CResult_NodeFeaturesDecodeErrorZ) -> bool {
4804         o.result_ok
4805 }
4806 #[no_mangle]
4807 /// Frees any resources used by the CResult_NodeFeaturesDecodeErrorZ.
4808 pub extern "C" fn CResult_NodeFeaturesDecodeErrorZ_free(_res: CResult_NodeFeaturesDecodeErrorZ) { }
4809 impl Drop for CResult_NodeFeaturesDecodeErrorZ {
4810         fn drop(&mut self) {
4811                 if self.result_ok {
4812                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
4813                                 let _ = unsafe { Box::from_raw(self.contents.result) };
4814                         }
4815                 } else {
4816                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
4817                                 let _ = unsafe { Box::from_raw(self.contents.err) };
4818                         }
4819                 }
4820         }
4821 }
4822 impl From<crate::c_types::CResultTempl<crate::lightning::ln::features::NodeFeatures, crate::lightning::ln::msgs::DecodeError>> for CResult_NodeFeaturesDecodeErrorZ {
4823         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::features::NodeFeatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
4824                 let contents = if o.result_ok {
4825                         let result = unsafe { o.contents.result };
4826                         unsafe { o.contents.result = core::ptr::null_mut() };
4827                         CResult_NodeFeaturesDecodeErrorZPtr { result }
4828                 } else {
4829                         let err = unsafe { o.contents.err };
4830                         unsafe { o.contents.err = core::ptr::null_mut(); }
4831                         CResult_NodeFeaturesDecodeErrorZPtr { err }
4832                 };
4833                 Self {
4834                         contents,
4835                         result_ok: o.result_ok,
4836                 }
4837         }
4838 }
4839 impl Clone for CResult_NodeFeaturesDecodeErrorZ {
4840         fn clone(&self) -> Self {
4841                 if self.result_ok {
4842                         Self { result_ok: true, contents: CResult_NodeFeaturesDecodeErrorZPtr {
4843                                 result: Box::into_raw(Box::new(<crate::lightning::ln::features::NodeFeatures>::clone(unsafe { &*self.contents.result })))
4844                         } }
4845                 } else {
4846                         Self { result_ok: false, contents: CResult_NodeFeaturesDecodeErrorZPtr {
4847                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
4848                         } }
4849                 }
4850         }
4851 }
4852 #[no_mangle]
4853 /// Creates a new CResult_NodeFeaturesDecodeErrorZ which has the same data as `orig`
4854 /// but with all dynamically-allocated buffers duplicated in new buffers.
4855 pub extern "C" fn CResult_NodeFeaturesDecodeErrorZ_clone(orig: &CResult_NodeFeaturesDecodeErrorZ) -> CResult_NodeFeaturesDecodeErrorZ { Clone::clone(&orig) }
4856 #[repr(C)]
4857 /// The contents of CResult_InvoiceFeaturesDecodeErrorZ
4858 pub union CResult_InvoiceFeaturesDecodeErrorZPtr {
4859         /// A pointer to the contents in the success state.
4860         /// Reading from this pointer when `result_ok` is not set is undefined.
4861         pub result: *mut crate::lightning::ln::features::InvoiceFeatures,
4862         /// A pointer to the contents in the error state.
4863         /// Reading from this pointer when `result_ok` is set is undefined.
4864         pub err: *mut crate::lightning::ln::msgs::DecodeError,
4865 }
4866 #[repr(C)]
4867 /// A CResult_InvoiceFeaturesDecodeErrorZ represents the result of a fallible operation,
4868 /// containing a crate::lightning::ln::features::InvoiceFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
4869 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4870 pub struct CResult_InvoiceFeaturesDecodeErrorZ {
4871         /// The contents of this CResult_InvoiceFeaturesDecodeErrorZ, accessible via either
4872         /// `err` or `result` depending on the state of `result_ok`.
4873         pub contents: CResult_InvoiceFeaturesDecodeErrorZPtr,
4874         /// Whether this CResult_InvoiceFeaturesDecodeErrorZ represents a success state.
4875         pub result_ok: bool,
4876 }
4877 #[no_mangle]
4878 /// Creates a new CResult_InvoiceFeaturesDecodeErrorZ in the success state.
4879 pub extern "C" fn CResult_InvoiceFeaturesDecodeErrorZ_ok(o: crate::lightning::ln::features::InvoiceFeatures) -> CResult_InvoiceFeaturesDecodeErrorZ {
4880         CResult_InvoiceFeaturesDecodeErrorZ {
4881                 contents: CResult_InvoiceFeaturesDecodeErrorZPtr {
4882                         result: Box::into_raw(Box::new(o)),
4883                 },
4884                 result_ok: true,
4885         }
4886 }
4887 #[no_mangle]
4888 /// Creates a new CResult_InvoiceFeaturesDecodeErrorZ in the error state.
4889 pub extern "C" fn CResult_InvoiceFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_InvoiceFeaturesDecodeErrorZ {
4890         CResult_InvoiceFeaturesDecodeErrorZ {
4891                 contents: CResult_InvoiceFeaturesDecodeErrorZPtr {
4892                         err: Box::into_raw(Box::new(e)),
4893                 },
4894                 result_ok: false,
4895         }
4896 }
4897 /// Checks if the given object is currently in the success state
4898 #[no_mangle]
4899 pub extern "C" fn CResult_InvoiceFeaturesDecodeErrorZ_is_ok(o: &CResult_InvoiceFeaturesDecodeErrorZ) -> bool {
4900         o.result_ok
4901 }
4902 #[no_mangle]
4903 /// Frees any resources used by the CResult_InvoiceFeaturesDecodeErrorZ.
4904 pub extern "C" fn CResult_InvoiceFeaturesDecodeErrorZ_free(_res: CResult_InvoiceFeaturesDecodeErrorZ) { }
4905 impl Drop for CResult_InvoiceFeaturesDecodeErrorZ {
4906         fn drop(&mut self) {
4907                 if self.result_ok {
4908                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
4909                                 let _ = unsafe { Box::from_raw(self.contents.result) };
4910                         }
4911                 } else {
4912                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
4913                                 let _ = unsafe { Box::from_raw(self.contents.err) };
4914                         }
4915                 }
4916         }
4917 }
4918 impl From<crate::c_types::CResultTempl<crate::lightning::ln::features::InvoiceFeatures, crate::lightning::ln::msgs::DecodeError>> for CResult_InvoiceFeaturesDecodeErrorZ {
4919         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::features::InvoiceFeatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
4920                 let contents = if o.result_ok {
4921                         let result = unsafe { o.contents.result };
4922                         unsafe { o.contents.result = core::ptr::null_mut() };
4923                         CResult_InvoiceFeaturesDecodeErrorZPtr { result }
4924                 } else {
4925                         let err = unsafe { o.contents.err };
4926                         unsafe { o.contents.err = core::ptr::null_mut(); }
4927                         CResult_InvoiceFeaturesDecodeErrorZPtr { err }
4928                 };
4929                 Self {
4930                         contents,
4931                         result_ok: o.result_ok,
4932                 }
4933         }
4934 }
4935 impl Clone for CResult_InvoiceFeaturesDecodeErrorZ {
4936         fn clone(&self) -> Self {
4937                 if self.result_ok {
4938                         Self { result_ok: true, contents: CResult_InvoiceFeaturesDecodeErrorZPtr {
4939                                 result: Box::into_raw(Box::new(<crate::lightning::ln::features::InvoiceFeatures>::clone(unsafe { &*self.contents.result })))
4940                         } }
4941                 } else {
4942                         Self { result_ok: false, contents: CResult_InvoiceFeaturesDecodeErrorZPtr {
4943                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
4944                         } }
4945                 }
4946         }
4947 }
4948 #[no_mangle]
4949 /// Creates a new CResult_InvoiceFeaturesDecodeErrorZ which has the same data as `orig`
4950 /// but with all dynamically-allocated buffers duplicated in new buffers.
4951 pub extern "C" fn CResult_InvoiceFeaturesDecodeErrorZ_clone(orig: &CResult_InvoiceFeaturesDecodeErrorZ) -> CResult_InvoiceFeaturesDecodeErrorZ { Clone::clone(&orig) }
4952 #[repr(C)]
4953 /// The contents of CResult_ChannelTypeFeaturesDecodeErrorZ
4954 pub union CResult_ChannelTypeFeaturesDecodeErrorZPtr {
4955         /// A pointer to the contents in the success state.
4956         /// Reading from this pointer when `result_ok` is not set is undefined.
4957         pub result: *mut crate::lightning::ln::features::ChannelTypeFeatures,
4958         /// A pointer to the contents in the error state.
4959         /// Reading from this pointer when `result_ok` is set is undefined.
4960         pub err: *mut crate::lightning::ln::msgs::DecodeError,
4961 }
4962 #[repr(C)]
4963 /// A CResult_ChannelTypeFeaturesDecodeErrorZ represents the result of a fallible operation,
4964 /// containing a crate::lightning::ln::features::ChannelTypeFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
4965 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4966 pub struct CResult_ChannelTypeFeaturesDecodeErrorZ {
4967         /// The contents of this CResult_ChannelTypeFeaturesDecodeErrorZ, accessible via either
4968         /// `err` or `result` depending on the state of `result_ok`.
4969         pub contents: CResult_ChannelTypeFeaturesDecodeErrorZPtr,
4970         /// Whether this CResult_ChannelTypeFeaturesDecodeErrorZ represents a success state.
4971         pub result_ok: bool,
4972 }
4973 #[no_mangle]
4974 /// Creates a new CResult_ChannelTypeFeaturesDecodeErrorZ in the success state.
4975 pub extern "C" fn CResult_ChannelTypeFeaturesDecodeErrorZ_ok(o: crate::lightning::ln::features::ChannelTypeFeatures) -> CResult_ChannelTypeFeaturesDecodeErrorZ {
4976         CResult_ChannelTypeFeaturesDecodeErrorZ {
4977                 contents: CResult_ChannelTypeFeaturesDecodeErrorZPtr {
4978                         result: Box::into_raw(Box::new(o)),
4979                 },
4980                 result_ok: true,
4981         }
4982 }
4983 #[no_mangle]
4984 /// Creates a new CResult_ChannelTypeFeaturesDecodeErrorZ in the error state.
4985 pub extern "C" fn CResult_ChannelTypeFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelTypeFeaturesDecodeErrorZ {
4986         CResult_ChannelTypeFeaturesDecodeErrorZ {
4987                 contents: CResult_ChannelTypeFeaturesDecodeErrorZPtr {
4988                         err: Box::into_raw(Box::new(e)),
4989                 },
4990                 result_ok: false,
4991         }
4992 }
4993 /// Checks if the given object is currently in the success state
4994 #[no_mangle]
4995 pub extern "C" fn CResult_ChannelTypeFeaturesDecodeErrorZ_is_ok(o: &CResult_ChannelTypeFeaturesDecodeErrorZ) -> bool {
4996         o.result_ok
4997 }
4998 #[no_mangle]
4999 /// Frees any resources used by the CResult_ChannelTypeFeaturesDecodeErrorZ.
5000 pub extern "C" fn CResult_ChannelTypeFeaturesDecodeErrorZ_free(_res: CResult_ChannelTypeFeaturesDecodeErrorZ) { }
5001 impl Drop for CResult_ChannelTypeFeaturesDecodeErrorZ {
5002         fn drop(&mut self) {
5003                 if self.result_ok {
5004                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
5005                                 let _ = unsafe { Box::from_raw(self.contents.result) };
5006                         }
5007                 } else {
5008                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
5009                                 let _ = unsafe { Box::from_raw(self.contents.err) };
5010                         }
5011                 }
5012         }
5013 }
5014 impl From<crate::c_types::CResultTempl<crate::lightning::ln::features::ChannelTypeFeatures, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelTypeFeaturesDecodeErrorZ {
5015         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::features::ChannelTypeFeatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
5016                 let contents = if o.result_ok {
5017                         let result = unsafe { o.contents.result };
5018                         unsafe { o.contents.result = core::ptr::null_mut() };
5019                         CResult_ChannelTypeFeaturesDecodeErrorZPtr { result }
5020                 } else {
5021                         let err = unsafe { o.contents.err };
5022                         unsafe { o.contents.err = core::ptr::null_mut(); }
5023                         CResult_ChannelTypeFeaturesDecodeErrorZPtr { err }
5024                 };
5025                 Self {
5026                         contents,
5027                         result_ok: o.result_ok,
5028                 }
5029         }
5030 }
5031 impl Clone for CResult_ChannelTypeFeaturesDecodeErrorZ {
5032         fn clone(&self) -> Self {
5033                 if self.result_ok {
5034                         Self { result_ok: true, contents: CResult_ChannelTypeFeaturesDecodeErrorZPtr {
5035                                 result: Box::into_raw(Box::new(<crate::lightning::ln::features::ChannelTypeFeatures>::clone(unsafe { &*self.contents.result })))
5036                         } }
5037                 } else {
5038                         Self { result_ok: false, contents: CResult_ChannelTypeFeaturesDecodeErrorZPtr {
5039                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
5040                         } }
5041                 }
5042         }
5043 }
5044 #[no_mangle]
5045 /// Creates a new CResult_ChannelTypeFeaturesDecodeErrorZ which has the same data as `orig`
5046 /// but with all dynamically-allocated buffers duplicated in new buffers.
5047 pub extern "C" fn CResult_ChannelTypeFeaturesDecodeErrorZ_clone(orig: &CResult_ChannelTypeFeaturesDecodeErrorZ) -> CResult_ChannelTypeFeaturesDecodeErrorZ { Clone::clone(&orig) }
5048 #[repr(C)]
5049 /// The contents of CResult_NodeIdDecodeErrorZ
5050 pub union CResult_NodeIdDecodeErrorZPtr {
5051         /// A pointer to the contents in the success state.
5052         /// Reading from this pointer when `result_ok` is not set is undefined.
5053         pub result: *mut crate::lightning::routing::gossip::NodeId,
5054         /// A pointer to the contents in the error state.
5055         /// Reading from this pointer when `result_ok` is set is undefined.
5056         pub err: *mut crate::lightning::ln::msgs::DecodeError,
5057 }
5058 #[repr(C)]
5059 /// A CResult_NodeIdDecodeErrorZ represents the result of a fallible operation,
5060 /// containing a crate::lightning::routing::gossip::NodeId on success and a crate::lightning::ln::msgs::DecodeError on failure.
5061 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5062 pub struct CResult_NodeIdDecodeErrorZ {
5063         /// The contents of this CResult_NodeIdDecodeErrorZ, accessible via either
5064         /// `err` or `result` depending on the state of `result_ok`.
5065         pub contents: CResult_NodeIdDecodeErrorZPtr,
5066         /// Whether this CResult_NodeIdDecodeErrorZ represents a success state.
5067         pub result_ok: bool,
5068 }
5069 #[no_mangle]
5070 /// Creates a new CResult_NodeIdDecodeErrorZ in the success state.
5071 pub extern "C" fn CResult_NodeIdDecodeErrorZ_ok(o: crate::lightning::routing::gossip::NodeId) -> CResult_NodeIdDecodeErrorZ {
5072         CResult_NodeIdDecodeErrorZ {
5073                 contents: CResult_NodeIdDecodeErrorZPtr {
5074                         result: Box::into_raw(Box::new(o)),
5075                 },
5076                 result_ok: true,
5077         }
5078 }
5079 #[no_mangle]
5080 /// Creates a new CResult_NodeIdDecodeErrorZ in the error state.
5081 pub extern "C" fn CResult_NodeIdDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeIdDecodeErrorZ {
5082         CResult_NodeIdDecodeErrorZ {
5083                 contents: CResult_NodeIdDecodeErrorZPtr {
5084                         err: Box::into_raw(Box::new(e)),
5085                 },
5086                 result_ok: false,
5087         }
5088 }
5089 /// Checks if the given object is currently in the success state
5090 #[no_mangle]
5091 pub extern "C" fn CResult_NodeIdDecodeErrorZ_is_ok(o: &CResult_NodeIdDecodeErrorZ) -> bool {
5092         o.result_ok
5093 }
5094 #[no_mangle]
5095 /// Frees any resources used by the CResult_NodeIdDecodeErrorZ.
5096 pub extern "C" fn CResult_NodeIdDecodeErrorZ_free(_res: CResult_NodeIdDecodeErrorZ) { }
5097 impl Drop for CResult_NodeIdDecodeErrorZ {
5098         fn drop(&mut self) {
5099                 if self.result_ok {
5100                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
5101                                 let _ = unsafe { Box::from_raw(self.contents.result) };
5102                         }
5103                 } else {
5104                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
5105                                 let _ = unsafe { Box::from_raw(self.contents.err) };
5106                         }
5107                 }
5108         }
5109 }
5110 impl From<crate::c_types::CResultTempl<crate::lightning::routing::gossip::NodeId, crate::lightning::ln::msgs::DecodeError>> for CResult_NodeIdDecodeErrorZ {
5111         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::gossip::NodeId, crate::lightning::ln::msgs::DecodeError>) -> Self {
5112                 let contents = if o.result_ok {
5113                         let result = unsafe { o.contents.result };
5114                         unsafe { o.contents.result = core::ptr::null_mut() };
5115                         CResult_NodeIdDecodeErrorZPtr { result }
5116                 } else {
5117                         let err = unsafe { o.contents.err };
5118                         unsafe { o.contents.err = core::ptr::null_mut(); }
5119                         CResult_NodeIdDecodeErrorZPtr { err }
5120                 };
5121                 Self {
5122                         contents,
5123                         result_ok: o.result_ok,
5124                 }
5125         }
5126 }
5127 impl Clone for CResult_NodeIdDecodeErrorZ {
5128         fn clone(&self) -> Self {
5129                 if self.result_ok {
5130                         Self { result_ok: true, contents: CResult_NodeIdDecodeErrorZPtr {
5131                                 result: Box::into_raw(Box::new(<crate::lightning::routing::gossip::NodeId>::clone(unsafe { &*self.contents.result })))
5132                         } }
5133                 } else {
5134                         Self { result_ok: false, contents: CResult_NodeIdDecodeErrorZPtr {
5135                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
5136                         } }
5137                 }
5138         }
5139 }
5140 #[no_mangle]
5141 /// Creates a new CResult_NodeIdDecodeErrorZ which has the same data as `orig`
5142 /// but with all dynamically-allocated buffers duplicated in new buffers.
5143 pub extern "C" fn CResult_NodeIdDecodeErrorZ_clone(orig: &CResult_NodeIdDecodeErrorZ) -> CResult_NodeIdDecodeErrorZ { Clone::clone(&orig) }
5144 #[repr(C)]
5145 /// The contents of CResult_COption_NetworkUpdateZDecodeErrorZ
5146 pub union CResult_COption_NetworkUpdateZDecodeErrorZPtr {
5147         /// A pointer to the contents in the success state.
5148         /// Reading from this pointer when `result_ok` is not set is undefined.
5149         pub result: *mut crate::c_types::derived::COption_NetworkUpdateZ,
5150         /// A pointer to the contents in the error state.
5151         /// Reading from this pointer when `result_ok` is set is undefined.
5152         pub err: *mut crate::lightning::ln::msgs::DecodeError,
5153 }
5154 #[repr(C)]
5155 /// A CResult_COption_NetworkUpdateZDecodeErrorZ represents the result of a fallible operation,
5156 /// containing a crate::c_types::derived::COption_NetworkUpdateZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
5157 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5158 pub struct CResult_COption_NetworkUpdateZDecodeErrorZ {
5159         /// The contents of this CResult_COption_NetworkUpdateZDecodeErrorZ, accessible via either
5160         /// `err` or `result` depending on the state of `result_ok`.
5161         pub contents: CResult_COption_NetworkUpdateZDecodeErrorZPtr,
5162         /// Whether this CResult_COption_NetworkUpdateZDecodeErrorZ represents a success state.
5163         pub result_ok: bool,
5164 }
5165 #[no_mangle]
5166 /// Creates a new CResult_COption_NetworkUpdateZDecodeErrorZ in the success state.
5167 pub extern "C" fn CResult_COption_NetworkUpdateZDecodeErrorZ_ok(o: crate::c_types::derived::COption_NetworkUpdateZ) -> CResult_COption_NetworkUpdateZDecodeErrorZ {
5168         CResult_COption_NetworkUpdateZDecodeErrorZ {
5169                 contents: CResult_COption_NetworkUpdateZDecodeErrorZPtr {
5170                         result: Box::into_raw(Box::new(o)),
5171                 },
5172                 result_ok: true,
5173         }
5174 }
5175 #[no_mangle]
5176 /// Creates a new CResult_COption_NetworkUpdateZDecodeErrorZ in the error state.
5177 pub extern "C" fn CResult_COption_NetworkUpdateZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_NetworkUpdateZDecodeErrorZ {
5178         CResult_COption_NetworkUpdateZDecodeErrorZ {
5179                 contents: CResult_COption_NetworkUpdateZDecodeErrorZPtr {
5180                         err: Box::into_raw(Box::new(e)),
5181                 },
5182                 result_ok: false,
5183         }
5184 }
5185 /// Checks if the given object is currently in the success state
5186 #[no_mangle]
5187 pub extern "C" fn CResult_COption_NetworkUpdateZDecodeErrorZ_is_ok(o: &CResult_COption_NetworkUpdateZDecodeErrorZ) -> bool {
5188         o.result_ok
5189 }
5190 #[no_mangle]
5191 /// Frees any resources used by the CResult_COption_NetworkUpdateZDecodeErrorZ.
5192 pub extern "C" fn CResult_COption_NetworkUpdateZDecodeErrorZ_free(_res: CResult_COption_NetworkUpdateZDecodeErrorZ) { }
5193 impl Drop for CResult_COption_NetworkUpdateZDecodeErrorZ {
5194         fn drop(&mut self) {
5195                 if self.result_ok {
5196                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
5197                                 let _ = unsafe { Box::from_raw(self.contents.result) };
5198                         }
5199                 } else {
5200                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
5201                                 let _ = unsafe { Box::from_raw(self.contents.err) };
5202                         }
5203                 }
5204         }
5205 }
5206 impl From<crate::c_types::CResultTempl<crate::c_types::derived::COption_NetworkUpdateZ, crate::lightning::ln::msgs::DecodeError>> for CResult_COption_NetworkUpdateZDecodeErrorZ {
5207         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::COption_NetworkUpdateZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
5208                 let contents = if o.result_ok {
5209                         let result = unsafe { o.contents.result };
5210                         unsafe { o.contents.result = core::ptr::null_mut() };
5211                         CResult_COption_NetworkUpdateZDecodeErrorZPtr { result }
5212                 } else {
5213                         let err = unsafe { o.contents.err };
5214                         unsafe { o.contents.err = core::ptr::null_mut(); }
5215                         CResult_COption_NetworkUpdateZDecodeErrorZPtr { err }
5216                 };
5217                 Self {
5218                         contents,
5219                         result_ok: o.result_ok,
5220                 }
5221         }
5222 }
5223 impl Clone for CResult_COption_NetworkUpdateZDecodeErrorZ {
5224         fn clone(&self) -> Self {
5225                 if self.result_ok {
5226                         Self { result_ok: true, contents: CResult_COption_NetworkUpdateZDecodeErrorZPtr {
5227                                 result: Box::into_raw(Box::new(<crate::c_types::derived::COption_NetworkUpdateZ>::clone(unsafe { &*self.contents.result })))
5228                         } }
5229                 } else {
5230                         Self { result_ok: false, contents: CResult_COption_NetworkUpdateZDecodeErrorZPtr {
5231                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
5232                         } }
5233                 }
5234         }
5235 }
5236 #[no_mangle]
5237 /// Creates a new CResult_COption_NetworkUpdateZDecodeErrorZ which has the same data as `orig`
5238 /// but with all dynamically-allocated buffers duplicated in new buffers.
5239 pub extern "C" fn CResult_COption_NetworkUpdateZDecodeErrorZ_clone(orig: &CResult_COption_NetworkUpdateZDecodeErrorZ) -> CResult_COption_NetworkUpdateZDecodeErrorZ { Clone::clone(&orig) }
5240 #[repr(C)]
5241 /// An enum which can either contain a crate::lightning::chain::Access or not
5242 pub enum COption_AccessZ {
5243         /// When we're in this state, this COption_AccessZ contains a crate::lightning::chain::Access
5244         Some(crate::lightning::chain::Access),
5245         /// When we're in this state, this COption_AccessZ contains nothing
5246         None
5247 }
5248 impl COption_AccessZ {
5249         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
5250                 if let Self::None = self { false } else { true }
5251         }
5252         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
5253                 !self.is_some()
5254         }
5255         #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::chain::Access {
5256                 if let Self::Some(v) = self { v } else { unreachable!() }
5257         }
5258 }
5259 #[no_mangle]
5260 /// Constructs a new COption_AccessZ containing a crate::lightning::chain::Access
5261 pub extern "C" fn COption_AccessZ_some(o: crate::lightning::chain::Access) -> COption_AccessZ {
5262         COption_AccessZ::Some(o)
5263 }
5264 #[no_mangle]
5265 /// Constructs a new COption_AccessZ containing nothing
5266 pub extern "C" fn COption_AccessZ_none() -> COption_AccessZ {
5267         COption_AccessZ::None
5268 }
5269 #[no_mangle]
5270 /// Frees any resources associated with the crate::lightning::chain::Access, if we are in the Some state
5271 pub extern "C" fn COption_AccessZ_free(_res: COption_AccessZ) { }
5272 #[repr(C)]
5273 /// The contents of CResult_boolLightningErrorZ
5274 pub union CResult_boolLightningErrorZPtr {
5275         /// A pointer to the contents in the success state.
5276         /// Reading from this pointer when `result_ok` is not set is undefined.
5277         pub result: *mut bool,
5278         /// A pointer to the contents in the error state.
5279         /// Reading from this pointer when `result_ok` is set is undefined.
5280         pub err: *mut crate::lightning::ln::msgs::LightningError,
5281 }
5282 #[repr(C)]
5283 /// A CResult_boolLightningErrorZ represents the result of a fallible operation,
5284 /// containing a bool on success and a crate::lightning::ln::msgs::LightningError on failure.
5285 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5286 pub struct CResult_boolLightningErrorZ {
5287         /// The contents of this CResult_boolLightningErrorZ, accessible via either
5288         /// `err` or `result` depending on the state of `result_ok`.
5289         pub contents: CResult_boolLightningErrorZPtr,
5290         /// Whether this CResult_boolLightningErrorZ represents a success state.
5291         pub result_ok: bool,
5292 }
5293 #[no_mangle]
5294 /// Creates a new CResult_boolLightningErrorZ in the success state.
5295 pub extern "C" fn CResult_boolLightningErrorZ_ok(o: bool) -> CResult_boolLightningErrorZ {
5296         CResult_boolLightningErrorZ {
5297                 contents: CResult_boolLightningErrorZPtr {
5298                         result: Box::into_raw(Box::new(o)),
5299                 },
5300                 result_ok: true,
5301         }
5302 }
5303 #[no_mangle]
5304 /// Creates a new CResult_boolLightningErrorZ in the error state.
5305 pub extern "C" fn CResult_boolLightningErrorZ_err(e: crate::lightning::ln::msgs::LightningError) -> CResult_boolLightningErrorZ {
5306         CResult_boolLightningErrorZ {
5307                 contents: CResult_boolLightningErrorZPtr {
5308                         err: Box::into_raw(Box::new(e)),
5309                 },
5310                 result_ok: false,
5311         }
5312 }
5313 /// Checks if the given object is currently in the success state
5314 #[no_mangle]
5315 pub extern "C" fn CResult_boolLightningErrorZ_is_ok(o: &CResult_boolLightningErrorZ) -> bool {
5316         o.result_ok
5317 }
5318 #[no_mangle]
5319 /// Frees any resources used by the CResult_boolLightningErrorZ.
5320 pub extern "C" fn CResult_boolLightningErrorZ_free(_res: CResult_boolLightningErrorZ) { }
5321 impl Drop for CResult_boolLightningErrorZ {
5322         fn drop(&mut self) {
5323                 if self.result_ok {
5324                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
5325                                 let _ = unsafe { Box::from_raw(self.contents.result) };
5326                         }
5327                 } else {
5328                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
5329                                 let _ = unsafe { Box::from_raw(self.contents.err) };
5330                         }
5331                 }
5332         }
5333 }
5334 impl From<crate::c_types::CResultTempl<bool, crate::lightning::ln::msgs::LightningError>> for CResult_boolLightningErrorZ {
5335         fn from(mut o: crate::c_types::CResultTempl<bool, crate::lightning::ln::msgs::LightningError>) -> Self {
5336                 let contents = if o.result_ok {
5337                         let result = unsafe { o.contents.result };
5338                         unsafe { o.contents.result = core::ptr::null_mut() };
5339                         CResult_boolLightningErrorZPtr { result }
5340                 } else {
5341                         let err = unsafe { o.contents.err };
5342                         unsafe { o.contents.err = core::ptr::null_mut(); }
5343                         CResult_boolLightningErrorZPtr { err }
5344                 };
5345                 Self {
5346                         contents,
5347                         result_ok: o.result_ok,
5348                 }
5349         }
5350 }
5351 impl Clone for CResult_boolLightningErrorZ {
5352         fn clone(&self) -> Self {
5353                 if self.result_ok {
5354                         Self { result_ok: true, contents: CResult_boolLightningErrorZPtr {
5355                                 result: Box::into_raw(Box::new(<bool>::clone(unsafe { &*self.contents.result })))
5356                         } }
5357                 } else {
5358                         Self { result_ok: false, contents: CResult_boolLightningErrorZPtr {
5359                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::LightningError>::clone(unsafe { &*self.contents.err })))
5360                         } }
5361                 }
5362         }
5363 }
5364 #[no_mangle]
5365 /// Creates a new CResult_boolLightningErrorZ which has the same data as `orig`
5366 /// but with all dynamically-allocated buffers duplicated in new buffers.
5367 pub extern "C" fn CResult_boolLightningErrorZ_clone(orig: &CResult_boolLightningErrorZ) -> CResult_boolLightningErrorZ { Clone::clone(&orig) }
5368 #[repr(C)]
5369 /// A tuple of 3 elements. See the individual fields for the types contained.
5370 pub struct C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
5371         /// The element at position 0
5372         pub a: crate::lightning::ln::msgs::ChannelAnnouncement,
5373         /// The element at position 1
5374         pub b: crate::lightning::ln::msgs::ChannelUpdate,
5375         /// The element at position 2
5376         pub c: crate::lightning::ln::msgs::ChannelUpdate,
5377 }
5378 impl From<(crate::lightning::ln::msgs::ChannelAnnouncement, crate::lightning::ln::msgs::ChannelUpdate, crate::lightning::ln::msgs::ChannelUpdate)> for C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
5379         fn from (tup: (crate::lightning::ln::msgs::ChannelAnnouncement, crate::lightning::ln::msgs::ChannelUpdate, crate::lightning::ln::msgs::ChannelUpdate)) -> Self {
5380                 Self {
5381                         a: tup.0,
5382                         b: tup.1,
5383                         c: tup.2,
5384                 }
5385         }
5386 }
5387 impl C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
5388         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::lightning::ln::msgs::ChannelAnnouncement, crate::lightning::ln::msgs::ChannelUpdate, crate::lightning::ln::msgs::ChannelUpdate) {
5389                 (self.a, self.b, self.c)
5390         }
5391 }
5392 impl Clone for C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
5393         fn clone(&self) -> Self {
5394                 Self {
5395                         a: Clone::clone(&self.a),
5396                         b: Clone::clone(&self.b),
5397                         c: Clone::clone(&self.c),
5398                 }
5399         }
5400 }
5401 #[no_mangle]
5402 /// Creates a new tuple which has the same data as `orig`
5403 /// but with all dynamically-allocated buffers duplicated in new buffers.
5404 pub extern "C" fn C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(orig: &C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ) -> C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ { Clone::clone(&orig) }
5405 /// Creates a new C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ from the contained elements.
5406 #[no_mangle]
5407 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 {
5408         C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ { a, b, c, }
5409 }
5410
5411 #[no_mangle]
5412 /// Frees any resources used by the C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ.
5413 pub extern "C" fn C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free(_res: C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ) { }
5414 #[repr(C)]
5415 #[derive(Clone)]
5416 /// An enum which can either contain a crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ or not
5417 pub enum COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
5418         /// When we're in this state, this COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ contains a crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ
5419         Some(crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ),
5420         /// When we're in this state, this COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ contains nothing
5421         None
5422 }
5423 impl COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
5424         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
5425                 if let Self::None = self { false } else { true }
5426         }
5427         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
5428                 !self.is_some()
5429         }
5430         #[allow(unused)] pub(crate) fn take(mut self) -> crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
5431                 if let Self::Some(v) = self { v } else { unreachable!() }
5432         }
5433 }
5434 #[no_mangle]
5435 /// Constructs a new COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ containing a crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ
5436 pub extern "C" fn COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_some(o: crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ) -> COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
5437         COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ::Some(o)
5438 }
5439 #[no_mangle]
5440 /// Constructs a new COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ containing nothing
5441 pub extern "C" fn COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_none() -> COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
5442         COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ::None
5443 }
5444 #[no_mangle]
5445 /// Frees any resources associated with the crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ, if we are in the Some state
5446 pub extern "C" fn COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free(_res: COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ) { }
5447 #[no_mangle]
5448 /// Creates a new COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ which has the same data as `orig`
5449 /// but with all dynamically-allocated buffers duplicated in new buffers.
5450 pub extern "C" fn COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_clone(orig: &COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ) -> COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ { Clone::clone(&orig) }
5451 #[repr(C)]
5452 /// The contents of CResult_NoneLightningErrorZ
5453 pub union CResult_NoneLightningErrorZPtr {
5454         /// Note that this value is always NULL, as there are no contents in the OK variant
5455         pub result: *mut core::ffi::c_void,
5456         /// A pointer to the contents in the error state.
5457         /// Reading from this pointer when `result_ok` is set is undefined.
5458         pub err: *mut crate::lightning::ln::msgs::LightningError,
5459 }
5460 #[repr(C)]
5461 /// A CResult_NoneLightningErrorZ represents the result of a fallible operation,
5462 /// containing a () on success and a crate::lightning::ln::msgs::LightningError on failure.
5463 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5464 pub struct CResult_NoneLightningErrorZ {
5465         /// The contents of this CResult_NoneLightningErrorZ, accessible via either
5466         /// `err` or `result` depending on the state of `result_ok`.
5467         pub contents: CResult_NoneLightningErrorZPtr,
5468         /// Whether this CResult_NoneLightningErrorZ represents a success state.
5469         pub result_ok: bool,
5470 }
5471 #[no_mangle]
5472 /// Creates a new CResult_NoneLightningErrorZ in the success state.
5473 pub extern "C" fn CResult_NoneLightningErrorZ_ok() -> CResult_NoneLightningErrorZ {
5474         CResult_NoneLightningErrorZ {
5475                 contents: CResult_NoneLightningErrorZPtr {
5476                         result: core::ptr::null_mut(),
5477                 },
5478                 result_ok: true,
5479         }
5480 }
5481 #[no_mangle]
5482 /// Creates a new CResult_NoneLightningErrorZ in the error state.
5483 pub extern "C" fn CResult_NoneLightningErrorZ_err(e: crate::lightning::ln::msgs::LightningError) -> CResult_NoneLightningErrorZ {
5484         CResult_NoneLightningErrorZ {
5485                 contents: CResult_NoneLightningErrorZPtr {
5486                         err: Box::into_raw(Box::new(e)),
5487                 },
5488                 result_ok: false,
5489         }
5490 }
5491 /// Checks if the given object is currently in the success state
5492 #[no_mangle]
5493 pub extern "C" fn CResult_NoneLightningErrorZ_is_ok(o: &CResult_NoneLightningErrorZ) -> bool {
5494         o.result_ok
5495 }
5496 #[no_mangle]
5497 /// Frees any resources used by the CResult_NoneLightningErrorZ.
5498 pub extern "C" fn CResult_NoneLightningErrorZ_free(_res: CResult_NoneLightningErrorZ) { }
5499 impl Drop for CResult_NoneLightningErrorZ {
5500         fn drop(&mut self) {
5501                 if self.result_ok {
5502                 } else {
5503                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
5504                                 let _ = unsafe { Box::from_raw(self.contents.err) };
5505                         }
5506                 }
5507         }
5508 }
5509 impl From<crate::c_types::CResultTempl<(), crate::lightning::ln::msgs::LightningError>> for CResult_NoneLightningErrorZ {
5510         fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::ln::msgs::LightningError>) -> Self {
5511                 let contents = if o.result_ok {
5512                         let _ = unsafe { Box::from_raw(o.contents.result) };
5513                         o.contents.result = core::ptr::null_mut();
5514                         CResult_NoneLightningErrorZPtr { result: core::ptr::null_mut() }
5515                 } else {
5516                         let err = unsafe { o.contents.err };
5517                         unsafe { o.contents.err = core::ptr::null_mut(); }
5518                         CResult_NoneLightningErrorZPtr { err }
5519                 };
5520                 Self {
5521                         contents,
5522                         result_ok: o.result_ok,
5523                 }
5524         }
5525 }
5526 impl Clone for CResult_NoneLightningErrorZ {
5527         fn clone(&self) -> Self {
5528                 if self.result_ok {
5529                         Self { result_ok: true, contents: CResult_NoneLightningErrorZPtr {
5530                                 result: core::ptr::null_mut()
5531                         } }
5532                 } else {
5533                         Self { result_ok: false, contents: CResult_NoneLightningErrorZPtr {
5534                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::LightningError>::clone(unsafe { &*self.contents.err })))
5535                         } }
5536                 }
5537         }
5538 }
5539 #[no_mangle]
5540 /// Creates a new CResult_NoneLightningErrorZ which has the same data as `orig`
5541 /// but with all dynamically-allocated buffers duplicated in new buffers.
5542 pub extern "C" fn CResult_NoneLightningErrorZ_clone(orig: &CResult_NoneLightningErrorZ) -> CResult_NoneLightningErrorZ { Clone::clone(&orig) }
5543 #[repr(C)]
5544 /// The contents of CResult_ChannelUpdateInfoDecodeErrorZ
5545 pub union CResult_ChannelUpdateInfoDecodeErrorZPtr {
5546         /// A pointer to the contents in the success state.
5547         /// Reading from this pointer when `result_ok` is not set is undefined.
5548         pub result: *mut crate::lightning::routing::gossip::ChannelUpdateInfo,
5549         /// A pointer to the contents in the error state.
5550         /// Reading from this pointer when `result_ok` is set is undefined.
5551         pub err: *mut crate::lightning::ln::msgs::DecodeError,
5552 }
5553 #[repr(C)]
5554 /// A CResult_ChannelUpdateInfoDecodeErrorZ represents the result of a fallible operation,
5555 /// containing a crate::lightning::routing::gossip::ChannelUpdateInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
5556 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5557 pub struct CResult_ChannelUpdateInfoDecodeErrorZ {
5558         /// The contents of this CResult_ChannelUpdateInfoDecodeErrorZ, accessible via either
5559         /// `err` or `result` depending on the state of `result_ok`.
5560         pub contents: CResult_ChannelUpdateInfoDecodeErrorZPtr,
5561         /// Whether this CResult_ChannelUpdateInfoDecodeErrorZ represents a success state.
5562         pub result_ok: bool,
5563 }
5564 #[no_mangle]
5565 /// Creates a new CResult_ChannelUpdateInfoDecodeErrorZ in the success state.
5566 pub extern "C" fn CResult_ChannelUpdateInfoDecodeErrorZ_ok(o: crate::lightning::routing::gossip::ChannelUpdateInfo) -> CResult_ChannelUpdateInfoDecodeErrorZ {
5567         CResult_ChannelUpdateInfoDecodeErrorZ {
5568                 contents: CResult_ChannelUpdateInfoDecodeErrorZPtr {
5569                         result: Box::into_raw(Box::new(o)),
5570                 },
5571                 result_ok: true,
5572         }
5573 }
5574 #[no_mangle]
5575 /// Creates a new CResult_ChannelUpdateInfoDecodeErrorZ in the error state.
5576 pub extern "C" fn CResult_ChannelUpdateInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelUpdateInfoDecodeErrorZ {
5577         CResult_ChannelUpdateInfoDecodeErrorZ {
5578                 contents: CResult_ChannelUpdateInfoDecodeErrorZPtr {
5579                         err: Box::into_raw(Box::new(e)),
5580                 },
5581                 result_ok: false,
5582         }
5583 }
5584 /// Checks if the given object is currently in the success state
5585 #[no_mangle]
5586 pub extern "C" fn CResult_ChannelUpdateInfoDecodeErrorZ_is_ok(o: &CResult_ChannelUpdateInfoDecodeErrorZ) -> bool {
5587         o.result_ok
5588 }
5589 #[no_mangle]
5590 /// Frees any resources used by the CResult_ChannelUpdateInfoDecodeErrorZ.
5591 pub extern "C" fn CResult_ChannelUpdateInfoDecodeErrorZ_free(_res: CResult_ChannelUpdateInfoDecodeErrorZ) { }
5592 impl Drop for CResult_ChannelUpdateInfoDecodeErrorZ {
5593         fn drop(&mut self) {
5594                 if self.result_ok {
5595                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
5596                                 let _ = unsafe { Box::from_raw(self.contents.result) };
5597                         }
5598                 } else {
5599                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
5600                                 let _ = unsafe { Box::from_raw(self.contents.err) };
5601                         }
5602                 }
5603         }
5604 }
5605 impl From<crate::c_types::CResultTempl<crate::lightning::routing::gossip::ChannelUpdateInfo, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelUpdateInfoDecodeErrorZ {
5606         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::gossip::ChannelUpdateInfo, crate::lightning::ln::msgs::DecodeError>) -> Self {
5607                 let contents = if o.result_ok {
5608                         let result = unsafe { o.contents.result };
5609                         unsafe { o.contents.result = core::ptr::null_mut() };
5610                         CResult_ChannelUpdateInfoDecodeErrorZPtr { result }
5611                 } else {
5612                         let err = unsafe { o.contents.err };
5613                         unsafe { o.contents.err = core::ptr::null_mut(); }
5614                         CResult_ChannelUpdateInfoDecodeErrorZPtr { err }
5615                 };
5616                 Self {
5617                         contents,
5618                         result_ok: o.result_ok,
5619                 }
5620         }
5621 }
5622 impl Clone for CResult_ChannelUpdateInfoDecodeErrorZ {
5623         fn clone(&self) -> Self {
5624                 if self.result_ok {
5625                         Self { result_ok: true, contents: CResult_ChannelUpdateInfoDecodeErrorZPtr {
5626                                 result: Box::into_raw(Box::new(<crate::lightning::routing::gossip::ChannelUpdateInfo>::clone(unsafe { &*self.contents.result })))
5627                         } }
5628                 } else {
5629                         Self { result_ok: false, contents: CResult_ChannelUpdateInfoDecodeErrorZPtr {
5630                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
5631                         } }
5632                 }
5633         }
5634 }
5635 #[no_mangle]
5636 /// Creates a new CResult_ChannelUpdateInfoDecodeErrorZ which has the same data as `orig`
5637 /// but with all dynamically-allocated buffers duplicated in new buffers.
5638 pub extern "C" fn CResult_ChannelUpdateInfoDecodeErrorZ_clone(orig: &CResult_ChannelUpdateInfoDecodeErrorZ) -> CResult_ChannelUpdateInfoDecodeErrorZ { Clone::clone(&orig) }
5639 #[repr(C)]
5640 /// The contents of CResult_ChannelInfoDecodeErrorZ
5641 pub union CResult_ChannelInfoDecodeErrorZPtr {
5642         /// A pointer to the contents in the success state.
5643         /// Reading from this pointer when `result_ok` is not set is undefined.
5644         pub result: *mut crate::lightning::routing::gossip::ChannelInfo,
5645         /// A pointer to the contents in the error state.
5646         /// Reading from this pointer when `result_ok` is set is undefined.
5647         pub err: *mut crate::lightning::ln::msgs::DecodeError,
5648 }
5649 #[repr(C)]
5650 /// A CResult_ChannelInfoDecodeErrorZ represents the result of a fallible operation,
5651 /// containing a crate::lightning::routing::gossip::ChannelInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
5652 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5653 pub struct CResult_ChannelInfoDecodeErrorZ {
5654         /// The contents of this CResult_ChannelInfoDecodeErrorZ, accessible via either
5655         /// `err` or `result` depending on the state of `result_ok`.
5656         pub contents: CResult_ChannelInfoDecodeErrorZPtr,
5657         /// Whether this CResult_ChannelInfoDecodeErrorZ represents a success state.
5658         pub result_ok: bool,
5659 }
5660 #[no_mangle]
5661 /// Creates a new CResult_ChannelInfoDecodeErrorZ in the success state.
5662 pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_ok(o: crate::lightning::routing::gossip::ChannelInfo) -> CResult_ChannelInfoDecodeErrorZ {
5663         CResult_ChannelInfoDecodeErrorZ {
5664                 contents: CResult_ChannelInfoDecodeErrorZPtr {
5665                         result: Box::into_raw(Box::new(o)),
5666                 },
5667                 result_ok: true,
5668         }
5669 }
5670 #[no_mangle]
5671 /// Creates a new CResult_ChannelInfoDecodeErrorZ in the error state.
5672 pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelInfoDecodeErrorZ {
5673         CResult_ChannelInfoDecodeErrorZ {
5674                 contents: CResult_ChannelInfoDecodeErrorZPtr {
5675                         err: Box::into_raw(Box::new(e)),
5676                 },
5677                 result_ok: false,
5678         }
5679 }
5680 /// Checks if the given object is currently in the success state
5681 #[no_mangle]
5682 pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_is_ok(o: &CResult_ChannelInfoDecodeErrorZ) -> bool {
5683         o.result_ok
5684 }
5685 #[no_mangle]
5686 /// Frees any resources used by the CResult_ChannelInfoDecodeErrorZ.
5687 pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_free(_res: CResult_ChannelInfoDecodeErrorZ) { }
5688 impl Drop for CResult_ChannelInfoDecodeErrorZ {
5689         fn drop(&mut self) {
5690                 if self.result_ok {
5691                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
5692                                 let _ = unsafe { Box::from_raw(self.contents.result) };
5693                         }
5694                 } else {
5695                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
5696                                 let _ = unsafe { Box::from_raw(self.contents.err) };
5697                         }
5698                 }
5699         }
5700 }
5701 impl From<crate::c_types::CResultTempl<crate::lightning::routing::gossip::ChannelInfo, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelInfoDecodeErrorZ {
5702         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::gossip::ChannelInfo, crate::lightning::ln::msgs::DecodeError>) -> Self {
5703                 let contents = if o.result_ok {
5704                         let result = unsafe { o.contents.result };
5705                         unsafe { o.contents.result = core::ptr::null_mut() };
5706                         CResult_ChannelInfoDecodeErrorZPtr { result }
5707                 } else {
5708                         let err = unsafe { o.contents.err };
5709                         unsafe { o.contents.err = core::ptr::null_mut(); }
5710                         CResult_ChannelInfoDecodeErrorZPtr { err }
5711                 };
5712                 Self {
5713                         contents,
5714                         result_ok: o.result_ok,
5715                 }
5716         }
5717 }
5718 impl Clone for CResult_ChannelInfoDecodeErrorZ {
5719         fn clone(&self) -> Self {
5720                 if self.result_ok {
5721                         Self { result_ok: true, contents: CResult_ChannelInfoDecodeErrorZPtr {
5722                                 result: Box::into_raw(Box::new(<crate::lightning::routing::gossip::ChannelInfo>::clone(unsafe { &*self.contents.result })))
5723                         } }
5724                 } else {
5725                         Self { result_ok: false, contents: CResult_ChannelInfoDecodeErrorZPtr {
5726                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
5727                         } }
5728                 }
5729         }
5730 }
5731 #[no_mangle]
5732 /// Creates a new CResult_ChannelInfoDecodeErrorZ which has the same data as `orig`
5733 /// but with all dynamically-allocated buffers duplicated in new buffers.
5734 pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_clone(orig: &CResult_ChannelInfoDecodeErrorZ) -> CResult_ChannelInfoDecodeErrorZ { Clone::clone(&orig) }
5735 #[repr(C)]
5736 /// The contents of CResult_RoutingFeesDecodeErrorZ
5737 pub union CResult_RoutingFeesDecodeErrorZPtr {
5738         /// A pointer to the contents in the success state.
5739         /// Reading from this pointer when `result_ok` is not set is undefined.
5740         pub result: *mut crate::lightning::routing::gossip::RoutingFees,
5741         /// A pointer to the contents in the error state.
5742         /// Reading from this pointer when `result_ok` is set is undefined.
5743         pub err: *mut crate::lightning::ln::msgs::DecodeError,
5744 }
5745 #[repr(C)]
5746 /// A CResult_RoutingFeesDecodeErrorZ represents the result of a fallible operation,
5747 /// containing a crate::lightning::routing::gossip::RoutingFees on success and a crate::lightning::ln::msgs::DecodeError on failure.
5748 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5749 pub struct CResult_RoutingFeesDecodeErrorZ {
5750         /// The contents of this CResult_RoutingFeesDecodeErrorZ, accessible via either
5751         /// `err` or `result` depending on the state of `result_ok`.
5752         pub contents: CResult_RoutingFeesDecodeErrorZPtr,
5753         /// Whether this CResult_RoutingFeesDecodeErrorZ represents a success state.
5754         pub result_ok: bool,
5755 }
5756 #[no_mangle]
5757 /// Creates a new CResult_RoutingFeesDecodeErrorZ in the success state.
5758 pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_ok(o: crate::lightning::routing::gossip::RoutingFees) -> CResult_RoutingFeesDecodeErrorZ {
5759         CResult_RoutingFeesDecodeErrorZ {
5760                 contents: CResult_RoutingFeesDecodeErrorZPtr {
5761                         result: Box::into_raw(Box::new(o)),
5762                 },
5763                 result_ok: true,
5764         }
5765 }
5766 #[no_mangle]
5767 /// Creates a new CResult_RoutingFeesDecodeErrorZ in the error state.
5768 pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RoutingFeesDecodeErrorZ {
5769         CResult_RoutingFeesDecodeErrorZ {
5770                 contents: CResult_RoutingFeesDecodeErrorZPtr {
5771                         err: Box::into_raw(Box::new(e)),
5772                 },
5773                 result_ok: false,
5774         }
5775 }
5776 /// Checks if the given object is currently in the success state
5777 #[no_mangle]
5778 pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_is_ok(o: &CResult_RoutingFeesDecodeErrorZ) -> bool {
5779         o.result_ok
5780 }
5781 #[no_mangle]
5782 /// Frees any resources used by the CResult_RoutingFeesDecodeErrorZ.
5783 pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_free(_res: CResult_RoutingFeesDecodeErrorZ) { }
5784 impl Drop for CResult_RoutingFeesDecodeErrorZ {
5785         fn drop(&mut self) {
5786                 if self.result_ok {
5787                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
5788                                 let _ = unsafe { Box::from_raw(self.contents.result) };
5789                         }
5790                 } else {
5791                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
5792                                 let _ = unsafe { Box::from_raw(self.contents.err) };
5793                         }
5794                 }
5795         }
5796 }
5797 impl From<crate::c_types::CResultTempl<crate::lightning::routing::gossip::RoutingFees, crate::lightning::ln::msgs::DecodeError>> for CResult_RoutingFeesDecodeErrorZ {
5798         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::gossip::RoutingFees, crate::lightning::ln::msgs::DecodeError>) -> Self {
5799                 let contents = if o.result_ok {
5800                         let result = unsafe { o.contents.result };
5801                         unsafe { o.contents.result = core::ptr::null_mut() };
5802                         CResult_RoutingFeesDecodeErrorZPtr { result }
5803                 } else {
5804                         let err = unsafe { o.contents.err };
5805                         unsafe { o.contents.err = core::ptr::null_mut(); }
5806                         CResult_RoutingFeesDecodeErrorZPtr { err }
5807                 };
5808                 Self {
5809                         contents,
5810                         result_ok: o.result_ok,
5811                 }
5812         }
5813 }
5814 impl Clone for CResult_RoutingFeesDecodeErrorZ {
5815         fn clone(&self) -> Self {
5816                 if self.result_ok {
5817                         Self { result_ok: true, contents: CResult_RoutingFeesDecodeErrorZPtr {
5818                                 result: Box::into_raw(Box::new(<crate::lightning::routing::gossip::RoutingFees>::clone(unsafe { &*self.contents.result })))
5819                         } }
5820                 } else {
5821                         Self { result_ok: false, contents: CResult_RoutingFeesDecodeErrorZPtr {
5822                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
5823                         } }
5824                 }
5825         }
5826 }
5827 #[no_mangle]
5828 /// Creates a new CResult_RoutingFeesDecodeErrorZ which has the same data as `orig`
5829 /// but with all dynamically-allocated buffers duplicated in new buffers.
5830 pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_clone(orig: &CResult_RoutingFeesDecodeErrorZ) -> CResult_RoutingFeesDecodeErrorZ { Clone::clone(&orig) }
5831 #[repr(C)]
5832 /// A dynamically-allocated array of crate::lightning::ln::msgs::NetAddresss of arbitrary size.
5833 /// This corresponds to std::vector in C++
5834 pub struct CVec_NetAddressZ {
5835         /// The elements in the array.
5836         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
5837         pub data: *mut crate::lightning::ln::msgs::NetAddress,
5838         /// The number of elements pointed to by `data`.
5839         pub datalen: usize
5840 }
5841 impl CVec_NetAddressZ {
5842         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::NetAddress> {
5843                 if self.datalen == 0 { return Vec::new(); }
5844                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
5845                 self.data = core::ptr::null_mut();
5846                 self.datalen = 0;
5847                 ret
5848         }
5849         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::NetAddress] {
5850                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
5851         }
5852 }
5853 impl From<Vec<crate::lightning::ln::msgs::NetAddress>> for CVec_NetAddressZ {
5854         fn from(v: Vec<crate::lightning::ln::msgs::NetAddress>) -> Self {
5855                 let datalen = v.len();
5856                 let data = Box::into_raw(v.into_boxed_slice());
5857                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
5858         }
5859 }
5860 #[no_mangle]
5861 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
5862 pub extern "C" fn CVec_NetAddressZ_free(_res: CVec_NetAddressZ) { }
5863 impl Drop for CVec_NetAddressZ {
5864         fn drop(&mut self) {
5865                 if self.datalen == 0 { return; }
5866                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
5867         }
5868 }
5869 impl Clone for CVec_NetAddressZ {
5870         fn clone(&self) -> Self {
5871                 let mut res = Vec::new();
5872                 if self.datalen == 0 { return Self::from(res); }
5873                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
5874                 Self::from(res)
5875         }
5876 }
5877 #[repr(C)]
5878 /// The contents of CResult_NodeAnnouncementInfoDecodeErrorZ
5879 pub union CResult_NodeAnnouncementInfoDecodeErrorZPtr {
5880         /// A pointer to the contents in the success state.
5881         /// Reading from this pointer when `result_ok` is not set is undefined.
5882         pub result: *mut crate::lightning::routing::gossip::NodeAnnouncementInfo,
5883         /// A pointer to the contents in the error state.
5884         /// Reading from this pointer when `result_ok` is set is undefined.
5885         pub err: *mut crate::lightning::ln::msgs::DecodeError,
5886 }
5887 #[repr(C)]
5888 /// A CResult_NodeAnnouncementInfoDecodeErrorZ represents the result of a fallible operation,
5889 /// containing a crate::lightning::routing::gossip::NodeAnnouncementInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
5890 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5891 pub struct CResult_NodeAnnouncementInfoDecodeErrorZ {
5892         /// The contents of this CResult_NodeAnnouncementInfoDecodeErrorZ, accessible via either
5893         /// `err` or `result` depending on the state of `result_ok`.
5894         pub contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr,
5895         /// Whether this CResult_NodeAnnouncementInfoDecodeErrorZ represents a success state.
5896         pub result_ok: bool,
5897 }
5898 #[no_mangle]
5899 /// Creates a new CResult_NodeAnnouncementInfoDecodeErrorZ in the success state.
5900 pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_ok(o: crate::lightning::routing::gossip::NodeAnnouncementInfo) -> CResult_NodeAnnouncementInfoDecodeErrorZ {
5901         CResult_NodeAnnouncementInfoDecodeErrorZ {
5902                 contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr {
5903                         result: Box::into_raw(Box::new(o)),
5904                 },
5905                 result_ok: true,
5906         }
5907 }
5908 #[no_mangle]
5909 /// Creates a new CResult_NodeAnnouncementInfoDecodeErrorZ in the error state.
5910 pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeAnnouncementInfoDecodeErrorZ {
5911         CResult_NodeAnnouncementInfoDecodeErrorZ {
5912                 contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr {
5913                         err: Box::into_raw(Box::new(e)),
5914                 },
5915                 result_ok: false,
5916         }
5917 }
5918 /// Checks if the given object is currently in the success state
5919 #[no_mangle]
5920 pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_is_ok(o: &CResult_NodeAnnouncementInfoDecodeErrorZ) -> bool {
5921         o.result_ok
5922 }
5923 #[no_mangle]
5924 /// Frees any resources used by the CResult_NodeAnnouncementInfoDecodeErrorZ.
5925 pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_free(_res: CResult_NodeAnnouncementInfoDecodeErrorZ) { }
5926 impl Drop for CResult_NodeAnnouncementInfoDecodeErrorZ {
5927         fn drop(&mut self) {
5928                 if self.result_ok {
5929                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
5930                                 let _ = unsafe { Box::from_raw(self.contents.result) };
5931                         }
5932                 } else {
5933                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
5934                                 let _ = unsafe { Box::from_raw(self.contents.err) };
5935                         }
5936                 }
5937         }
5938 }
5939 impl From<crate::c_types::CResultTempl<crate::lightning::routing::gossip::NodeAnnouncementInfo, crate::lightning::ln::msgs::DecodeError>> for CResult_NodeAnnouncementInfoDecodeErrorZ {
5940         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::gossip::NodeAnnouncementInfo, crate::lightning::ln::msgs::DecodeError>) -> Self {
5941                 let contents = if o.result_ok {
5942                         let result = unsafe { o.contents.result };
5943                         unsafe { o.contents.result = core::ptr::null_mut() };
5944                         CResult_NodeAnnouncementInfoDecodeErrorZPtr { result }
5945                 } else {
5946                         let err = unsafe { o.contents.err };
5947                         unsafe { o.contents.err = core::ptr::null_mut(); }
5948                         CResult_NodeAnnouncementInfoDecodeErrorZPtr { err }
5949                 };
5950                 Self {
5951                         contents,
5952                         result_ok: o.result_ok,
5953                 }
5954         }
5955 }
5956 impl Clone for CResult_NodeAnnouncementInfoDecodeErrorZ {
5957         fn clone(&self) -> Self {
5958                 if self.result_ok {
5959                         Self { result_ok: true, contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr {
5960                                 result: Box::into_raw(Box::new(<crate::lightning::routing::gossip::NodeAnnouncementInfo>::clone(unsafe { &*self.contents.result })))
5961                         } }
5962                 } else {
5963                         Self { result_ok: false, contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr {
5964                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
5965                         } }
5966                 }
5967         }
5968 }
5969 #[no_mangle]
5970 /// Creates a new CResult_NodeAnnouncementInfoDecodeErrorZ which has the same data as `orig`
5971 /// but with all dynamically-allocated buffers duplicated in new buffers.
5972 pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_clone(orig: &CResult_NodeAnnouncementInfoDecodeErrorZ) -> CResult_NodeAnnouncementInfoDecodeErrorZ { Clone::clone(&orig) }
5973 #[repr(C)]
5974 /// The contents of CResult_NodeAliasDecodeErrorZ
5975 pub union CResult_NodeAliasDecodeErrorZPtr {
5976         /// A pointer to the contents in the success state.
5977         /// Reading from this pointer when `result_ok` is not set is undefined.
5978         pub result: *mut crate::lightning::routing::gossip::NodeAlias,
5979         /// A pointer to the contents in the error state.
5980         /// Reading from this pointer when `result_ok` is set is undefined.
5981         pub err: *mut crate::lightning::ln::msgs::DecodeError,
5982 }
5983 #[repr(C)]
5984 /// A CResult_NodeAliasDecodeErrorZ represents the result of a fallible operation,
5985 /// containing a crate::lightning::routing::gossip::NodeAlias on success and a crate::lightning::ln::msgs::DecodeError on failure.
5986 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5987 pub struct CResult_NodeAliasDecodeErrorZ {
5988         /// The contents of this CResult_NodeAliasDecodeErrorZ, accessible via either
5989         /// `err` or `result` depending on the state of `result_ok`.
5990         pub contents: CResult_NodeAliasDecodeErrorZPtr,
5991         /// Whether this CResult_NodeAliasDecodeErrorZ represents a success state.
5992         pub result_ok: bool,
5993 }
5994 #[no_mangle]
5995 /// Creates a new CResult_NodeAliasDecodeErrorZ in the success state.
5996 pub extern "C" fn CResult_NodeAliasDecodeErrorZ_ok(o: crate::lightning::routing::gossip::NodeAlias) -> CResult_NodeAliasDecodeErrorZ {
5997         CResult_NodeAliasDecodeErrorZ {
5998                 contents: CResult_NodeAliasDecodeErrorZPtr {
5999                         result: Box::into_raw(Box::new(o)),
6000                 },
6001                 result_ok: true,
6002         }
6003 }
6004 #[no_mangle]
6005 /// Creates a new CResult_NodeAliasDecodeErrorZ in the error state.
6006 pub extern "C" fn CResult_NodeAliasDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeAliasDecodeErrorZ {
6007         CResult_NodeAliasDecodeErrorZ {
6008                 contents: CResult_NodeAliasDecodeErrorZPtr {
6009                         err: Box::into_raw(Box::new(e)),
6010                 },
6011                 result_ok: false,
6012         }
6013 }
6014 /// Checks if the given object is currently in the success state
6015 #[no_mangle]
6016 pub extern "C" fn CResult_NodeAliasDecodeErrorZ_is_ok(o: &CResult_NodeAliasDecodeErrorZ) -> bool {
6017         o.result_ok
6018 }
6019 #[no_mangle]
6020 /// Frees any resources used by the CResult_NodeAliasDecodeErrorZ.
6021 pub extern "C" fn CResult_NodeAliasDecodeErrorZ_free(_res: CResult_NodeAliasDecodeErrorZ) { }
6022 impl Drop for CResult_NodeAliasDecodeErrorZ {
6023         fn drop(&mut self) {
6024                 if self.result_ok {
6025                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
6026                                 let _ = unsafe { Box::from_raw(self.contents.result) };
6027                         }
6028                 } else {
6029                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
6030                                 let _ = unsafe { Box::from_raw(self.contents.err) };
6031                         }
6032                 }
6033         }
6034 }
6035 impl From<crate::c_types::CResultTempl<crate::lightning::routing::gossip::NodeAlias, crate::lightning::ln::msgs::DecodeError>> for CResult_NodeAliasDecodeErrorZ {
6036         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::gossip::NodeAlias, crate::lightning::ln::msgs::DecodeError>) -> Self {
6037                 let contents = if o.result_ok {
6038                         let result = unsafe { o.contents.result };
6039                         unsafe { o.contents.result = core::ptr::null_mut() };
6040                         CResult_NodeAliasDecodeErrorZPtr { result }
6041                 } else {
6042                         let err = unsafe { o.contents.err };
6043                         unsafe { o.contents.err = core::ptr::null_mut(); }
6044                         CResult_NodeAliasDecodeErrorZPtr { err }
6045                 };
6046                 Self {
6047                         contents,
6048                         result_ok: o.result_ok,
6049                 }
6050         }
6051 }
6052 impl Clone for CResult_NodeAliasDecodeErrorZ {
6053         fn clone(&self) -> Self {
6054                 if self.result_ok {
6055                         Self { result_ok: true, contents: CResult_NodeAliasDecodeErrorZPtr {
6056                                 result: Box::into_raw(Box::new(<crate::lightning::routing::gossip::NodeAlias>::clone(unsafe { &*self.contents.result })))
6057                         } }
6058                 } else {
6059                         Self { result_ok: false, contents: CResult_NodeAliasDecodeErrorZPtr {
6060                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
6061                         } }
6062                 }
6063         }
6064 }
6065 #[no_mangle]
6066 /// Creates a new CResult_NodeAliasDecodeErrorZ which has the same data as `orig`
6067 /// but with all dynamically-allocated buffers duplicated in new buffers.
6068 pub extern "C" fn CResult_NodeAliasDecodeErrorZ_clone(orig: &CResult_NodeAliasDecodeErrorZ) -> CResult_NodeAliasDecodeErrorZ { Clone::clone(&orig) }
6069 #[repr(C)]
6070 /// The contents of CResult_NodeInfoDecodeErrorZ
6071 pub union CResult_NodeInfoDecodeErrorZPtr {
6072         /// A pointer to the contents in the success state.
6073         /// Reading from this pointer when `result_ok` is not set is undefined.
6074         pub result: *mut crate::lightning::routing::gossip::NodeInfo,
6075         /// A pointer to the contents in the error state.
6076         /// Reading from this pointer when `result_ok` is set is undefined.
6077         pub err: *mut crate::lightning::ln::msgs::DecodeError,
6078 }
6079 #[repr(C)]
6080 /// A CResult_NodeInfoDecodeErrorZ represents the result of a fallible operation,
6081 /// containing a crate::lightning::routing::gossip::NodeInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
6082 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6083 pub struct CResult_NodeInfoDecodeErrorZ {
6084         /// The contents of this CResult_NodeInfoDecodeErrorZ, accessible via either
6085         /// `err` or `result` depending on the state of `result_ok`.
6086         pub contents: CResult_NodeInfoDecodeErrorZPtr,
6087         /// Whether this CResult_NodeInfoDecodeErrorZ represents a success state.
6088         pub result_ok: bool,
6089 }
6090 #[no_mangle]
6091 /// Creates a new CResult_NodeInfoDecodeErrorZ in the success state.
6092 pub extern "C" fn CResult_NodeInfoDecodeErrorZ_ok(o: crate::lightning::routing::gossip::NodeInfo) -> CResult_NodeInfoDecodeErrorZ {
6093         CResult_NodeInfoDecodeErrorZ {
6094                 contents: CResult_NodeInfoDecodeErrorZPtr {
6095                         result: Box::into_raw(Box::new(o)),
6096                 },
6097                 result_ok: true,
6098         }
6099 }
6100 #[no_mangle]
6101 /// Creates a new CResult_NodeInfoDecodeErrorZ in the error state.
6102 pub extern "C" fn CResult_NodeInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeInfoDecodeErrorZ {
6103         CResult_NodeInfoDecodeErrorZ {
6104                 contents: CResult_NodeInfoDecodeErrorZPtr {
6105                         err: Box::into_raw(Box::new(e)),
6106                 },
6107                 result_ok: false,
6108         }
6109 }
6110 /// Checks if the given object is currently in the success state
6111 #[no_mangle]
6112 pub extern "C" fn CResult_NodeInfoDecodeErrorZ_is_ok(o: &CResult_NodeInfoDecodeErrorZ) -> bool {
6113         o.result_ok
6114 }
6115 #[no_mangle]
6116 /// Frees any resources used by the CResult_NodeInfoDecodeErrorZ.
6117 pub extern "C" fn CResult_NodeInfoDecodeErrorZ_free(_res: CResult_NodeInfoDecodeErrorZ) { }
6118 impl Drop for CResult_NodeInfoDecodeErrorZ {
6119         fn drop(&mut self) {
6120                 if self.result_ok {
6121                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
6122                                 let _ = unsafe { Box::from_raw(self.contents.result) };
6123                         }
6124                 } else {
6125                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
6126                                 let _ = unsafe { Box::from_raw(self.contents.err) };
6127                         }
6128                 }
6129         }
6130 }
6131 impl From<crate::c_types::CResultTempl<crate::lightning::routing::gossip::NodeInfo, crate::lightning::ln::msgs::DecodeError>> for CResult_NodeInfoDecodeErrorZ {
6132         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::gossip::NodeInfo, crate::lightning::ln::msgs::DecodeError>) -> Self {
6133                 let contents = if o.result_ok {
6134                         let result = unsafe { o.contents.result };
6135                         unsafe { o.contents.result = core::ptr::null_mut() };
6136                         CResult_NodeInfoDecodeErrorZPtr { result }
6137                 } else {
6138                         let err = unsafe { o.contents.err };
6139                         unsafe { o.contents.err = core::ptr::null_mut(); }
6140                         CResult_NodeInfoDecodeErrorZPtr { err }
6141                 };
6142                 Self {
6143                         contents,
6144                         result_ok: o.result_ok,
6145                 }
6146         }
6147 }
6148 impl Clone for CResult_NodeInfoDecodeErrorZ {
6149         fn clone(&self) -> Self {
6150                 if self.result_ok {
6151                         Self { result_ok: true, contents: CResult_NodeInfoDecodeErrorZPtr {
6152                                 result: Box::into_raw(Box::new(<crate::lightning::routing::gossip::NodeInfo>::clone(unsafe { &*self.contents.result })))
6153                         } }
6154                 } else {
6155                         Self { result_ok: false, contents: CResult_NodeInfoDecodeErrorZPtr {
6156                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
6157                         } }
6158                 }
6159         }
6160 }
6161 #[no_mangle]
6162 /// Creates a new CResult_NodeInfoDecodeErrorZ which has the same data as `orig`
6163 /// but with all dynamically-allocated buffers duplicated in new buffers.
6164 pub extern "C" fn CResult_NodeInfoDecodeErrorZ_clone(orig: &CResult_NodeInfoDecodeErrorZ) -> CResult_NodeInfoDecodeErrorZ { Clone::clone(&orig) }
6165 #[repr(C)]
6166 /// The contents of CResult_NetworkGraphDecodeErrorZ
6167 pub union CResult_NetworkGraphDecodeErrorZPtr {
6168         /// A pointer to the contents in the success state.
6169         /// Reading from this pointer when `result_ok` is not set is undefined.
6170         pub result: *mut crate::lightning::routing::gossip::NetworkGraph,
6171         /// A pointer to the contents in the error state.
6172         /// Reading from this pointer when `result_ok` is set is undefined.
6173         pub err: *mut crate::lightning::ln::msgs::DecodeError,
6174 }
6175 #[repr(C)]
6176 /// A CResult_NetworkGraphDecodeErrorZ represents the result of a fallible operation,
6177 /// containing a crate::lightning::routing::gossip::NetworkGraph on success and a crate::lightning::ln::msgs::DecodeError on failure.
6178 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6179 pub struct CResult_NetworkGraphDecodeErrorZ {
6180         /// The contents of this CResult_NetworkGraphDecodeErrorZ, accessible via either
6181         /// `err` or `result` depending on the state of `result_ok`.
6182         pub contents: CResult_NetworkGraphDecodeErrorZPtr,
6183         /// Whether this CResult_NetworkGraphDecodeErrorZ represents a success state.
6184         pub result_ok: bool,
6185 }
6186 #[no_mangle]
6187 /// Creates a new CResult_NetworkGraphDecodeErrorZ in the success state.
6188 pub extern "C" fn CResult_NetworkGraphDecodeErrorZ_ok(o: crate::lightning::routing::gossip::NetworkGraph) -> CResult_NetworkGraphDecodeErrorZ {
6189         CResult_NetworkGraphDecodeErrorZ {
6190                 contents: CResult_NetworkGraphDecodeErrorZPtr {
6191                         result: Box::into_raw(Box::new(o)),
6192                 },
6193                 result_ok: true,
6194         }
6195 }
6196 #[no_mangle]
6197 /// Creates a new CResult_NetworkGraphDecodeErrorZ in the error state.
6198 pub extern "C" fn CResult_NetworkGraphDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NetworkGraphDecodeErrorZ {
6199         CResult_NetworkGraphDecodeErrorZ {
6200                 contents: CResult_NetworkGraphDecodeErrorZPtr {
6201                         err: Box::into_raw(Box::new(e)),
6202                 },
6203                 result_ok: false,
6204         }
6205 }
6206 /// Checks if the given object is currently in the success state
6207 #[no_mangle]
6208 pub extern "C" fn CResult_NetworkGraphDecodeErrorZ_is_ok(o: &CResult_NetworkGraphDecodeErrorZ) -> bool {
6209         o.result_ok
6210 }
6211 #[no_mangle]
6212 /// Frees any resources used by the CResult_NetworkGraphDecodeErrorZ.
6213 pub extern "C" fn CResult_NetworkGraphDecodeErrorZ_free(_res: CResult_NetworkGraphDecodeErrorZ) { }
6214 impl Drop for CResult_NetworkGraphDecodeErrorZ {
6215         fn drop(&mut self) {
6216                 if self.result_ok {
6217                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
6218                                 let _ = unsafe { Box::from_raw(self.contents.result) };
6219                         }
6220                 } else {
6221                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
6222                                 let _ = unsafe { Box::from_raw(self.contents.err) };
6223                         }
6224                 }
6225         }
6226 }
6227 impl From<crate::c_types::CResultTempl<crate::lightning::routing::gossip::NetworkGraph, crate::lightning::ln::msgs::DecodeError>> for CResult_NetworkGraphDecodeErrorZ {
6228         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::gossip::NetworkGraph, crate::lightning::ln::msgs::DecodeError>) -> Self {
6229                 let contents = if o.result_ok {
6230                         let result = unsafe { o.contents.result };
6231                         unsafe { o.contents.result = core::ptr::null_mut() };
6232                         CResult_NetworkGraphDecodeErrorZPtr { result }
6233                 } else {
6234                         let err = unsafe { o.contents.err };
6235                         unsafe { o.contents.err = core::ptr::null_mut(); }
6236                         CResult_NetworkGraphDecodeErrorZPtr { err }
6237                 };
6238                 Self {
6239                         contents,
6240                         result_ok: o.result_ok,
6241                 }
6242         }
6243 }
6244 #[repr(C)]
6245 #[derive(Clone)]
6246 /// An enum which can either contain a crate::c_types::derived::CVec_NetAddressZ or not
6247 pub enum COption_CVec_NetAddressZZ {
6248         /// When we're in this state, this COption_CVec_NetAddressZZ contains a crate::c_types::derived::CVec_NetAddressZ
6249         Some(crate::c_types::derived::CVec_NetAddressZ),
6250         /// When we're in this state, this COption_CVec_NetAddressZZ contains nothing
6251         None
6252 }
6253 impl COption_CVec_NetAddressZZ {
6254         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
6255                 if let Self::None = self { false } else { true }
6256         }
6257         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
6258                 !self.is_some()
6259         }
6260         #[allow(unused)] pub(crate) fn take(mut self) -> crate::c_types::derived::CVec_NetAddressZ {
6261                 if let Self::Some(v) = self { v } else { unreachable!() }
6262         }
6263 }
6264 #[no_mangle]
6265 /// Constructs a new COption_CVec_NetAddressZZ containing a crate::c_types::derived::CVec_NetAddressZ
6266 pub extern "C" fn COption_CVec_NetAddressZZ_some(o: crate::c_types::derived::CVec_NetAddressZ) -> COption_CVec_NetAddressZZ {
6267         COption_CVec_NetAddressZZ::Some(o)
6268 }
6269 #[no_mangle]
6270 /// Constructs a new COption_CVec_NetAddressZZ containing nothing
6271 pub extern "C" fn COption_CVec_NetAddressZZ_none() -> COption_CVec_NetAddressZZ {
6272         COption_CVec_NetAddressZZ::None
6273 }
6274 #[no_mangle]
6275 /// Frees any resources associated with the crate::c_types::derived::CVec_NetAddressZ, if we are in the Some state
6276 pub extern "C" fn COption_CVec_NetAddressZZ_free(_res: COption_CVec_NetAddressZZ) { }
6277 #[no_mangle]
6278 /// Creates a new COption_CVec_NetAddressZZ which has the same data as `orig`
6279 /// but with all dynamically-allocated buffers duplicated in new buffers.
6280 pub extern "C" fn COption_CVec_NetAddressZZ_clone(orig: &COption_CVec_NetAddressZZ) -> COption_CVec_NetAddressZZ { Clone::clone(&orig) }
6281 #[repr(C)]
6282 /// The contents of CResult_DelayedPaymentOutputDescriptorDecodeErrorZ
6283 pub union CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr {
6284         /// A pointer to the contents in the success state.
6285         /// Reading from this pointer when `result_ok` is not set is undefined.
6286         pub result: *mut crate::lightning::chain::keysinterface::DelayedPaymentOutputDescriptor,
6287         /// A pointer to the contents in the error state.
6288         /// Reading from this pointer when `result_ok` is set is undefined.
6289         pub err: *mut crate::lightning::ln::msgs::DecodeError,
6290 }
6291 #[repr(C)]
6292 /// A CResult_DelayedPaymentOutputDescriptorDecodeErrorZ represents the result of a fallible operation,
6293 /// containing a crate::lightning::chain::keysinterface::DelayedPaymentOutputDescriptor on success and a crate::lightning::ln::msgs::DecodeError on failure.
6294 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6295 pub struct CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
6296         /// The contents of this CResult_DelayedPaymentOutputDescriptorDecodeErrorZ, accessible via either
6297         /// `err` or `result` depending on the state of `result_ok`.
6298         pub contents: CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr,
6299         /// Whether this CResult_DelayedPaymentOutputDescriptorDecodeErrorZ represents a success state.
6300         pub result_ok: bool,
6301 }
6302 #[no_mangle]
6303 /// Creates a new CResult_DelayedPaymentOutputDescriptorDecodeErrorZ in the success state.
6304 pub extern "C" fn CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_ok(o: crate::lightning::chain::keysinterface::DelayedPaymentOutputDescriptor) -> CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
6305         CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
6306                 contents: CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr {
6307                         result: Box::into_raw(Box::new(o)),
6308                 },
6309                 result_ok: true,
6310         }
6311 }
6312 #[no_mangle]
6313 /// Creates a new CResult_DelayedPaymentOutputDescriptorDecodeErrorZ in the error state.
6314 pub extern "C" fn CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
6315         CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
6316                 contents: CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr {
6317                         err: Box::into_raw(Box::new(e)),
6318                 },
6319                 result_ok: false,
6320         }
6321 }
6322 /// Checks if the given object is currently in the success state
6323 #[no_mangle]
6324 pub extern "C" fn CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_is_ok(o: &CResult_DelayedPaymentOutputDescriptorDecodeErrorZ) -> bool {
6325         o.result_ok
6326 }
6327 #[no_mangle]
6328 /// Frees any resources used by the CResult_DelayedPaymentOutputDescriptorDecodeErrorZ.
6329 pub extern "C" fn CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_free(_res: CResult_DelayedPaymentOutputDescriptorDecodeErrorZ) { }
6330 impl Drop for CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
6331         fn drop(&mut self) {
6332                 if self.result_ok {
6333                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
6334                                 let _ = unsafe { Box::from_raw(self.contents.result) };
6335                         }
6336                 } else {
6337                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
6338                                 let _ = unsafe { Box::from_raw(self.contents.err) };
6339                         }
6340                 }
6341         }
6342 }
6343 impl From<crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::DelayedPaymentOutputDescriptor, crate::lightning::ln::msgs::DecodeError>> for CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
6344         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::DelayedPaymentOutputDescriptor, crate::lightning::ln::msgs::DecodeError>) -> Self {
6345                 let contents = if o.result_ok {
6346                         let result = unsafe { o.contents.result };
6347                         unsafe { o.contents.result = core::ptr::null_mut() };
6348                         CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr { result }
6349                 } else {
6350                         let err = unsafe { o.contents.err };
6351                         unsafe { o.contents.err = core::ptr::null_mut(); }
6352                         CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr { err }
6353                 };
6354                 Self {
6355                         contents,
6356                         result_ok: o.result_ok,
6357                 }
6358         }
6359 }
6360 impl Clone for CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
6361         fn clone(&self) -> Self {
6362                 if self.result_ok {
6363                         Self { result_ok: true, contents: CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr {
6364                                 result: Box::into_raw(Box::new(<crate::lightning::chain::keysinterface::DelayedPaymentOutputDescriptor>::clone(unsafe { &*self.contents.result })))
6365                         } }
6366                 } else {
6367                         Self { result_ok: false, contents: CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr {
6368                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
6369                         } }
6370                 }
6371         }
6372 }
6373 #[no_mangle]
6374 /// Creates a new CResult_DelayedPaymentOutputDescriptorDecodeErrorZ which has the same data as `orig`
6375 /// but with all dynamically-allocated buffers duplicated in new buffers.
6376 pub extern "C" fn CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone(orig: &CResult_DelayedPaymentOutputDescriptorDecodeErrorZ) -> CResult_DelayedPaymentOutputDescriptorDecodeErrorZ { Clone::clone(&orig) }
6377 #[repr(C)]
6378 /// The contents of CResult_StaticPaymentOutputDescriptorDecodeErrorZ
6379 pub union CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr {
6380         /// A pointer to the contents in the success state.
6381         /// Reading from this pointer when `result_ok` is not set is undefined.
6382         pub result: *mut crate::lightning::chain::keysinterface::StaticPaymentOutputDescriptor,
6383         /// A pointer to the contents in the error state.
6384         /// Reading from this pointer when `result_ok` is set is undefined.
6385         pub err: *mut crate::lightning::ln::msgs::DecodeError,
6386 }
6387 #[repr(C)]
6388 /// A CResult_StaticPaymentOutputDescriptorDecodeErrorZ represents the result of a fallible operation,
6389 /// containing a crate::lightning::chain::keysinterface::StaticPaymentOutputDescriptor on success and a crate::lightning::ln::msgs::DecodeError on failure.
6390 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6391 pub struct CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
6392         /// The contents of this CResult_StaticPaymentOutputDescriptorDecodeErrorZ, accessible via either
6393         /// `err` or `result` depending on the state of `result_ok`.
6394         pub contents: CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr,
6395         /// Whether this CResult_StaticPaymentOutputDescriptorDecodeErrorZ represents a success state.
6396         pub result_ok: bool,
6397 }
6398 #[no_mangle]
6399 /// Creates a new CResult_StaticPaymentOutputDescriptorDecodeErrorZ in the success state.
6400 pub extern "C" fn CResult_StaticPaymentOutputDescriptorDecodeErrorZ_ok(o: crate::lightning::chain::keysinterface::StaticPaymentOutputDescriptor) -> CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
6401         CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
6402                 contents: CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr {
6403                         result: Box::into_raw(Box::new(o)),
6404                 },
6405                 result_ok: true,
6406         }
6407 }
6408 #[no_mangle]
6409 /// Creates a new CResult_StaticPaymentOutputDescriptorDecodeErrorZ in the error state.
6410 pub extern "C" fn CResult_StaticPaymentOutputDescriptorDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
6411         CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
6412                 contents: CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr {
6413                         err: Box::into_raw(Box::new(e)),
6414                 },
6415                 result_ok: false,
6416         }
6417 }
6418 /// Checks if the given object is currently in the success state
6419 #[no_mangle]
6420 pub extern "C" fn CResult_StaticPaymentOutputDescriptorDecodeErrorZ_is_ok(o: &CResult_StaticPaymentOutputDescriptorDecodeErrorZ) -> bool {
6421         o.result_ok
6422 }
6423 #[no_mangle]
6424 /// Frees any resources used by the CResult_StaticPaymentOutputDescriptorDecodeErrorZ.
6425 pub extern "C" fn CResult_StaticPaymentOutputDescriptorDecodeErrorZ_free(_res: CResult_StaticPaymentOutputDescriptorDecodeErrorZ) { }
6426 impl Drop for CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
6427         fn drop(&mut self) {
6428                 if self.result_ok {
6429                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
6430                                 let _ = unsafe { Box::from_raw(self.contents.result) };
6431                         }
6432                 } else {
6433                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
6434                                 let _ = unsafe { Box::from_raw(self.contents.err) };
6435                         }
6436                 }
6437         }
6438 }
6439 impl From<crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::StaticPaymentOutputDescriptor, crate::lightning::ln::msgs::DecodeError>> for CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
6440         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::StaticPaymentOutputDescriptor, crate::lightning::ln::msgs::DecodeError>) -> Self {
6441                 let contents = if o.result_ok {
6442                         let result = unsafe { o.contents.result };
6443                         unsafe { o.contents.result = core::ptr::null_mut() };
6444                         CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr { result }
6445                 } else {
6446                         let err = unsafe { o.contents.err };
6447                         unsafe { o.contents.err = core::ptr::null_mut(); }
6448                         CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr { err }
6449                 };
6450                 Self {
6451                         contents,
6452                         result_ok: o.result_ok,
6453                 }
6454         }
6455 }
6456 impl Clone for CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
6457         fn clone(&self) -> Self {
6458                 if self.result_ok {
6459                         Self { result_ok: true, contents: CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr {
6460                                 result: Box::into_raw(Box::new(<crate::lightning::chain::keysinterface::StaticPaymentOutputDescriptor>::clone(unsafe { &*self.contents.result })))
6461                         } }
6462                 } else {
6463                         Self { result_ok: false, contents: CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr {
6464                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
6465                         } }
6466                 }
6467         }
6468 }
6469 #[no_mangle]
6470 /// Creates a new CResult_StaticPaymentOutputDescriptorDecodeErrorZ which has the same data as `orig`
6471 /// but with all dynamically-allocated buffers duplicated in new buffers.
6472 pub extern "C" fn CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone(orig: &CResult_StaticPaymentOutputDescriptorDecodeErrorZ) -> CResult_StaticPaymentOutputDescriptorDecodeErrorZ { Clone::clone(&orig) }
6473 #[repr(C)]
6474 /// The contents of CResult_SpendableOutputDescriptorDecodeErrorZ
6475 pub union CResult_SpendableOutputDescriptorDecodeErrorZPtr {
6476         /// A pointer to the contents in the success state.
6477         /// Reading from this pointer when `result_ok` is not set is undefined.
6478         pub result: *mut crate::lightning::chain::keysinterface::SpendableOutputDescriptor,
6479         /// A pointer to the contents in the error state.
6480         /// Reading from this pointer when `result_ok` is set is undefined.
6481         pub err: *mut crate::lightning::ln::msgs::DecodeError,
6482 }
6483 #[repr(C)]
6484 /// A CResult_SpendableOutputDescriptorDecodeErrorZ represents the result of a fallible operation,
6485 /// containing a crate::lightning::chain::keysinterface::SpendableOutputDescriptor on success and a crate::lightning::ln::msgs::DecodeError on failure.
6486 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6487 pub struct CResult_SpendableOutputDescriptorDecodeErrorZ {
6488         /// The contents of this CResult_SpendableOutputDescriptorDecodeErrorZ, accessible via either
6489         /// `err` or `result` depending on the state of `result_ok`.
6490         pub contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr,
6491         /// Whether this CResult_SpendableOutputDescriptorDecodeErrorZ represents a success state.
6492         pub result_ok: bool,
6493 }
6494 #[no_mangle]
6495 /// Creates a new CResult_SpendableOutputDescriptorDecodeErrorZ in the success state.
6496 pub extern "C" fn CResult_SpendableOutputDescriptorDecodeErrorZ_ok(o: crate::lightning::chain::keysinterface::SpendableOutputDescriptor) -> CResult_SpendableOutputDescriptorDecodeErrorZ {
6497         CResult_SpendableOutputDescriptorDecodeErrorZ {
6498                 contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr {
6499                         result: Box::into_raw(Box::new(o)),
6500                 },
6501                 result_ok: true,
6502         }
6503 }
6504 #[no_mangle]
6505 /// Creates a new CResult_SpendableOutputDescriptorDecodeErrorZ in the error state.
6506 pub extern "C" fn CResult_SpendableOutputDescriptorDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_SpendableOutputDescriptorDecodeErrorZ {
6507         CResult_SpendableOutputDescriptorDecodeErrorZ {
6508                 contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr {
6509                         err: Box::into_raw(Box::new(e)),
6510                 },
6511                 result_ok: false,
6512         }
6513 }
6514 /// Checks if the given object is currently in the success state
6515 #[no_mangle]
6516 pub extern "C" fn CResult_SpendableOutputDescriptorDecodeErrorZ_is_ok(o: &CResult_SpendableOutputDescriptorDecodeErrorZ) -> bool {
6517         o.result_ok
6518 }
6519 #[no_mangle]
6520 /// Frees any resources used by the CResult_SpendableOutputDescriptorDecodeErrorZ.
6521 pub extern "C" fn CResult_SpendableOutputDescriptorDecodeErrorZ_free(_res: CResult_SpendableOutputDescriptorDecodeErrorZ) { }
6522 impl Drop for CResult_SpendableOutputDescriptorDecodeErrorZ {
6523         fn drop(&mut self) {
6524                 if self.result_ok {
6525                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
6526                                 let _ = unsafe { Box::from_raw(self.contents.result) };
6527                         }
6528                 } else {
6529                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
6530                                 let _ = unsafe { Box::from_raw(self.contents.err) };
6531                         }
6532                 }
6533         }
6534 }
6535 impl From<crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::SpendableOutputDescriptor, crate::lightning::ln::msgs::DecodeError>> for CResult_SpendableOutputDescriptorDecodeErrorZ {
6536         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::SpendableOutputDescriptor, crate::lightning::ln::msgs::DecodeError>) -> Self {
6537                 let contents = if o.result_ok {
6538                         let result = unsafe { o.contents.result };
6539                         unsafe { o.contents.result = core::ptr::null_mut() };
6540                         CResult_SpendableOutputDescriptorDecodeErrorZPtr { result }
6541                 } else {
6542                         let err = unsafe { o.contents.err };
6543                         unsafe { o.contents.err = core::ptr::null_mut(); }
6544                         CResult_SpendableOutputDescriptorDecodeErrorZPtr { err }
6545                 };
6546                 Self {
6547                         contents,
6548                         result_ok: o.result_ok,
6549                 }
6550         }
6551 }
6552 impl Clone for CResult_SpendableOutputDescriptorDecodeErrorZ {
6553         fn clone(&self) -> Self {
6554                 if self.result_ok {
6555                         Self { result_ok: true, contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr {
6556                                 result: Box::into_raw(Box::new(<crate::lightning::chain::keysinterface::SpendableOutputDescriptor>::clone(unsafe { &*self.contents.result })))
6557                         } }
6558                 } else {
6559                         Self { result_ok: false, contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr {
6560                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
6561                         } }
6562                 }
6563         }
6564 }
6565 #[no_mangle]
6566 /// Creates a new CResult_SpendableOutputDescriptorDecodeErrorZ which has the same data as `orig`
6567 /// but with all dynamically-allocated buffers duplicated in new buffers.
6568 pub extern "C" fn CResult_SpendableOutputDescriptorDecodeErrorZ_clone(orig: &CResult_SpendableOutputDescriptorDecodeErrorZ) -> CResult_SpendableOutputDescriptorDecodeErrorZ { Clone::clone(&orig) }
6569 #[repr(C)]
6570 /// A dynamically-allocated array of crate::c_types::ThirtyTwoBytess of arbitrary size.
6571 /// This corresponds to std::vector in C++
6572 pub struct CVec_PaymentPreimageZ {
6573         /// The elements in the array.
6574         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
6575         pub data: *mut crate::c_types::ThirtyTwoBytes,
6576         /// The number of elements pointed to by `data`.
6577         pub datalen: usize
6578 }
6579 impl CVec_PaymentPreimageZ {
6580         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::ThirtyTwoBytes> {
6581                 if self.datalen == 0 { return Vec::new(); }
6582                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
6583                 self.data = core::ptr::null_mut();
6584                 self.datalen = 0;
6585                 ret
6586         }
6587         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::ThirtyTwoBytes] {
6588                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
6589         }
6590 }
6591 impl From<Vec<crate::c_types::ThirtyTwoBytes>> for CVec_PaymentPreimageZ {
6592         fn from(v: Vec<crate::c_types::ThirtyTwoBytes>) -> Self {
6593                 let datalen = v.len();
6594                 let data = Box::into_raw(v.into_boxed_slice());
6595                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
6596         }
6597 }
6598 #[no_mangle]
6599 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
6600 pub extern "C" fn CVec_PaymentPreimageZ_free(_res: CVec_PaymentPreimageZ) { }
6601 impl Drop for CVec_PaymentPreimageZ {
6602         fn drop(&mut self) {
6603                 if self.datalen == 0 { return; }
6604                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
6605         }
6606 }
6607 impl Clone for CVec_PaymentPreimageZ {
6608         fn clone(&self) -> Self {
6609                 let mut res = Vec::new();
6610                 if self.datalen == 0 { return Self::from(res); }
6611                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
6612                 Self::from(res)
6613         }
6614 }
6615 #[repr(C)]
6616 /// A tuple of 2 elements. See the individual fields for the types contained.
6617 pub struct C2Tuple_SignatureCVec_SignatureZZ {
6618         /// The element at position 0
6619         pub a: crate::c_types::Signature,
6620         /// The element at position 1
6621         pub b: crate::c_types::derived::CVec_SignatureZ,
6622 }
6623 impl From<(crate::c_types::Signature, crate::c_types::derived::CVec_SignatureZ)> for C2Tuple_SignatureCVec_SignatureZZ {
6624         fn from (tup: (crate::c_types::Signature, crate::c_types::derived::CVec_SignatureZ)) -> Self {
6625                 Self {
6626                         a: tup.0,
6627                         b: tup.1,
6628                 }
6629         }
6630 }
6631 impl C2Tuple_SignatureCVec_SignatureZZ {
6632         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::Signature, crate::c_types::derived::CVec_SignatureZ) {
6633                 (self.a, self.b)
6634         }
6635 }
6636 impl Clone for C2Tuple_SignatureCVec_SignatureZZ {
6637         fn clone(&self) -> Self {
6638                 Self {
6639                         a: Clone::clone(&self.a),
6640                         b: Clone::clone(&self.b),
6641                 }
6642         }
6643 }
6644 #[no_mangle]
6645 /// Creates a new tuple which has the same data as `orig`
6646 /// but with all dynamically-allocated buffers duplicated in new buffers.
6647 pub extern "C" fn C2Tuple_SignatureCVec_SignatureZZ_clone(orig: &C2Tuple_SignatureCVec_SignatureZZ) -> C2Tuple_SignatureCVec_SignatureZZ { Clone::clone(&orig) }
6648 /// Creates a new C2Tuple_SignatureCVec_SignatureZZ from the contained elements.
6649 #[no_mangle]
6650 pub extern "C" fn C2Tuple_SignatureCVec_SignatureZZ_new(a: crate::c_types::Signature, b: crate::c_types::derived::CVec_SignatureZ) -> C2Tuple_SignatureCVec_SignatureZZ {
6651         C2Tuple_SignatureCVec_SignatureZZ { a, b, }
6652 }
6653
6654 #[no_mangle]
6655 /// Frees any resources used by the C2Tuple_SignatureCVec_SignatureZZ.
6656 pub extern "C" fn C2Tuple_SignatureCVec_SignatureZZ_free(_res: C2Tuple_SignatureCVec_SignatureZZ) { }
6657 #[repr(C)]
6658 /// The contents of CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ
6659 pub union CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
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::derived::C2Tuple_SignatureCVec_SignatureZZ,
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_C2Tuple_SignatureCVec_SignatureZZNoneZ represents the result of a fallible operation,
6668 /// containing a crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ on success and a () on failure.
6669 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6670 pub struct CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
6671         /// The contents of this CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ, accessible via either
6672         /// `err` or `result` depending on the state of `result_ok`.
6673         pub contents: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr,
6674         /// Whether this CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ represents a success state.
6675         pub result_ok: bool,
6676 }
6677 #[no_mangle]
6678 /// Creates a new CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ in the success state.
6679 pub extern "C" fn CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_ok(o: crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ) -> CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
6680         CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
6681                 contents: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
6682                         result: Box::into_raw(Box::new(o)),
6683                 },
6684                 result_ok: true,
6685         }
6686 }
6687 #[no_mangle]
6688 /// Creates a new CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ in the error state.
6689 pub extern "C" fn CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_err() -> CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
6690         CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
6691                 contents: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
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_C2Tuple_SignatureCVec_SignatureZZNoneZ_is_ok(o: &CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ) -> bool {
6700         o.result_ok
6701 }
6702 #[no_mangle]
6703 /// Frees any resources used by the CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ.
6704 pub extern "C" fn CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_free(_res: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ) { }
6705 impl Drop for CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
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::derived::C2Tuple_SignatureCVec_SignatureZZ, ()>> for CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
6716         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ, ()>) -> 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_C2Tuple_SignatureCVec_SignatureZZNoneZPtr { result }
6721                 } else {
6722                         let _ = unsafe { Box::from_raw(o.contents.err) };
6723                         o.contents.err = core::ptr::null_mut();
6724                         CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr { err: core::ptr::null_mut() }
6725                 };
6726                 Self {
6727                         contents,
6728                         result_ok: o.result_ok,
6729                 }
6730         }
6731 }
6732 impl Clone for CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
6733         fn clone(&self) -> Self {
6734                 if self.result_ok {
6735                         Self { result_ok: true, contents: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
6736                                 result: Box::into_raw(Box::new(<crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ>::clone(unsafe { &*self.contents.result })))
6737                         } }
6738                 } else {
6739                         Self { result_ok: false, contents: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
6740                                 err: core::ptr::null_mut()
6741                         } }
6742                 }
6743         }
6744 }
6745 #[no_mangle]
6746 /// Creates a new CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ which has the same data as `orig`
6747 /// but with all dynamically-allocated buffers duplicated in new buffers.
6748 pub extern "C" fn CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone(orig: &CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ) -> CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ { Clone::clone(&orig) }
6749 #[repr(C)]
6750 /// The contents of CResult_SignatureNoneZ
6751 pub union CResult_SignatureNoneZPtr {
6752         /// A pointer to the contents in the success state.
6753         /// Reading from this pointer when `result_ok` is not set is undefined.
6754         pub result: *mut crate::c_types::Signature,
6755         /// Note that this value is always NULL, as there are no contents in the Err variant
6756         pub err: *mut core::ffi::c_void,
6757 }
6758 #[repr(C)]
6759 /// A CResult_SignatureNoneZ represents the result of a fallible operation,
6760 /// containing a crate::c_types::Signature on success and a () on failure.
6761 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6762 pub struct CResult_SignatureNoneZ {
6763         /// The contents of this CResult_SignatureNoneZ, accessible via either
6764         /// `err` or `result` depending on the state of `result_ok`.
6765         pub contents: CResult_SignatureNoneZPtr,
6766         /// Whether this CResult_SignatureNoneZ represents a success state.
6767         pub result_ok: bool,
6768 }
6769 #[no_mangle]
6770 /// Creates a new CResult_SignatureNoneZ in the success state.
6771 pub extern "C" fn CResult_SignatureNoneZ_ok(o: crate::c_types::Signature) -> CResult_SignatureNoneZ {
6772         CResult_SignatureNoneZ {
6773                 contents: CResult_SignatureNoneZPtr {
6774                         result: Box::into_raw(Box::new(o)),
6775                 },
6776                 result_ok: true,
6777         }
6778 }
6779 #[no_mangle]
6780 /// Creates a new CResult_SignatureNoneZ in the error state.
6781 pub extern "C" fn CResult_SignatureNoneZ_err() -> CResult_SignatureNoneZ {
6782         CResult_SignatureNoneZ {
6783                 contents: CResult_SignatureNoneZPtr {
6784                         err: core::ptr::null_mut(),
6785                 },
6786                 result_ok: false,
6787         }
6788 }
6789 /// Checks if the given object is currently in the success state
6790 #[no_mangle]
6791 pub extern "C" fn CResult_SignatureNoneZ_is_ok(o: &CResult_SignatureNoneZ) -> bool {
6792         o.result_ok
6793 }
6794 #[no_mangle]
6795 /// Frees any resources used by the CResult_SignatureNoneZ.
6796 pub extern "C" fn CResult_SignatureNoneZ_free(_res: CResult_SignatureNoneZ) { }
6797 impl Drop for CResult_SignatureNoneZ {
6798         fn drop(&mut self) {
6799                 if self.result_ok {
6800                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
6801                                 let _ = unsafe { Box::from_raw(self.contents.result) };
6802                         }
6803                 } else {
6804                 }
6805         }
6806 }
6807 impl From<crate::c_types::CResultTempl<crate::c_types::Signature, ()>> for CResult_SignatureNoneZ {
6808         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::Signature, ()>) -> Self {
6809                 let contents = if o.result_ok {
6810                         let result = unsafe { o.contents.result };
6811                         unsafe { o.contents.result = core::ptr::null_mut() };
6812                         CResult_SignatureNoneZPtr { result }
6813                 } else {
6814                         let _ = unsafe { Box::from_raw(o.contents.err) };
6815                         o.contents.err = core::ptr::null_mut();
6816                         CResult_SignatureNoneZPtr { err: core::ptr::null_mut() }
6817                 };
6818                 Self {
6819                         contents,
6820                         result_ok: o.result_ok,
6821                 }
6822         }
6823 }
6824 impl Clone for CResult_SignatureNoneZ {
6825         fn clone(&self) -> Self {
6826                 if self.result_ok {
6827                         Self { result_ok: true, contents: CResult_SignatureNoneZPtr {
6828                                 result: Box::into_raw(Box::new(<crate::c_types::Signature>::clone(unsafe { &*self.contents.result })))
6829                         } }
6830                 } else {
6831                         Self { result_ok: false, contents: CResult_SignatureNoneZPtr {
6832                                 err: core::ptr::null_mut()
6833                         } }
6834                 }
6835         }
6836 }
6837 #[no_mangle]
6838 /// Creates a new CResult_SignatureNoneZ which has the same data as `orig`
6839 /// but with all dynamically-allocated buffers duplicated in new buffers.
6840 pub extern "C" fn CResult_SignatureNoneZ_clone(orig: &CResult_SignatureNoneZ) -> CResult_SignatureNoneZ { Clone::clone(&orig) }
6841 #[repr(C)]
6842 /// A tuple of 2 elements. See the individual fields for the types contained.
6843 pub struct C2Tuple_SignatureSignatureZ {
6844         /// The element at position 0
6845         pub a: crate::c_types::Signature,
6846         /// The element at position 1
6847         pub b: crate::c_types::Signature,
6848 }
6849 impl From<(crate::c_types::Signature, crate::c_types::Signature)> for C2Tuple_SignatureSignatureZ {
6850         fn from (tup: (crate::c_types::Signature, crate::c_types::Signature)) -> Self {
6851                 Self {
6852                         a: tup.0,
6853                         b: tup.1,
6854                 }
6855         }
6856 }
6857 impl C2Tuple_SignatureSignatureZ {
6858         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::Signature, crate::c_types::Signature) {
6859                 (self.a, self.b)
6860         }
6861 }
6862 impl Clone for C2Tuple_SignatureSignatureZ {
6863         fn clone(&self) -> Self {
6864                 Self {
6865                         a: Clone::clone(&self.a),
6866                         b: Clone::clone(&self.b),
6867                 }
6868         }
6869 }
6870 #[no_mangle]
6871 /// Creates a new tuple which has the same data as `orig`
6872 /// but with all dynamically-allocated buffers duplicated in new buffers.
6873 pub extern "C" fn C2Tuple_SignatureSignatureZ_clone(orig: &C2Tuple_SignatureSignatureZ) -> C2Tuple_SignatureSignatureZ { Clone::clone(&orig) }
6874 /// Creates a new C2Tuple_SignatureSignatureZ from the contained elements.
6875 #[no_mangle]
6876 pub extern "C" fn C2Tuple_SignatureSignatureZ_new(a: crate::c_types::Signature, b: crate::c_types::Signature) -> C2Tuple_SignatureSignatureZ {
6877         C2Tuple_SignatureSignatureZ { a, b, }
6878 }
6879
6880 #[no_mangle]
6881 /// Frees any resources used by the C2Tuple_SignatureSignatureZ.
6882 pub extern "C" fn C2Tuple_SignatureSignatureZ_free(_res: C2Tuple_SignatureSignatureZ) { }
6883 #[repr(C)]
6884 /// The contents of CResult_C2Tuple_SignatureSignatureZNoneZ
6885 pub union CResult_C2Tuple_SignatureSignatureZNoneZPtr {
6886         /// A pointer to the contents in the success state.
6887         /// Reading from this pointer when `result_ok` is not set is undefined.
6888         pub result: *mut crate::c_types::derived::C2Tuple_SignatureSignatureZ,
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_C2Tuple_SignatureSignatureZNoneZ represents the result of a fallible operation,
6894 /// containing a crate::c_types::derived::C2Tuple_SignatureSignatureZ on success and a () on failure.
6895 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6896 pub struct CResult_C2Tuple_SignatureSignatureZNoneZ {
6897         /// The contents of this CResult_C2Tuple_SignatureSignatureZNoneZ, accessible via either
6898         /// `err` or `result` depending on the state of `result_ok`.
6899         pub contents: CResult_C2Tuple_SignatureSignatureZNoneZPtr,
6900         /// Whether this CResult_C2Tuple_SignatureSignatureZNoneZ represents a success state.
6901         pub result_ok: bool,
6902 }
6903 #[no_mangle]
6904 /// Creates a new CResult_C2Tuple_SignatureSignatureZNoneZ in the success state.
6905 pub extern "C" fn CResult_C2Tuple_SignatureSignatureZNoneZ_ok(o: crate::c_types::derived::C2Tuple_SignatureSignatureZ) -> CResult_C2Tuple_SignatureSignatureZNoneZ {
6906         CResult_C2Tuple_SignatureSignatureZNoneZ {
6907                 contents: CResult_C2Tuple_SignatureSignatureZNoneZPtr {
6908                         result: Box::into_raw(Box::new(o)),
6909                 },
6910                 result_ok: true,
6911         }
6912 }
6913 #[no_mangle]
6914 /// Creates a new CResult_C2Tuple_SignatureSignatureZNoneZ in the error state.
6915 pub extern "C" fn CResult_C2Tuple_SignatureSignatureZNoneZ_err() -> CResult_C2Tuple_SignatureSignatureZNoneZ {
6916         CResult_C2Tuple_SignatureSignatureZNoneZ {
6917                 contents: CResult_C2Tuple_SignatureSignatureZNoneZPtr {
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_C2Tuple_SignatureSignatureZNoneZ_is_ok(o: &CResult_C2Tuple_SignatureSignatureZNoneZ) -> bool {
6926         o.result_ok
6927 }
6928 #[no_mangle]
6929 /// Frees any resources used by the CResult_C2Tuple_SignatureSignatureZNoneZ.
6930 pub extern "C" fn CResult_C2Tuple_SignatureSignatureZNoneZ_free(_res: CResult_C2Tuple_SignatureSignatureZNoneZ) { }
6931 impl Drop for CResult_C2Tuple_SignatureSignatureZNoneZ {
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::derived::C2Tuple_SignatureSignatureZ, ()>> for CResult_C2Tuple_SignatureSignatureZNoneZ {
6942         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_SignatureSignatureZ, ()>) -> 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_C2Tuple_SignatureSignatureZNoneZPtr { result }
6947                 } else {
6948                         let _ = unsafe { Box::from_raw(o.contents.err) };
6949                         o.contents.err = core::ptr::null_mut();
6950                         CResult_C2Tuple_SignatureSignatureZNoneZPtr { err: core::ptr::null_mut() }
6951                 };
6952                 Self {
6953                         contents,
6954                         result_ok: o.result_ok,
6955                 }
6956         }
6957 }
6958 impl Clone for CResult_C2Tuple_SignatureSignatureZNoneZ {
6959         fn clone(&self) -> Self {
6960                 if self.result_ok {
6961                         Self { result_ok: true, contents: CResult_C2Tuple_SignatureSignatureZNoneZPtr {
6962                                 result: Box::into_raw(Box::new(<crate::c_types::derived::C2Tuple_SignatureSignatureZ>::clone(unsafe { &*self.contents.result })))
6963                         } }
6964                 } else {
6965                         Self { result_ok: false, contents: CResult_C2Tuple_SignatureSignatureZNoneZPtr {
6966                                 err: core::ptr::null_mut()
6967                         } }
6968                 }
6969         }
6970 }
6971 #[no_mangle]
6972 /// Creates a new CResult_C2Tuple_SignatureSignatureZNoneZ which has the same data as `orig`
6973 /// but with all dynamically-allocated buffers duplicated in new buffers.
6974 pub extern "C" fn CResult_C2Tuple_SignatureSignatureZNoneZ_clone(orig: &CResult_C2Tuple_SignatureSignatureZNoneZ) -> CResult_C2Tuple_SignatureSignatureZNoneZ { Clone::clone(&orig) }
6975 #[repr(C)]
6976 /// The contents of CResult_SecretKeyNoneZ
6977 pub union CResult_SecretKeyNoneZPtr {
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::SecretKey,
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_SecretKeyNoneZ represents the result of a fallible operation,
6986 /// containing a crate::c_types::SecretKey on success and a () on failure.
6987 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6988 pub struct CResult_SecretKeyNoneZ {
6989         /// The contents of this CResult_SecretKeyNoneZ, accessible via either
6990         /// `err` or `result` depending on the state of `result_ok`.
6991         pub contents: CResult_SecretKeyNoneZPtr,
6992         /// Whether this CResult_SecretKeyNoneZ represents a success state.
6993         pub result_ok: bool,
6994 }
6995 #[no_mangle]
6996 /// Creates a new CResult_SecretKeyNoneZ in the success state.
6997 pub extern "C" fn CResult_SecretKeyNoneZ_ok(o: crate::c_types::SecretKey) -> CResult_SecretKeyNoneZ {
6998         CResult_SecretKeyNoneZ {
6999                 contents: CResult_SecretKeyNoneZPtr {
7000                         result: Box::into_raw(Box::new(o)),
7001                 },
7002                 result_ok: true,
7003         }
7004 }
7005 #[no_mangle]
7006 /// Creates a new CResult_SecretKeyNoneZ in the error state.
7007 pub extern "C" fn CResult_SecretKeyNoneZ_err() -> CResult_SecretKeyNoneZ {
7008         CResult_SecretKeyNoneZ {
7009                 contents: CResult_SecretKeyNoneZPtr {
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_SecretKeyNoneZ_is_ok(o: &CResult_SecretKeyNoneZ) -> bool {
7018         o.result_ok
7019 }
7020 #[no_mangle]
7021 /// Frees any resources used by the CResult_SecretKeyNoneZ.
7022 pub extern "C" fn CResult_SecretKeyNoneZ_free(_res: CResult_SecretKeyNoneZ) { }
7023 impl Drop for CResult_SecretKeyNoneZ {
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::SecretKey, ()>> for CResult_SecretKeyNoneZ {
7034         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::SecretKey, ()>) -> 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_SecretKeyNoneZPtr { result }
7039                 } else {
7040                         let _ = unsafe { Box::from_raw(o.contents.err) };
7041                         o.contents.err = core::ptr::null_mut();
7042                         CResult_SecretKeyNoneZPtr { err: core::ptr::null_mut() }
7043                 };
7044                 Self {
7045                         contents,
7046                         result_ok: o.result_ok,
7047                 }
7048         }
7049 }
7050 impl Clone for CResult_SecretKeyNoneZ {
7051         fn clone(&self) -> Self {
7052                 if self.result_ok {
7053                         Self { result_ok: true, contents: CResult_SecretKeyNoneZPtr {
7054                                 result: Box::into_raw(Box::new(<crate::c_types::SecretKey>::clone(unsafe { &*self.contents.result })))
7055                         } }
7056                 } else {
7057                         Self { result_ok: false, contents: CResult_SecretKeyNoneZPtr {
7058                                 err: core::ptr::null_mut()
7059                         } }
7060                 }
7061         }
7062 }
7063 #[no_mangle]
7064 /// Creates a new CResult_SecretKeyNoneZ which has the same data as `orig`
7065 /// but with all dynamically-allocated buffers duplicated in new buffers.
7066 pub extern "C" fn CResult_SecretKeyNoneZ_clone(orig: &CResult_SecretKeyNoneZ) -> CResult_SecretKeyNoneZ { 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 #[derive(Clone)]
12256 /// An enum which can either contain a crate::lightning::ln::msgs::NetAddress or not
12257 pub enum COption_NetAddressZ {
12258         /// When we're in this state, this COption_NetAddressZ contains a crate::lightning::ln::msgs::NetAddress
12259         Some(crate::lightning::ln::msgs::NetAddress),
12260         /// When we're in this state, this COption_NetAddressZ contains nothing
12261         None
12262 }
12263 impl COption_NetAddressZ {
12264         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
12265                 if let Self::None = self { false } else { true }
12266         }
12267         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
12268                 !self.is_some()
12269         }
12270         #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::ln::msgs::NetAddress {
12271                 if let Self::Some(v) = self { v } else { unreachable!() }
12272         }
12273 }
12274 #[no_mangle]
12275 /// Constructs a new COption_NetAddressZ containing a crate::lightning::ln::msgs::NetAddress
12276 pub extern "C" fn COption_NetAddressZ_some(o: crate::lightning::ln::msgs::NetAddress) -> COption_NetAddressZ {
12277         COption_NetAddressZ::Some(o)
12278 }
12279 #[no_mangle]
12280 /// Constructs a new COption_NetAddressZ containing nothing
12281 pub extern "C" fn COption_NetAddressZ_none() -> COption_NetAddressZ {
12282         COption_NetAddressZ::None
12283 }
12284 #[no_mangle]
12285 /// Frees any resources associated with the crate::lightning::ln::msgs::NetAddress, if we are in the Some state
12286 pub extern "C" fn COption_NetAddressZ_free(_res: COption_NetAddressZ) { }
12287 #[no_mangle]
12288 /// Creates a new COption_NetAddressZ which has the same data as `orig`
12289 /// but with all dynamically-allocated buffers duplicated in new buffers.
12290 pub extern "C" fn COption_NetAddressZ_clone(orig: &COption_NetAddressZ) -> COption_NetAddressZ { Clone::clone(&orig) }
12291 #[repr(C)]
12292 /// The contents of CResult_CVec_u8ZPeerHandleErrorZ
12293 pub union CResult_CVec_u8ZPeerHandleErrorZPtr {
12294         /// A pointer to the contents in the success state.
12295         /// Reading from this pointer when `result_ok` is not set is undefined.
12296         pub result: *mut crate::c_types::derived::CVec_u8Z,
12297         /// A pointer to the contents in the error state.
12298         /// Reading from this pointer when `result_ok` is set is undefined.
12299         pub err: *mut crate::lightning::ln::peer_handler::PeerHandleError,
12300 }
12301 #[repr(C)]
12302 /// A CResult_CVec_u8ZPeerHandleErrorZ represents the result of a fallible operation,
12303 /// containing a crate::c_types::derived::CVec_u8Z on success and a crate::lightning::ln::peer_handler::PeerHandleError on failure.
12304 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12305 pub struct CResult_CVec_u8ZPeerHandleErrorZ {
12306         /// The contents of this CResult_CVec_u8ZPeerHandleErrorZ, accessible via either
12307         /// `err` or `result` depending on the state of `result_ok`.
12308         pub contents: CResult_CVec_u8ZPeerHandleErrorZPtr,
12309         /// Whether this CResult_CVec_u8ZPeerHandleErrorZ represents a success state.
12310         pub result_ok: bool,
12311 }
12312 #[no_mangle]
12313 /// Creates a new CResult_CVec_u8ZPeerHandleErrorZ in the success state.
12314 pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_ok(o: crate::c_types::derived::CVec_u8Z) -> CResult_CVec_u8ZPeerHandleErrorZ {
12315         CResult_CVec_u8ZPeerHandleErrorZ {
12316                 contents: CResult_CVec_u8ZPeerHandleErrorZPtr {
12317                         result: Box::into_raw(Box::new(o)),
12318                 },
12319                 result_ok: true,
12320         }
12321 }
12322 #[no_mangle]
12323 /// Creates a new CResult_CVec_u8ZPeerHandleErrorZ in the error state.
12324 pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_err(e: crate::lightning::ln::peer_handler::PeerHandleError) -> CResult_CVec_u8ZPeerHandleErrorZ {
12325         CResult_CVec_u8ZPeerHandleErrorZ {
12326                 contents: CResult_CVec_u8ZPeerHandleErrorZPtr {
12327                         err: Box::into_raw(Box::new(e)),
12328                 },
12329                 result_ok: false,
12330         }
12331 }
12332 /// Checks if the given object is currently in the success state
12333 #[no_mangle]
12334 pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_is_ok(o: &CResult_CVec_u8ZPeerHandleErrorZ) -> bool {
12335         o.result_ok
12336 }
12337 #[no_mangle]
12338 /// Frees any resources used by the CResult_CVec_u8ZPeerHandleErrorZ.
12339 pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_free(_res: CResult_CVec_u8ZPeerHandleErrorZ) { }
12340 impl Drop for CResult_CVec_u8ZPeerHandleErrorZ {
12341         fn drop(&mut self) {
12342                 if self.result_ok {
12343                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
12344                                 let _ = unsafe { Box::from_raw(self.contents.result) };
12345                         }
12346                 } else {
12347                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
12348                                 let _ = unsafe { Box::from_raw(self.contents.err) };
12349                         }
12350                 }
12351         }
12352 }
12353 impl From<crate::c_types::CResultTempl<crate::c_types::derived::CVec_u8Z, crate::lightning::ln::peer_handler::PeerHandleError>> for CResult_CVec_u8ZPeerHandleErrorZ {
12354         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CVec_u8Z, crate::lightning::ln::peer_handler::PeerHandleError>) -> Self {
12355                 let contents = if o.result_ok {
12356                         let result = unsafe { o.contents.result };
12357                         unsafe { o.contents.result = core::ptr::null_mut() };
12358                         CResult_CVec_u8ZPeerHandleErrorZPtr { result }
12359                 } else {
12360                         let err = unsafe { o.contents.err };
12361                         unsafe { o.contents.err = core::ptr::null_mut(); }
12362                         CResult_CVec_u8ZPeerHandleErrorZPtr { err }
12363                 };
12364                 Self {
12365                         contents,
12366                         result_ok: o.result_ok,
12367                 }
12368         }
12369 }
12370 impl Clone for CResult_CVec_u8ZPeerHandleErrorZ {
12371         fn clone(&self) -> Self {
12372                 if self.result_ok {
12373                         Self { result_ok: true, contents: CResult_CVec_u8ZPeerHandleErrorZPtr {
12374                                 result: Box::into_raw(Box::new(<crate::c_types::derived::CVec_u8Z>::clone(unsafe { &*self.contents.result })))
12375                         } }
12376                 } else {
12377                         Self { result_ok: false, contents: CResult_CVec_u8ZPeerHandleErrorZPtr {
12378                                 err: Box::into_raw(Box::new(<crate::lightning::ln::peer_handler::PeerHandleError>::clone(unsafe { &*self.contents.err })))
12379                         } }
12380                 }
12381         }
12382 }
12383 #[no_mangle]
12384 /// Creates a new CResult_CVec_u8ZPeerHandleErrorZ which has the same data as `orig`
12385 /// but with all dynamically-allocated buffers duplicated in new buffers.
12386 pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_clone(orig: &CResult_CVec_u8ZPeerHandleErrorZ) -> CResult_CVec_u8ZPeerHandleErrorZ { Clone::clone(&orig) }
12387 #[repr(C)]
12388 /// The contents of CResult_NonePeerHandleErrorZ
12389 pub union CResult_NonePeerHandleErrorZPtr {
12390         /// Note that this value is always NULL, as there are no contents in the OK variant
12391         pub result: *mut core::ffi::c_void,
12392         /// A pointer to the contents in the error state.
12393         /// Reading from this pointer when `result_ok` is set is undefined.
12394         pub err: *mut crate::lightning::ln::peer_handler::PeerHandleError,
12395 }
12396 #[repr(C)]
12397 /// A CResult_NonePeerHandleErrorZ represents the result of a fallible operation,
12398 /// containing a () on success and a crate::lightning::ln::peer_handler::PeerHandleError on failure.
12399 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12400 pub struct CResult_NonePeerHandleErrorZ {
12401         /// The contents of this CResult_NonePeerHandleErrorZ, accessible via either
12402         /// `err` or `result` depending on the state of `result_ok`.
12403         pub contents: CResult_NonePeerHandleErrorZPtr,
12404         /// Whether this CResult_NonePeerHandleErrorZ represents a success state.
12405         pub result_ok: bool,
12406 }
12407 #[no_mangle]
12408 /// Creates a new CResult_NonePeerHandleErrorZ in the success state.
12409 pub extern "C" fn CResult_NonePeerHandleErrorZ_ok() -> CResult_NonePeerHandleErrorZ {
12410         CResult_NonePeerHandleErrorZ {
12411                 contents: CResult_NonePeerHandleErrorZPtr {
12412                         result: core::ptr::null_mut(),
12413                 },
12414                 result_ok: true,
12415         }
12416 }
12417 #[no_mangle]
12418 /// Creates a new CResult_NonePeerHandleErrorZ in the error state.
12419 pub extern "C" fn CResult_NonePeerHandleErrorZ_err(e: crate::lightning::ln::peer_handler::PeerHandleError) -> CResult_NonePeerHandleErrorZ {
12420         CResult_NonePeerHandleErrorZ {
12421                 contents: CResult_NonePeerHandleErrorZPtr {
12422                         err: Box::into_raw(Box::new(e)),
12423                 },
12424                 result_ok: false,
12425         }
12426 }
12427 /// Checks if the given object is currently in the success state
12428 #[no_mangle]
12429 pub extern "C" fn CResult_NonePeerHandleErrorZ_is_ok(o: &CResult_NonePeerHandleErrorZ) -> bool {
12430         o.result_ok
12431 }
12432 #[no_mangle]
12433 /// Frees any resources used by the CResult_NonePeerHandleErrorZ.
12434 pub extern "C" fn CResult_NonePeerHandleErrorZ_free(_res: CResult_NonePeerHandleErrorZ) { }
12435 impl Drop for CResult_NonePeerHandleErrorZ {
12436         fn drop(&mut self) {
12437                 if self.result_ok {
12438                 } else {
12439                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
12440                                 let _ = unsafe { Box::from_raw(self.contents.err) };
12441                         }
12442                 }
12443         }
12444 }
12445 impl From<crate::c_types::CResultTempl<(), crate::lightning::ln::peer_handler::PeerHandleError>> for CResult_NonePeerHandleErrorZ {
12446         fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::ln::peer_handler::PeerHandleError>) -> Self {
12447                 let contents = if o.result_ok {
12448                         let _ = unsafe { Box::from_raw(o.contents.result) };
12449                         o.contents.result = core::ptr::null_mut();
12450                         CResult_NonePeerHandleErrorZPtr { result: core::ptr::null_mut() }
12451                 } else {
12452                         let err = unsafe { o.contents.err };
12453                         unsafe { o.contents.err = core::ptr::null_mut(); }
12454                         CResult_NonePeerHandleErrorZPtr { err }
12455                 };
12456                 Self {
12457                         contents,
12458                         result_ok: o.result_ok,
12459                 }
12460         }
12461 }
12462 impl Clone for CResult_NonePeerHandleErrorZ {
12463         fn clone(&self) -> Self {
12464                 if self.result_ok {
12465                         Self { result_ok: true, contents: CResult_NonePeerHandleErrorZPtr {
12466                                 result: core::ptr::null_mut()
12467                         } }
12468                 } else {
12469                         Self { result_ok: false, contents: CResult_NonePeerHandleErrorZPtr {
12470                                 err: Box::into_raw(Box::new(<crate::lightning::ln::peer_handler::PeerHandleError>::clone(unsafe { &*self.contents.err })))
12471                         } }
12472                 }
12473         }
12474 }
12475 #[no_mangle]
12476 /// Creates a new CResult_NonePeerHandleErrorZ which has the same data as `orig`
12477 /// but with all dynamically-allocated buffers duplicated in new buffers.
12478 pub extern "C" fn CResult_NonePeerHandleErrorZ_clone(orig: &CResult_NonePeerHandleErrorZ) -> CResult_NonePeerHandleErrorZ { Clone::clone(&orig) }
12479 #[repr(C)]
12480 /// The contents of CResult_boolPeerHandleErrorZ
12481 pub union CResult_boolPeerHandleErrorZPtr {
12482         /// A pointer to the contents in the success state.
12483         /// Reading from this pointer when `result_ok` is not set is undefined.
12484         pub result: *mut bool,
12485         /// A pointer to the contents in the error state.
12486         /// Reading from this pointer when `result_ok` is set is undefined.
12487         pub err: *mut crate::lightning::ln::peer_handler::PeerHandleError,
12488 }
12489 #[repr(C)]
12490 /// A CResult_boolPeerHandleErrorZ represents the result of a fallible operation,
12491 /// containing a bool on success and a crate::lightning::ln::peer_handler::PeerHandleError on failure.
12492 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12493 pub struct CResult_boolPeerHandleErrorZ {
12494         /// The contents of this CResult_boolPeerHandleErrorZ, accessible via either
12495         /// `err` or `result` depending on the state of `result_ok`.
12496         pub contents: CResult_boolPeerHandleErrorZPtr,
12497         /// Whether this CResult_boolPeerHandleErrorZ represents a success state.
12498         pub result_ok: bool,
12499 }
12500 #[no_mangle]
12501 /// Creates a new CResult_boolPeerHandleErrorZ in the success state.
12502 pub extern "C" fn CResult_boolPeerHandleErrorZ_ok(o: bool) -> CResult_boolPeerHandleErrorZ {
12503         CResult_boolPeerHandleErrorZ {
12504                 contents: CResult_boolPeerHandleErrorZPtr {
12505                         result: Box::into_raw(Box::new(o)),
12506                 },
12507                 result_ok: true,
12508         }
12509 }
12510 #[no_mangle]
12511 /// Creates a new CResult_boolPeerHandleErrorZ in the error state.
12512 pub extern "C" fn CResult_boolPeerHandleErrorZ_err(e: crate::lightning::ln::peer_handler::PeerHandleError) -> CResult_boolPeerHandleErrorZ {
12513         CResult_boolPeerHandleErrorZ {
12514                 contents: CResult_boolPeerHandleErrorZPtr {
12515                         err: Box::into_raw(Box::new(e)),
12516                 },
12517                 result_ok: false,
12518         }
12519 }
12520 /// Checks if the given object is currently in the success state
12521 #[no_mangle]
12522 pub extern "C" fn CResult_boolPeerHandleErrorZ_is_ok(o: &CResult_boolPeerHandleErrorZ) -> bool {
12523         o.result_ok
12524 }
12525 #[no_mangle]
12526 /// Frees any resources used by the CResult_boolPeerHandleErrorZ.
12527 pub extern "C" fn CResult_boolPeerHandleErrorZ_free(_res: CResult_boolPeerHandleErrorZ) { }
12528 impl Drop for CResult_boolPeerHandleErrorZ {
12529         fn drop(&mut self) {
12530                 if self.result_ok {
12531                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
12532                                 let _ = unsafe { Box::from_raw(self.contents.result) };
12533                         }
12534                 } else {
12535                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
12536                                 let _ = unsafe { Box::from_raw(self.contents.err) };
12537                         }
12538                 }
12539         }
12540 }
12541 impl From<crate::c_types::CResultTempl<bool, crate::lightning::ln::peer_handler::PeerHandleError>> for CResult_boolPeerHandleErrorZ {
12542         fn from(mut o: crate::c_types::CResultTempl<bool, crate::lightning::ln::peer_handler::PeerHandleError>) -> Self {
12543                 let contents = if o.result_ok {
12544                         let result = unsafe { o.contents.result };
12545                         unsafe { o.contents.result = core::ptr::null_mut() };
12546                         CResult_boolPeerHandleErrorZPtr { result }
12547                 } else {
12548                         let err = unsafe { o.contents.err };
12549                         unsafe { o.contents.err = core::ptr::null_mut(); }
12550                         CResult_boolPeerHandleErrorZPtr { err }
12551                 };
12552                 Self {
12553                         contents,
12554                         result_ok: o.result_ok,
12555                 }
12556         }
12557 }
12558 impl Clone for CResult_boolPeerHandleErrorZ {
12559         fn clone(&self) -> Self {
12560                 if self.result_ok {
12561                         Self { result_ok: true, contents: CResult_boolPeerHandleErrorZPtr {
12562                                 result: Box::into_raw(Box::new(<bool>::clone(unsafe { &*self.contents.result })))
12563                         } }
12564                 } else {
12565                         Self { result_ok: false, contents: CResult_boolPeerHandleErrorZPtr {
12566                                 err: Box::into_raw(Box::new(<crate::lightning::ln::peer_handler::PeerHandleError>::clone(unsafe { &*self.contents.err })))
12567                         } }
12568                 }
12569         }
12570 }
12571 #[no_mangle]
12572 /// Creates a new CResult_boolPeerHandleErrorZ which has the same data as `orig`
12573 /// but with all dynamically-allocated buffers duplicated in new buffers.
12574 pub extern "C" fn CResult_boolPeerHandleErrorZ_clone(orig: &CResult_boolPeerHandleErrorZ) -> CResult_boolPeerHandleErrorZ { Clone::clone(&orig) }
12575 #[repr(C)]
12576 /// The contents of CResult_NoneSendErrorZ
12577 pub union CResult_NoneSendErrorZPtr {
12578         /// Note that this value is always NULL, as there are no contents in the OK variant
12579         pub result: *mut core::ffi::c_void,
12580         /// A pointer to the contents in the error state.
12581         /// Reading from this pointer when `result_ok` is set is undefined.
12582         pub err: *mut crate::lightning::onion_message::messenger::SendError,
12583 }
12584 #[repr(C)]
12585 /// A CResult_NoneSendErrorZ represents the result of a fallible operation,
12586 /// containing a () on success and a crate::lightning::onion_message::messenger::SendError on failure.
12587 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12588 pub struct CResult_NoneSendErrorZ {
12589         /// The contents of this CResult_NoneSendErrorZ, accessible via either
12590         /// `err` or `result` depending on the state of `result_ok`.
12591         pub contents: CResult_NoneSendErrorZPtr,
12592         /// Whether this CResult_NoneSendErrorZ represents a success state.
12593         pub result_ok: bool,
12594 }
12595 #[no_mangle]
12596 /// Creates a new CResult_NoneSendErrorZ in the success state.
12597 pub extern "C" fn CResult_NoneSendErrorZ_ok() -> CResult_NoneSendErrorZ {
12598         CResult_NoneSendErrorZ {
12599                 contents: CResult_NoneSendErrorZPtr {
12600                         result: core::ptr::null_mut(),
12601                 },
12602                 result_ok: true,
12603         }
12604 }
12605 #[no_mangle]
12606 /// Creates a new CResult_NoneSendErrorZ in the error state.
12607 pub extern "C" fn CResult_NoneSendErrorZ_err(e: crate::lightning::onion_message::messenger::SendError) -> CResult_NoneSendErrorZ {
12608         CResult_NoneSendErrorZ {
12609                 contents: CResult_NoneSendErrorZPtr {
12610                         err: Box::into_raw(Box::new(e)),
12611                 },
12612                 result_ok: false,
12613         }
12614 }
12615 /// Checks if the given object is currently in the success state
12616 #[no_mangle]
12617 pub extern "C" fn CResult_NoneSendErrorZ_is_ok(o: &CResult_NoneSendErrorZ) -> bool {
12618         o.result_ok
12619 }
12620 #[no_mangle]
12621 /// Frees any resources used by the CResult_NoneSendErrorZ.
12622 pub extern "C" fn CResult_NoneSendErrorZ_free(_res: CResult_NoneSendErrorZ) { }
12623 impl Drop for CResult_NoneSendErrorZ {
12624         fn drop(&mut self) {
12625                 if self.result_ok {
12626                 } else {
12627                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
12628                                 let _ = unsafe { Box::from_raw(self.contents.err) };
12629                         }
12630                 }
12631         }
12632 }
12633 impl From<crate::c_types::CResultTempl<(), crate::lightning::onion_message::messenger::SendError>> for CResult_NoneSendErrorZ {
12634         fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::onion_message::messenger::SendError>) -> Self {
12635                 let contents = if o.result_ok {
12636                         let _ = unsafe { Box::from_raw(o.contents.result) };
12637                         o.contents.result = core::ptr::null_mut();
12638                         CResult_NoneSendErrorZPtr { result: core::ptr::null_mut() }
12639                 } else {
12640                         let err = unsafe { o.contents.err };
12641                         unsafe { o.contents.err = core::ptr::null_mut(); }
12642                         CResult_NoneSendErrorZPtr { err }
12643                 };
12644                 Self {
12645                         contents,
12646                         result_ok: o.result_ok,
12647                 }
12648         }
12649 }
12650 #[repr(C)]
12651 /// The contents of CResult_u32GraphSyncErrorZ
12652 pub union CResult_u32GraphSyncErrorZPtr {
12653         /// A pointer to the contents in the success state.
12654         /// Reading from this pointer when `result_ok` is not set is undefined.
12655         pub result: *mut u32,
12656         /// A pointer to the contents in the error state.
12657         /// Reading from this pointer when `result_ok` is set is undefined.
12658         pub err: *mut crate::lightning_rapid_gossip_sync::error::GraphSyncError,
12659 }
12660 #[repr(C)]
12661 /// A CResult_u32GraphSyncErrorZ represents the result of a fallible operation,
12662 /// containing a u32 on success and a crate::lightning_rapid_gossip_sync::error::GraphSyncError on failure.
12663 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12664 pub struct CResult_u32GraphSyncErrorZ {
12665         /// The contents of this CResult_u32GraphSyncErrorZ, accessible via either
12666         /// `err` or `result` depending on the state of `result_ok`.
12667         pub contents: CResult_u32GraphSyncErrorZPtr,
12668         /// Whether this CResult_u32GraphSyncErrorZ represents a success state.
12669         pub result_ok: bool,
12670 }
12671 #[no_mangle]
12672 /// Creates a new CResult_u32GraphSyncErrorZ in the success state.
12673 pub extern "C" fn CResult_u32GraphSyncErrorZ_ok(o: u32) -> CResult_u32GraphSyncErrorZ {
12674         CResult_u32GraphSyncErrorZ {
12675                 contents: CResult_u32GraphSyncErrorZPtr {
12676                         result: Box::into_raw(Box::new(o)),
12677                 },
12678                 result_ok: true,
12679         }
12680 }
12681 #[no_mangle]
12682 /// Creates a new CResult_u32GraphSyncErrorZ in the error state.
12683 pub extern "C" fn CResult_u32GraphSyncErrorZ_err(e: crate::lightning_rapid_gossip_sync::error::GraphSyncError) -> CResult_u32GraphSyncErrorZ {
12684         CResult_u32GraphSyncErrorZ {
12685                 contents: CResult_u32GraphSyncErrorZPtr {
12686                         err: Box::into_raw(Box::new(e)),
12687                 },
12688                 result_ok: false,
12689         }
12690 }
12691 /// Checks if the given object is currently in the success state
12692 #[no_mangle]
12693 pub extern "C" fn CResult_u32GraphSyncErrorZ_is_ok(o: &CResult_u32GraphSyncErrorZ) -> bool {
12694         o.result_ok
12695 }
12696 #[no_mangle]
12697 /// Frees any resources used by the CResult_u32GraphSyncErrorZ.
12698 pub extern "C" fn CResult_u32GraphSyncErrorZ_free(_res: CResult_u32GraphSyncErrorZ) { }
12699 impl Drop for CResult_u32GraphSyncErrorZ {
12700         fn drop(&mut self) {
12701                 if self.result_ok {
12702                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
12703                                 let _ = unsafe { Box::from_raw(self.contents.result) };
12704                         }
12705                 } else {
12706                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
12707                                 let _ = unsafe { Box::from_raw(self.contents.err) };
12708                         }
12709                 }
12710         }
12711 }
12712 impl From<crate::c_types::CResultTempl<u32, crate::lightning_rapid_gossip_sync::error::GraphSyncError>> for CResult_u32GraphSyncErrorZ {
12713         fn from(mut o: crate::c_types::CResultTempl<u32, crate::lightning_rapid_gossip_sync::error::GraphSyncError>) -> Self {
12714                 let contents = if o.result_ok {
12715                         let result = unsafe { o.contents.result };
12716                         unsafe { o.contents.result = core::ptr::null_mut() };
12717                         CResult_u32GraphSyncErrorZPtr { result }
12718                 } else {
12719                         let err = unsafe { o.contents.err };
12720                         unsafe { o.contents.err = core::ptr::null_mut(); }
12721                         CResult_u32GraphSyncErrorZPtr { err }
12722                 };
12723                 Self {
12724                         contents,
12725                         result_ok: o.result_ok,
12726                 }
12727         }
12728 }
12729 #[repr(C)]
12730 /// The contents of CResult_NetAddressDecodeErrorZ
12731 pub union CResult_NetAddressDecodeErrorZPtr {
12732         /// A pointer to the contents in the success state.
12733         /// Reading from this pointer when `result_ok` is not set is undefined.
12734         pub result: *mut crate::lightning::ln::msgs::NetAddress,
12735         /// A pointer to the contents in the error state.
12736         /// Reading from this pointer when `result_ok` is set is undefined.
12737         pub err: *mut crate::lightning::ln::msgs::DecodeError,
12738 }
12739 #[repr(C)]
12740 /// A CResult_NetAddressDecodeErrorZ represents the result of a fallible operation,
12741 /// containing a crate::lightning::ln::msgs::NetAddress on success and a crate::lightning::ln::msgs::DecodeError on failure.
12742 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12743 pub struct CResult_NetAddressDecodeErrorZ {
12744         /// The contents of this CResult_NetAddressDecodeErrorZ, accessible via either
12745         /// `err` or `result` depending on the state of `result_ok`.
12746         pub contents: CResult_NetAddressDecodeErrorZPtr,
12747         /// Whether this CResult_NetAddressDecodeErrorZ represents a success state.
12748         pub result_ok: bool,
12749 }
12750 #[no_mangle]
12751 /// Creates a new CResult_NetAddressDecodeErrorZ in the success state.
12752 pub extern "C" fn CResult_NetAddressDecodeErrorZ_ok(o: crate::lightning::ln::msgs::NetAddress) -> CResult_NetAddressDecodeErrorZ {
12753         CResult_NetAddressDecodeErrorZ {
12754                 contents: CResult_NetAddressDecodeErrorZPtr {
12755                         result: Box::into_raw(Box::new(o)),
12756                 },
12757                 result_ok: true,
12758         }
12759 }
12760 #[no_mangle]
12761 /// Creates a new CResult_NetAddressDecodeErrorZ in the error state.
12762 pub extern "C" fn CResult_NetAddressDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NetAddressDecodeErrorZ {
12763         CResult_NetAddressDecodeErrorZ {
12764                 contents: CResult_NetAddressDecodeErrorZPtr {
12765                         err: Box::into_raw(Box::new(e)),
12766                 },
12767                 result_ok: false,
12768         }
12769 }
12770 /// Checks if the given object is currently in the success state
12771 #[no_mangle]
12772 pub extern "C" fn CResult_NetAddressDecodeErrorZ_is_ok(o: &CResult_NetAddressDecodeErrorZ) -> bool {
12773         o.result_ok
12774 }
12775 #[no_mangle]
12776 /// Frees any resources used by the CResult_NetAddressDecodeErrorZ.
12777 pub extern "C" fn CResult_NetAddressDecodeErrorZ_free(_res: CResult_NetAddressDecodeErrorZ) { }
12778 impl Drop for CResult_NetAddressDecodeErrorZ {
12779         fn drop(&mut self) {
12780                 if self.result_ok {
12781                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
12782                                 let _ = unsafe { Box::from_raw(self.contents.result) };
12783                         }
12784                 } else {
12785                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
12786                                 let _ = unsafe { Box::from_raw(self.contents.err) };
12787                         }
12788                 }
12789         }
12790 }
12791 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::NetAddress, crate::lightning::ln::msgs::DecodeError>> for CResult_NetAddressDecodeErrorZ {
12792         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::NetAddress, crate::lightning::ln::msgs::DecodeError>) -> Self {
12793                 let contents = if o.result_ok {
12794                         let result = unsafe { o.contents.result };
12795                         unsafe { o.contents.result = core::ptr::null_mut() };
12796                         CResult_NetAddressDecodeErrorZPtr { result }
12797                 } else {
12798                         let err = unsafe { o.contents.err };
12799                         unsafe { o.contents.err = core::ptr::null_mut(); }
12800                         CResult_NetAddressDecodeErrorZPtr { err }
12801                 };
12802                 Self {
12803                         contents,
12804                         result_ok: o.result_ok,
12805                 }
12806         }
12807 }
12808 impl Clone for CResult_NetAddressDecodeErrorZ {
12809         fn clone(&self) -> Self {
12810                 if self.result_ok {
12811                         Self { result_ok: true, contents: CResult_NetAddressDecodeErrorZPtr {
12812                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::NetAddress>::clone(unsafe { &*self.contents.result })))
12813                         } }
12814                 } else {
12815                         Self { result_ok: false, contents: CResult_NetAddressDecodeErrorZPtr {
12816                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
12817                         } }
12818                 }
12819         }
12820 }
12821 #[no_mangle]
12822 /// Creates a new CResult_NetAddressDecodeErrorZ which has the same data as `orig`
12823 /// but with all dynamically-allocated buffers duplicated in new buffers.
12824 pub extern "C" fn CResult_NetAddressDecodeErrorZ_clone(orig: &CResult_NetAddressDecodeErrorZ) -> CResult_NetAddressDecodeErrorZ { Clone::clone(&orig) }
12825 #[repr(C)]
12826 /// A dynamically-allocated array of crate::lightning::ln::msgs::UpdateAddHTLCs of arbitrary size.
12827 /// This corresponds to std::vector in C++
12828 pub struct CVec_UpdateAddHTLCZ {
12829         /// The elements in the array.
12830         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
12831         pub data: *mut crate::lightning::ln::msgs::UpdateAddHTLC,
12832         /// The number of elements pointed to by `data`.
12833         pub datalen: usize
12834 }
12835 impl CVec_UpdateAddHTLCZ {
12836         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::UpdateAddHTLC> {
12837                 if self.datalen == 0 { return Vec::new(); }
12838                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
12839                 self.data = core::ptr::null_mut();
12840                 self.datalen = 0;
12841                 ret
12842         }
12843         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::UpdateAddHTLC] {
12844                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
12845         }
12846 }
12847 impl From<Vec<crate::lightning::ln::msgs::UpdateAddHTLC>> for CVec_UpdateAddHTLCZ {
12848         fn from(v: Vec<crate::lightning::ln::msgs::UpdateAddHTLC>) -> Self {
12849                 let datalen = v.len();
12850                 let data = Box::into_raw(v.into_boxed_slice());
12851                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
12852         }
12853 }
12854 #[no_mangle]
12855 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
12856 pub extern "C" fn CVec_UpdateAddHTLCZ_free(_res: CVec_UpdateAddHTLCZ) { }
12857 impl Drop for CVec_UpdateAddHTLCZ {
12858         fn drop(&mut self) {
12859                 if self.datalen == 0 { return; }
12860                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
12861         }
12862 }
12863 impl Clone for CVec_UpdateAddHTLCZ {
12864         fn clone(&self) -> Self {
12865                 let mut res = Vec::new();
12866                 if self.datalen == 0 { return Self::from(res); }
12867                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
12868                 Self::from(res)
12869         }
12870 }
12871 #[repr(C)]
12872 /// A dynamically-allocated array of crate::lightning::ln::msgs::UpdateFulfillHTLCs of arbitrary size.
12873 /// This corresponds to std::vector in C++
12874 pub struct CVec_UpdateFulfillHTLCZ {
12875         /// The elements in the array.
12876         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
12877         pub data: *mut crate::lightning::ln::msgs::UpdateFulfillHTLC,
12878         /// The number of elements pointed to by `data`.
12879         pub datalen: usize
12880 }
12881 impl CVec_UpdateFulfillHTLCZ {
12882         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::UpdateFulfillHTLC> {
12883                 if self.datalen == 0 { return Vec::new(); }
12884                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
12885                 self.data = core::ptr::null_mut();
12886                 self.datalen = 0;
12887                 ret
12888         }
12889         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::UpdateFulfillHTLC] {
12890                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
12891         }
12892 }
12893 impl From<Vec<crate::lightning::ln::msgs::UpdateFulfillHTLC>> for CVec_UpdateFulfillHTLCZ {
12894         fn from(v: Vec<crate::lightning::ln::msgs::UpdateFulfillHTLC>) -> Self {
12895                 let datalen = v.len();
12896                 let data = Box::into_raw(v.into_boxed_slice());
12897                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
12898         }
12899 }
12900 #[no_mangle]
12901 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
12902 pub extern "C" fn CVec_UpdateFulfillHTLCZ_free(_res: CVec_UpdateFulfillHTLCZ) { }
12903 impl Drop for CVec_UpdateFulfillHTLCZ {
12904         fn drop(&mut self) {
12905                 if self.datalen == 0 { return; }
12906                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
12907         }
12908 }
12909 impl Clone for CVec_UpdateFulfillHTLCZ {
12910         fn clone(&self) -> Self {
12911                 let mut res = Vec::new();
12912                 if self.datalen == 0 { return Self::from(res); }
12913                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
12914                 Self::from(res)
12915         }
12916 }
12917 #[repr(C)]
12918 /// A dynamically-allocated array of crate::lightning::ln::msgs::UpdateFailHTLCs of arbitrary size.
12919 /// This corresponds to std::vector in C++
12920 pub struct CVec_UpdateFailHTLCZ {
12921         /// The elements in the array.
12922         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
12923         pub data: *mut crate::lightning::ln::msgs::UpdateFailHTLC,
12924         /// The number of elements pointed to by `data`.
12925         pub datalen: usize
12926 }
12927 impl CVec_UpdateFailHTLCZ {
12928         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::UpdateFailHTLC> {
12929                 if self.datalen == 0 { return Vec::new(); }
12930                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
12931                 self.data = core::ptr::null_mut();
12932                 self.datalen = 0;
12933                 ret
12934         }
12935         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::UpdateFailHTLC] {
12936                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
12937         }
12938 }
12939 impl From<Vec<crate::lightning::ln::msgs::UpdateFailHTLC>> for CVec_UpdateFailHTLCZ {
12940         fn from(v: Vec<crate::lightning::ln::msgs::UpdateFailHTLC>) -> Self {
12941                 let datalen = v.len();
12942                 let data = Box::into_raw(v.into_boxed_slice());
12943                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
12944         }
12945 }
12946 #[no_mangle]
12947 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
12948 pub extern "C" fn CVec_UpdateFailHTLCZ_free(_res: CVec_UpdateFailHTLCZ) { }
12949 impl Drop for CVec_UpdateFailHTLCZ {
12950         fn drop(&mut self) {
12951                 if self.datalen == 0 { return; }
12952                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
12953         }
12954 }
12955 impl Clone for CVec_UpdateFailHTLCZ {
12956         fn clone(&self) -> Self {
12957                 let mut res = Vec::new();
12958                 if self.datalen == 0 { return Self::from(res); }
12959                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
12960                 Self::from(res)
12961         }
12962 }
12963 #[repr(C)]
12964 /// A dynamically-allocated array of crate::lightning::ln::msgs::UpdateFailMalformedHTLCs of arbitrary size.
12965 /// This corresponds to std::vector in C++
12966 pub struct CVec_UpdateFailMalformedHTLCZ {
12967         /// The elements in the array.
12968         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
12969         pub data: *mut crate::lightning::ln::msgs::UpdateFailMalformedHTLC,
12970         /// The number of elements pointed to by `data`.
12971         pub datalen: usize
12972 }
12973 impl CVec_UpdateFailMalformedHTLCZ {
12974         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::UpdateFailMalformedHTLC> {
12975                 if self.datalen == 0 { return Vec::new(); }
12976                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
12977                 self.data = core::ptr::null_mut();
12978                 self.datalen = 0;
12979                 ret
12980         }
12981         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::UpdateFailMalformedHTLC] {
12982                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
12983         }
12984 }
12985 impl From<Vec<crate::lightning::ln::msgs::UpdateFailMalformedHTLC>> for CVec_UpdateFailMalformedHTLCZ {
12986         fn from(v: Vec<crate::lightning::ln::msgs::UpdateFailMalformedHTLC>) -> Self {
12987                 let datalen = v.len();
12988                 let data = Box::into_raw(v.into_boxed_slice());
12989                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
12990         }
12991 }
12992 #[no_mangle]
12993 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
12994 pub extern "C" fn CVec_UpdateFailMalformedHTLCZ_free(_res: CVec_UpdateFailMalformedHTLCZ) { }
12995 impl Drop for CVec_UpdateFailMalformedHTLCZ {
12996         fn drop(&mut self) {
12997                 if self.datalen == 0 { return; }
12998                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
12999         }
13000 }
13001 impl Clone for CVec_UpdateFailMalformedHTLCZ {
13002         fn clone(&self) -> Self {
13003                 let mut res = Vec::new();
13004                 if self.datalen == 0 { return Self::from(res); }
13005                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
13006                 Self::from(res)
13007         }
13008 }
13009 #[repr(C)]
13010 /// The contents of CResult_AcceptChannelDecodeErrorZ
13011 pub union CResult_AcceptChannelDecodeErrorZPtr {
13012         /// A pointer to the contents in the success state.
13013         /// Reading from this pointer when `result_ok` is not set is undefined.
13014         pub result: *mut crate::lightning::ln::msgs::AcceptChannel,
13015         /// A pointer to the contents in the error state.
13016         /// Reading from this pointer when `result_ok` is set is undefined.
13017         pub err: *mut crate::lightning::ln::msgs::DecodeError,
13018 }
13019 #[repr(C)]
13020 /// A CResult_AcceptChannelDecodeErrorZ represents the result of a fallible operation,
13021 /// containing a crate::lightning::ln::msgs::AcceptChannel on success and a crate::lightning::ln::msgs::DecodeError on failure.
13022 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13023 pub struct CResult_AcceptChannelDecodeErrorZ {
13024         /// The contents of this CResult_AcceptChannelDecodeErrorZ, accessible via either
13025         /// `err` or `result` depending on the state of `result_ok`.
13026         pub contents: CResult_AcceptChannelDecodeErrorZPtr,
13027         /// Whether this CResult_AcceptChannelDecodeErrorZ represents a success state.
13028         pub result_ok: bool,
13029 }
13030 #[no_mangle]
13031 /// Creates a new CResult_AcceptChannelDecodeErrorZ in the success state.
13032 pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_ok(o: crate::lightning::ln::msgs::AcceptChannel) -> CResult_AcceptChannelDecodeErrorZ {
13033         CResult_AcceptChannelDecodeErrorZ {
13034                 contents: CResult_AcceptChannelDecodeErrorZPtr {
13035                         result: Box::into_raw(Box::new(o)),
13036                 },
13037                 result_ok: true,
13038         }
13039 }
13040 #[no_mangle]
13041 /// Creates a new CResult_AcceptChannelDecodeErrorZ in the error state.
13042 pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_AcceptChannelDecodeErrorZ {
13043         CResult_AcceptChannelDecodeErrorZ {
13044                 contents: CResult_AcceptChannelDecodeErrorZPtr {
13045                         err: Box::into_raw(Box::new(e)),
13046                 },
13047                 result_ok: false,
13048         }
13049 }
13050 /// Checks if the given object is currently in the success state
13051 #[no_mangle]
13052 pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_is_ok(o: &CResult_AcceptChannelDecodeErrorZ) -> bool {
13053         o.result_ok
13054 }
13055 #[no_mangle]
13056 /// Frees any resources used by the CResult_AcceptChannelDecodeErrorZ.
13057 pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_free(_res: CResult_AcceptChannelDecodeErrorZ) { }
13058 impl Drop for CResult_AcceptChannelDecodeErrorZ {
13059         fn drop(&mut self) {
13060                 if self.result_ok {
13061                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
13062                                 let _ = unsafe { Box::from_raw(self.contents.result) };
13063                         }
13064                 } else {
13065                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
13066                                 let _ = unsafe { Box::from_raw(self.contents.err) };
13067                         }
13068                 }
13069         }
13070 }
13071 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::AcceptChannel, crate::lightning::ln::msgs::DecodeError>> for CResult_AcceptChannelDecodeErrorZ {
13072         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::AcceptChannel, crate::lightning::ln::msgs::DecodeError>) -> Self {
13073                 let contents = if o.result_ok {
13074                         let result = unsafe { o.contents.result };
13075                         unsafe { o.contents.result = core::ptr::null_mut() };
13076                         CResult_AcceptChannelDecodeErrorZPtr { result }
13077                 } else {
13078                         let err = unsafe { o.contents.err };
13079                         unsafe { o.contents.err = core::ptr::null_mut(); }
13080                         CResult_AcceptChannelDecodeErrorZPtr { err }
13081                 };
13082                 Self {
13083                         contents,
13084                         result_ok: o.result_ok,
13085                 }
13086         }
13087 }
13088 impl Clone for CResult_AcceptChannelDecodeErrorZ {
13089         fn clone(&self) -> Self {
13090                 if self.result_ok {
13091                         Self { result_ok: true, contents: CResult_AcceptChannelDecodeErrorZPtr {
13092                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::AcceptChannel>::clone(unsafe { &*self.contents.result })))
13093                         } }
13094                 } else {
13095                         Self { result_ok: false, contents: CResult_AcceptChannelDecodeErrorZPtr {
13096                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13097                         } }
13098                 }
13099         }
13100 }
13101 #[no_mangle]
13102 /// Creates a new CResult_AcceptChannelDecodeErrorZ which has the same data as `orig`
13103 /// but with all dynamically-allocated buffers duplicated in new buffers.
13104 pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_clone(orig: &CResult_AcceptChannelDecodeErrorZ) -> CResult_AcceptChannelDecodeErrorZ { Clone::clone(&orig) }
13105 #[repr(C)]
13106 /// The contents of CResult_AnnouncementSignaturesDecodeErrorZ
13107 pub union CResult_AnnouncementSignaturesDecodeErrorZPtr {
13108         /// A pointer to the contents in the success state.
13109         /// Reading from this pointer when `result_ok` is not set is undefined.
13110         pub result: *mut crate::lightning::ln::msgs::AnnouncementSignatures,
13111         /// A pointer to the contents in the error state.
13112         /// Reading from this pointer when `result_ok` is set is undefined.
13113         pub err: *mut crate::lightning::ln::msgs::DecodeError,
13114 }
13115 #[repr(C)]
13116 /// A CResult_AnnouncementSignaturesDecodeErrorZ represents the result of a fallible operation,
13117 /// containing a crate::lightning::ln::msgs::AnnouncementSignatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
13118 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13119 pub struct CResult_AnnouncementSignaturesDecodeErrorZ {
13120         /// The contents of this CResult_AnnouncementSignaturesDecodeErrorZ, accessible via either
13121         /// `err` or `result` depending on the state of `result_ok`.
13122         pub contents: CResult_AnnouncementSignaturesDecodeErrorZPtr,
13123         /// Whether this CResult_AnnouncementSignaturesDecodeErrorZ represents a success state.
13124         pub result_ok: bool,
13125 }
13126 #[no_mangle]
13127 /// Creates a new CResult_AnnouncementSignaturesDecodeErrorZ in the success state.
13128 pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_ok(o: crate::lightning::ln::msgs::AnnouncementSignatures) -> CResult_AnnouncementSignaturesDecodeErrorZ {
13129         CResult_AnnouncementSignaturesDecodeErrorZ {
13130                 contents: CResult_AnnouncementSignaturesDecodeErrorZPtr {
13131                         result: Box::into_raw(Box::new(o)),
13132                 },
13133                 result_ok: true,
13134         }
13135 }
13136 #[no_mangle]
13137 /// Creates a new CResult_AnnouncementSignaturesDecodeErrorZ in the error state.
13138 pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_AnnouncementSignaturesDecodeErrorZ {
13139         CResult_AnnouncementSignaturesDecodeErrorZ {
13140                 contents: CResult_AnnouncementSignaturesDecodeErrorZPtr {
13141                         err: Box::into_raw(Box::new(e)),
13142                 },
13143                 result_ok: false,
13144         }
13145 }
13146 /// Checks if the given object is currently in the success state
13147 #[no_mangle]
13148 pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_is_ok(o: &CResult_AnnouncementSignaturesDecodeErrorZ) -> bool {
13149         o.result_ok
13150 }
13151 #[no_mangle]
13152 /// Frees any resources used by the CResult_AnnouncementSignaturesDecodeErrorZ.
13153 pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_free(_res: CResult_AnnouncementSignaturesDecodeErrorZ) { }
13154 impl Drop for CResult_AnnouncementSignaturesDecodeErrorZ {
13155         fn drop(&mut self) {
13156                 if self.result_ok {
13157                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
13158                                 let _ = unsafe { Box::from_raw(self.contents.result) };
13159                         }
13160                 } else {
13161                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
13162                                 let _ = unsafe { Box::from_raw(self.contents.err) };
13163                         }
13164                 }
13165         }
13166 }
13167 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::AnnouncementSignatures, crate::lightning::ln::msgs::DecodeError>> for CResult_AnnouncementSignaturesDecodeErrorZ {
13168         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::AnnouncementSignatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
13169                 let contents = if o.result_ok {
13170                         let result = unsafe { o.contents.result };
13171                         unsafe { o.contents.result = core::ptr::null_mut() };
13172                         CResult_AnnouncementSignaturesDecodeErrorZPtr { result }
13173                 } else {
13174                         let err = unsafe { o.contents.err };
13175                         unsafe { o.contents.err = core::ptr::null_mut(); }
13176                         CResult_AnnouncementSignaturesDecodeErrorZPtr { err }
13177                 };
13178                 Self {
13179                         contents,
13180                         result_ok: o.result_ok,
13181                 }
13182         }
13183 }
13184 impl Clone for CResult_AnnouncementSignaturesDecodeErrorZ {
13185         fn clone(&self) -> Self {
13186                 if self.result_ok {
13187                         Self { result_ok: true, contents: CResult_AnnouncementSignaturesDecodeErrorZPtr {
13188                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::AnnouncementSignatures>::clone(unsafe { &*self.contents.result })))
13189                         } }
13190                 } else {
13191                         Self { result_ok: false, contents: CResult_AnnouncementSignaturesDecodeErrorZPtr {
13192                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13193                         } }
13194                 }
13195         }
13196 }
13197 #[no_mangle]
13198 /// Creates a new CResult_AnnouncementSignaturesDecodeErrorZ which has the same data as `orig`
13199 /// but with all dynamically-allocated buffers duplicated in new buffers.
13200 pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_clone(orig: &CResult_AnnouncementSignaturesDecodeErrorZ) -> CResult_AnnouncementSignaturesDecodeErrorZ { Clone::clone(&orig) }
13201 #[repr(C)]
13202 /// The contents of CResult_ChannelReestablishDecodeErrorZ
13203 pub union CResult_ChannelReestablishDecodeErrorZPtr {
13204         /// A pointer to the contents in the success state.
13205         /// Reading from this pointer when `result_ok` is not set is undefined.
13206         pub result: *mut crate::lightning::ln::msgs::ChannelReestablish,
13207         /// A pointer to the contents in the error state.
13208         /// Reading from this pointer when `result_ok` is set is undefined.
13209         pub err: *mut crate::lightning::ln::msgs::DecodeError,
13210 }
13211 #[repr(C)]
13212 /// A CResult_ChannelReestablishDecodeErrorZ represents the result of a fallible operation,
13213 /// containing a crate::lightning::ln::msgs::ChannelReestablish on success and a crate::lightning::ln::msgs::DecodeError on failure.
13214 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13215 pub struct CResult_ChannelReestablishDecodeErrorZ {
13216         /// The contents of this CResult_ChannelReestablishDecodeErrorZ, accessible via either
13217         /// `err` or `result` depending on the state of `result_ok`.
13218         pub contents: CResult_ChannelReestablishDecodeErrorZPtr,
13219         /// Whether this CResult_ChannelReestablishDecodeErrorZ represents a success state.
13220         pub result_ok: bool,
13221 }
13222 #[no_mangle]
13223 /// Creates a new CResult_ChannelReestablishDecodeErrorZ in the success state.
13224 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ChannelReestablish) -> CResult_ChannelReestablishDecodeErrorZ {
13225         CResult_ChannelReestablishDecodeErrorZ {
13226                 contents: CResult_ChannelReestablishDecodeErrorZPtr {
13227                         result: Box::into_raw(Box::new(o)),
13228                 },
13229                 result_ok: true,
13230         }
13231 }
13232 #[no_mangle]
13233 /// Creates a new CResult_ChannelReestablishDecodeErrorZ in the error state.
13234 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelReestablishDecodeErrorZ {
13235         CResult_ChannelReestablishDecodeErrorZ {
13236                 contents: CResult_ChannelReestablishDecodeErrorZPtr {
13237                         err: Box::into_raw(Box::new(e)),
13238                 },
13239                 result_ok: false,
13240         }
13241 }
13242 /// Checks if the given object is currently in the success state
13243 #[no_mangle]
13244 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_is_ok(o: &CResult_ChannelReestablishDecodeErrorZ) -> bool {
13245         o.result_ok
13246 }
13247 #[no_mangle]
13248 /// Frees any resources used by the CResult_ChannelReestablishDecodeErrorZ.
13249 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_free(_res: CResult_ChannelReestablishDecodeErrorZ) { }
13250 impl Drop for CResult_ChannelReestablishDecodeErrorZ {
13251         fn drop(&mut self) {
13252                 if self.result_ok {
13253                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
13254                                 let _ = unsafe { Box::from_raw(self.contents.result) };
13255                         }
13256                 } else {
13257                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
13258                                 let _ = unsafe { Box::from_raw(self.contents.err) };
13259                         }
13260                 }
13261         }
13262 }
13263 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelReestablish, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelReestablishDecodeErrorZ {
13264         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelReestablish, crate::lightning::ln::msgs::DecodeError>) -> Self {
13265                 let contents = if o.result_ok {
13266                         let result = unsafe { o.contents.result };
13267                         unsafe { o.contents.result = core::ptr::null_mut() };
13268                         CResult_ChannelReestablishDecodeErrorZPtr { result }
13269                 } else {
13270                         let err = unsafe { o.contents.err };
13271                         unsafe { o.contents.err = core::ptr::null_mut(); }
13272                         CResult_ChannelReestablishDecodeErrorZPtr { err }
13273                 };
13274                 Self {
13275                         contents,
13276                         result_ok: o.result_ok,
13277                 }
13278         }
13279 }
13280 impl Clone for CResult_ChannelReestablishDecodeErrorZ {
13281         fn clone(&self) -> Self {
13282                 if self.result_ok {
13283                         Self { result_ok: true, contents: CResult_ChannelReestablishDecodeErrorZPtr {
13284                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ChannelReestablish>::clone(unsafe { &*self.contents.result })))
13285                         } }
13286                 } else {
13287                         Self { result_ok: false, contents: CResult_ChannelReestablishDecodeErrorZPtr {
13288                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13289                         } }
13290                 }
13291         }
13292 }
13293 #[no_mangle]
13294 /// Creates a new CResult_ChannelReestablishDecodeErrorZ which has the same data as `orig`
13295 /// but with all dynamically-allocated buffers duplicated in new buffers.
13296 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_clone(orig: &CResult_ChannelReestablishDecodeErrorZ) -> CResult_ChannelReestablishDecodeErrorZ { Clone::clone(&orig) }
13297 #[repr(C)]
13298 /// The contents of CResult_ClosingSignedDecodeErrorZ
13299 pub union CResult_ClosingSignedDecodeErrorZPtr {
13300         /// A pointer to the contents in the success state.
13301         /// Reading from this pointer when `result_ok` is not set is undefined.
13302         pub result: *mut crate::lightning::ln::msgs::ClosingSigned,
13303         /// A pointer to the contents in the error state.
13304         /// Reading from this pointer when `result_ok` is set is undefined.
13305         pub err: *mut crate::lightning::ln::msgs::DecodeError,
13306 }
13307 #[repr(C)]
13308 /// A CResult_ClosingSignedDecodeErrorZ represents the result of a fallible operation,
13309 /// containing a crate::lightning::ln::msgs::ClosingSigned on success and a crate::lightning::ln::msgs::DecodeError on failure.
13310 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13311 pub struct CResult_ClosingSignedDecodeErrorZ {
13312         /// The contents of this CResult_ClosingSignedDecodeErrorZ, accessible via either
13313         /// `err` or `result` depending on the state of `result_ok`.
13314         pub contents: CResult_ClosingSignedDecodeErrorZPtr,
13315         /// Whether this CResult_ClosingSignedDecodeErrorZ represents a success state.
13316         pub result_ok: bool,
13317 }
13318 #[no_mangle]
13319 /// Creates a new CResult_ClosingSignedDecodeErrorZ in the success state.
13320 pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ClosingSigned) -> CResult_ClosingSignedDecodeErrorZ {
13321         CResult_ClosingSignedDecodeErrorZ {
13322                 contents: CResult_ClosingSignedDecodeErrorZPtr {
13323                         result: Box::into_raw(Box::new(o)),
13324                 },
13325                 result_ok: true,
13326         }
13327 }
13328 #[no_mangle]
13329 /// Creates a new CResult_ClosingSignedDecodeErrorZ in the error state.
13330 pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ClosingSignedDecodeErrorZ {
13331         CResult_ClosingSignedDecodeErrorZ {
13332                 contents: CResult_ClosingSignedDecodeErrorZPtr {
13333                         err: Box::into_raw(Box::new(e)),
13334                 },
13335                 result_ok: false,
13336         }
13337 }
13338 /// Checks if the given object is currently in the success state
13339 #[no_mangle]
13340 pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_is_ok(o: &CResult_ClosingSignedDecodeErrorZ) -> bool {
13341         o.result_ok
13342 }
13343 #[no_mangle]
13344 /// Frees any resources used by the CResult_ClosingSignedDecodeErrorZ.
13345 pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_free(_res: CResult_ClosingSignedDecodeErrorZ) { }
13346 impl Drop for CResult_ClosingSignedDecodeErrorZ {
13347         fn drop(&mut self) {
13348                 if self.result_ok {
13349                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
13350                                 let _ = unsafe { Box::from_raw(self.contents.result) };
13351                         }
13352                 } else {
13353                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
13354                                 let _ = unsafe { Box::from_raw(self.contents.err) };
13355                         }
13356                 }
13357         }
13358 }
13359 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ClosingSigned, crate::lightning::ln::msgs::DecodeError>> for CResult_ClosingSignedDecodeErrorZ {
13360         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ClosingSigned, crate::lightning::ln::msgs::DecodeError>) -> Self {
13361                 let contents = if o.result_ok {
13362                         let result = unsafe { o.contents.result };
13363                         unsafe { o.contents.result = core::ptr::null_mut() };
13364                         CResult_ClosingSignedDecodeErrorZPtr { result }
13365                 } else {
13366                         let err = unsafe { o.contents.err };
13367                         unsafe { o.contents.err = core::ptr::null_mut(); }
13368                         CResult_ClosingSignedDecodeErrorZPtr { err }
13369                 };
13370                 Self {
13371                         contents,
13372                         result_ok: o.result_ok,
13373                 }
13374         }
13375 }
13376 impl Clone for CResult_ClosingSignedDecodeErrorZ {
13377         fn clone(&self) -> Self {
13378                 if self.result_ok {
13379                         Self { result_ok: true, contents: CResult_ClosingSignedDecodeErrorZPtr {
13380                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ClosingSigned>::clone(unsafe { &*self.contents.result })))
13381                         } }
13382                 } else {
13383                         Self { result_ok: false, contents: CResult_ClosingSignedDecodeErrorZPtr {
13384                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13385                         } }
13386                 }
13387         }
13388 }
13389 #[no_mangle]
13390 /// Creates a new CResult_ClosingSignedDecodeErrorZ which has the same data as `orig`
13391 /// but with all dynamically-allocated buffers duplicated in new buffers.
13392 pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_clone(orig: &CResult_ClosingSignedDecodeErrorZ) -> CResult_ClosingSignedDecodeErrorZ { Clone::clone(&orig) }
13393 #[repr(C)]
13394 /// The contents of CResult_ClosingSignedFeeRangeDecodeErrorZ
13395 pub union CResult_ClosingSignedFeeRangeDecodeErrorZPtr {
13396         /// A pointer to the contents in the success state.
13397         /// Reading from this pointer when `result_ok` is not set is undefined.
13398         pub result: *mut crate::lightning::ln::msgs::ClosingSignedFeeRange,
13399         /// A pointer to the contents in the error state.
13400         /// Reading from this pointer when `result_ok` is set is undefined.
13401         pub err: *mut crate::lightning::ln::msgs::DecodeError,
13402 }
13403 #[repr(C)]
13404 /// A CResult_ClosingSignedFeeRangeDecodeErrorZ represents the result of a fallible operation,
13405 /// containing a crate::lightning::ln::msgs::ClosingSignedFeeRange on success and a crate::lightning::ln::msgs::DecodeError on failure.
13406 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13407 pub struct CResult_ClosingSignedFeeRangeDecodeErrorZ {
13408         /// The contents of this CResult_ClosingSignedFeeRangeDecodeErrorZ, accessible via either
13409         /// `err` or `result` depending on the state of `result_ok`.
13410         pub contents: CResult_ClosingSignedFeeRangeDecodeErrorZPtr,
13411         /// Whether this CResult_ClosingSignedFeeRangeDecodeErrorZ represents a success state.
13412         pub result_ok: bool,
13413 }
13414 #[no_mangle]
13415 /// Creates a new CResult_ClosingSignedFeeRangeDecodeErrorZ in the success state.
13416 pub extern "C" fn CResult_ClosingSignedFeeRangeDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ClosingSignedFeeRange) -> CResult_ClosingSignedFeeRangeDecodeErrorZ {
13417         CResult_ClosingSignedFeeRangeDecodeErrorZ {
13418                 contents: CResult_ClosingSignedFeeRangeDecodeErrorZPtr {
13419                         result: Box::into_raw(Box::new(o)),
13420                 },
13421                 result_ok: true,
13422         }
13423 }
13424 #[no_mangle]
13425 /// Creates a new CResult_ClosingSignedFeeRangeDecodeErrorZ in the error state.
13426 pub extern "C" fn CResult_ClosingSignedFeeRangeDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ClosingSignedFeeRangeDecodeErrorZ {
13427         CResult_ClosingSignedFeeRangeDecodeErrorZ {
13428                 contents: CResult_ClosingSignedFeeRangeDecodeErrorZPtr {
13429                         err: Box::into_raw(Box::new(e)),
13430                 },
13431                 result_ok: false,
13432         }
13433 }
13434 /// Checks if the given object is currently in the success state
13435 #[no_mangle]
13436 pub extern "C" fn CResult_ClosingSignedFeeRangeDecodeErrorZ_is_ok(o: &CResult_ClosingSignedFeeRangeDecodeErrorZ) -> bool {
13437         o.result_ok
13438 }
13439 #[no_mangle]
13440 /// Frees any resources used by the CResult_ClosingSignedFeeRangeDecodeErrorZ.
13441 pub extern "C" fn CResult_ClosingSignedFeeRangeDecodeErrorZ_free(_res: CResult_ClosingSignedFeeRangeDecodeErrorZ) { }
13442 impl Drop for CResult_ClosingSignedFeeRangeDecodeErrorZ {
13443         fn drop(&mut self) {
13444                 if self.result_ok {
13445                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
13446                                 let _ = unsafe { Box::from_raw(self.contents.result) };
13447                         }
13448                 } else {
13449                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
13450                                 let _ = unsafe { Box::from_raw(self.contents.err) };
13451                         }
13452                 }
13453         }
13454 }
13455 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ClosingSignedFeeRange, crate::lightning::ln::msgs::DecodeError>> for CResult_ClosingSignedFeeRangeDecodeErrorZ {
13456         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ClosingSignedFeeRange, crate::lightning::ln::msgs::DecodeError>) -> Self {
13457                 let contents = if o.result_ok {
13458                         let result = unsafe { o.contents.result };
13459                         unsafe { o.contents.result = core::ptr::null_mut() };
13460                         CResult_ClosingSignedFeeRangeDecodeErrorZPtr { result }
13461                 } else {
13462                         let err = unsafe { o.contents.err };
13463                         unsafe { o.contents.err = core::ptr::null_mut(); }
13464                         CResult_ClosingSignedFeeRangeDecodeErrorZPtr { err }
13465                 };
13466                 Self {
13467                         contents,
13468                         result_ok: o.result_ok,
13469                 }
13470         }
13471 }
13472 impl Clone for CResult_ClosingSignedFeeRangeDecodeErrorZ {
13473         fn clone(&self) -> Self {
13474                 if self.result_ok {
13475                         Self { result_ok: true, contents: CResult_ClosingSignedFeeRangeDecodeErrorZPtr {
13476                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ClosingSignedFeeRange>::clone(unsafe { &*self.contents.result })))
13477                         } }
13478                 } else {
13479                         Self { result_ok: false, contents: CResult_ClosingSignedFeeRangeDecodeErrorZPtr {
13480                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13481                         } }
13482                 }
13483         }
13484 }
13485 #[no_mangle]
13486 /// Creates a new CResult_ClosingSignedFeeRangeDecodeErrorZ which has the same data as `orig`
13487 /// but with all dynamically-allocated buffers duplicated in new buffers.
13488 pub extern "C" fn CResult_ClosingSignedFeeRangeDecodeErrorZ_clone(orig: &CResult_ClosingSignedFeeRangeDecodeErrorZ) -> CResult_ClosingSignedFeeRangeDecodeErrorZ { Clone::clone(&orig) }
13489 #[repr(C)]
13490 /// The contents of CResult_CommitmentSignedDecodeErrorZ
13491 pub union CResult_CommitmentSignedDecodeErrorZPtr {
13492         /// A pointer to the contents in the success state.
13493         /// Reading from this pointer when `result_ok` is not set is undefined.
13494         pub result: *mut crate::lightning::ln::msgs::CommitmentSigned,
13495         /// A pointer to the contents in the error state.
13496         /// Reading from this pointer when `result_ok` is set is undefined.
13497         pub err: *mut crate::lightning::ln::msgs::DecodeError,
13498 }
13499 #[repr(C)]
13500 /// A CResult_CommitmentSignedDecodeErrorZ represents the result of a fallible operation,
13501 /// containing a crate::lightning::ln::msgs::CommitmentSigned on success and a crate::lightning::ln::msgs::DecodeError on failure.
13502 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13503 pub struct CResult_CommitmentSignedDecodeErrorZ {
13504         /// The contents of this CResult_CommitmentSignedDecodeErrorZ, accessible via either
13505         /// `err` or `result` depending on the state of `result_ok`.
13506         pub contents: CResult_CommitmentSignedDecodeErrorZPtr,
13507         /// Whether this CResult_CommitmentSignedDecodeErrorZ represents a success state.
13508         pub result_ok: bool,
13509 }
13510 #[no_mangle]
13511 /// Creates a new CResult_CommitmentSignedDecodeErrorZ in the success state.
13512 pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_ok(o: crate::lightning::ln::msgs::CommitmentSigned) -> CResult_CommitmentSignedDecodeErrorZ {
13513         CResult_CommitmentSignedDecodeErrorZ {
13514                 contents: CResult_CommitmentSignedDecodeErrorZPtr {
13515                         result: Box::into_raw(Box::new(o)),
13516                 },
13517                 result_ok: true,
13518         }
13519 }
13520 #[no_mangle]
13521 /// Creates a new CResult_CommitmentSignedDecodeErrorZ in the error state.
13522 pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_CommitmentSignedDecodeErrorZ {
13523         CResult_CommitmentSignedDecodeErrorZ {
13524                 contents: CResult_CommitmentSignedDecodeErrorZPtr {
13525                         err: Box::into_raw(Box::new(e)),
13526                 },
13527                 result_ok: false,
13528         }
13529 }
13530 /// Checks if the given object is currently in the success state
13531 #[no_mangle]
13532 pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_is_ok(o: &CResult_CommitmentSignedDecodeErrorZ) -> bool {
13533         o.result_ok
13534 }
13535 #[no_mangle]
13536 /// Frees any resources used by the CResult_CommitmentSignedDecodeErrorZ.
13537 pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_free(_res: CResult_CommitmentSignedDecodeErrorZ) { }
13538 impl Drop for CResult_CommitmentSignedDecodeErrorZ {
13539         fn drop(&mut self) {
13540                 if self.result_ok {
13541                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
13542                                 let _ = unsafe { Box::from_raw(self.contents.result) };
13543                         }
13544                 } else {
13545                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
13546                                 let _ = unsafe { Box::from_raw(self.contents.err) };
13547                         }
13548                 }
13549         }
13550 }
13551 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::CommitmentSigned, crate::lightning::ln::msgs::DecodeError>> for CResult_CommitmentSignedDecodeErrorZ {
13552         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::CommitmentSigned, crate::lightning::ln::msgs::DecodeError>) -> Self {
13553                 let contents = if o.result_ok {
13554                         let result = unsafe { o.contents.result };
13555                         unsafe { o.contents.result = core::ptr::null_mut() };
13556                         CResult_CommitmentSignedDecodeErrorZPtr { result }
13557                 } else {
13558                         let err = unsafe { o.contents.err };
13559                         unsafe { o.contents.err = core::ptr::null_mut(); }
13560                         CResult_CommitmentSignedDecodeErrorZPtr { err }
13561                 };
13562                 Self {
13563                         contents,
13564                         result_ok: o.result_ok,
13565                 }
13566         }
13567 }
13568 impl Clone for CResult_CommitmentSignedDecodeErrorZ {
13569         fn clone(&self) -> Self {
13570                 if self.result_ok {
13571                         Self { result_ok: true, contents: CResult_CommitmentSignedDecodeErrorZPtr {
13572                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::CommitmentSigned>::clone(unsafe { &*self.contents.result })))
13573                         } }
13574                 } else {
13575                         Self { result_ok: false, contents: CResult_CommitmentSignedDecodeErrorZPtr {
13576                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13577                         } }
13578                 }
13579         }
13580 }
13581 #[no_mangle]
13582 /// Creates a new CResult_CommitmentSignedDecodeErrorZ which has the same data as `orig`
13583 /// but with all dynamically-allocated buffers duplicated in new buffers.
13584 pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_clone(orig: &CResult_CommitmentSignedDecodeErrorZ) -> CResult_CommitmentSignedDecodeErrorZ { Clone::clone(&orig) }
13585 #[repr(C)]
13586 /// The contents of CResult_FundingCreatedDecodeErrorZ
13587 pub union CResult_FundingCreatedDecodeErrorZPtr {
13588         /// A pointer to the contents in the success state.
13589         /// Reading from this pointer when `result_ok` is not set is undefined.
13590         pub result: *mut crate::lightning::ln::msgs::FundingCreated,
13591         /// A pointer to the contents in the error state.
13592         /// Reading from this pointer when `result_ok` is set is undefined.
13593         pub err: *mut crate::lightning::ln::msgs::DecodeError,
13594 }
13595 #[repr(C)]
13596 /// A CResult_FundingCreatedDecodeErrorZ represents the result of a fallible operation,
13597 /// containing a crate::lightning::ln::msgs::FundingCreated on success and a crate::lightning::ln::msgs::DecodeError on failure.
13598 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13599 pub struct CResult_FundingCreatedDecodeErrorZ {
13600         /// The contents of this CResult_FundingCreatedDecodeErrorZ, accessible via either
13601         /// `err` or `result` depending on the state of `result_ok`.
13602         pub contents: CResult_FundingCreatedDecodeErrorZPtr,
13603         /// Whether this CResult_FundingCreatedDecodeErrorZ represents a success state.
13604         pub result_ok: bool,
13605 }
13606 #[no_mangle]
13607 /// Creates a new CResult_FundingCreatedDecodeErrorZ in the success state.
13608 pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_ok(o: crate::lightning::ln::msgs::FundingCreated) -> CResult_FundingCreatedDecodeErrorZ {
13609         CResult_FundingCreatedDecodeErrorZ {
13610                 contents: CResult_FundingCreatedDecodeErrorZPtr {
13611                         result: Box::into_raw(Box::new(o)),
13612                 },
13613                 result_ok: true,
13614         }
13615 }
13616 #[no_mangle]
13617 /// Creates a new CResult_FundingCreatedDecodeErrorZ in the error state.
13618 pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_FundingCreatedDecodeErrorZ {
13619         CResult_FundingCreatedDecodeErrorZ {
13620                 contents: CResult_FundingCreatedDecodeErrorZPtr {
13621                         err: Box::into_raw(Box::new(e)),
13622                 },
13623                 result_ok: false,
13624         }
13625 }
13626 /// Checks if the given object is currently in the success state
13627 #[no_mangle]
13628 pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_is_ok(o: &CResult_FundingCreatedDecodeErrorZ) -> bool {
13629         o.result_ok
13630 }
13631 #[no_mangle]
13632 /// Frees any resources used by the CResult_FundingCreatedDecodeErrorZ.
13633 pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_free(_res: CResult_FundingCreatedDecodeErrorZ) { }
13634 impl Drop for CResult_FundingCreatedDecodeErrorZ {
13635         fn drop(&mut self) {
13636                 if self.result_ok {
13637                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
13638                                 let _ = unsafe { Box::from_raw(self.contents.result) };
13639                         }
13640                 } else {
13641                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
13642                                 let _ = unsafe { Box::from_raw(self.contents.err) };
13643                         }
13644                 }
13645         }
13646 }
13647 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::FundingCreated, crate::lightning::ln::msgs::DecodeError>> for CResult_FundingCreatedDecodeErrorZ {
13648         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::FundingCreated, crate::lightning::ln::msgs::DecodeError>) -> Self {
13649                 let contents = if o.result_ok {
13650                         let result = unsafe { o.contents.result };
13651                         unsafe { o.contents.result = core::ptr::null_mut() };
13652                         CResult_FundingCreatedDecodeErrorZPtr { result }
13653                 } else {
13654                         let err = unsafe { o.contents.err };
13655                         unsafe { o.contents.err = core::ptr::null_mut(); }
13656                         CResult_FundingCreatedDecodeErrorZPtr { err }
13657                 };
13658                 Self {
13659                         contents,
13660                         result_ok: o.result_ok,
13661                 }
13662         }
13663 }
13664 impl Clone for CResult_FundingCreatedDecodeErrorZ {
13665         fn clone(&self) -> Self {
13666                 if self.result_ok {
13667                         Self { result_ok: true, contents: CResult_FundingCreatedDecodeErrorZPtr {
13668                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::FundingCreated>::clone(unsafe { &*self.contents.result })))
13669                         } }
13670                 } else {
13671                         Self { result_ok: false, contents: CResult_FundingCreatedDecodeErrorZPtr {
13672                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13673                         } }
13674                 }
13675         }
13676 }
13677 #[no_mangle]
13678 /// Creates a new CResult_FundingCreatedDecodeErrorZ which has the same data as `orig`
13679 /// but with all dynamically-allocated buffers duplicated in new buffers.
13680 pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_clone(orig: &CResult_FundingCreatedDecodeErrorZ) -> CResult_FundingCreatedDecodeErrorZ { Clone::clone(&orig) }
13681 #[repr(C)]
13682 /// The contents of CResult_FundingSignedDecodeErrorZ
13683 pub union CResult_FundingSignedDecodeErrorZPtr {
13684         /// A pointer to the contents in the success state.
13685         /// Reading from this pointer when `result_ok` is not set is undefined.
13686         pub result: *mut crate::lightning::ln::msgs::FundingSigned,
13687         /// A pointer to the contents in the error state.
13688         /// Reading from this pointer when `result_ok` is set is undefined.
13689         pub err: *mut crate::lightning::ln::msgs::DecodeError,
13690 }
13691 #[repr(C)]
13692 /// A CResult_FundingSignedDecodeErrorZ represents the result of a fallible operation,
13693 /// containing a crate::lightning::ln::msgs::FundingSigned on success and a crate::lightning::ln::msgs::DecodeError on failure.
13694 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13695 pub struct CResult_FundingSignedDecodeErrorZ {
13696         /// The contents of this CResult_FundingSignedDecodeErrorZ, accessible via either
13697         /// `err` or `result` depending on the state of `result_ok`.
13698         pub contents: CResult_FundingSignedDecodeErrorZPtr,
13699         /// Whether this CResult_FundingSignedDecodeErrorZ represents a success state.
13700         pub result_ok: bool,
13701 }
13702 #[no_mangle]
13703 /// Creates a new CResult_FundingSignedDecodeErrorZ in the success state.
13704 pub extern "C" fn CResult_FundingSignedDecodeErrorZ_ok(o: crate::lightning::ln::msgs::FundingSigned) -> CResult_FundingSignedDecodeErrorZ {
13705         CResult_FundingSignedDecodeErrorZ {
13706                 contents: CResult_FundingSignedDecodeErrorZPtr {
13707                         result: Box::into_raw(Box::new(o)),
13708                 },
13709                 result_ok: true,
13710         }
13711 }
13712 #[no_mangle]
13713 /// Creates a new CResult_FundingSignedDecodeErrorZ in the error state.
13714 pub extern "C" fn CResult_FundingSignedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_FundingSignedDecodeErrorZ {
13715         CResult_FundingSignedDecodeErrorZ {
13716                 contents: CResult_FundingSignedDecodeErrorZPtr {
13717                         err: Box::into_raw(Box::new(e)),
13718                 },
13719                 result_ok: false,
13720         }
13721 }
13722 /// Checks if the given object is currently in the success state
13723 #[no_mangle]
13724 pub extern "C" fn CResult_FundingSignedDecodeErrorZ_is_ok(o: &CResult_FundingSignedDecodeErrorZ) -> bool {
13725         o.result_ok
13726 }
13727 #[no_mangle]
13728 /// Frees any resources used by the CResult_FundingSignedDecodeErrorZ.
13729 pub extern "C" fn CResult_FundingSignedDecodeErrorZ_free(_res: CResult_FundingSignedDecodeErrorZ) { }
13730 impl Drop for CResult_FundingSignedDecodeErrorZ {
13731         fn drop(&mut self) {
13732                 if self.result_ok {
13733                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
13734                                 let _ = unsafe { Box::from_raw(self.contents.result) };
13735                         }
13736                 } else {
13737                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
13738                                 let _ = unsafe { Box::from_raw(self.contents.err) };
13739                         }
13740                 }
13741         }
13742 }
13743 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::FundingSigned, crate::lightning::ln::msgs::DecodeError>> for CResult_FundingSignedDecodeErrorZ {
13744         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::FundingSigned, crate::lightning::ln::msgs::DecodeError>) -> Self {
13745                 let contents = if o.result_ok {
13746                         let result = unsafe { o.contents.result };
13747                         unsafe { o.contents.result = core::ptr::null_mut() };
13748                         CResult_FundingSignedDecodeErrorZPtr { result }
13749                 } else {
13750                         let err = unsafe { o.contents.err };
13751                         unsafe { o.contents.err = core::ptr::null_mut(); }
13752                         CResult_FundingSignedDecodeErrorZPtr { err }
13753                 };
13754                 Self {
13755                         contents,
13756                         result_ok: o.result_ok,
13757                 }
13758         }
13759 }
13760 impl Clone for CResult_FundingSignedDecodeErrorZ {
13761         fn clone(&self) -> Self {
13762                 if self.result_ok {
13763                         Self { result_ok: true, contents: CResult_FundingSignedDecodeErrorZPtr {
13764                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::FundingSigned>::clone(unsafe { &*self.contents.result })))
13765                         } }
13766                 } else {
13767                         Self { result_ok: false, contents: CResult_FundingSignedDecodeErrorZPtr {
13768                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13769                         } }
13770                 }
13771         }
13772 }
13773 #[no_mangle]
13774 /// Creates a new CResult_FundingSignedDecodeErrorZ which has the same data as `orig`
13775 /// but with all dynamically-allocated buffers duplicated in new buffers.
13776 pub extern "C" fn CResult_FundingSignedDecodeErrorZ_clone(orig: &CResult_FundingSignedDecodeErrorZ) -> CResult_FundingSignedDecodeErrorZ { Clone::clone(&orig) }
13777 #[repr(C)]
13778 /// The contents of CResult_ChannelReadyDecodeErrorZ
13779 pub union CResult_ChannelReadyDecodeErrorZPtr {
13780         /// A pointer to the contents in the success state.
13781         /// Reading from this pointer when `result_ok` is not set is undefined.
13782         pub result: *mut crate::lightning::ln::msgs::ChannelReady,
13783         /// A pointer to the contents in the error state.
13784         /// Reading from this pointer when `result_ok` is set is undefined.
13785         pub err: *mut crate::lightning::ln::msgs::DecodeError,
13786 }
13787 #[repr(C)]
13788 /// A CResult_ChannelReadyDecodeErrorZ represents the result of a fallible operation,
13789 /// containing a crate::lightning::ln::msgs::ChannelReady on success and a crate::lightning::ln::msgs::DecodeError on failure.
13790 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13791 pub struct CResult_ChannelReadyDecodeErrorZ {
13792         /// The contents of this CResult_ChannelReadyDecodeErrorZ, accessible via either
13793         /// `err` or `result` depending on the state of `result_ok`.
13794         pub contents: CResult_ChannelReadyDecodeErrorZPtr,
13795         /// Whether this CResult_ChannelReadyDecodeErrorZ represents a success state.
13796         pub result_ok: bool,
13797 }
13798 #[no_mangle]
13799 /// Creates a new CResult_ChannelReadyDecodeErrorZ in the success state.
13800 pub extern "C" fn CResult_ChannelReadyDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ChannelReady) -> CResult_ChannelReadyDecodeErrorZ {
13801         CResult_ChannelReadyDecodeErrorZ {
13802                 contents: CResult_ChannelReadyDecodeErrorZPtr {
13803                         result: Box::into_raw(Box::new(o)),
13804                 },
13805                 result_ok: true,
13806         }
13807 }
13808 #[no_mangle]
13809 /// Creates a new CResult_ChannelReadyDecodeErrorZ in the error state.
13810 pub extern "C" fn CResult_ChannelReadyDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelReadyDecodeErrorZ {
13811         CResult_ChannelReadyDecodeErrorZ {
13812                 contents: CResult_ChannelReadyDecodeErrorZPtr {
13813                         err: Box::into_raw(Box::new(e)),
13814                 },
13815                 result_ok: false,
13816         }
13817 }
13818 /// Checks if the given object is currently in the success state
13819 #[no_mangle]
13820 pub extern "C" fn CResult_ChannelReadyDecodeErrorZ_is_ok(o: &CResult_ChannelReadyDecodeErrorZ) -> bool {
13821         o.result_ok
13822 }
13823 #[no_mangle]
13824 /// Frees any resources used by the CResult_ChannelReadyDecodeErrorZ.
13825 pub extern "C" fn CResult_ChannelReadyDecodeErrorZ_free(_res: CResult_ChannelReadyDecodeErrorZ) { }
13826 impl Drop for CResult_ChannelReadyDecodeErrorZ {
13827         fn drop(&mut self) {
13828                 if self.result_ok {
13829                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
13830                                 let _ = unsafe { Box::from_raw(self.contents.result) };
13831                         }
13832                 } else {
13833                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
13834                                 let _ = unsafe { Box::from_raw(self.contents.err) };
13835                         }
13836                 }
13837         }
13838 }
13839 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelReady, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelReadyDecodeErrorZ {
13840         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelReady, crate::lightning::ln::msgs::DecodeError>) -> Self {
13841                 let contents = if o.result_ok {
13842                         let result = unsafe { o.contents.result };
13843                         unsafe { o.contents.result = core::ptr::null_mut() };
13844                         CResult_ChannelReadyDecodeErrorZPtr { result }
13845                 } else {
13846                         let err = unsafe { o.contents.err };
13847                         unsafe { o.contents.err = core::ptr::null_mut(); }
13848                         CResult_ChannelReadyDecodeErrorZPtr { err }
13849                 };
13850                 Self {
13851                         contents,
13852                         result_ok: o.result_ok,
13853                 }
13854         }
13855 }
13856 impl Clone for CResult_ChannelReadyDecodeErrorZ {
13857         fn clone(&self) -> Self {
13858                 if self.result_ok {
13859                         Self { result_ok: true, contents: CResult_ChannelReadyDecodeErrorZPtr {
13860                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ChannelReady>::clone(unsafe { &*self.contents.result })))
13861                         } }
13862                 } else {
13863                         Self { result_ok: false, contents: CResult_ChannelReadyDecodeErrorZPtr {
13864                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13865                         } }
13866                 }
13867         }
13868 }
13869 #[no_mangle]
13870 /// Creates a new CResult_ChannelReadyDecodeErrorZ which has the same data as `orig`
13871 /// but with all dynamically-allocated buffers duplicated in new buffers.
13872 pub extern "C" fn CResult_ChannelReadyDecodeErrorZ_clone(orig: &CResult_ChannelReadyDecodeErrorZ) -> CResult_ChannelReadyDecodeErrorZ { Clone::clone(&orig) }
13873 #[repr(C)]
13874 /// The contents of CResult_InitDecodeErrorZ
13875 pub union CResult_InitDecodeErrorZPtr {
13876         /// A pointer to the contents in the success state.
13877         /// Reading from this pointer when `result_ok` is not set is undefined.
13878         pub result: *mut crate::lightning::ln::msgs::Init,
13879         /// A pointer to the contents in the error state.
13880         /// Reading from this pointer when `result_ok` is set is undefined.
13881         pub err: *mut crate::lightning::ln::msgs::DecodeError,
13882 }
13883 #[repr(C)]
13884 /// A CResult_InitDecodeErrorZ represents the result of a fallible operation,
13885 /// containing a crate::lightning::ln::msgs::Init on success and a crate::lightning::ln::msgs::DecodeError on failure.
13886 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13887 pub struct CResult_InitDecodeErrorZ {
13888         /// The contents of this CResult_InitDecodeErrorZ, accessible via either
13889         /// `err` or `result` depending on the state of `result_ok`.
13890         pub contents: CResult_InitDecodeErrorZPtr,
13891         /// Whether this CResult_InitDecodeErrorZ represents a success state.
13892         pub result_ok: bool,
13893 }
13894 #[no_mangle]
13895 /// Creates a new CResult_InitDecodeErrorZ in the success state.
13896 pub extern "C" fn CResult_InitDecodeErrorZ_ok(o: crate::lightning::ln::msgs::Init) -> CResult_InitDecodeErrorZ {
13897         CResult_InitDecodeErrorZ {
13898                 contents: CResult_InitDecodeErrorZPtr {
13899                         result: Box::into_raw(Box::new(o)),
13900                 },
13901                 result_ok: true,
13902         }
13903 }
13904 #[no_mangle]
13905 /// Creates a new CResult_InitDecodeErrorZ in the error state.
13906 pub extern "C" fn CResult_InitDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_InitDecodeErrorZ {
13907         CResult_InitDecodeErrorZ {
13908                 contents: CResult_InitDecodeErrorZPtr {
13909                         err: Box::into_raw(Box::new(e)),
13910                 },
13911                 result_ok: false,
13912         }
13913 }
13914 /// Checks if the given object is currently in the success state
13915 #[no_mangle]
13916 pub extern "C" fn CResult_InitDecodeErrorZ_is_ok(o: &CResult_InitDecodeErrorZ) -> bool {
13917         o.result_ok
13918 }
13919 #[no_mangle]
13920 /// Frees any resources used by the CResult_InitDecodeErrorZ.
13921 pub extern "C" fn CResult_InitDecodeErrorZ_free(_res: CResult_InitDecodeErrorZ) { }
13922 impl Drop for CResult_InitDecodeErrorZ {
13923         fn drop(&mut self) {
13924                 if self.result_ok {
13925                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
13926                                 let _ = unsafe { Box::from_raw(self.contents.result) };
13927                         }
13928                 } else {
13929                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
13930                                 let _ = unsafe { Box::from_raw(self.contents.err) };
13931                         }
13932                 }
13933         }
13934 }
13935 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::Init, crate::lightning::ln::msgs::DecodeError>> for CResult_InitDecodeErrorZ {
13936         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::Init, crate::lightning::ln::msgs::DecodeError>) -> Self {
13937                 let contents = if o.result_ok {
13938                         let result = unsafe { o.contents.result };
13939                         unsafe { o.contents.result = core::ptr::null_mut() };
13940                         CResult_InitDecodeErrorZPtr { result }
13941                 } else {
13942                         let err = unsafe { o.contents.err };
13943                         unsafe { o.contents.err = core::ptr::null_mut(); }
13944                         CResult_InitDecodeErrorZPtr { err }
13945                 };
13946                 Self {
13947                         contents,
13948                         result_ok: o.result_ok,
13949                 }
13950         }
13951 }
13952 impl Clone for CResult_InitDecodeErrorZ {
13953         fn clone(&self) -> Self {
13954                 if self.result_ok {
13955                         Self { result_ok: true, contents: CResult_InitDecodeErrorZPtr {
13956                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::Init>::clone(unsafe { &*self.contents.result })))
13957                         } }
13958                 } else {
13959                         Self { result_ok: false, contents: CResult_InitDecodeErrorZPtr {
13960                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13961                         } }
13962                 }
13963         }
13964 }
13965 #[no_mangle]
13966 /// Creates a new CResult_InitDecodeErrorZ which has the same data as `orig`
13967 /// but with all dynamically-allocated buffers duplicated in new buffers.
13968 pub extern "C" fn CResult_InitDecodeErrorZ_clone(orig: &CResult_InitDecodeErrorZ) -> CResult_InitDecodeErrorZ { Clone::clone(&orig) }
13969 #[repr(C)]
13970 /// The contents of CResult_OpenChannelDecodeErrorZ
13971 pub union CResult_OpenChannelDecodeErrorZPtr {
13972         /// A pointer to the contents in the success state.
13973         /// Reading from this pointer when `result_ok` is not set is undefined.
13974         pub result: *mut crate::lightning::ln::msgs::OpenChannel,
13975         /// A pointer to the contents in the error state.
13976         /// Reading from this pointer when `result_ok` is set is undefined.
13977         pub err: *mut crate::lightning::ln::msgs::DecodeError,
13978 }
13979 #[repr(C)]
13980 /// A CResult_OpenChannelDecodeErrorZ represents the result of a fallible operation,
13981 /// containing a crate::lightning::ln::msgs::OpenChannel on success and a crate::lightning::ln::msgs::DecodeError on failure.
13982 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13983 pub struct CResult_OpenChannelDecodeErrorZ {
13984         /// The contents of this CResult_OpenChannelDecodeErrorZ, accessible via either
13985         /// `err` or `result` depending on the state of `result_ok`.
13986         pub contents: CResult_OpenChannelDecodeErrorZPtr,
13987         /// Whether this CResult_OpenChannelDecodeErrorZ represents a success state.
13988         pub result_ok: bool,
13989 }
13990 #[no_mangle]
13991 /// Creates a new CResult_OpenChannelDecodeErrorZ in the success state.
13992 pub extern "C" fn CResult_OpenChannelDecodeErrorZ_ok(o: crate::lightning::ln::msgs::OpenChannel) -> CResult_OpenChannelDecodeErrorZ {
13993         CResult_OpenChannelDecodeErrorZ {
13994                 contents: CResult_OpenChannelDecodeErrorZPtr {
13995                         result: Box::into_raw(Box::new(o)),
13996                 },
13997                 result_ok: true,
13998         }
13999 }
14000 #[no_mangle]
14001 /// Creates a new CResult_OpenChannelDecodeErrorZ in the error state.
14002 pub extern "C" fn CResult_OpenChannelDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_OpenChannelDecodeErrorZ {
14003         CResult_OpenChannelDecodeErrorZ {
14004                 contents: CResult_OpenChannelDecodeErrorZPtr {
14005                         err: Box::into_raw(Box::new(e)),
14006                 },
14007                 result_ok: false,
14008         }
14009 }
14010 /// Checks if the given object is currently in the success state
14011 #[no_mangle]
14012 pub extern "C" fn CResult_OpenChannelDecodeErrorZ_is_ok(o: &CResult_OpenChannelDecodeErrorZ) -> bool {
14013         o.result_ok
14014 }
14015 #[no_mangle]
14016 /// Frees any resources used by the CResult_OpenChannelDecodeErrorZ.
14017 pub extern "C" fn CResult_OpenChannelDecodeErrorZ_free(_res: CResult_OpenChannelDecodeErrorZ) { }
14018 impl Drop for CResult_OpenChannelDecodeErrorZ {
14019         fn drop(&mut self) {
14020                 if self.result_ok {
14021                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
14022                                 let _ = unsafe { Box::from_raw(self.contents.result) };
14023                         }
14024                 } else {
14025                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
14026                                 let _ = unsafe { Box::from_raw(self.contents.err) };
14027                         }
14028                 }
14029         }
14030 }
14031 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::OpenChannel, crate::lightning::ln::msgs::DecodeError>> for CResult_OpenChannelDecodeErrorZ {
14032         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::OpenChannel, crate::lightning::ln::msgs::DecodeError>) -> Self {
14033                 let contents = if o.result_ok {
14034                         let result = unsafe { o.contents.result };
14035                         unsafe { o.contents.result = core::ptr::null_mut() };
14036                         CResult_OpenChannelDecodeErrorZPtr { result }
14037                 } else {
14038                         let err = unsafe { o.contents.err };
14039                         unsafe { o.contents.err = core::ptr::null_mut(); }
14040                         CResult_OpenChannelDecodeErrorZPtr { err }
14041                 };
14042                 Self {
14043                         contents,
14044                         result_ok: o.result_ok,
14045                 }
14046         }
14047 }
14048 impl Clone for CResult_OpenChannelDecodeErrorZ {
14049         fn clone(&self) -> Self {
14050                 if self.result_ok {
14051                         Self { result_ok: true, contents: CResult_OpenChannelDecodeErrorZPtr {
14052                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::OpenChannel>::clone(unsafe { &*self.contents.result })))
14053                         } }
14054                 } else {
14055                         Self { result_ok: false, contents: CResult_OpenChannelDecodeErrorZPtr {
14056                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14057                         } }
14058                 }
14059         }
14060 }
14061 #[no_mangle]
14062 /// Creates a new CResult_OpenChannelDecodeErrorZ which has the same data as `orig`
14063 /// but with all dynamically-allocated buffers duplicated in new buffers.
14064 pub extern "C" fn CResult_OpenChannelDecodeErrorZ_clone(orig: &CResult_OpenChannelDecodeErrorZ) -> CResult_OpenChannelDecodeErrorZ { Clone::clone(&orig) }
14065 #[repr(C)]
14066 /// The contents of CResult_RevokeAndACKDecodeErrorZ
14067 pub union CResult_RevokeAndACKDecodeErrorZPtr {
14068         /// A pointer to the contents in the success state.
14069         /// Reading from this pointer when `result_ok` is not set is undefined.
14070         pub result: *mut crate::lightning::ln::msgs::RevokeAndACK,
14071         /// A pointer to the contents in the error state.
14072         /// Reading from this pointer when `result_ok` is set is undefined.
14073         pub err: *mut crate::lightning::ln::msgs::DecodeError,
14074 }
14075 #[repr(C)]
14076 /// A CResult_RevokeAndACKDecodeErrorZ represents the result of a fallible operation,
14077 /// containing a crate::lightning::ln::msgs::RevokeAndACK on success and a crate::lightning::ln::msgs::DecodeError on failure.
14078 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14079 pub struct CResult_RevokeAndACKDecodeErrorZ {
14080         /// The contents of this CResult_RevokeAndACKDecodeErrorZ, accessible via either
14081         /// `err` or `result` depending on the state of `result_ok`.
14082         pub contents: CResult_RevokeAndACKDecodeErrorZPtr,
14083         /// Whether this CResult_RevokeAndACKDecodeErrorZ represents a success state.
14084         pub result_ok: bool,
14085 }
14086 #[no_mangle]
14087 /// Creates a new CResult_RevokeAndACKDecodeErrorZ in the success state.
14088 pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_ok(o: crate::lightning::ln::msgs::RevokeAndACK) -> CResult_RevokeAndACKDecodeErrorZ {
14089         CResult_RevokeAndACKDecodeErrorZ {
14090                 contents: CResult_RevokeAndACKDecodeErrorZPtr {
14091                         result: Box::into_raw(Box::new(o)),
14092                 },
14093                 result_ok: true,
14094         }
14095 }
14096 #[no_mangle]
14097 /// Creates a new CResult_RevokeAndACKDecodeErrorZ in the error state.
14098 pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RevokeAndACKDecodeErrorZ {
14099         CResult_RevokeAndACKDecodeErrorZ {
14100                 contents: CResult_RevokeAndACKDecodeErrorZPtr {
14101                         err: Box::into_raw(Box::new(e)),
14102                 },
14103                 result_ok: false,
14104         }
14105 }
14106 /// Checks if the given object is currently in the success state
14107 #[no_mangle]
14108 pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_is_ok(o: &CResult_RevokeAndACKDecodeErrorZ) -> bool {
14109         o.result_ok
14110 }
14111 #[no_mangle]
14112 /// Frees any resources used by the CResult_RevokeAndACKDecodeErrorZ.
14113 pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_free(_res: CResult_RevokeAndACKDecodeErrorZ) { }
14114 impl Drop for CResult_RevokeAndACKDecodeErrorZ {
14115         fn drop(&mut self) {
14116                 if self.result_ok {
14117                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
14118                                 let _ = unsafe { Box::from_raw(self.contents.result) };
14119                         }
14120                 } else {
14121                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
14122                                 let _ = unsafe { Box::from_raw(self.contents.err) };
14123                         }
14124                 }
14125         }
14126 }
14127 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::RevokeAndACK, crate::lightning::ln::msgs::DecodeError>> for CResult_RevokeAndACKDecodeErrorZ {
14128         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::RevokeAndACK, crate::lightning::ln::msgs::DecodeError>) -> Self {
14129                 let contents = if o.result_ok {
14130                         let result = unsafe { o.contents.result };
14131                         unsafe { o.contents.result = core::ptr::null_mut() };
14132                         CResult_RevokeAndACKDecodeErrorZPtr { result }
14133                 } else {
14134                         let err = unsafe { o.contents.err };
14135                         unsafe { o.contents.err = core::ptr::null_mut(); }
14136                         CResult_RevokeAndACKDecodeErrorZPtr { err }
14137                 };
14138                 Self {
14139                         contents,
14140                         result_ok: o.result_ok,
14141                 }
14142         }
14143 }
14144 impl Clone for CResult_RevokeAndACKDecodeErrorZ {
14145         fn clone(&self) -> Self {
14146                 if self.result_ok {
14147                         Self { result_ok: true, contents: CResult_RevokeAndACKDecodeErrorZPtr {
14148                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::RevokeAndACK>::clone(unsafe { &*self.contents.result })))
14149                         } }
14150                 } else {
14151                         Self { result_ok: false, contents: CResult_RevokeAndACKDecodeErrorZPtr {
14152                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14153                         } }
14154                 }
14155         }
14156 }
14157 #[no_mangle]
14158 /// Creates a new CResult_RevokeAndACKDecodeErrorZ which has the same data as `orig`
14159 /// but with all dynamically-allocated buffers duplicated in new buffers.
14160 pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_clone(orig: &CResult_RevokeAndACKDecodeErrorZ) -> CResult_RevokeAndACKDecodeErrorZ { Clone::clone(&orig) }
14161 #[repr(C)]
14162 /// The contents of CResult_ShutdownDecodeErrorZ
14163 pub union CResult_ShutdownDecodeErrorZPtr {
14164         /// A pointer to the contents in the success state.
14165         /// Reading from this pointer when `result_ok` is not set is undefined.
14166         pub result: *mut crate::lightning::ln::msgs::Shutdown,
14167         /// A pointer to the contents in the error state.
14168         /// Reading from this pointer when `result_ok` is set is undefined.
14169         pub err: *mut crate::lightning::ln::msgs::DecodeError,
14170 }
14171 #[repr(C)]
14172 /// A CResult_ShutdownDecodeErrorZ represents the result of a fallible operation,
14173 /// containing a crate::lightning::ln::msgs::Shutdown on success and a crate::lightning::ln::msgs::DecodeError on failure.
14174 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14175 pub struct CResult_ShutdownDecodeErrorZ {
14176         /// The contents of this CResult_ShutdownDecodeErrorZ, accessible via either
14177         /// `err` or `result` depending on the state of `result_ok`.
14178         pub contents: CResult_ShutdownDecodeErrorZPtr,
14179         /// Whether this CResult_ShutdownDecodeErrorZ represents a success state.
14180         pub result_ok: bool,
14181 }
14182 #[no_mangle]
14183 /// Creates a new CResult_ShutdownDecodeErrorZ in the success state.
14184 pub extern "C" fn CResult_ShutdownDecodeErrorZ_ok(o: crate::lightning::ln::msgs::Shutdown) -> CResult_ShutdownDecodeErrorZ {
14185         CResult_ShutdownDecodeErrorZ {
14186                 contents: CResult_ShutdownDecodeErrorZPtr {
14187                         result: Box::into_raw(Box::new(o)),
14188                 },
14189                 result_ok: true,
14190         }
14191 }
14192 #[no_mangle]
14193 /// Creates a new CResult_ShutdownDecodeErrorZ in the error state.
14194 pub extern "C" fn CResult_ShutdownDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ShutdownDecodeErrorZ {
14195         CResult_ShutdownDecodeErrorZ {
14196                 contents: CResult_ShutdownDecodeErrorZPtr {
14197                         err: Box::into_raw(Box::new(e)),
14198                 },
14199                 result_ok: false,
14200         }
14201 }
14202 /// Checks if the given object is currently in the success state
14203 #[no_mangle]
14204 pub extern "C" fn CResult_ShutdownDecodeErrorZ_is_ok(o: &CResult_ShutdownDecodeErrorZ) -> bool {
14205         o.result_ok
14206 }
14207 #[no_mangle]
14208 /// Frees any resources used by the CResult_ShutdownDecodeErrorZ.
14209 pub extern "C" fn CResult_ShutdownDecodeErrorZ_free(_res: CResult_ShutdownDecodeErrorZ) { }
14210 impl Drop for CResult_ShutdownDecodeErrorZ {
14211         fn drop(&mut self) {
14212                 if self.result_ok {
14213                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
14214                                 let _ = unsafe { Box::from_raw(self.contents.result) };
14215                         }
14216                 } else {
14217                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
14218                                 let _ = unsafe { Box::from_raw(self.contents.err) };
14219                         }
14220                 }
14221         }
14222 }
14223 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::Shutdown, crate::lightning::ln::msgs::DecodeError>> for CResult_ShutdownDecodeErrorZ {
14224         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::Shutdown, crate::lightning::ln::msgs::DecodeError>) -> Self {
14225                 let contents = if o.result_ok {
14226                         let result = unsafe { o.contents.result };
14227                         unsafe { o.contents.result = core::ptr::null_mut() };
14228                         CResult_ShutdownDecodeErrorZPtr { result }
14229                 } else {
14230                         let err = unsafe { o.contents.err };
14231                         unsafe { o.contents.err = core::ptr::null_mut(); }
14232                         CResult_ShutdownDecodeErrorZPtr { err }
14233                 };
14234                 Self {
14235                         contents,
14236                         result_ok: o.result_ok,
14237                 }
14238         }
14239 }
14240 impl Clone for CResult_ShutdownDecodeErrorZ {
14241         fn clone(&self) -> Self {
14242                 if self.result_ok {
14243                         Self { result_ok: true, contents: CResult_ShutdownDecodeErrorZPtr {
14244                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::Shutdown>::clone(unsafe { &*self.contents.result })))
14245                         } }
14246                 } else {
14247                         Self { result_ok: false, contents: CResult_ShutdownDecodeErrorZPtr {
14248                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14249                         } }
14250                 }
14251         }
14252 }
14253 #[no_mangle]
14254 /// Creates a new CResult_ShutdownDecodeErrorZ which has the same data as `orig`
14255 /// but with all dynamically-allocated buffers duplicated in new buffers.
14256 pub extern "C" fn CResult_ShutdownDecodeErrorZ_clone(orig: &CResult_ShutdownDecodeErrorZ) -> CResult_ShutdownDecodeErrorZ { Clone::clone(&orig) }
14257 #[repr(C)]
14258 /// The contents of CResult_UpdateFailHTLCDecodeErrorZ
14259 pub union CResult_UpdateFailHTLCDecodeErrorZPtr {
14260         /// A pointer to the contents in the success state.
14261         /// Reading from this pointer when `result_ok` is not set is undefined.
14262         pub result: *mut crate::lightning::ln::msgs::UpdateFailHTLC,
14263         /// A pointer to the contents in the error state.
14264         /// Reading from this pointer when `result_ok` is set is undefined.
14265         pub err: *mut crate::lightning::ln::msgs::DecodeError,
14266 }
14267 #[repr(C)]
14268 /// A CResult_UpdateFailHTLCDecodeErrorZ represents the result of a fallible operation,
14269 /// containing a crate::lightning::ln::msgs::UpdateFailHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
14270 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14271 pub struct CResult_UpdateFailHTLCDecodeErrorZ {
14272         /// The contents of this CResult_UpdateFailHTLCDecodeErrorZ, accessible via either
14273         /// `err` or `result` depending on the state of `result_ok`.
14274         pub contents: CResult_UpdateFailHTLCDecodeErrorZPtr,
14275         /// Whether this CResult_UpdateFailHTLCDecodeErrorZ represents a success state.
14276         pub result_ok: bool,
14277 }
14278 #[no_mangle]
14279 /// Creates a new CResult_UpdateFailHTLCDecodeErrorZ in the success state.
14280 pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateFailHTLC) -> CResult_UpdateFailHTLCDecodeErrorZ {
14281         CResult_UpdateFailHTLCDecodeErrorZ {
14282                 contents: CResult_UpdateFailHTLCDecodeErrorZPtr {
14283                         result: Box::into_raw(Box::new(o)),
14284                 },
14285                 result_ok: true,
14286         }
14287 }
14288 #[no_mangle]
14289 /// Creates a new CResult_UpdateFailHTLCDecodeErrorZ in the error state.
14290 pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateFailHTLCDecodeErrorZ {
14291         CResult_UpdateFailHTLCDecodeErrorZ {
14292                 contents: CResult_UpdateFailHTLCDecodeErrorZPtr {
14293                         err: Box::into_raw(Box::new(e)),
14294                 },
14295                 result_ok: false,
14296         }
14297 }
14298 /// Checks if the given object is currently in the success state
14299 #[no_mangle]
14300 pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_is_ok(o: &CResult_UpdateFailHTLCDecodeErrorZ) -> bool {
14301         o.result_ok
14302 }
14303 #[no_mangle]
14304 /// Frees any resources used by the CResult_UpdateFailHTLCDecodeErrorZ.
14305 pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_free(_res: CResult_UpdateFailHTLCDecodeErrorZ) { }
14306 impl Drop for CResult_UpdateFailHTLCDecodeErrorZ {
14307         fn drop(&mut self) {
14308                 if self.result_ok {
14309                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
14310                                 let _ = unsafe { Box::from_raw(self.contents.result) };
14311                         }
14312                 } else {
14313                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
14314                                 let _ = unsafe { Box::from_raw(self.contents.err) };
14315                         }
14316                 }
14317         }
14318 }
14319 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFailHTLC, crate::lightning::ln::msgs::DecodeError>> for CResult_UpdateFailHTLCDecodeErrorZ {
14320         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFailHTLC, crate::lightning::ln::msgs::DecodeError>) -> Self {
14321                 let contents = if o.result_ok {
14322                         let result = unsafe { o.contents.result };
14323                         unsafe { o.contents.result = core::ptr::null_mut() };
14324                         CResult_UpdateFailHTLCDecodeErrorZPtr { result }
14325                 } else {
14326                         let err = unsafe { o.contents.err };
14327                         unsafe { o.contents.err = core::ptr::null_mut(); }
14328                         CResult_UpdateFailHTLCDecodeErrorZPtr { err }
14329                 };
14330                 Self {
14331                         contents,
14332                         result_ok: o.result_ok,
14333                 }
14334         }
14335 }
14336 impl Clone for CResult_UpdateFailHTLCDecodeErrorZ {
14337         fn clone(&self) -> Self {
14338                 if self.result_ok {
14339                         Self { result_ok: true, contents: CResult_UpdateFailHTLCDecodeErrorZPtr {
14340                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UpdateFailHTLC>::clone(unsafe { &*self.contents.result })))
14341                         } }
14342                 } else {
14343                         Self { result_ok: false, contents: CResult_UpdateFailHTLCDecodeErrorZPtr {
14344                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14345                         } }
14346                 }
14347         }
14348 }
14349 #[no_mangle]
14350 /// Creates a new CResult_UpdateFailHTLCDecodeErrorZ which has the same data as `orig`
14351 /// but with all dynamically-allocated buffers duplicated in new buffers.
14352 pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_clone(orig: &CResult_UpdateFailHTLCDecodeErrorZ) -> CResult_UpdateFailHTLCDecodeErrorZ { Clone::clone(&orig) }
14353 #[repr(C)]
14354 /// The contents of CResult_UpdateFailMalformedHTLCDecodeErrorZ
14355 pub union CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
14356         /// A pointer to the contents in the success state.
14357         /// Reading from this pointer when `result_ok` is not set is undefined.
14358         pub result: *mut crate::lightning::ln::msgs::UpdateFailMalformedHTLC,
14359         /// A pointer to the contents in the error state.
14360         /// Reading from this pointer when `result_ok` is set is undefined.
14361         pub err: *mut crate::lightning::ln::msgs::DecodeError,
14362 }
14363 #[repr(C)]
14364 /// A CResult_UpdateFailMalformedHTLCDecodeErrorZ represents the result of a fallible operation,
14365 /// containing a crate::lightning::ln::msgs::UpdateFailMalformedHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
14366 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14367 pub struct CResult_UpdateFailMalformedHTLCDecodeErrorZ {
14368         /// The contents of this CResult_UpdateFailMalformedHTLCDecodeErrorZ, accessible via either
14369         /// `err` or `result` depending on the state of `result_ok`.
14370         pub contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr,
14371         /// Whether this CResult_UpdateFailMalformedHTLCDecodeErrorZ represents a success state.
14372         pub result_ok: bool,
14373 }
14374 #[no_mangle]
14375 /// Creates a new CResult_UpdateFailMalformedHTLCDecodeErrorZ in the success state.
14376 pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateFailMalformedHTLC) -> CResult_UpdateFailMalformedHTLCDecodeErrorZ {
14377         CResult_UpdateFailMalformedHTLCDecodeErrorZ {
14378                 contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
14379                         result: Box::into_raw(Box::new(o)),
14380                 },
14381                 result_ok: true,
14382         }
14383 }
14384 #[no_mangle]
14385 /// Creates a new CResult_UpdateFailMalformedHTLCDecodeErrorZ in the error state.
14386 pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateFailMalformedHTLCDecodeErrorZ {
14387         CResult_UpdateFailMalformedHTLCDecodeErrorZ {
14388                 contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
14389                         err: Box::into_raw(Box::new(e)),
14390                 },
14391                 result_ok: false,
14392         }
14393 }
14394 /// Checks if the given object is currently in the success state
14395 #[no_mangle]
14396 pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_is_ok(o: &CResult_UpdateFailMalformedHTLCDecodeErrorZ) -> bool {
14397         o.result_ok
14398 }
14399 #[no_mangle]
14400 /// Frees any resources used by the CResult_UpdateFailMalformedHTLCDecodeErrorZ.
14401 pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_free(_res: CResult_UpdateFailMalformedHTLCDecodeErrorZ) { }
14402 impl Drop for CResult_UpdateFailMalformedHTLCDecodeErrorZ {
14403         fn drop(&mut self) {
14404                 if self.result_ok {
14405                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
14406                                 let _ = unsafe { Box::from_raw(self.contents.result) };
14407                         }
14408                 } else {
14409                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
14410                                 let _ = unsafe { Box::from_raw(self.contents.err) };
14411                         }
14412                 }
14413         }
14414 }
14415 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFailMalformedHTLC, crate::lightning::ln::msgs::DecodeError>> for CResult_UpdateFailMalformedHTLCDecodeErrorZ {
14416         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFailMalformedHTLC, crate::lightning::ln::msgs::DecodeError>) -> Self {
14417                 let contents = if o.result_ok {
14418                         let result = unsafe { o.contents.result };
14419                         unsafe { o.contents.result = core::ptr::null_mut() };
14420                         CResult_UpdateFailMalformedHTLCDecodeErrorZPtr { result }
14421                 } else {
14422                         let err = unsafe { o.contents.err };
14423                         unsafe { o.contents.err = core::ptr::null_mut(); }
14424                         CResult_UpdateFailMalformedHTLCDecodeErrorZPtr { err }
14425                 };
14426                 Self {
14427                         contents,
14428                         result_ok: o.result_ok,
14429                 }
14430         }
14431 }
14432 impl Clone for CResult_UpdateFailMalformedHTLCDecodeErrorZ {
14433         fn clone(&self) -> Self {
14434                 if self.result_ok {
14435                         Self { result_ok: true, contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
14436                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UpdateFailMalformedHTLC>::clone(unsafe { &*self.contents.result })))
14437                         } }
14438                 } else {
14439                         Self { result_ok: false, contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
14440                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14441                         } }
14442                 }
14443         }
14444 }
14445 #[no_mangle]
14446 /// Creates a new CResult_UpdateFailMalformedHTLCDecodeErrorZ which has the same data as `orig`
14447 /// but with all dynamically-allocated buffers duplicated in new buffers.
14448 pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone(orig: &CResult_UpdateFailMalformedHTLCDecodeErrorZ) -> CResult_UpdateFailMalformedHTLCDecodeErrorZ { Clone::clone(&orig) }
14449 #[repr(C)]
14450 /// The contents of CResult_UpdateFeeDecodeErrorZ
14451 pub union CResult_UpdateFeeDecodeErrorZPtr {
14452         /// A pointer to the contents in the success state.
14453         /// Reading from this pointer when `result_ok` is not set is undefined.
14454         pub result: *mut crate::lightning::ln::msgs::UpdateFee,
14455         /// A pointer to the contents in the error state.
14456         /// Reading from this pointer when `result_ok` is set is undefined.
14457         pub err: *mut crate::lightning::ln::msgs::DecodeError,
14458 }
14459 #[repr(C)]
14460 /// A CResult_UpdateFeeDecodeErrorZ represents the result of a fallible operation,
14461 /// containing a crate::lightning::ln::msgs::UpdateFee on success and a crate::lightning::ln::msgs::DecodeError on failure.
14462 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14463 pub struct CResult_UpdateFeeDecodeErrorZ {
14464         /// The contents of this CResult_UpdateFeeDecodeErrorZ, accessible via either
14465         /// `err` or `result` depending on the state of `result_ok`.
14466         pub contents: CResult_UpdateFeeDecodeErrorZPtr,
14467         /// Whether this CResult_UpdateFeeDecodeErrorZ represents a success state.
14468         pub result_ok: bool,
14469 }
14470 #[no_mangle]
14471 /// Creates a new CResult_UpdateFeeDecodeErrorZ in the success state.
14472 pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateFee) -> CResult_UpdateFeeDecodeErrorZ {
14473         CResult_UpdateFeeDecodeErrorZ {
14474                 contents: CResult_UpdateFeeDecodeErrorZPtr {
14475                         result: Box::into_raw(Box::new(o)),
14476                 },
14477                 result_ok: true,
14478         }
14479 }
14480 #[no_mangle]
14481 /// Creates a new CResult_UpdateFeeDecodeErrorZ in the error state.
14482 pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateFeeDecodeErrorZ {
14483         CResult_UpdateFeeDecodeErrorZ {
14484                 contents: CResult_UpdateFeeDecodeErrorZPtr {
14485                         err: Box::into_raw(Box::new(e)),
14486                 },
14487                 result_ok: false,
14488         }
14489 }
14490 /// Checks if the given object is currently in the success state
14491 #[no_mangle]
14492 pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_is_ok(o: &CResult_UpdateFeeDecodeErrorZ) -> bool {
14493         o.result_ok
14494 }
14495 #[no_mangle]
14496 /// Frees any resources used by the CResult_UpdateFeeDecodeErrorZ.
14497 pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_free(_res: CResult_UpdateFeeDecodeErrorZ) { }
14498 impl Drop for CResult_UpdateFeeDecodeErrorZ {
14499         fn drop(&mut self) {
14500                 if self.result_ok {
14501                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
14502                                 let _ = unsafe { Box::from_raw(self.contents.result) };
14503                         }
14504                 } else {
14505                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
14506                                 let _ = unsafe { Box::from_raw(self.contents.err) };
14507                         }
14508                 }
14509         }
14510 }
14511 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFee, crate::lightning::ln::msgs::DecodeError>> for CResult_UpdateFeeDecodeErrorZ {
14512         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFee, crate::lightning::ln::msgs::DecodeError>) -> Self {
14513                 let contents = if o.result_ok {
14514                         let result = unsafe { o.contents.result };
14515                         unsafe { o.contents.result = core::ptr::null_mut() };
14516                         CResult_UpdateFeeDecodeErrorZPtr { result }
14517                 } else {
14518                         let err = unsafe { o.contents.err };
14519                         unsafe { o.contents.err = core::ptr::null_mut(); }
14520                         CResult_UpdateFeeDecodeErrorZPtr { err }
14521                 };
14522                 Self {
14523                         contents,
14524                         result_ok: o.result_ok,
14525                 }
14526         }
14527 }
14528 impl Clone for CResult_UpdateFeeDecodeErrorZ {
14529         fn clone(&self) -> Self {
14530                 if self.result_ok {
14531                         Self { result_ok: true, contents: CResult_UpdateFeeDecodeErrorZPtr {
14532                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UpdateFee>::clone(unsafe { &*self.contents.result })))
14533                         } }
14534                 } else {
14535                         Self { result_ok: false, contents: CResult_UpdateFeeDecodeErrorZPtr {
14536                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14537                         } }
14538                 }
14539         }
14540 }
14541 #[no_mangle]
14542 /// Creates a new CResult_UpdateFeeDecodeErrorZ which has the same data as `orig`
14543 /// but with all dynamically-allocated buffers duplicated in new buffers.
14544 pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_clone(orig: &CResult_UpdateFeeDecodeErrorZ) -> CResult_UpdateFeeDecodeErrorZ { Clone::clone(&orig) }
14545 #[repr(C)]
14546 /// The contents of CResult_UpdateFulfillHTLCDecodeErrorZ
14547 pub union CResult_UpdateFulfillHTLCDecodeErrorZPtr {
14548         /// A pointer to the contents in the success state.
14549         /// Reading from this pointer when `result_ok` is not set is undefined.
14550         pub result: *mut crate::lightning::ln::msgs::UpdateFulfillHTLC,
14551         /// A pointer to the contents in the error state.
14552         /// Reading from this pointer when `result_ok` is set is undefined.
14553         pub err: *mut crate::lightning::ln::msgs::DecodeError,
14554 }
14555 #[repr(C)]
14556 /// A CResult_UpdateFulfillHTLCDecodeErrorZ represents the result of a fallible operation,
14557 /// containing a crate::lightning::ln::msgs::UpdateFulfillHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
14558 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14559 pub struct CResult_UpdateFulfillHTLCDecodeErrorZ {
14560         /// The contents of this CResult_UpdateFulfillHTLCDecodeErrorZ, accessible via either
14561         /// `err` or `result` depending on the state of `result_ok`.
14562         pub contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr,
14563         /// Whether this CResult_UpdateFulfillHTLCDecodeErrorZ represents a success state.
14564         pub result_ok: bool,
14565 }
14566 #[no_mangle]
14567 /// Creates a new CResult_UpdateFulfillHTLCDecodeErrorZ in the success state.
14568 pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateFulfillHTLC) -> CResult_UpdateFulfillHTLCDecodeErrorZ {
14569         CResult_UpdateFulfillHTLCDecodeErrorZ {
14570                 contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr {
14571                         result: Box::into_raw(Box::new(o)),
14572                 },
14573                 result_ok: true,
14574         }
14575 }
14576 #[no_mangle]
14577 /// Creates a new CResult_UpdateFulfillHTLCDecodeErrorZ in the error state.
14578 pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateFulfillHTLCDecodeErrorZ {
14579         CResult_UpdateFulfillHTLCDecodeErrorZ {
14580                 contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr {
14581                         err: Box::into_raw(Box::new(e)),
14582                 },
14583                 result_ok: false,
14584         }
14585 }
14586 /// Checks if the given object is currently in the success state
14587 #[no_mangle]
14588 pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_is_ok(o: &CResult_UpdateFulfillHTLCDecodeErrorZ) -> bool {
14589         o.result_ok
14590 }
14591 #[no_mangle]
14592 /// Frees any resources used by the CResult_UpdateFulfillHTLCDecodeErrorZ.
14593 pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_free(_res: CResult_UpdateFulfillHTLCDecodeErrorZ) { }
14594 impl Drop for CResult_UpdateFulfillHTLCDecodeErrorZ {
14595         fn drop(&mut self) {
14596                 if self.result_ok {
14597                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
14598                                 let _ = unsafe { Box::from_raw(self.contents.result) };
14599                         }
14600                 } else {
14601                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
14602                                 let _ = unsafe { Box::from_raw(self.contents.err) };
14603                         }
14604                 }
14605         }
14606 }
14607 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFulfillHTLC, crate::lightning::ln::msgs::DecodeError>> for CResult_UpdateFulfillHTLCDecodeErrorZ {
14608         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFulfillHTLC, crate::lightning::ln::msgs::DecodeError>) -> Self {
14609                 let contents = if o.result_ok {
14610                         let result = unsafe { o.contents.result };
14611                         unsafe { o.contents.result = core::ptr::null_mut() };
14612                         CResult_UpdateFulfillHTLCDecodeErrorZPtr { result }
14613                 } else {
14614                         let err = unsafe { o.contents.err };
14615                         unsafe { o.contents.err = core::ptr::null_mut(); }
14616                         CResult_UpdateFulfillHTLCDecodeErrorZPtr { err }
14617                 };
14618                 Self {
14619                         contents,
14620                         result_ok: o.result_ok,
14621                 }
14622         }
14623 }
14624 impl Clone for CResult_UpdateFulfillHTLCDecodeErrorZ {
14625         fn clone(&self) -> Self {
14626                 if self.result_ok {
14627                         Self { result_ok: true, contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr {
14628                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UpdateFulfillHTLC>::clone(unsafe { &*self.contents.result })))
14629                         } }
14630                 } else {
14631                         Self { result_ok: false, contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr {
14632                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14633                         } }
14634                 }
14635         }
14636 }
14637 #[no_mangle]
14638 /// Creates a new CResult_UpdateFulfillHTLCDecodeErrorZ which has the same data as `orig`
14639 /// but with all dynamically-allocated buffers duplicated in new buffers.
14640 pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_clone(orig: &CResult_UpdateFulfillHTLCDecodeErrorZ) -> CResult_UpdateFulfillHTLCDecodeErrorZ { Clone::clone(&orig) }
14641 #[repr(C)]
14642 /// The contents of CResult_UpdateAddHTLCDecodeErrorZ
14643 pub union CResult_UpdateAddHTLCDecodeErrorZPtr {
14644         /// A pointer to the contents in the success state.
14645         /// Reading from this pointer when `result_ok` is not set is undefined.
14646         pub result: *mut crate::lightning::ln::msgs::UpdateAddHTLC,
14647         /// A pointer to the contents in the error state.
14648         /// Reading from this pointer when `result_ok` is set is undefined.
14649         pub err: *mut crate::lightning::ln::msgs::DecodeError,
14650 }
14651 #[repr(C)]
14652 /// A CResult_UpdateAddHTLCDecodeErrorZ represents the result of a fallible operation,
14653 /// containing a crate::lightning::ln::msgs::UpdateAddHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
14654 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14655 pub struct CResult_UpdateAddHTLCDecodeErrorZ {
14656         /// The contents of this CResult_UpdateAddHTLCDecodeErrorZ, accessible via either
14657         /// `err` or `result` depending on the state of `result_ok`.
14658         pub contents: CResult_UpdateAddHTLCDecodeErrorZPtr,
14659         /// Whether this CResult_UpdateAddHTLCDecodeErrorZ represents a success state.
14660         pub result_ok: bool,
14661 }
14662 #[no_mangle]
14663 /// Creates a new CResult_UpdateAddHTLCDecodeErrorZ in the success state.
14664 pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateAddHTLC) -> CResult_UpdateAddHTLCDecodeErrorZ {
14665         CResult_UpdateAddHTLCDecodeErrorZ {
14666                 contents: CResult_UpdateAddHTLCDecodeErrorZPtr {
14667                         result: Box::into_raw(Box::new(o)),
14668                 },
14669                 result_ok: true,
14670         }
14671 }
14672 #[no_mangle]
14673 /// Creates a new CResult_UpdateAddHTLCDecodeErrorZ in the error state.
14674 pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateAddHTLCDecodeErrorZ {
14675         CResult_UpdateAddHTLCDecodeErrorZ {
14676                 contents: CResult_UpdateAddHTLCDecodeErrorZPtr {
14677                         err: Box::into_raw(Box::new(e)),
14678                 },
14679                 result_ok: false,
14680         }
14681 }
14682 /// Checks if the given object is currently in the success state
14683 #[no_mangle]
14684 pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_is_ok(o: &CResult_UpdateAddHTLCDecodeErrorZ) -> bool {
14685         o.result_ok
14686 }
14687 #[no_mangle]
14688 /// Frees any resources used by the CResult_UpdateAddHTLCDecodeErrorZ.
14689 pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_free(_res: CResult_UpdateAddHTLCDecodeErrorZ) { }
14690 impl Drop for CResult_UpdateAddHTLCDecodeErrorZ {
14691         fn drop(&mut self) {
14692                 if self.result_ok {
14693                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
14694                                 let _ = unsafe { Box::from_raw(self.contents.result) };
14695                         }
14696                 } else {
14697                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
14698                                 let _ = unsafe { Box::from_raw(self.contents.err) };
14699                         }
14700                 }
14701         }
14702 }
14703 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateAddHTLC, crate::lightning::ln::msgs::DecodeError>> for CResult_UpdateAddHTLCDecodeErrorZ {
14704         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateAddHTLC, crate::lightning::ln::msgs::DecodeError>) -> Self {
14705                 let contents = if o.result_ok {
14706                         let result = unsafe { o.contents.result };
14707                         unsafe { o.contents.result = core::ptr::null_mut() };
14708                         CResult_UpdateAddHTLCDecodeErrorZPtr { result }
14709                 } else {
14710                         let err = unsafe { o.contents.err };
14711                         unsafe { o.contents.err = core::ptr::null_mut(); }
14712                         CResult_UpdateAddHTLCDecodeErrorZPtr { err }
14713                 };
14714                 Self {
14715                         contents,
14716                         result_ok: o.result_ok,
14717                 }
14718         }
14719 }
14720 impl Clone for CResult_UpdateAddHTLCDecodeErrorZ {
14721         fn clone(&self) -> Self {
14722                 if self.result_ok {
14723                         Self { result_ok: true, contents: CResult_UpdateAddHTLCDecodeErrorZPtr {
14724                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UpdateAddHTLC>::clone(unsafe { &*self.contents.result })))
14725                         } }
14726                 } else {
14727                         Self { result_ok: false, contents: CResult_UpdateAddHTLCDecodeErrorZPtr {
14728                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14729                         } }
14730                 }
14731         }
14732 }
14733 #[no_mangle]
14734 /// Creates a new CResult_UpdateAddHTLCDecodeErrorZ which has the same data as `orig`
14735 /// but with all dynamically-allocated buffers duplicated in new buffers.
14736 pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_clone(orig: &CResult_UpdateAddHTLCDecodeErrorZ) -> CResult_UpdateAddHTLCDecodeErrorZ { Clone::clone(&orig) }
14737 #[repr(C)]
14738 /// The contents of CResult_OnionMessageDecodeErrorZ
14739 pub union CResult_OnionMessageDecodeErrorZPtr {
14740         /// A pointer to the contents in the success state.
14741         /// Reading from this pointer when `result_ok` is not set is undefined.
14742         pub result: *mut crate::lightning::ln::msgs::OnionMessage,
14743         /// A pointer to the contents in the error state.
14744         /// Reading from this pointer when `result_ok` is set is undefined.
14745         pub err: *mut crate::lightning::ln::msgs::DecodeError,
14746 }
14747 #[repr(C)]
14748 /// A CResult_OnionMessageDecodeErrorZ represents the result of a fallible operation,
14749 /// containing a crate::lightning::ln::msgs::OnionMessage on success and a crate::lightning::ln::msgs::DecodeError on failure.
14750 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14751 pub struct CResult_OnionMessageDecodeErrorZ {
14752         /// The contents of this CResult_OnionMessageDecodeErrorZ, accessible via either
14753         /// `err` or `result` depending on the state of `result_ok`.
14754         pub contents: CResult_OnionMessageDecodeErrorZPtr,
14755         /// Whether this CResult_OnionMessageDecodeErrorZ represents a success state.
14756         pub result_ok: bool,
14757 }
14758 #[no_mangle]
14759 /// Creates a new CResult_OnionMessageDecodeErrorZ in the success state.
14760 pub extern "C" fn CResult_OnionMessageDecodeErrorZ_ok(o: crate::lightning::ln::msgs::OnionMessage) -> CResult_OnionMessageDecodeErrorZ {
14761         CResult_OnionMessageDecodeErrorZ {
14762                 contents: CResult_OnionMessageDecodeErrorZPtr {
14763                         result: Box::into_raw(Box::new(o)),
14764                 },
14765                 result_ok: true,
14766         }
14767 }
14768 #[no_mangle]
14769 /// Creates a new CResult_OnionMessageDecodeErrorZ in the error state.
14770 pub extern "C" fn CResult_OnionMessageDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_OnionMessageDecodeErrorZ {
14771         CResult_OnionMessageDecodeErrorZ {
14772                 contents: CResult_OnionMessageDecodeErrorZPtr {
14773                         err: Box::into_raw(Box::new(e)),
14774                 },
14775                 result_ok: false,
14776         }
14777 }
14778 /// Checks if the given object is currently in the success state
14779 #[no_mangle]
14780 pub extern "C" fn CResult_OnionMessageDecodeErrorZ_is_ok(o: &CResult_OnionMessageDecodeErrorZ) -> bool {
14781         o.result_ok
14782 }
14783 #[no_mangle]
14784 /// Frees any resources used by the CResult_OnionMessageDecodeErrorZ.
14785 pub extern "C" fn CResult_OnionMessageDecodeErrorZ_free(_res: CResult_OnionMessageDecodeErrorZ) { }
14786 impl Drop for CResult_OnionMessageDecodeErrorZ {
14787         fn drop(&mut self) {
14788                 if self.result_ok {
14789                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
14790                                 let _ = unsafe { Box::from_raw(self.contents.result) };
14791                         }
14792                 } else {
14793                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
14794                                 let _ = unsafe { Box::from_raw(self.contents.err) };
14795                         }
14796                 }
14797         }
14798 }
14799 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::OnionMessage, crate::lightning::ln::msgs::DecodeError>> for CResult_OnionMessageDecodeErrorZ {
14800         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::OnionMessage, crate::lightning::ln::msgs::DecodeError>) -> Self {
14801                 let contents = if o.result_ok {
14802                         let result = unsafe { o.contents.result };
14803                         unsafe { o.contents.result = core::ptr::null_mut() };
14804                         CResult_OnionMessageDecodeErrorZPtr { result }
14805                 } else {
14806                         let err = unsafe { o.contents.err };
14807                         unsafe { o.contents.err = core::ptr::null_mut(); }
14808                         CResult_OnionMessageDecodeErrorZPtr { err }
14809                 };
14810                 Self {
14811                         contents,
14812                         result_ok: o.result_ok,
14813                 }
14814         }
14815 }
14816 impl Clone for CResult_OnionMessageDecodeErrorZ {
14817         fn clone(&self) -> Self {
14818                 if self.result_ok {
14819                         Self { result_ok: true, contents: CResult_OnionMessageDecodeErrorZPtr {
14820                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::OnionMessage>::clone(unsafe { &*self.contents.result })))
14821                         } }
14822                 } else {
14823                         Self { result_ok: false, contents: CResult_OnionMessageDecodeErrorZPtr {
14824                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14825                         } }
14826                 }
14827         }
14828 }
14829 #[no_mangle]
14830 /// Creates a new CResult_OnionMessageDecodeErrorZ which has the same data as `orig`
14831 /// but with all dynamically-allocated buffers duplicated in new buffers.
14832 pub extern "C" fn CResult_OnionMessageDecodeErrorZ_clone(orig: &CResult_OnionMessageDecodeErrorZ) -> CResult_OnionMessageDecodeErrorZ { Clone::clone(&orig) }
14833 #[repr(C)]
14834 /// The contents of CResult_PingDecodeErrorZ
14835 pub union CResult_PingDecodeErrorZPtr {
14836         /// A pointer to the contents in the success state.
14837         /// Reading from this pointer when `result_ok` is not set is undefined.
14838         pub result: *mut crate::lightning::ln::msgs::Ping,
14839         /// A pointer to the contents in the error state.
14840         /// Reading from this pointer when `result_ok` is set is undefined.
14841         pub err: *mut crate::lightning::ln::msgs::DecodeError,
14842 }
14843 #[repr(C)]
14844 /// A CResult_PingDecodeErrorZ represents the result of a fallible operation,
14845 /// containing a crate::lightning::ln::msgs::Ping on success and a crate::lightning::ln::msgs::DecodeError on failure.
14846 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14847 pub struct CResult_PingDecodeErrorZ {
14848         /// The contents of this CResult_PingDecodeErrorZ, accessible via either
14849         /// `err` or `result` depending on the state of `result_ok`.
14850         pub contents: CResult_PingDecodeErrorZPtr,
14851         /// Whether this CResult_PingDecodeErrorZ represents a success state.
14852         pub result_ok: bool,
14853 }
14854 #[no_mangle]
14855 /// Creates a new CResult_PingDecodeErrorZ in the success state.
14856 pub extern "C" fn CResult_PingDecodeErrorZ_ok(o: crate::lightning::ln::msgs::Ping) -> CResult_PingDecodeErrorZ {
14857         CResult_PingDecodeErrorZ {
14858                 contents: CResult_PingDecodeErrorZPtr {
14859                         result: Box::into_raw(Box::new(o)),
14860                 },
14861                 result_ok: true,
14862         }
14863 }
14864 #[no_mangle]
14865 /// Creates a new CResult_PingDecodeErrorZ in the error state.
14866 pub extern "C" fn CResult_PingDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_PingDecodeErrorZ {
14867         CResult_PingDecodeErrorZ {
14868                 contents: CResult_PingDecodeErrorZPtr {
14869                         err: Box::into_raw(Box::new(e)),
14870                 },
14871                 result_ok: false,
14872         }
14873 }
14874 /// Checks if the given object is currently in the success state
14875 #[no_mangle]
14876 pub extern "C" fn CResult_PingDecodeErrorZ_is_ok(o: &CResult_PingDecodeErrorZ) -> bool {
14877         o.result_ok
14878 }
14879 #[no_mangle]
14880 /// Frees any resources used by the CResult_PingDecodeErrorZ.
14881 pub extern "C" fn CResult_PingDecodeErrorZ_free(_res: CResult_PingDecodeErrorZ) { }
14882 impl Drop for CResult_PingDecodeErrorZ {
14883         fn drop(&mut self) {
14884                 if self.result_ok {
14885                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
14886                                 let _ = unsafe { Box::from_raw(self.contents.result) };
14887                         }
14888                 } else {
14889                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
14890                                 let _ = unsafe { Box::from_raw(self.contents.err) };
14891                         }
14892                 }
14893         }
14894 }
14895 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::Ping, crate::lightning::ln::msgs::DecodeError>> for CResult_PingDecodeErrorZ {
14896         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::Ping, crate::lightning::ln::msgs::DecodeError>) -> Self {
14897                 let contents = if o.result_ok {
14898                         let result = unsafe { o.contents.result };
14899                         unsafe { o.contents.result = core::ptr::null_mut() };
14900                         CResult_PingDecodeErrorZPtr { result }
14901                 } else {
14902                         let err = unsafe { o.contents.err };
14903                         unsafe { o.contents.err = core::ptr::null_mut(); }
14904                         CResult_PingDecodeErrorZPtr { err }
14905                 };
14906                 Self {
14907                         contents,
14908                         result_ok: o.result_ok,
14909                 }
14910         }
14911 }
14912 impl Clone for CResult_PingDecodeErrorZ {
14913         fn clone(&self) -> Self {
14914                 if self.result_ok {
14915                         Self { result_ok: true, contents: CResult_PingDecodeErrorZPtr {
14916                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::Ping>::clone(unsafe { &*self.contents.result })))
14917                         } }
14918                 } else {
14919                         Self { result_ok: false, contents: CResult_PingDecodeErrorZPtr {
14920                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14921                         } }
14922                 }
14923         }
14924 }
14925 #[no_mangle]
14926 /// Creates a new CResult_PingDecodeErrorZ which has the same data as `orig`
14927 /// but with all dynamically-allocated buffers duplicated in new buffers.
14928 pub extern "C" fn CResult_PingDecodeErrorZ_clone(orig: &CResult_PingDecodeErrorZ) -> CResult_PingDecodeErrorZ { Clone::clone(&orig) }
14929 #[repr(C)]
14930 /// The contents of CResult_PongDecodeErrorZ
14931 pub union CResult_PongDecodeErrorZPtr {
14932         /// A pointer to the contents in the success state.
14933         /// Reading from this pointer when `result_ok` is not set is undefined.
14934         pub result: *mut crate::lightning::ln::msgs::Pong,
14935         /// A pointer to the contents in the error state.
14936         /// Reading from this pointer when `result_ok` is set is undefined.
14937         pub err: *mut crate::lightning::ln::msgs::DecodeError,
14938 }
14939 #[repr(C)]
14940 /// A CResult_PongDecodeErrorZ represents the result of a fallible operation,
14941 /// containing a crate::lightning::ln::msgs::Pong on success and a crate::lightning::ln::msgs::DecodeError on failure.
14942 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14943 pub struct CResult_PongDecodeErrorZ {
14944         /// The contents of this CResult_PongDecodeErrorZ, accessible via either
14945         /// `err` or `result` depending on the state of `result_ok`.
14946         pub contents: CResult_PongDecodeErrorZPtr,
14947         /// Whether this CResult_PongDecodeErrorZ represents a success state.
14948         pub result_ok: bool,
14949 }
14950 #[no_mangle]
14951 /// Creates a new CResult_PongDecodeErrorZ in the success state.
14952 pub extern "C" fn CResult_PongDecodeErrorZ_ok(o: crate::lightning::ln::msgs::Pong) -> CResult_PongDecodeErrorZ {
14953         CResult_PongDecodeErrorZ {
14954                 contents: CResult_PongDecodeErrorZPtr {
14955                         result: Box::into_raw(Box::new(o)),
14956                 },
14957                 result_ok: true,
14958         }
14959 }
14960 #[no_mangle]
14961 /// Creates a new CResult_PongDecodeErrorZ in the error state.
14962 pub extern "C" fn CResult_PongDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_PongDecodeErrorZ {
14963         CResult_PongDecodeErrorZ {
14964                 contents: CResult_PongDecodeErrorZPtr {
14965                         err: Box::into_raw(Box::new(e)),
14966                 },
14967                 result_ok: false,
14968         }
14969 }
14970 /// Checks if the given object is currently in the success state
14971 #[no_mangle]
14972 pub extern "C" fn CResult_PongDecodeErrorZ_is_ok(o: &CResult_PongDecodeErrorZ) -> bool {
14973         o.result_ok
14974 }
14975 #[no_mangle]
14976 /// Frees any resources used by the CResult_PongDecodeErrorZ.
14977 pub extern "C" fn CResult_PongDecodeErrorZ_free(_res: CResult_PongDecodeErrorZ) { }
14978 impl Drop for CResult_PongDecodeErrorZ {
14979         fn drop(&mut self) {
14980                 if self.result_ok {
14981                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
14982                                 let _ = unsafe { Box::from_raw(self.contents.result) };
14983                         }
14984                 } else {
14985                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
14986                                 let _ = unsafe { Box::from_raw(self.contents.err) };
14987                         }
14988                 }
14989         }
14990 }
14991 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::Pong, crate::lightning::ln::msgs::DecodeError>> for CResult_PongDecodeErrorZ {
14992         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::Pong, crate::lightning::ln::msgs::DecodeError>) -> Self {
14993                 let contents = if o.result_ok {
14994                         let result = unsafe { o.contents.result };
14995                         unsafe { o.contents.result = core::ptr::null_mut() };
14996                         CResult_PongDecodeErrorZPtr { result }
14997                 } else {
14998                         let err = unsafe { o.contents.err };
14999                         unsafe { o.contents.err = core::ptr::null_mut(); }
15000                         CResult_PongDecodeErrorZPtr { err }
15001                 };
15002                 Self {
15003                         contents,
15004                         result_ok: o.result_ok,
15005                 }
15006         }
15007 }
15008 impl Clone for CResult_PongDecodeErrorZ {
15009         fn clone(&self) -> Self {
15010                 if self.result_ok {
15011                         Self { result_ok: true, contents: CResult_PongDecodeErrorZPtr {
15012                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::Pong>::clone(unsafe { &*self.contents.result })))
15013                         } }
15014                 } else {
15015                         Self { result_ok: false, contents: CResult_PongDecodeErrorZPtr {
15016                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
15017                         } }
15018                 }
15019         }
15020 }
15021 #[no_mangle]
15022 /// Creates a new CResult_PongDecodeErrorZ which has the same data as `orig`
15023 /// but with all dynamically-allocated buffers duplicated in new buffers.
15024 pub extern "C" fn CResult_PongDecodeErrorZ_clone(orig: &CResult_PongDecodeErrorZ) -> CResult_PongDecodeErrorZ { Clone::clone(&orig) }
15025 #[repr(C)]
15026 /// The contents of CResult_UnsignedChannelAnnouncementDecodeErrorZ
15027 pub union CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
15028         /// A pointer to the contents in the success state.
15029         /// Reading from this pointer when `result_ok` is not set is undefined.
15030         pub result: *mut crate::lightning::ln::msgs::UnsignedChannelAnnouncement,
15031         /// A pointer to the contents in the error state.
15032         /// Reading from this pointer when `result_ok` is set is undefined.
15033         pub err: *mut crate::lightning::ln::msgs::DecodeError,
15034 }
15035 #[repr(C)]
15036 /// A CResult_UnsignedChannelAnnouncementDecodeErrorZ represents the result of a fallible operation,
15037 /// containing a crate::lightning::ln::msgs::UnsignedChannelAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
15038 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
15039 pub struct CResult_UnsignedChannelAnnouncementDecodeErrorZ {
15040         /// The contents of this CResult_UnsignedChannelAnnouncementDecodeErrorZ, accessible via either
15041         /// `err` or `result` depending on the state of `result_ok`.
15042         pub contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr,
15043         /// Whether this CResult_UnsignedChannelAnnouncementDecodeErrorZ represents a success state.
15044         pub result_ok: bool,
15045 }
15046 #[no_mangle]
15047 /// Creates a new CResult_UnsignedChannelAnnouncementDecodeErrorZ in the success state.
15048 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UnsignedChannelAnnouncement) -> CResult_UnsignedChannelAnnouncementDecodeErrorZ {
15049         CResult_UnsignedChannelAnnouncementDecodeErrorZ {
15050                 contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
15051                         result: Box::into_raw(Box::new(o)),
15052                 },
15053                 result_ok: true,
15054         }
15055 }
15056 #[no_mangle]
15057 /// Creates a new CResult_UnsignedChannelAnnouncementDecodeErrorZ in the error state.
15058 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UnsignedChannelAnnouncementDecodeErrorZ {
15059         CResult_UnsignedChannelAnnouncementDecodeErrorZ {
15060                 contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
15061                         err: Box::into_raw(Box::new(e)),
15062                 },
15063                 result_ok: false,
15064         }
15065 }
15066 /// Checks if the given object is currently in the success state
15067 #[no_mangle]
15068 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_is_ok(o: &CResult_UnsignedChannelAnnouncementDecodeErrorZ) -> bool {
15069         o.result_ok
15070 }
15071 #[no_mangle]
15072 /// Frees any resources used by the CResult_UnsignedChannelAnnouncementDecodeErrorZ.
15073 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_free(_res: CResult_UnsignedChannelAnnouncementDecodeErrorZ) { }
15074 impl Drop for CResult_UnsignedChannelAnnouncementDecodeErrorZ {
15075         fn drop(&mut self) {
15076                 if self.result_ok {
15077                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
15078                                 let _ = unsafe { Box::from_raw(self.contents.result) };
15079                         }
15080                 } else {
15081                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
15082                                 let _ = unsafe { Box::from_raw(self.contents.err) };
15083                         }
15084                 }
15085         }
15086 }
15087 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedChannelAnnouncement, crate::lightning::ln::msgs::DecodeError>> for CResult_UnsignedChannelAnnouncementDecodeErrorZ {
15088         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedChannelAnnouncement, crate::lightning::ln::msgs::DecodeError>) -> Self {
15089                 let contents = if o.result_ok {
15090                         let result = unsafe { o.contents.result };
15091                         unsafe { o.contents.result = core::ptr::null_mut() };
15092                         CResult_UnsignedChannelAnnouncementDecodeErrorZPtr { result }
15093                 } else {
15094                         let err = unsafe { o.contents.err };
15095                         unsafe { o.contents.err = core::ptr::null_mut(); }
15096                         CResult_UnsignedChannelAnnouncementDecodeErrorZPtr { err }
15097                 };
15098                 Self {
15099                         contents,
15100                         result_ok: o.result_ok,
15101                 }
15102         }
15103 }
15104 impl Clone for CResult_UnsignedChannelAnnouncementDecodeErrorZ {
15105         fn clone(&self) -> Self {
15106                 if self.result_ok {
15107                         Self { result_ok: true, contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
15108                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UnsignedChannelAnnouncement>::clone(unsafe { &*self.contents.result })))
15109                         } }
15110                 } else {
15111                         Self { result_ok: false, contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
15112                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
15113                         } }
15114                 }
15115         }
15116 }
15117 #[no_mangle]
15118 /// Creates a new CResult_UnsignedChannelAnnouncementDecodeErrorZ which has the same data as `orig`
15119 /// but with all dynamically-allocated buffers duplicated in new buffers.
15120 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone(orig: &CResult_UnsignedChannelAnnouncementDecodeErrorZ) -> CResult_UnsignedChannelAnnouncementDecodeErrorZ { Clone::clone(&orig) }
15121 #[repr(C)]
15122 /// The contents of CResult_ChannelAnnouncementDecodeErrorZ
15123 pub union CResult_ChannelAnnouncementDecodeErrorZPtr {
15124         /// A pointer to the contents in the success state.
15125         /// Reading from this pointer when `result_ok` is not set is undefined.
15126         pub result: *mut crate::lightning::ln::msgs::ChannelAnnouncement,
15127         /// A pointer to the contents in the error state.
15128         /// Reading from this pointer when `result_ok` is set is undefined.
15129         pub err: *mut crate::lightning::ln::msgs::DecodeError,
15130 }
15131 #[repr(C)]
15132 /// A CResult_ChannelAnnouncementDecodeErrorZ represents the result of a fallible operation,
15133 /// containing a crate::lightning::ln::msgs::ChannelAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
15134 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
15135 pub struct CResult_ChannelAnnouncementDecodeErrorZ {
15136         /// The contents of this CResult_ChannelAnnouncementDecodeErrorZ, accessible via either
15137         /// `err` or `result` depending on the state of `result_ok`.
15138         pub contents: CResult_ChannelAnnouncementDecodeErrorZPtr,
15139         /// Whether this CResult_ChannelAnnouncementDecodeErrorZ represents a success state.
15140         pub result_ok: bool,
15141 }
15142 #[no_mangle]
15143 /// Creates a new CResult_ChannelAnnouncementDecodeErrorZ in the success state.
15144 pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ChannelAnnouncement) -> CResult_ChannelAnnouncementDecodeErrorZ {
15145         CResult_ChannelAnnouncementDecodeErrorZ {
15146                 contents: CResult_ChannelAnnouncementDecodeErrorZPtr {
15147                         result: Box::into_raw(Box::new(o)),
15148                 },
15149                 result_ok: true,
15150         }
15151 }
15152 #[no_mangle]
15153 /// Creates a new CResult_ChannelAnnouncementDecodeErrorZ in the error state.
15154 pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelAnnouncementDecodeErrorZ {
15155         CResult_ChannelAnnouncementDecodeErrorZ {
15156                 contents: CResult_ChannelAnnouncementDecodeErrorZPtr {
15157                         err: Box::into_raw(Box::new(e)),
15158                 },
15159                 result_ok: false,
15160         }
15161 }
15162 /// Checks if the given object is currently in the success state
15163 #[no_mangle]
15164 pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_is_ok(o: &CResult_ChannelAnnouncementDecodeErrorZ) -> bool {
15165         o.result_ok
15166 }
15167 #[no_mangle]
15168 /// Frees any resources used by the CResult_ChannelAnnouncementDecodeErrorZ.
15169 pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_free(_res: CResult_ChannelAnnouncementDecodeErrorZ) { }
15170 impl Drop for CResult_ChannelAnnouncementDecodeErrorZ {
15171         fn drop(&mut self) {
15172                 if self.result_ok {
15173                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
15174                                 let _ = unsafe { Box::from_raw(self.contents.result) };
15175                         }
15176                 } else {
15177                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
15178                                 let _ = unsafe { Box::from_raw(self.contents.err) };
15179                         }
15180                 }
15181         }
15182 }
15183 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelAnnouncement, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelAnnouncementDecodeErrorZ {
15184         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelAnnouncement, crate::lightning::ln::msgs::DecodeError>) -> Self {
15185                 let contents = if o.result_ok {
15186                         let result = unsafe { o.contents.result };
15187                         unsafe { o.contents.result = core::ptr::null_mut() };
15188                         CResult_ChannelAnnouncementDecodeErrorZPtr { result }
15189                 } else {
15190                         let err = unsafe { o.contents.err };
15191                         unsafe { o.contents.err = core::ptr::null_mut(); }
15192                         CResult_ChannelAnnouncementDecodeErrorZPtr { err }
15193                 };
15194                 Self {
15195                         contents,
15196                         result_ok: o.result_ok,
15197                 }
15198         }
15199 }
15200 impl Clone for CResult_ChannelAnnouncementDecodeErrorZ {
15201         fn clone(&self) -> Self {
15202                 if self.result_ok {
15203                         Self { result_ok: true, contents: CResult_ChannelAnnouncementDecodeErrorZPtr {
15204                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ChannelAnnouncement>::clone(unsafe { &*self.contents.result })))
15205                         } }
15206                 } else {
15207                         Self { result_ok: false, contents: CResult_ChannelAnnouncementDecodeErrorZPtr {
15208                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
15209                         } }
15210                 }
15211         }
15212 }
15213 #[no_mangle]
15214 /// Creates a new CResult_ChannelAnnouncementDecodeErrorZ which has the same data as `orig`
15215 /// but with all dynamically-allocated buffers duplicated in new buffers.
15216 pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_clone(orig: &CResult_ChannelAnnouncementDecodeErrorZ) -> CResult_ChannelAnnouncementDecodeErrorZ { Clone::clone(&orig) }
15217 #[repr(C)]
15218 /// The contents of CResult_UnsignedChannelUpdateDecodeErrorZ
15219 pub union CResult_UnsignedChannelUpdateDecodeErrorZPtr {
15220         /// A pointer to the contents in the success state.
15221         /// Reading from this pointer when `result_ok` is not set is undefined.
15222         pub result: *mut crate::lightning::ln::msgs::UnsignedChannelUpdate,
15223         /// A pointer to the contents in the error state.
15224         /// Reading from this pointer when `result_ok` is set is undefined.
15225         pub err: *mut crate::lightning::ln::msgs::DecodeError,
15226 }
15227 #[repr(C)]
15228 /// A CResult_UnsignedChannelUpdateDecodeErrorZ represents the result of a fallible operation,
15229 /// containing a crate::lightning::ln::msgs::UnsignedChannelUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
15230 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
15231 pub struct CResult_UnsignedChannelUpdateDecodeErrorZ {
15232         /// The contents of this CResult_UnsignedChannelUpdateDecodeErrorZ, accessible via either
15233         /// `err` or `result` depending on the state of `result_ok`.
15234         pub contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr,
15235         /// Whether this CResult_UnsignedChannelUpdateDecodeErrorZ represents a success state.
15236         pub result_ok: bool,
15237 }
15238 #[no_mangle]
15239 /// Creates a new CResult_UnsignedChannelUpdateDecodeErrorZ in the success state.
15240 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UnsignedChannelUpdate) -> CResult_UnsignedChannelUpdateDecodeErrorZ {
15241         CResult_UnsignedChannelUpdateDecodeErrorZ {
15242                 contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr {
15243                         result: Box::into_raw(Box::new(o)),
15244                 },
15245                 result_ok: true,
15246         }
15247 }
15248 #[no_mangle]
15249 /// Creates a new CResult_UnsignedChannelUpdateDecodeErrorZ in the error state.
15250 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UnsignedChannelUpdateDecodeErrorZ {
15251         CResult_UnsignedChannelUpdateDecodeErrorZ {
15252                 contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr {
15253                         err: Box::into_raw(Box::new(e)),
15254                 },
15255                 result_ok: false,
15256         }
15257 }
15258 /// Checks if the given object is currently in the success state
15259 #[no_mangle]
15260 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_is_ok(o: &CResult_UnsignedChannelUpdateDecodeErrorZ) -> bool {
15261         o.result_ok
15262 }
15263 #[no_mangle]
15264 /// Frees any resources used by the CResult_UnsignedChannelUpdateDecodeErrorZ.
15265 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_free(_res: CResult_UnsignedChannelUpdateDecodeErrorZ) { }
15266 impl Drop for CResult_UnsignedChannelUpdateDecodeErrorZ {
15267         fn drop(&mut self) {
15268                 if self.result_ok {
15269                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
15270                                 let _ = unsafe { Box::from_raw(self.contents.result) };
15271                         }
15272                 } else {
15273                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
15274                                 let _ = unsafe { Box::from_raw(self.contents.err) };
15275                         }
15276                 }
15277         }
15278 }
15279 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedChannelUpdate, crate::lightning::ln::msgs::DecodeError>> for CResult_UnsignedChannelUpdateDecodeErrorZ {
15280         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedChannelUpdate, crate::lightning::ln::msgs::DecodeError>) -> Self {
15281                 let contents = if o.result_ok {
15282                         let result = unsafe { o.contents.result };
15283                         unsafe { o.contents.result = core::ptr::null_mut() };
15284                         CResult_UnsignedChannelUpdateDecodeErrorZPtr { result }
15285                 } else {
15286                         let err = unsafe { o.contents.err };
15287                         unsafe { o.contents.err = core::ptr::null_mut(); }
15288                         CResult_UnsignedChannelUpdateDecodeErrorZPtr { err }
15289                 };
15290                 Self {
15291                         contents,
15292                         result_ok: o.result_ok,
15293                 }
15294         }
15295 }
15296 impl Clone for CResult_UnsignedChannelUpdateDecodeErrorZ {
15297         fn clone(&self) -> Self {
15298                 if self.result_ok {
15299                         Self { result_ok: true, contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr {
15300                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UnsignedChannelUpdate>::clone(unsafe { &*self.contents.result })))
15301                         } }
15302                 } else {
15303                         Self { result_ok: false, contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr {
15304                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
15305                         } }
15306                 }
15307         }
15308 }
15309 #[no_mangle]
15310 /// Creates a new CResult_UnsignedChannelUpdateDecodeErrorZ which has the same data as `orig`
15311 /// but with all dynamically-allocated buffers duplicated in new buffers.
15312 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_clone(orig: &CResult_UnsignedChannelUpdateDecodeErrorZ) -> CResult_UnsignedChannelUpdateDecodeErrorZ { Clone::clone(&orig) }
15313 #[repr(C)]
15314 /// The contents of CResult_ChannelUpdateDecodeErrorZ
15315 pub union CResult_ChannelUpdateDecodeErrorZPtr {
15316         /// A pointer to the contents in the success state.
15317         /// Reading from this pointer when `result_ok` is not set is undefined.
15318         pub result: *mut crate::lightning::ln::msgs::ChannelUpdate,
15319         /// A pointer to the contents in the error state.
15320         /// Reading from this pointer when `result_ok` is set is undefined.
15321         pub err: *mut crate::lightning::ln::msgs::DecodeError,
15322 }
15323 #[repr(C)]
15324 /// A CResult_ChannelUpdateDecodeErrorZ represents the result of a fallible operation,
15325 /// containing a crate::lightning::ln::msgs::ChannelUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
15326 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
15327 pub struct CResult_ChannelUpdateDecodeErrorZ {
15328         /// The contents of this CResult_ChannelUpdateDecodeErrorZ, accessible via either
15329         /// `err` or `result` depending on the state of `result_ok`.
15330         pub contents: CResult_ChannelUpdateDecodeErrorZPtr,
15331         /// Whether this CResult_ChannelUpdateDecodeErrorZ represents a success state.
15332         pub result_ok: bool,
15333 }
15334 #[no_mangle]
15335 /// Creates a new CResult_ChannelUpdateDecodeErrorZ in the success state.
15336 pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ChannelUpdate) -> CResult_ChannelUpdateDecodeErrorZ {
15337         CResult_ChannelUpdateDecodeErrorZ {
15338                 contents: CResult_ChannelUpdateDecodeErrorZPtr {
15339                         result: Box::into_raw(Box::new(o)),
15340                 },
15341                 result_ok: true,
15342         }
15343 }
15344 #[no_mangle]
15345 /// Creates a new CResult_ChannelUpdateDecodeErrorZ in the error state.
15346 pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelUpdateDecodeErrorZ {
15347         CResult_ChannelUpdateDecodeErrorZ {
15348                 contents: CResult_ChannelUpdateDecodeErrorZPtr {
15349                         err: Box::into_raw(Box::new(e)),
15350                 },
15351                 result_ok: false,
15352         }
15353 }
15354 /// Checks if the given object is currently in the success state
15355 #[no_mangle]
15356 pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_is_ok(o: &CResult_ChannelUpdateDecodeErrorZ) -> bool {
15357         o.result_ok
15358 }
15359 #[no_mangle]
15360 /// Frees any resources used by the CResult_ChannelUpdateDecodeErrorZ.
15361 pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_free(_res: CResult_ChannelUpdateDecodeErrorZ) { }
15362 impl Drop for CResult_ChannelUpdateDecodeErrorZ {
15363         fn drop(&mut self) {
15364                 if self.result_ok {
15365                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
15366                                 let _ = unsafe { Box::from_raw(self.contents.result) };
15367                         }
15368                 } else {
15369                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
15370                                 let _ = unsafe { Box::from_raw(self.contents.err) };
15371                         }
15372                 }
15373         }
15374 }
15375 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelUpdate, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelUpdateDecodeErrorZ {
15376         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelUpdate, crate::lightning::ln::msgs::DecodeError>) -> Self {
15377                 let contents = if o.result_ok {
15378                         let result = unsafe { o.contents.result };
15379                         unsafe { o.contents.result = core::ptr::null_mut() };
15380                         CResult_ChannelUpdateDecodeErrorZPtr { result }
15381                 } else {
15382                         let err = unsafe { o.contents.err };
15383                         unsafe { o.contents.err = core::ptr::null_mut(); }
15384                         CResult_ChannelUpdateDecodeErrorZPtr { err }
15385                 };
15386                 Self {
15387                         contents,
15388                         result_ok: o.result_ok,
15389                 }
15390         }
15391 }
15392 impl Clone for CResult_ChannelUpdateDecodeErrorZ {
15393         fn clone(&self) -> Self {
15394                 if self.result_ok {
15395                         Self { result_ok: true, contents: CResult_ChannelUpdateDecodeErrorZPtr {
15396                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ChannelUpdate>::clone(unsafe { &*self.contents.result })))
15397                         } }
15398                 } else {
15399                         Self { result_ok: false, contents: CResult_ChannelUpdateDecodeErrorZPtr {
15400                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
15401                         } }
15402                 }
15403         }
15404 }
15405 #[no_mangle]
15406 /// Creates a new CResult_ChannelUpdateDecodeErrorZ which has the same data as `orig`
15407 /// but with all dynamically-allocated buffers duplicated in new buffers.
15408 pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_clone(orig: &CResult_ChannelUpdateDecodeErrorZ) -> CResult_ChannelUpdateDecodeErrorZ { Clone::clone(&orig) }
15409 #[repr(C)]
15410 /// The contents of CResult_ErrorMessageDecodeErrorZ
15411 pub union CResult_ErrorMessageDecodeErrorZPtr {
15412         /// A pointer to the contents in the success state.
15413         /// Reading from this pointer when `result_ok` is not set is undefined.
15414         pub result: *mut crate::lightning::ln::msgs::ErrorMessage,
15415         /// A pointer to the contents in the error state.
15416         /// Reading from this pointer when `result_ok` is set is undefined.
15417         pub err: *mut crate::lightning::ln::msgs::DecodeError,
15418 }
15419 #[repr(C)]
15420 /// A CResult_ErrorMessageDecodeErrorZ represents the result of a fallible operation,
15421 /// containing a crate::lightning::ln::msgs::ErrorMessage on success and a crate::lightning::ln::msgs::DecodeError on failure.
15422 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
15423 pub struct CResult_ErrorMessageDecodeErrorZ {
15424         /// The contents of this CResult_ErrorMessageDecodeErrorZ, accessible via either
15425         /// `err` or `result` depending on the state of `result_ok`.
15426         pub contents: CResult_ErrorMessageDecodeErrorZPtr,
15427         /// Whether this CResult_ErrorMessageDecodeErrorZ represents a success state.
15428         pub result_ok: bool,
15429 }
15430 #[no_mangle]
15431 /// Creates a new CResult_ErrorMessageDecodeErrorZ in the success state.
15432 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ErrorMessage) -> CResult_ErrorMessageDecodeErrorZ {
15433         CResult_ErrorMessageDecodeErrorZ {
15434                 contents: CResult_ErrorMessageDecodeErrorZPtr {
15435                         result: Box::into_raw(Box::new(o)),
15436                 },
15437                 result_ok: true,
15438         }
15439 }
15440 #[no_mangle]
15441 /// Creates a new CResult_ErrorMessageDecodeErrorZ in the error state.
15442 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ErrorMessageDecodeErrorZ {
15443         CResult_ErrorMessageDecodeErrorZ {
15444                 contents: CResult_ErrorMessageDecodeErrorZPtr {
15445                         err: Box::into_raw(Box::new(e)),
15446                 },
15447                 result_ok: false,
15448         }
15449 }
15450 /// Checks if the given object is currently in the success state
15451 #[no_mangle]
15452 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_is_ok(o: &CResult_ErrorMessageDecodeErrorZ) -> bool {
15453         o.result_ok
15454 }
15455 #[no_mangle]
15456 /// Frees any resources used by the CResult_ErrorMessageDecodeErrorZ.
15457 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_free(_res: CResult_ErrorMessageDecodeErrorZ) { }
15458 impl Drop for CResult_ErrorMessageDecodeErrorZ {
15459         fn drop(&mut self) {
15460                 if self.result_ok {
15461                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
15462                                 let _ = unsafe { Box::from_raw(self.contents.result) };
15463                         }
15464                 } else {
15465                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
15466                                 let _ = unsafe { Box::from_raw(self.contents.err) };
15467                         }
15468                 }
15469         }
15470 }
15471 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ErrorMessage, crate::lightning::ln::msgs::DecodeError>> for CResult_ErrorMessageDecodeErrorZ {
15472         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ErrorMessage, crate::lightning::ln::msgs::DecodeError>) -> Self {
15473                 let contents = if o.result_ok {
15474                         let result = unsafe { o.contents.result };
15475                         unsafe { o.contents.result = core::ptr::null_mut() };
15476                         CResult_ErrorMessageDecodeErrorZPtr { result }
15477                 } else {
15478                         let err = unsafe { o.contents.err };
15479                         unsafe { o.contents.err = core::ptr::null_mut(); }
15480                         CResult_ErrorMessageDecodeErrorZPtr { err }
15481                 };
15482                 Self {
15483                         contents,
15484                         result_ok: o.result_ok,
15485                 }
15486         }
15487 }
15488 impl Clone for CResult_ErrorMessageDecodeErrorZ {
15489         fn clone(&self) -> Self {
15490                 if self.result_ok {
15491                         Self { result_ok: true, contents: CResult_ErrorMessageDecodeErrorZPtr {
15492                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ErrorMessage>::clone(unsafe { &*self.contents.result })))
15493                         } }
15494                 } else {
15495                         Self { result_ok: false, contents: CResult_ErrorMessageDecodeErrorZPtr {
15496                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
15497                         } }
15498                 }
15499         }
15500 }
15501 #[no_mangle]
15502 /// Creates a new CResult_ErrorMessageDecodeErrorZ which has the same data as `orig`
15503 /// but with all dynamically-allocated buffers duplicated in new buffers.
15504 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_clone(orig: &CResult_ErrorMessageDecodeErrorZ) -> CResult_ErrorMessageDecodeErrorZ { Clone::clone(&orig) }
15505 #[repr(C)]
15506 /// The contents of CResult_WarningMessageDecodeErrorZ
15507 pub union CResult_WarningMessageDecodeErrorZPtr {
15508         /// A pointer to the contents in the success state.
15509         /// Reading from this pointer when `result_ok` is not set is undefined.
15510         pub result: *mut crate::lightning::ln::msgs::WarningMessage,
15511         /// A pointer to the contents in the error state.
15512         /// Reading from this pointer when `result_ok` is set is undefined.
15513         pub err: *mut crate::lightning::ln::msgs::DecodeError,
15514 }
15515 #[repr(C)]
15516 /// A CResult_WarningMessageDecodeErrorZ represents the result of a fallible operation,
15517 /// containing a crate::lightning::ln::msgs::WarningMessage on success and a crate::lightning::ln::msgs::DecodeError on failure.
15518 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
15519 pub struct CResult_WarningMessageDecodeErrorZ {
15520         /// The contents of this CResult_WarningMessageDecodeErrorZ, accessible via either
15521         /// `err` or `result` depending on the state of `result_ok`.
15522         pub contents: CResult_WarningMessageDecodeErrorZPtr,
15523         /// Whether this CResult_WarningMessageDecodeErrorZ represents a success state.
15524         pub result_ok: bool,
15525 }
15526 #[no_mangle]
15527 /// Creates a new CResult_WarningMessageDecodeErrorZ in the success state.
15528 pub extern "C" fn CResult_WarningMessageDecodeErrorZ_ok(o: crate::lightning::ln::msgs::WarningMessage) -> CResult_WarningMessageDecodeErrorZ {
15529         CResult_WarningMessageDecodeErrorZ {
15530                 contents: CResult_WarningMessageDecodeErrorZPtr {
15531                         result: Box::into_raw(Box::new(o)),
15532                 },
15533                 result_ok: true,
15534         }
15535 }
15536 #[no_mangle]
15537 /// Creates a new CResult_WarningMessageDecodeErrorZ in the error state.
15538 pub extern "C" fn CResult_WarningMessageDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_WarningMessageDecodeErrorZ {
15539         CResult_WarningMessageDecodeErrorZ {
15540                 contents: CResult_WarningMessageDecodeErrorZPtr {
15541                         err: Box::into_raw(Box::new(e)),
15542                 },
15543                 result_ok: false,
15544         }
15545 }
15546 /// Checks if the given object is currently in the success state
15547 #[no_mangle]
15548 pub extern "C" fn CResult_WarningMessageDecodeErrorZ_is_ok(o: &CResult_WarningMessageDecodeErrorZ) -> bool {
15549         o.result_ok
15550 }
15551 #[no_mangle]
15552 /// Frees any resources used by the CResult_WarningMessageDecodeErrorZ.
15553 pub extern "C" fn CResult_WarningMessageDecodeErrorZ_free(_res: CResult_WarningMessageDecodeErrorZ) { }
15554 impl Drop for CResult_WarningMessageDecodeErrorZ {
15555         fn drop(&mut self) {
15556                 if self.result_ok {
15557                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
15558                                 let _ = unsafe { Box::from_raw(self.contents.result) };
15559                         }
15560                 } else {
15561                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
15562                                 let _ = unsafe { Box::from_raw(self.contents.err) };
15563                         }
15564                 }
15565         }
15566 }
15567 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::WarningMessage, crate::lightning::ln::msgs::DecodeError>> for CResult_WarningMessageDecodeErrorZ {
15568         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::WarningMessage, crate::lightning::ln::msgs::DecodeError>) -> Self {
15569                 let contents = if o.result_ok {
15570                         let result = unsafe { o.contents.result };
15571                         unsafe { o.contents.result = core::ptr::null_mut() };
15572                         CResult_WarningMessageDecodeErrorZPtr { result }
15573                 } else {
15574                         let err = unsafe { o.contents.err };
15575                         unsafe { o.contents.err = core::ptr::null_mut(); }
15576                         CResult_WarningMessageDecodeErrorZPtr { err }
15577                 };
15578                 Self {
15579                         contents,
15580                         result_ok: o.result_ok,
15581                 }
15582         }
15583 }
15584 impl Clone for CResult_WarningMessageDecodeErrorZ {
15585         fn clone(&self) -> Self {
15586                 if self.result_ok {
15587                         Self { result_ok: true, contents: CResult_WarningMessageDecodeErrorZPtr {
15588                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::WarningMessage>::clone(unsafe { &*self.contents.result })))
15589                         } }
15590                 } else {
15591                         Self { result_ok: false, contents: CResult_WarningMessageDecodeErrorZPtr {
15592                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
15593                         } }
15594                 }
15595         }
15596 }
15597 #[no_mangle]
15598 /// Creates a new CResult_WarningMessageDecodeErrorZ which has the same data as `orig`
15599 /// but with all dynamically-allocated buffers duplicated in new buffers.
15600 pub extern "C" fn CResult_WarningMessageDecodeErrorZ_clone(orig: &CResult_WarningMessageDecodeErrorZ) -> CResult_WarningMessageDecodeErrorZ { Clone::clone(&orig) }
15601 #[repr(C)]
15602 /// The contents of CResult_UnsignedNodeAnnouncementDecodeErrorZ
15603 pub union CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
15604         /// A pointer to the contents in the success state.
15605         /// Reading from this pointer when `result_ok` is not set is undefined.
15606         pub result: *mut crate::lightning::ln::msgs::UnsignedNodeAnnouncement,
15607         /// A pointer to the contents in the error state.
15608         /// Reading from this pointer when `result_ok` is set is undefined.
15609         pub err: *mut crate::lightning::ln::msgs::DecodeError,
15610 }
15611 #[repr(C)]
15612 /// A CResult_UnsignedNodeAnnouncementDecodeErrorZ represents the result of a fallible operation,
15613 /// containing a crate::lightning::ln::msgs::UnsignedNodeAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
15614 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
15615 pub struct CResult_UnsignedNodeAnnouncementDecodeErrorZ {
15616         /// The contents of this CResult_UnsignedNodeAnnouncementDecodeErrorZ, accessible via either
15617         /// `err` or `result` depending on the state of `result_ok`.
15618         pub contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr,
15619         /// Whether this CResult_UnsignedNodeAnnouncementDecodeErrorZ represents a success state.
15620         pub result_ok: bool,
15621 }
15622 #[no_mangle]
15623 /// Creates a new CResult_UnsignedNodeAnnouncementDecodeErrorZ in the success state.
15624 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UnsignedNodeAnnouncement) -> CResult_UnsignedNodeAnnouncementDecodeErrorZ {
15625         CResult_UnsignedNodeAnnouncementDecodeErrorZ {
15626                 contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
15627                         result: Box::into_raw(Box::new(o)),
15628                 },
15629                 result_ok: true,
15630         }
15631 }
15632 #[no_mangle]
15633 /// Creates a new CResult_UnsignedNodeAnnouncementDecodeErrorZ in the error state.
15634 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UnsignedNodeAnnouncementDecodeErrorZ {
15635         CResult_UnsignedNodeAnnouncementDecodeErrorZ {
15636                 contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
15637                         err: Box::into_raw(Box::new(e)),
15638                 },
15639                 result_ok: false,
15640         }
15641 }
15642 /// Checks if the given object is currently in the success state
15643 #[no_mangle]
15644 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_is_ok(o: &CResult_UnsignedNodeAnnouncementDecodeErrorZ) -> bool {
15645         o.result_ok
15646 }
15647 #[no_mangle]
15648 /// Frees any resources used by the CResult_UnsignedNodeAnnouncementDecodeErrorZ.
15649 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_free(_res: CResult_UnsignedNodeAnnouncementDecodeErrorZ) { }
15650 impl Drop for CResult_UnsignedNodeAnnouncementDecodeErrorZ {
15651         fn drop(&mut self) {
15652                 if self.result_ok {
15653                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
15654                                 let _ = unsafe { Box::from_raw(self.contents.result) };
15655                         }
15656                 } else {
15657                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
15658                                 let _ = unsafe { Box::from_raw(self.contents.err) };
15659                         }
15660                 }
15661         }
15662 }
15663 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedNodeAnnouncement, crate::lightning::ln::msgs::DecodeError>> for CResult_UnsignedNodeAnnouncementDecodeErrorZ {
15664         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedNodeAnnouncement, crate::lightning::ln::msgs::DecodeError>) -> Self {
15665                 let contents = if o.result_ok {
15666                         let result = unsafe { o.contents.result };
15667                         unsafe { o.contents.result = core::ptr::null_mut() };
15668                         CResult_UnsignedNodeAnnouncementDecodeErrorZPtr { result }
15669                 } else {
15670                         let err = unsafe { o.contents.err };
15671                         unsafe { o.contents.err = core::ptr::null_mut(); }
15672                         CResult_UnsignedNodeAnnouncementDecodeErrorZPtr { err }
15673                 };
15674                 Self {
15675                         contents,
15676                         result_ok: o.result_ok,
15677                 }
15678         }
15679 }
15680 impl Clone for CResult_UnsignedNodeAnnouncementDecodeErrorZ {
15681         fn clone(&self) -> Self {
15682                 if self.result_ok {
15683                         Self { result_ok: true, contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
15684                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UnsignedNodeAnnouncement>::clone(unsafe { &*self.contents.result })))
15685                         } }
15686                 } else {
15687                         Self { result_ok: false, contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
15688                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
15689                         } }
15690                 }
15691         }
15692 }
15693 #[no_mangle]
15694 /// Creates a new CResult_UnsignedNodeAnnouncementDecodeErrorZ which has the same data as `orig`
15695 /// but with all dynamically-allocated buffers duplicated in new buffers.
15696 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone(orig: &CResult_UnsignedNodeAnnouncementDecodeErrorZ) -> CResult_UnsignedNodeAnnouncementDecodeErrorZ { Clone::clone(&orig) }
15697 #[repr(C)]
15698 /// The contents of CResult_NodeAnnouncementDecodeErrorZ
15699 pub union CResult_NodeAnnouncementDecodeErrorZPtr {
15700         /// A pointer to the contents in the success state.
15701         /// Reading from this pointer when `result_ok` is not set is undefined.
15702         pub result: *mut crate::lightning::ln::msgs::NodeAnnouncement,
15703         /// A pointer to the contents in the error state.
15704         /// Reading from this pointer when `result_ok` is set is undefined.
15705         pub err: *mut crate::lightning::ln::msgs::DecodeError,
15706 }
15707 #[repr(C)]
15708 /// A CResult_NodeAnnouncementDecodeErrorZ represents the result of a fallible operation,
15709 /// containing a crate::lightning::ln::msgs::NodeAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
15710 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
15711 pub struct CResult_NodeAnnouncementDecodeErrorZ {
15712         /// The contents of this CResult_NodeAnnouncementDecodeErrorZ, accessible via either
15713         /// `err` or `result` depending on the state of `result_ok`.
15714         pub contents: CResult_NodeAnnouncementDecodeErrorZPtr,
15715         /// Whether this CResult_NodeAnnouncementDecodeErrorZ represents a success state.
15716         pub result_ok: bool,
15717 }
15718 #[no_mangle]
15719 /// Creates a new CResult_NodeAnnouncementDecodeErrorZ in the success state.
15720 pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_ok(o: crate::lightning::ln::msgs::NodeAnnouncement) -> CResult_NodeAnnouncementDecodeErrorZ {
15721         CResult_NodeAnnouncementDecodeErrorZ {
15722                 contents: CResult_NodeAnnouncementDecodeErrorZPtr {
15723                         result: Box::into_raw(Box::new(o)),
15724                 },
15725                 result_ok: true,
15726         }
15727 }
15728 #[no_mangle]
15729 /// Creates a new CResult_NodeAnnouncementDecodeErrorZ in the error state.
15730 pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeAnnouncementDecodeErrorZ {
15731         CResult_NodeAnnouncementDecodeErrorZ {
15732                 contents: CResult_NodeAnnouncementDecodeErrorZPtr {
15733                         err: Box::into_raw(Box::new(e)),
15734                 },
15735                 result_ok: false,
15736         }
15737 }
15738 /// Checks if the given object is currently in the success state
15739 #[no_mangle]
15740 pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_is_ok(o: &CResult_NodeAnnouncementDecodeErrorZ) -> bool {
15741         o.result_ok
15742 }
15743 #[no_mangle]
15744 /// Frees any resources used by the CResult_NodeAnnouncementDecodeErrorZ.
15745 pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_free(_res: CResult_NodeAnnouncementDecodeErrorZ) { }
15746 impl Drop for CResult_NodeAnnouncementDecodeErrorZ {
15747         fn drop(&mut self) {
15748                 if self.result_ok {
15749                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
15750                                 let _ = unsafe { Box::from_raw(self.contents.result) };
15751                         }
15752                 } else {
15753                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
15754                                 let _ = unsafe { Box::from_raw(self.contents.err) };
15755                         }
15756                 }
15757         }
15758 }
15759 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::NodeAnnouncement, crate::lightning::ln::msgs::DecodeError>> for CResult_NodeAnnouncementDecodeErrorZ {
15760         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::NodeAnnouncement, crate::lightning::ln::msgs::DecodeError>) -> Self {
15761                 let contents = if o.result_ok {
15762                         let result = unsafe { o.contents.result };
15763                         unsafe { o.contents.result = core::ptr::null_mut() };
15764                         CResult_NodeAnnouncementDecodeErrorZPtr { result }
15765                 } else {
15766                         let err = unsafe { o.contents.err };
15767                         unsafe { o.contents.err = core::ptr::null_mut(); }
15768                         CResult_NodeAnnouncementDecodeErrorZPtr { err }
15769                 };
15770                 Self {
15771                         contents,
15772                         result_ok: o.result_ok,
15773                 }
15774         }
15775 }
15776 impl Clone for CResult_NodeAnnouncementDecodeErrorZ {
15777         fn clone(&self) -> Self {
15778                 if self.result_ok {
15779                         Self { result_ok: true, contents: CResult_NodeAnnouncementDecodeErrorZPtr {
15780                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::NodeAnnouncement>::clone(unsafe { &*self.contents.result })))
15781                         } }
15782                 } else {
15783                         Self { result_ok: false, contents: CResult_NodeAnnouncementDecodeErrorZPtr {
15784                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
15785                         } }
15786                 }
15787         }
15788 }
15789 #[no_mangle]
15790 /// Creates a new CResult_NodeAnnouncementDecodeErrorZ which has the same data as `orig`
15791 /// but with all dynamically-allocated buffers duplicated in new buffers.
15792 pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_clone(orig: &CResult_NodeAnnouncementDecodeErrorZ) -> CResult_NodeAnnouncementDecodeErrorZ { Clone::clone(&orig) }
15793 #[repr(C)]
15794 /// The contents of CResult_QueryShortChannelIdsDecodeErrorZ
15795 pub union CResult_QueryShortChannelIdsDecodeErrorZPtr {
15796         /// A pointer to the contents in the success state.
15797         /// Reading from this pointer when `result_ok` is not set is undefined.
15798         pub result: *mut crate::lightning::ln::msgs::QueryShortChannelIds,
15799         /// A pointer to the contents in the error state.
15800         /// Reading from this pointer when `result_ok` is set is undefined.
15801         pub err: *mut crate::lightning::ln::msgs::DecodeError,
15802 }
15803 #[repr(C)]
15804 /// A CResult_QueryShortChannelIdsDecodeErrorZ represents the result of a fallible operation,
15805 /// containing a crate::lightning::ln::msgs::QueryShortChannelIds on success and a crate::lightning::ln::msgs::DecodeError on failure.
15806 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
15807 pub struct CResult_QueryShortChannelIdsDecodeErrorZ {
15808         /// The contents of this CResult_QueryShortChannelIdsDecodeErrorZ, accessible via either
15809         /// `err` or `result` depending on the state of `result_ok`.
15810         pub contents: CResult_QueryShortChannelIdsDecodeErrorZPtr,
15811         /// Whether this CResult_QueryShortChannelIdsDecodeErrorZ represents a success state.
15812         pub result_ok: bool,
15813 }
15814 #[no_mangle]
15815 /// Creates a new CResult_QueryShortChannelIdsDecodeErrorZ in the success state.
15816 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_ok(o: crate::lightning::ln::msgs::QueryShortChannelIds) -> CResult_QueryShortChannelIdsDecodeErrorZ {
15817         CResult_QueryShortChannelIdsDecodeErrorZ {
15818                 contents: CResult_QueryShortChannelIdsDecodeErrorZPtr {
15819                         result: Box::into_raw(Box::new(o)),
15820                 },
15821                 result_ok: true,
15822         }
15823 }
15824 #[no_mangle]
15825 /// Creates a new CResult_QueryShortChannelIdsDecodeErrorZ in the error state.
15826 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_QueryShortChannelIdsDecodeErrorZ {
15827         CResult_QueryShortChannelIdsDecodeErrorZ {
15828                 contents: CResult_QueryShortChannelIdsDecodeErrorZPtr {
15829                         err: Box::into_raw(Box::new(e)),
15830                 },
15831                 result_ok: false,
15832         }
15833 }
15834 /// Checks if the given object is currently in the success state
15835 #[no_mangle]
15836 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_is_ok(o: &CResult_QueryShortChannelIdsDecodeErrorZ) -> bool {
15837         o.result_ok
15838 }
15839 #[no_mangle]
15840 /// Frees any resources used by the CResult_QueryShortChannelIdsDecodeErrorZ.
15841 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_free(_res: CResult_QueryShortChannelIdsDecodeErrorZ) { }
15842 impl Drop for CResult_QueryShortChannelIdsDecodeErrorZ {
15843         fn drop(&mut self) {
15844                 if self.result_ok {
15845                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
15846                                 let _ = unsafe { Box::from_raw(self.contents.result) };
15847                         }
15848                 } else {
15849                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
15850                                 let _ = unsafe { Box::from_raw(self.contents.err) };
15851                         }
15852                 }
15853         }
15854 }
15855 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::QueryShortChannelIds, crate::lightning::ln::msgs::DecodeError>> for CResult_QueryShortChannelIdsDecodeErrorZ {
15856         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::QueryShortChannelIds, crate::lightning::ln::msgs::DecodeError>) -> Self {
15857                 let contents = if o.result_ok {
15858                         let result = unsafe { o.contents.result };
15859                         unsafe { o.contents.result = core::ptr::null_mut() };
15860                         CResult_QueryShortChannelIdsDecodeErrorZPtr { result }
15861                 } else {
15862                         let err = unsafe { o.contents.err };
15863                         unsafe { o.contents.err = core::ptr::null_mut(); }
15864                         CResult_QueryShortChannelIdsDecodeErrorZPtr { err }
15865                 };
15866                 Self {
15867                         contents,
15868                         result_ok: o.result_ok,
15869                 }
15870         }
15871 }
15872 impl Clone for CResult_QueryShortChannelIdsDecodeErrorZ {
15873         fn clone(&self) -> Self {
15874                 if self.result_ok {
15875                         Self { result_ok: true, contents: CResult_QueryShortChannelIdsDecodeErrorZPtr {
15876                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::QueryShortChannelIds>::clone(unsafe { &*self.contents.result })))
15877                         } }
15878                 } else {
15879                         Self { result_ok: false, contents: CResult_QueryShortChannelIdsDecodeErrorZPtr {
15880                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
15881                         } }
15882                 }
15883         }
15884 }
15885 #[no_mangle]
15886 /// Creates a new CResult_QueryShortChannelIdsDecodeErrorZ which has the same data as `orig`
15887 /// but with all dynamically-allocated buffers duplicated in new buffers.
15888 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_clone(orig: &CResult_QueryShortChannelIdsDecodeErrorZ) -> CResult_QueryShortChannelIdsDecodeErrorZ { Clone::clone(&orig) }
15889 #[repr(C)]
15890 /// The contents of CResult_ReplyShortChannelIdsEndDecodeErrorZ
15891 pub union CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
15892         /// A pointer to the contents in the success state.
15893         /// Reading from this pointer when `result_ok` is not set is undefined.
15894         pub result: *mut crate::lightning::ln::msgs::ReplyShortChannelIdsEnd,
15895         /// A pointer to the contents in the error state.
15896         /// Reading from this pointer when `result_ok` is set is undefined.
15897         pub err: *mut crate::lightning::ln::msgs::DecodeError,
15898 }
15899 #[repr(C)]
15900 /// A CResult_ReplyShortChannelIdsEndDecodeErrorZ represents the result of a fallible operation,
15901 /// containing a crate::lightning::ln::msgs::ReplyShortChannelIdsEnd on success and a crate::lightning::ln::msgs::DecodeError on failure.
15902 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
15903 pub struct CResult_ReplyShortChannelIdsEndDecodeErrorZ {
15904         /// The contents of this CResult_ReplyShortChannelIdsEndDecodeErrorZ, accessible via either
15905         /// `err` or `result` depending on the state of `result_ok`.
15906         pub contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr,
15907         /// Whether this CResult_ReplyShortChannelIdsEndDecodeErrorZ represents a success state.
15908         pub result_ok: bool,
15909 }
15910 #[no_mangle]
15911 /// Creates a new CResult_ReplyShortChannelIdsEndDecodeErrorZ in the success state.
15912 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ReplyShortChannelIdsEnd) -> CResult_ReplyShortChannelIdsEndDecodeErrorZ {
15913         CResult_ReplyShortChannelIdsEndDecodeErrorZ {
15914                 contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
15915                         result: Box::into_raw(Box::new(o)),
15916                 },
15917                 result_ok: true,
15918         }
15919 }
15920 #[no_mangle]
15921 /// Creates a new CResult_ReplyShortChannelIdsEndDecodeErrorZ in the error state.
15922 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ReplyShortChannelIdsEndDecodeErrorZ {
15923         CResult_ReplyShortChannelIdsEndDecodeErrorZ {
15924                 contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
15925                         err: Box::into_raw(Box::new(e)),
15926                 },
15927                 result_ok: false,
15928         }
15929 }
15930 /// Checks if the given object is currently in the success state
15931 #[no_mangle]
15932 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_is_ok(o: &CResult_ReplyShortChannelIdsEndDecodeErrorZ) -> bool {
15933         o.result_ok
15934 }
15935 #[no_mangle]
15936 /// Frees any resources used by the CResult_ReplyShortChannelIdsEndDecodeErrorZ.
15937 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_free(_res: CResult_ReplyShortChannelIdsEndDecodeErrorZ) { }
15938 impl Drop for CResult_ReplyShortChannelIdsEndDecodeErrorZ {
15939         fn drop(&mut self) {
15940                 if self.result_ok {
15941                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
15942                                 let _ = unsafe { Box::from_raw(self.contents.result) };
15943                         }
15944                 } else {
15945                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
15946                                 let _ = unsafe { Box::from_raw(self.contents.err) };
15947                         }
15948                 }
15949         }
15950 }
15951 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ReplyShortChannelIdsEnd, crate::lightning::ln::msgs::DecodeError>> for CResult_ReplyShortChannelIdsEndDecodeErrorZ {
15952         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ReplyShortChannelIdsEnd, crate::lightning::ln::msgs::DecodeError>) -> Self {
15953                 let contents = if o.result_ok {
15954                         let result = unsafe { o.contents.result };
15955                         unsafe { o.contents.result = core::ptr::null_mut() };
15956                         CResult_ReplyShortChannelIdsEndDecodeErrorZPtr { result }
15957                 } else {
15958                         let err = unsafe { o.contents.err };
15959                         unsafe { o.contents.err = core::ptr::null_mut(); }
15960                         CResult_ReplyShortChannelIdsEndDecodeErrorZPtr { err }
15961                 };
15962                 Self {
15963                         contents,
15964                         result_ok: o.result_ok,
15965                 }
15966         }
15967 }
15968 impl Clone for CResult_ReplyShortChannelIdsEndDecodeErrorZ {
15969         fn clone(&self) -> Self {
15970                 if self.result_ok {
15971                         Self { result_ok: true, contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
15972                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ReplyShortChannelIdsEnd>::clone(unsafe { &*self.contents.result })))
15973                         } }
15974                 } else {
15975                         Self { result_ok: false, contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
15976                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
15977                         } }
15978                 }
15979         }
15980 }
15981 #[no_mangle]
15982 /// Creates a new CResult_ReplyShortChannelIdsEndDecodeErrorZ which has the same data as `orig`
15983 /// but with all dynamically-allocated buffers duplicated in new buffers.
15984 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone(orig: &CResult_ReplyShortChannelIdsEndDecodeErrorZ) -> CResult_ReplyShortChannelIdsEndDecodeErrorZ { Clone::clone(&orig) }
15985 #[repr(C)]
15986 /// The contents of CResult_QueryChannelRangeDecodeErrorZ
15987 pub union CResult_QueryChannelRangeDecodeErrorZPtr {
15988         /// A pointer to the contents in the success state.
15989         /// Reading from this pointer when `result_ok` is not set is undefined.
15990         pub result: *mut crate::lightning::ln::msgs::QueryChannelRange,
15991         /// A pointer to the contents in the error state.
15992         /// Reading from this pointer when `result_ok` is set is undefined.
15993         pub err: *mut crate::lightning::ln::msgs::DecodeError,
15994 }
15995 #[repr(C)]
15996 /// A CResult_QueryChannelRangeDecodeErrorZ represents the result of a fallible operation,
15997 /// containing a crate::lightning::ln::msgs::QueryChannelRange on success and a crate::lightning::ln::msgs::DecodeError on failure.
15998 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
15999 pub struct CResult_QueryChannelRangeDecodeErrorZ {
16000         /// The contents of this CResult_QueryChannelRangeDecodeErrorZ, accessible via either
16001         /// `err` or `result` depending on the state of `result_ok`.
16002         pub contents: CResult_QueryChannelRangeDecodeErrorZPtr,
16003         /// Whether this CResult_QueryChannelRangeDecodeErrorZ represents a success state.
16004         pub result_ok: bool,
16005 }
16006 #[no_mangle]
16007 /// Creates a new CResult_QueryChannelRangeDecodeErrorZ in the success state.
16008 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_ok(o: crate::lightning::ln::msgs::QueryChannelRange) -> CResult_QueryChannelRangeDecodeErrorZ {
16009         CResult_QueryChannelRangeDecodeErrorZ {
16010                 contents: CResult_QueryChannelRangeDecodeErrorZPtr {
16011                         result: Box::into_raw(Box::new(o)),
16012                 },
16013                 result_ok: true,
16014         }
16015 }
16016 #[no_mangle]
16017 /// Creates a new CResult_QueryChannelRangeDecodeErrorZ in the error state.
16018 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_QueryChannelRangeDecodeErrorZ {
16019         CResult_QueryChannelRangeDecodeErrorZ {
16020                 contents: CResult_QueryChannelRangeDecodeErrorZPtr {
16021                         err: Box::into_raw(Box::new(e)),
16022                 },
16023                 result_ok: false,
16024         }
16025 }
16026 /// Checks if the given object is currently in the success state
16027 #[no_mangle]
16028 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_is_ok(o: &CResult_QueryChannelRangeDecodeErrorZ) -> bool {
16029         o.result_ok
16030 }
16031 #[no_mangle]
16032 /// Frees any resources used by the CResult_QueryChannelRangeDecodeErrorZ.
16033 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_free(_res: CResult_QueryChannelRangeDecodeErrorZ) { }
16034 impl Drop for CResult_QueryChannelRangeDecodeErrorZ {
16035         fn drop(&mut self) {
16036                 if self.result_ok {
16037                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
16038                                 let _ = unsafe { Box::from_raw(self.contents.result) };
16039                         }
16040                 } else {
16041                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
16042                                 let _ = unsafe { Box::from_raw(self.contents.err) };
16043                         }
16044                 }
16045         }
16046 }
16047 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::QueryChannelRange, crate::lightning::ln::msgs::DecodeError>> for CResult_QueryChannelRangeDecodeErrorZ {
16048         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::QueryChannelRange, crate::lightning::ln::msgs::DecodeError>) -> Self {
16049                 let contents = if o.result_ok {
16050                         let result = unsafe { o.contents.result };
16051                         unsafe { o.contents.result = core::ptr::null_mut() };
16052                         CResult_QueryChannelRangeDecodeErrorZPtr { result }
16053                 } else {
16054                         let err = unsafe { o.contents.err };
16055                         unsafe { o.contents.err = core::ptr::null_mut(); }
16056                         CResult_QueryChannelRangeDecodeErrorZPtr { err }
16057                 };
16058                 Self {
16059                         contents,
16060                         result_ok: o.result_ok,
16061                 }
16062         }
16063 }
16064 impl Clone for CResult_QueryChannelRangeDecodeErrorZ {
16065         fn clone(&self) -> Self {
16066                 if self.result_ok {
16067                         Self { result_ok: true, contents: CResult_QueryChannelRangeDecodeErrorZPtr {
16068                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::QueryChannelRange>::clone(unsafe { &*self.contents.result })))
16069                         } }
16070                 } else {
16071                         Self { result_ok: false, contents: CResult_QueryChannelRangeDecodeErrorZPtr {
16072                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
16073                         } }
16074                 }
16075         }
16076 }
16077 #[no_mangle]
16078 /// Creates a new CResult_QueryChannelRangeDecodeErrorZ which has the same data as `orig`
16079 /// but with all dynamically-allocated buffers duplicated in new buffers.
16080 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_clone(orig: &CResult_QueryChannelRangeDecodeErrorZ) -> CResult_QueryChannelRangeDecodeErrorZ { Clone::clone(&orig) }
16081 #[repr(C)]
16082 /// The contents of CResult_ReplyChannelRangeDecodeErrorZ
16083 pub union CResult_ReplyChannelRangeDecodeErrorZPtr {
16084         /// A pointer to the contents in the success state.
16085         /// Reading from this pointer when `result_ok` is not set is undefined.
16086         pub result: *mut crate::lightning::ln::msgs::ReplyChannelRange,
16087         /// A pointer to the contents in the error state.
16088         /// Reading from this pointer when `result_ok` is set is undefined.
16089         pub err: *mut crate::lightning::ln::msgs::DecodeError,
16090 }
16091 #[repr(C)]
16092 /// A CResult_ReplyChannelRangeDecodeErrorZ represents the result of a fallible operation,
16093 /// containing a crate::lightning::ln::msgs::ReplyChannelRange on success and a crate::lightning::ln::msgs::DecodeError on failure.
16094 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
16095 pub struct CResult_ReplyChannelRangeDecodeErrorZ {
16096         /// The contents of this CResult_ReplyChannelRangeDecodeErrorZ, accessible via either
16097         /// `err` or `result` depending on the state of `result_ok`.
16098         pub contents: CResult_ReplyChannelRangeDecodeErrorZPtr,
16099         /// Whether this CResult_ReplyChannelRangeDecodeErrorZ represents a success state.
16100         pub result_ok: bool,
16101 }
16102 #[no_mangle]
16103 /// Creates a new CResult_ReplyChannelRangeDecodeErrorZ in the success state.
16104 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ReplyChannelRange) -> CResult_ReplyChannelRangeDecodeErrorZ {
16105         CResult_ReplyChannelRangeDecodeErrorZ {
16106                 contents: CResult_ReplyChannelRangeDecodeErrorZPtr {
16107                         result: Box::into_raw(Box::new(o)),
16108                 },
16109                 result_ok: true,
16110         }
16111 }
16112 #[no_mangle]
16113 /// Creates a new CResult_ReplyChannelRangeDecodeErrorZ in the error state.
16114 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ReplyChannelRangeDecodeErrorZ {
16115         CResult_ReplyChannelRangeDecodeErrorZ {
16116                 contents: CResult_ReplyChannelRangeDecodeErrorZPtr {
16117                         err: Box::into_raw(Box::new(e)),
16118                 },
16119                 result_ok: false,
16120         }
16121 }
16122 /// Checks if the given object is currently in the success state
16123 #[no_mangle]
16124 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_is_ok(o: &CResult_ReplyChannelRangeDecodeErrorZ) -> bool {
16125         o.result_ok
16126 }
16127 #[no_mangle]
16128 /// Frees any resources used by the CResult_ReplyChannelRangeDecodeErrorZ.
16129 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_free(_res: CResult_ReplyChannelRangeDecodeErrorZ) { }
16130 impl Drop for CResult_ReplyChannelRangeDecodeErrorZ {
16131         fn drop(&mut self) {
16132                 if self.result_ok {
16133                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
16134                                 let _ = unsafe { Box::from_raw(self.contents.result) };
16135                         }
16136                 } else {
16137                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
16138                                 let _ = unsafe { Box::from_raw(self.contents.err) };
16139                         }
16140                 }
16141         }
16142 }
16143 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ReplyChannelRange, crate::lightning::ln::msgs::DecodeError>> for CResult_ReplyChannelRangeDecodeErrorZ {
16144         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ReplyChannelRange, crate::lightning::ln::msgs::DecodeError>) -> Self {
16145                 let contents = if o.result_ok {
16146                         let result = unsafe { o.contents.result };
16147                         unsafe { o.contents.result = core::ptr::null_mut() };
16148                         CResult_ReplyChannelRangeDecodeErrorZPtr { result }
16149                 } else {
16150                         let err = unsafe { o.contents.err };
16151                         unsafe { o.contents.err = core::ptr::null_mut(); }
16152                         CResult_ReplyChannelRangeDecodeErrorZPtr { err }
16153                 };
16154                 Self {
16155                         contents,
16156                         result_ok: o.result_ok,
16157                 }
16158         }
16159 }
16160 impl Clone for CResult_ReplyChannelRangeDecodeErrorZ {
16161         fn clone(&self) -> Self {
16162                 if self.result_ok {
16163                         Self { result_ok: true, contents: CResult_ReplyChannelRangeDecodeErrorZPtr {
16164                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ReplyChannelRange>::clone(unsafe { &*self.contents.result })))
16165                         } }
16166                 } else {
16167                         Self { result_ok: false, contents: CResult_ReplyChannelRangeDecodeErrorZPtr {
16168                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
16169                         } }
16170                 }
16171         }
16172 }
16173 #[no_mangle]
16174 /// Creates a new CResult_ReplyChannelRangeDecodeErrorZ which has the same data as `orig`
16175 /// but with all dynamically-allocated buffers duplicated in new buffers.
16176 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_clone(orig: &CResult_ReplyChannelRangeDecodeErrorZ) -> CResult_ReplyChannelRangeDecodeErrorZ { Clone::clone(&orig) }
16177 #[repr(C)]
16178 /// The contents of CResult_GossipTimestampFilterDecodeErrorZ
16179 pub union CResult_GossipTimestampFilterDecodeErrorZPtr {
16180         /// A pointer to the contents in the success state.
16181         /// Reading from this pointer when `result_ok` is not set is undefined.
16182         pub result: *mut crate::lightning::ln::msgs::GossipTimestampFilter,
16183         /// A pointer to the contents in the error state.
16184         /// Reading from this pointer when `result_ok` is set is undefined.
16185         pub err: *mut crate::lightning::ln::msgs::DecodeError,
16186 }
16187 #[repr(C)]
16188 /// A CResult_GossipTimestampFilterDecodeErrorZ represents the result of a fallible operation,
16189 /// containing a crate::lightning::ln::msgs::GossipTimestampFilter on success and a crate::lightning::ln::msgs::DecodeError on failure.
16190 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
16191 pub struct CResult_GossipTimestampFilterDecodeErrorZ {
16192         /// The contents of this CResult_GossipTimestampFilterDecodeErrorZ, accessible via either
16193         /// `err` or `result` depending on the state of `result_ok`.
16194         pub contents: CResult_GossipTimestampFilterDecodeErrorZPtr,
16195         /// Whether this CResult_GossipTimestampFilterDecodeErrorZ represents a success state.
16196         pub result_ok: bool,
16197 }
16198 #[no_mangle]
16199 /// Creates a new CResult_GossipTimestampFilterDecodeErrorZ in the success state.
16200 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_ok(o: crate::lightning::ln::msgs::GossipTimestampFilter) -> CResult_GossipTimestampFilterDecodeErrorZ {
16201         CResult_GossipTimestampFilterDecodeErrorZ {
16202                 contents: CResult_GossipTimestampFilterDecodeErrorZPtr {
16203                         result: Box::into_raw(Box::new(o)),
16204                 },
16205                 result_ok: true,
16206         }
16207 }
16208 #[no_mangle]
16209 /// Creates a new CResult_GossipTimestampFilterDecodeErrorZ in the error state.
16210 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_GossipTimestampFilterDecodeErrorZ {
16211         CResult_GossipTimestampFilterDecodeErrorZ {
16212                 contents: CResult_GossipTimestampFilterDecodeErrorZPtr {
16213                         err: Box::into_raw(Box::new(e)),
16214                 },
16215                 result_ok: false,
16216         }
16217 }
16218 /// Checks if the given object is currently in the success state
16219 #[no_mangle]
16220 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_is_ok(o: &CResult_GossipTimestampFilterDecodeErrorZ) -> bool {
16221         o.result_ok
16222 }
16223 #[no_mangle]
16224 /// Frees any resources used by the CResult_GossipTimestampFilterDecodeErrorZ.
16225 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_free(_res: CResult_GossipTimestampFilterDecodeErrorZ) { }
16226 impl Drop for CResult_GossipTimestampFilterDecodeErrorZ {
16227         fn drop(&mut self) {
16228                 if self.result_ok {
16229                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
16230                                 let _ = unsafe { Box::from_raw(self.contents.result) };
16231                         }
16232                 } else {
16233                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
16234                                 let _ = unsafe { Box::from_raw(self.contents.err) };
16235                         }
16236                 }
16237         }
16238 }
16239 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::GossipTimestampFilter, crate::lightning::ln::msgs::DecodeError>> for CResult_GossipTimestampFilterDecodeErrorZ {
16240         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::GossipTimestampFilter, crate::lightning::ln::msgs::DecodeError>) -> Self {
16241                 let contents = if o.result_ok {
16242                         let result = unsafe { o.contents.result };
16243                         unsafe { o.contents.result = core::ptr::null_mut() };
16244                         CResult_GossipTimestampFilterDecodeErrorZPtr { result }
16245                 } else {
16246                         let err = unsafe { o.contents.err };
16247                         unsafe { o.contents.err = core::ptr::null_mut(); }
16248                         CResult_GossipTimestampFilterDecodeErrorZPtr { err }
16249                 };
16250                 Self {
16251                         contents,
16252                         result_ok: o.result_ok,
16253                 }
16254         }
16255 }
16256 impl Clone for CResult_GossipTimestampFilterDecodeErrorZ {
16257         fn clone(&self) -> Self {
16258                 if self.result_ok {
16259                         Self { result_ok: true, contents: CResult_GossipTimestampFilterDecodeErrorZPtr {
16260                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::GossipTimestampFilter>::clone(unsafe { &*self.contents.result })))
16261                         } }
16262                 } else {
16263                         Self { result_ok: false, contents: CResult_GossipTimestampFilterDecodeErrorZPtr {
16264                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
16265                         } }
16266                 }
16267         }
16268 }
16269 #[no_mangle]
16270 /// Creates a new CResult_GossipTimestampFilterDecodeErrorZ which has the same data as `orig`
16271 /// but with all dynamically-allocated buffers duplicated in new buffers.
16272 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_clone(orig: &CResult_GossipTimestampFilterDecodeErrorZ) -> CResult_GossipTimestampFilterDecodeErrorZ { Clone::clone(&orig) }
16273 #[repr(C)]
16274 /// A dynamically-allocated array of crate::lightning::ln::channelmanager::PhantomRouteHintss of arbitrary size.
16275 /// This corresponds to std::vector in C++
16276 pub struct CVec_PhantomRouteHintsZ {
16277         /// The elements in the array.
16278         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
16279         pub data: *mut crate::lightning::ln::channelmanager::PhantomRouteHints,
16280         /// The number of elements pointed to by `data`.
16281         pub datalen: usize
16282 }
16283 impl CVec_PhantomRouteHintsZ {
16284         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::channelmanager::PhantomRouteHints> {
16285                 if self.datalen == 0 { return Vec::new(); }
16286                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
16287                 self.data = core::ptr::null_mut();
16288                 self.datalen = 0;
16289                 ret
16290         }
16291         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::channelmanager::PhantomRouteHints] {
16292                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
16293         }
16294 }
16295 impl From<Vec<crate::lightning::ln::channelmanager::PhantomRouteHints>> for CVec_PhantomRouteHintsZ {
16296         fn from(v: Vec<crate::lightning::ln::channelmanager::PhantomRouteHints>) -> Self {
16297                 let datalen = v.len();
16298                 let data = Box::into_raw(v.into_boxed_slice());
16299                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
16300         }
16301 }
16302 #[no_mangle]
16303 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
16304 pub extern "C" fn CVec_PhantomRouteHintsZ_free(_res: CVec_PhantomRouteHintsZ) { }
16305 impl Drop for CVec_PhantomRouteHintsZ {
16306         fn drop(&mut self) {
16307                 if self.datalen == 0 { return; }
16308                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
16309         }
16310 }
16311 impl Clone for CVec_PhantomRouteHintsZ {
16312         fn clone(&self) -> Self {
16313                 let mut res = Vec::new();
16314                 if self.datalen == 0 { return Self::from(res); }
16315                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
16316                 Self::from(res)
16317         }
16318 }
16319 #[repr(C)]
16320 /// The contents of CResult_InvoiceSignOrCreationErrorZ
16321 pub union CResult_InvoiceSignOrCreationErrorZPtr {
16322         /// A pointer to the contents in the success state.
16323         /// Reading from this pointer when `result_ok` is not set is undefined.
16324         pub result: *mut crate::lightning_invoice::Invoice,
16325         /// A pointer to the contents in the error state.
16326         /// Reading from this pointer when `result_ok` is set is undefined.
16327         pub err: *mut crate::lightning_invoice::SignOrCreationError,
16328 }
16329 #[repr(C)]
16330 /// A CResult_InvoiceSignOrCreationErrorZ represents the result of a fallible operation,
16331 /// containing a crate::lightning_invoice::Invoice on success and a crate::lightning_invoice::SignOrCreationError on failure.
16332 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
16333 pub struct CResult_InvoiceSignOrCreationErrorZ {
16334         /// The contents of this CResult_InvoiceSignOrCreationErrorZ, accessible via either
16335         /// `err` or `result` depending on the state of `result_ok`.
16336         pub contents: CResult_InvoiceSignOrCreationErrorZPtr,
16337         /// Whether this CResult_InvoiceSignOrCreationErrorZ represents a success state.
16338         pub result_ok: bool,
16339 }
16340 #[no_mangle]
16341 /// Creates a new CResult_InvoiceSignOrCreationErrorZ in the success state.
16342 pub extern "C" fn CResult_InvoiceSignOrCreationErrorZ_ok(o: crate::lightning_invoice::Invoice) -> CResult_InvoiceSignOrCreationErrorZ {
16343         CResult_InvoiceSignOrCreationErrorZ {
16344                 contents: CResult_InvoiceSignOrCreationErrorZPtr {
16345                         result: Box::into_raw(Box::new(o)),
16346                 },
16347                 result_ok: true,
16348         }
16349 }
16350 #[no_mangle]
16351 /// Creates a new CResult_InvoiceSignOrCreationErrorZ in the error state.
16352 pub extern "C" fn CResult_InvoiceSignOrCreationErrorZ_err(e: crate::lightning_invoice::SignOrCreationError) -> CResult_InvoiceSignOrCreationErrorZ {
16353         CResult_InvoiceSignOrCreationErrorZ {
16354                 contents: CResult_InvoiceSignOrCreationErrorZPtr {
16355                         err: Box::into_raw(Box::new(e)),
16356                 },
16357                 result_ok: false,
16358         }
16359 }
16360 /// Checks if the given object is currently in the success state
16361 #[no_mangle]
16362 pub extern "C" fn CResult_InvoiceSignOrCreationErrorZ_is_ok(o: &CResult_InvoiceSignOrCreationErrorZ) -> bool {
16363         o.result_ok
16364 }
16365 #[no_mangle]
16366 /// Frees any resources used by the CResult_InvoiceSignOrCreationErrorZ.
16367 pub extern "C" fn CResult_InvoiceSignOrCreationErrorZ_free(_res: CResult_InvoiceSignOrCreationErrorZ) { }
16368 impl Drop for CResult_InvoiceSignOrCreationErrorZ {
16369         fn drop(&mut self) {
16370                 if self.result_ok {
16371                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
16372                                 let _ = unsafe { Box::from_raw(self.contents.result) };
16373                         }
16374                 } else {
16375                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
16376                                 let _ = unsafe { Box::from_raw(self.contents.err) };
16377                         }
16378                 }
16379         }
16380 }
16381 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::Invoice, crate::lightning_invoice::SignOrCreationError>> for CResult_InvoiceSignOrCreationErrorZ {
16382         fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::Invoice, crate::lightning_invoice::SignOrCreationError>) -> Self {
16383                 let contents = if o.result_ok {
16384                         let result = unsafe { o.contents.result };
16385                         unsafe { o.contents.result = core::ptr::null_mut() };
16386                         CResult_InvoiceSignOrCreationErrorZPtr { result }
16387                 } else {
16388                         let err = unsafe { o.contents.err };
16389                         unsafe { o.contents.err = core::ptr::null_mut(); }
16390                         CResult_InvoiceSignOrCreationErrorZPtr { err }
16391                 };
16392                 Self {
16393                         contents,
16394                         result_ok: o.result_ok,
16395                 }
16396         }
16397 }
16398 impl Clone for CResult_InvoiceSignOrCreationErrorZ {
16399         fn clone(&self) -> Self {
16400                 if self.result_ok {
16401                         Self { result_ok: true, contents: CResult_InvoiceSignOrCreationErrorZPtr {
16402                                 result: Box::into_raw(Box::new(<crate::lightning_invoice::Invoice>::clone(unsafe { &*self.contents.result })))
16403                         } }
16404                 } else {
16405                         Self { result_ok: false, contents: CResult_InvoiceSignOrCreationErrorZPtr {
16406                                 err: Box::into_raw(Box::new(<crate::lightning_invoice::SignOrCreationError>::clone(unsafe { &*self.contents.err })))
16407                         } }
16408                 }
16409         }
16410 }
16411 #[no_mangle]
16412 /// Creates a new CResult_InvoiceSignOrCreationErrorZ which has the same data as `orig`
16413 /// but with all dynamically-allocated buffers duplicated in new buffers.
16414 pub extern "C" fn CResult_InvoiceSignOrCreationErrorZ_clone(orig: &CResult_InvoiceSignOrCreationErrorZ) -> CResult_InvoiceSignOrCreationErrorZ { Clone::clone(&orig) }
16415 #[repr(C)]
16416 /// An enum which can either contain a crate::lightning::chain::Filter or not
16417 pub enum COption_FilterZ {
16418         /// When we're in this state, this COption_FilterZ contains a crate::lightning::chain::Filter
16419         Some(crate::lightning::chain::Filter),
16420         /// When we're in this state, this COption_FilterZ contains nothing
16421         None
16422 }
16423 impl COption_FilterZ {
16424         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
16425                 if let Self::None = self { false } else { true }
16426         }
16427         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
16428                 !self.is_some()
16429         }
16430         #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::chain::Filter {
16431                 if let Self::Some(v) = self { v } else { unreachable!() }
16432         }
16433 }
16434 #[no_mangle]
16435 /// Constructs a new COption_FilterZ containing a crate::lightning::chain::Filter
16436 pub extern "C" fn COption_FilterZ_some(o: crate::lightning::chain::Filter) -> COption_FilterZ {
16437         COption_FilterZ::Some(o)
16438 }
16439 #[no_mangle]
16440 /// Constructs a new COption_FilterZ containing nothing
16441 pub extern "C" fn COption_FilterZ_none() -> COption_FilterZ {
16442         COption_FilterZ::None
16443 }
16444 #[no_mangle]
16445 /// Frees any resources associated with the crate::lightning::chain::Filter, if we are in the Some state
16446 pub extern "C" fn COption_FilterZ_free(_res: COption_FilterZ) { }
16447 #[repr(C)]
16448 /// The contents of CResult_LockedChannelMonitorNoneZ
16449 pub union CResult_LockedChannelMonitorNoneZPtr {
16450         /// A pointer to the contents in the success state.
16451         /// Reading from this pointer when `result_ok` is not set is undefined.
16452         pub result: *mut crate::lightning::chain::chainmonitor::LockedChannelMonitor,
16453         /// Note that this value is always NULL, as there are no contents in the Err variant
16454         pub err: *mut core::ffi::c_void,
16455 }
16456 #[repr(C)]
16457 /// A CResult_LockedChannelMonitorNoneZ represents the result of a fallible operation,
16458 /// containing a crate::lightning::chain::chainmonitor::LockedChannelMonitor on success and a () on failure.
16459 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
16460 pub struct CResult_LockedChannelMonitorNoneZ {
16461         /// The contents of this CResult_LockedChannelMonitorNoneZ, accessible via either
16462         /// `err` or `result` depending on the state of `result_ok`.
16463         pub contents: CResult_LockedChannelMonitorNoneZPtr,
16464         /// Whether this CResult_LockedChannelMonitorNoneZ represents a success state.
16465         pub result_ok: bool,
16466 }
16467 #[no_mangle]
16468 /// Creates a new CResult_LockedChannelMonitorNoneZ in the success state.
16469 pub extern "C" fn CResult_LockedChannelMonitorNoneZ_ok(o: crate::lightning::chain::chainmonitor::LockedChannelMonitor) -> CResult_LockedChannelMonitorNoneZ {
16470         CResult_LockedChannelMonitorNoneZ {
16471                 contents: CResult_LockedChannelMonitorNoneZPtr {
16472                         result: Box::into_raw(Box::new(o)),
16473                 },
16474                 result_ok: true,
16475         }
16476 }
16477 #[no_mangle]
16478 /// Creates a new CResult_LockedChannelMonitorNoneZ in the error state.
16479 pub extern "C" fn CResult_LockedChannelMonitorNoneZ_err() -> CResult_LockedChannelMonitorNoneZ {
16480         CResult_LockedChannelMonitorNoneZ {
16481                 contents: CResult_LockedChannelMonitorNoneZPtr {
16482                         err: core::ptr::null_mut(),
16483                 },
16484                 result_ok: false,
16485         }
16486 }
16487 /// Checks if the given object is currently in the success state
16488 #[no_mangle]
16489 pub extern "C" fn CResult_LockedChannelMonitorNoneZ_is_ok(o: &CResult_LockedChannelMonitorNoneZ) -> bool {
16490         o.result_ok
16491 }
16492 #[no_mangle]
16493 /// Frees any resources used by the CResult_LockedChannelMonitorNoneZ.
16494 pub extern "C" fn CResult_LockedChannelMonitorNoneZ_free(_res: CResult_LockedChannelMonitorNoneZ) { }
16495 impl Drop for CResult_LockedChannelMonitorNoneZ {
16496         fn drop(&mut self) {
16497                 if self.result_ok {
16498                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
16499                                 let _ = unsafe { Box::from_raw(self.contents.result) };
16500                         }
16501                 } else {
16502                 }
16503         }
16504 }
16505 impl From<crate::c_types::CResultTempl<crate::lightning::chain::chainmonitor::LockedChannelMonitor, ()>> for CResult_LockedChannelMonitorNoneZ {
16506         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::chainmonitor::LockedChannelMonitor, ()>) -> Self {
16507                 let contents = if o.result_ok {
16508                         let result = unsafe { o.contents.result };
16509                         unsafe { o.contents.result = core::ptr::null_mut() };
16510                         CResult_LockedChannelMonitorNoneZPtr { result }
16511                 } else {
16512                         let _ = unsafe { Box::from_raw(o.contents.err) };
16513                         o.contents.err = core::ptr::null_mut();
16514                         CResult_LockedChannelMonitorNoneZPtr { err: core::ptr::null_mut() }
16515                 };
16516                 Self {
16517                         contents,
16518                         result_ok: o.result_ok,
16519                 }
16520         }
16521 }
16522 #[repr(C)]
16523 /// A dynamically-allocated array of crate::lightning::chain::transaction::OutPoints of arbitrary size.
16524 /// This corresponds to std::vector in C++
16525 pub struct CVec_OutPointZ {
16526         /// The elements in the array.
16527         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
16528         pub data: *mut crate::lightning::chain::transaction::OutPoint,
16529         /// The number of elements pointed to by `data`.
16530         pub datalen: usize
16531 }
16532 impl CVec_OutPointZ {
16533         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::chain::transaction::OutPoint> {
16534                 if self.datalen == 0 { return Vec::new(); }
16535                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
16536                 self.data = core::ptr::null_mut();
16537                 self.datalen = 0;
16538                 ret
16539         }
16540         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::chain::transaction::OutPoint] {
16541                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
16542         }
16543 }
16544 impl From<Vec<crate::lightning::chain::transaction::OutPoint>> for CVec_OutPointZ {
16545         fn from(v: Vec<crate::lightning::chain::transaction::OutPoint>) -> Self {
16546                 let datalen = v.len();
16547                 let data = Box::into_raw(v.into_boxed_slice());
16548                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
16549         }
16550 }
16551 #[no_mangle]
16552 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
16553 pub extern "C" fn CVec_OutPointZ_free(_res: CVec_OutPointZ) { }
16554 impl Drop for CVec_OutPointZ {
16555         fn drop(&mut self) {
16556                 if self.datalen == 0 { return; }
16557                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
16558         }
16559 }
16560 impl Clone for CVec_OutPointZ {
16561         fn clone(&self) -> Self {
16562                 let mut res = Vec::new();
16563                 if self.datalen == 0 { return Self::from(res); }
16564                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
16565                 Self::from(res)
16566         }
16567 }