Merge pull request #46 from TheBlueMatt/main
[ldk-c-bindings] / lightning-c-bindings / src / c_types / derived.rs
1 #[repr(C)]
2 /// The contents of CResult_SecretKeyErrorZ
3 pub union CResult_SecretKeyErrorZPtr {
4         /// A pointer to the contents in the success state.
5         /// Reading from this pointer when `result_ok` is not set is undefined.
6         pub result: *mut crate::c_types::SecretKey,
7         /// A pointer to the contents in the error state.
8         /// Reading from this pointer when `result_ok` is set is undefined.
9         pub err: *mut crate::c_types::Secp256k1Error,
10 }
11 #[repr(C)]
12 /// A CResult_SecretKeyErrorZ represents the result of a fallible operation,
13 /// containing a crate::c_types::SecretKey on success and a crate::c_types::Secp256k1Error on failure.
14 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
15 pub struct CResult_SecretKeyErrorZ {
16         /// The contents of this CResult_SecretKeyErrorZ, accessible via either
17         /// `err` or `result` depending on the state of `result_ok`.
18         pub contents: CResult_SecretKeyErrorZPtr,
19         /// Whether this CResult_SecretKeyErrorZ represents a success state.
20         pub result_ok: bool,
21 }
22 #[no_mangle]
23 /// Creates a new CResult_SecretKeyErrorZ in the success state.
24 pub extern "C" fn CResult_SecretKeyErrorZ_ok(o: crate::c_types::SecretKey) -> CResult_SecretKeyErrorZ {
25         CResult_SecretKeyErrorZ {
26                 contents: CResult_SecretKeyErrorZPtr {
27                         result: Box::into_raw(Box::new(o)),
28                 },
29                 result_ok: true,
30         }
31 }
32 #[no_mangle]
33 /// Creates a new CResult_SecretKeyErrorZ in the error state.
34 pub extern "C" fn CResult_SecretKeyErrorZ_err(e: crate::c_types::Secp256k1Error) -> CResult_SecretKeyErrorZ {
35         CResult_SecretKeyErrorZ {
36                 contents: CResult_SecretKeyErrorZPtr {
37                         err: Box::into_raw(Box::new(e)),
38                 },
39                 result_ok: false,
40         }
41 }
42 #[no_mangle]
43 /// Frees any resources used by the CResult_SecretKeyErrorZ.
44 pub extern "C" fn CResult_SecretKeyErrorZ_free(_res: CResult_SecretKeyErrorZ) { }
45 impl Drop for CResult_SecretKeyErrorZ {
46         fn drop(&mut self) {
47                 if self.result_ok {
48                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
49                                 let _ = unsafe { Box::from_raw(self.contents.result) };
50                         }
51                 } else {
52                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
53                                 let _ = unsafe { Box::from_raw(self.contents.err) };
54                         }
55                 }
56         }
57 }
58 impl From<crate::c_types::CResultTempl<crate::c_types::SecretKey, crate::c_types::Secp256k1Error>> for CResult_SecretKeyErrorZ {
59         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::SecretKey, crate::c_types::Secp256k1Error>) -> Self {
60                 let contents = if o.result_ok {
61                         let result = unsafe { o.contents.result };
62                         unsafe { o.contents.result = std::ptr::null_mut() };
63                         CResult_SecretKeyErrorZPtr { result }
64                 } else {
65                         let err = unsafe { o.contents.err };
66                         unsafe { o.contents.err = std::ptr::null_mut(); }
67                         CResult_SecretKeyErrorZPtr { err }
68                 };
69                 Self {
70                         contents,
71                         result_ok: o.result_ok,
72                 }
73         }
74 }
75 #[repr(C)]
76 /// The contents of CResult_PublicKeyErrorZ
77 pub union CResult_PublicKeyErrorZPtr {
78         /// A pointer to the contents in the success state.
79         /// Reading from this pointer when `result_ok` is not set is undefined.
80         pub result: *mut crate::c_types::PublicKey,
81         /// A pointer to the contents in the error state.
82         /// Reading from this pointer when `result_ok` is set is undefined.
83         pub err: *mut crate::c_types::Secp256k1Error,
84 }
85 #[repr(C)]
86 /// A CResult_PublicKeyErrorZ represents the result of a fallible operation,
87 /// containing a crate::c_types::PublicKey on success and a crate::c_types::Secp256k1Error on failure.
88 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
89 pub struct CResult_PublicKeyErrorZ {
90         /// The contents of this CResult_PublicKeyErrorZ, accessible via either
91         /// `err` or `result` depending on the state of `result_ok`.
92         pub contents: CResult_PublicKeyErrorZPtr,
93         /// Whether this CResult_PublicKeyErrorZ represents a success state.
94         pub result_ok: bool,
95 }
96 #[no_mangle]
97 /// Creates a new CResult_PublicKeyErrorZ in the success state.
98 pub extern "C" fn CResult_PublicKeyErrorZ_ok(o: crate::c_types::PublicKey) -> CResult_PublicKeyErrorZ {
99         CResult_PublicKeyErrorZ {
100                 contents: CResult_PublicKeyErrorZPtr {
101                         result: Box::into_raw(Box::new(o)),
102                 },
103                 result_ok: true,
104         }
105 }
106 #[no_mangle]
107 /// Creates a new CResult_PublicKeyErrorZ in the error state.
108 pub extern "C" fn CResult_PublicKeyErrorZ_err(e: crate::c_types::Secp256k1Error) -> CResult_PublicKeyErrorZ {
109         CResult_PublicKeyErrorZ {
110                 contents: CResult_PublicKeyErrorZPtr {
111                         err: Box::into_raw(Box::new(e)),
112                 },
113                 result_ok: false,
114         }
115 }
116 #[no_mangle]
117 /// Frees any resources used by the CResult_PublicKeyErrorZ.
118 pub extern "C" fn CResult_PublicKeyErrorZ_free(_res: CResult_PublicKeyErrorZ) { }
119 impl Drop for CResult_PublicKeyErrorZ {
120         fn drop(&mut self) {
121                 if self.result_ok {
122                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
123                                 let _ = unsafe { Box::from_raw(self.contents.result) };
124                         }
125                 } else {
126                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
127                                 let _ = unsafe { Box::from_raw(self.contents.err) };
128                         }
129                 }
130         }
131 }
132 impl From<crate::c_types::CResultTempl<crate::c_types::PublicKey, crate::c_types::Secp256k1Error>> for CResult_PublicKeyErrorZ {
133         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::PublicKey, crate::c_types::Secp256k1Error>) -> Self {
134                 let contents = if o.result_ok {
135                         let result = unsafe { o.contents.result };
136                         unsafe { o.contents.result = std::ptr::null_mut() };
137                         CResult_PublicKeyErrorZPtr { result }
138                 } else {
139                         let err = unsafe { o.contents.err };
140                         unsafe { o.contents.err = std::ptr::null_mut(); }
141                         CResult_PublicKeyErrorZPtr { err }
142                 };
143                 Self {
144                         contents,
145                         result_ok: o.result_ok,
146                 }
147         }
148 }
149 impl Clone for CResult_PublicKeyErrorZ {
150         fn clone(&self) -> Self {
151                 if self.result_ok {
152                         Self { result_ok: true, contents: CResult_PublicKeyErrorZPtr {
153                                 result: Box::into_raw(Box::new(<crate::c_types::PublicKey>::clone(unsafe { &*self.contents.result })))
154                         } }
155                 } else {
156                         Self { result_ok: false, contents: CResult_PublicKeyErrorZPtr {
157                                 err: Box::into_raw(Box::new(<crate::c_types::Secp256k1Error>::clone(unsafe { &*self.contents.err })))
158                         } }
159                 }
160         }
161 }
162 #[no_mangle]
163 /// Creates a new CResult_PublicKeyErrorZ which has the same data as `orig`
164 /// but with all dynamically-allocated buffers duplicated in new buffers.
165 pub extern "C" fn CResult_PublicKeyErrorZ_clone(orig: &CResult_PublicKeyErrorZ) -> CResult_PublicKeyErrorZ { Clone::clone(&orig) }
166 #[repr(C)]
167 /// The contents of CResult_TxCreationKeysDecodeErrorZ
168 pub union CResult_TxCreationKeysDecodeErrorZPtr {
169         /// A pointer to the contents in the success state.
170         /// Reading from this pointer when `result_ok` is not set is undefined.
171         pub result: *mut crate::lightning::ln::chan_utils::TxCreationKeys,
172         /// A pointer to the contents in the error state.
173         /// Reading from this pointer when `result_ok` is set is undefined.
174         pub err: *mut crate::lightning::ln::msgs::DecodeError,
175 }
176 #[repr(C)]
177 /// A CResult_TxCreationKeysDecodeErrorZ represents the result of a fallible operation,
178 /// containing a crate::lightning::ln::chan_utils::TxCreationKeys on success and a crate::lightning::ln::msgs::DecodeError on failure.
179 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
180 pub struct CResult_TxCreationKeysDecodeErrorZ {
181         /// The contents of this CResult_TxCreationKeysDecodeErrorZ, accessible via either
182         /// `err` or `result` depending on the state of `result_ok`.
183         pub contents: CResult_TxCreationKeysDecodeErrorZPtr,
184         /// Whether this CResult_TxCreationKeysDecodeErrorZ represents a success state.
185         pub result_ok: bool,
186 }
187 #[no_mangle]
188 /// Creates a new CResult_TxCreationKeysDecodeErrorZ in the success state.
189 pub extern "C" fn CResult_TxCreationKeysDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::TxCreationKeys) -> CResult_TxCreationKeysDecodeErrorZ {
190         CResult_TxCreationKeysDecodeErrorZ {
191                 contents: CResult_TxCreationKeysDecodeErrorZPtr {
192                         result: Box::into_raw(Box::new(o)),
193                 },
194                 result_ok: true,
195         }
196 }
197 #[no_mangle]
198 /// Creates a new CResult_TxCreationKeysDecodeErrorZ in the error state.
199 pub extern "C" fn CResult_TxCreationKeysDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_TxCreationKeysDecodeErrorZ {
200         CResult_TxCreationKeysDecodeErrorZ {
201                 contents: CResult_TxCreationKeysDecodeErrorZPtr {
202                         err: Box::into_raw(Box::new(e)),
203                 },
204                 result_ok: false,
205         }
206 }
207 #[no_mangle]
208 /// Frees any resources used by the CResult_TxCreationKeysDecodeErrorZ.
209 pub extern "C" fn CResult_TxCreationKeysDecodeErrorZ_free(_res: CResult_TxCreationKeysDecodeErrorZ) { }
210 impl Drop for CResult_TxCreationKeysDecodeErrorZ {
211         fn drop(&mut self) {
212                 if self.result_ok {
213                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
214                                 let _ = unsafe { Box::from_raw(self.contents.result) };
215                         }
216                 } else {
217                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
218                                 let _ = unsafe { Box::from_raw(self.contents.err) };
219                         }
220                 }
221         }
222 }
223 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::TxCreationKeys, crate::lightning::ln::msgs::DecodeError>> for CResult_TxCreationKeysDecodeErrorZ {
224         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::TxCreationKeys, crate::lightning::ln::msgs::DecodeError>) -> Self {
225                 let contents = if o.result_ok {
226                         let result = unsafe { o.contents.result };
227                         unsafe { o.contents.result = std::ptr::null_mut() };
228                         CResult_TxCreationKeysDecodeErrorZPtr { result }
229                 } else {
230                         let err = unsafe { o.contents.err };
231                         unsafe { o.contents.err = std::ptr::null_mut(); }
232                         CResult_TxCreationKeysDecodeErrorZPtr { err }
233                 };
234                 Self {
235                         contents,
236                         result_ok: o.result_ok,
237                 }
238         }
239 }
240 impl Clone for CResult_TxCreationKeysDecodeErrorZ {
241         fn clone(&self) -> Self {
242                 if self.result_ok {
243                         Self { result_ok: true, contents: CResult_TxCreationKeysDecodeErrorZPtr {
244                                 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::TxCreationKeys>::clone(unsafe { &*self.contents.result })))
245                         } }
246                 } else {
247                         Self { result_ok: false, contents: CResult_TxCreationKeysDecodeErrorZPtr {
248                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
249                         } }
250                 }
251         }
252 }
253 #[no_mangle]
254 /// Creates a new CResult_TxCreationKeysDecodeErrorZ which has the same data as `orig`
255 /// but with all dynamically-allocated buffers duplicated in new buffers.
256 pub extern "C" fn CResult_TxCreationKeysDecodeErrorZ_clone(orig: &CResult_TxCreationKeysDecodeErrorZ) -> CResult_TxCreationKeysDecodeErrorZ { Clone::clone(&orig) }
257 #[repr(C)]
258 /// The contents of CResult_ChannelPublicKeysDecodeErrorZ
259 pub union CResult_ChannelPublicKeysDecodeErrorZPtr {
260         /// A pointer to the contents in the success state.
261         /// Reading from this pointer when `result_ok` is not set is undefined.
262         pub result: *mut crate::lightning::ln::chan_utils::ChannelPublicKeys,
263         /// A pointer to the contents in the error state.
264         /// Reading from this pointer when `result_ok` is set is undefined.
265         pub err: *mut crate::lightning::ln::msgs::DecodeError,
266 }
267 #[repr(C)]
268 /// A CResult_ChannelPublicKeysDecodeErrorZ represents the result of a fallible operation,
269 /// containing a crate::lightning::ln::chan_utils::ChannelPublicKeys on success and a crate::lightning::ln::msgs::DecodeError on failure.
270 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
271 pub struct CResult_ChannelPublicKeysDecodeErrorZ {
272         /// The contents of this CResult_ChannelPublicKeysDecodeErrorZ, accessible via either
273         /// `err` or `result` depending on the state of `result_ok`.
274         pub contents: CResult_ChannelPublicKeysDecodeErrorZPtr,
275         /// Whether this CResult_ChannelPublicKeysDecodeErrorZ represents a success state.
276         pub result_ok: bool,
277 }
278 #[no_mangle]
279 /// Creates a new CResult_ChannelPublicKeysDecodeErrorZ in the success state.
280 pub extern "C" fn CResult_ChannelPublicKeysDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::ChannelPublicKeys) -> CResult_ChannelPublicKeysDecodeErrorZ {
281         CResult_ChannelPublicKeysDecodeErrorZ {
282                 contents: CResult_ChannelPublicKeysDecodeErrorZPtr {
283                         result: Box::into_raw(Box::new(o)),
284                 },
285                 result_ok: true,
286         }
287 }
288 #[no_mangle]
289 /// Creates a new CResult_ChannelPublicKeysDecodeErrorZ in the error state.
290 pub extern "C" fn CResult_ChannelPublicKeysDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelPublicKeysDecodeErrorZ {
291         CResult_ChannelPublicKeysDecodeErrorZ {
292                 contents: CResult_ChannelPublicKeysDecodeErrorZPtr {
293                         err: Box::into_raw(Box::new(e)),
294                 },
295                 result_ok: false,
296         }
297 }
298 #[no_mangle]
299 /// Frees any resources used by the CResult_ChannelPublicKeysDecodeErrorZ.
300 pub extern "C" fn CResult_ChannelPublicKeysDecodeErrorZ_free(_res: CResult_ChannelPublicKeysDecodeErrorZ) { }
301 impl Drop for CResult_ChannelPublicKeysDecodeErrorZ {
302         fn drop(&mut self) {
303                 if self.result_ok {
304                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
305                                 let _ = unsafe { Box::from_raw(self.contents.result) };
306                         }
307                 } else {
308                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
309                                 let _ = unsafe { Box::from_raw(self.contents.err) };
310                         }
311                 }
312         }
313 }
314 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::ChannelPublicKeys, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelPublicKeysDecodeErrorZ {
315         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::ChannelPublicKeys, crate::lightning::ln::msgs::DecodeError>) -> Self {
316                 let contents = if o.result_ok {
317                         let result = unsafe { o.contents.result };
318                         unsafe { o.contents.result = std::ptr::null_mut() };
319                         CResult_ChannelPublicKeysDecodeErrorZPtr { result }
320                 } else {
321                         let err = unsafe { o.contents.err };
322                         unsafe { o.contents.err = std::ptr::null_mut(); }
323                         CResult_ChannelPublicKeysDecodeErrorZPtr { err }
324                 };
325                 Self {
326                         contents,
327                         result_ok: o.result_ok,
328                 }
329         }
330 }
331 impl Clone for CResult_ChannelPublicKeysDecodeErrorZ {
332         fn clone(&self) -> Self {
333                 if self.result_ok {
334                         Self { result_ok: true, contents: CResult_ChannelPublicKeysDecodeErrorZPtr {
335                                 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::ChannelPublicKeys>::clone(unsafe { &*self.contents.result })))
336                         } }
337                 } else {
338                         Self { result_ok: false, contents: CResult_ChannelPublicKeysDecodeErrorZPtr {
339                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
340                         } }
341                 }
342         }
343 }
344 #[no_mangle]
345 /// Creates a new CResult_ChannelPublicKeysDecodeErrorZ which has the same data as `orig`
346 /// but with all dynamically-allocated buffers duplicated in new buffers.
347 pub extern "C" fn CResult_ChannelPublicKeysDecodeErrorZ_clone(orig: &CResult_ChannelPublicKeysDecodeErrorZ) -> CResult_ChannelPublicKeysDecodeErrorZ { Clone::clone(&orig) }
348 #[repr(C)]
349 /// The contents of CResult_TxCreationKeysErrorZ
350 pub union CResult_TxCreationKeysErrorZPtr {
351         /// A pointer to the contents in the success state.
352         /// Reading from this pointer when `result_ok` is not set is undefined.
353         pub result: *mut crate::lightning::ln::chan_utils::TxCreationKeys,
354         /// A pointer to the contents in the error state.
355         /// Reading from this pointer when `result_ok` is set is undefined.
356         pub err: *mut crate::c_types::Secp256k1Error,
357 }
358 #[repr(C)]
359 /// A CResult_TxCreationKeysErrorZ represents the result of a fallible operation,
360 /// containing a crate::lightning::ln::chan_utils::TxCreationKeys on success and a crate::c_types::Secp256k1Error on failure.
361 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
362 pub struct CResult_TxCreationKeysErrorZ {
363         /// The contents of this CResult_TxCreationKeysErrorZ, accessible via either
364         /// `err` or `result` depending on the state of `result_ok`.
365         pub contents: CResult_TxCreationKeysErrorZPtr,
366         /// Whether this CResult_TxCreationKeysErrorZ represents a success state.
367         pub result_ok: bool,
368 }
369 #[no_mangle]
370 /// Creates a new CResult_TxCreationKeysErrorZ in the success state.
371 pub extern "C" fn CResult_TxCreationKeysErrorZ_ok(o: crate::lightning::ln::chan_utils::TxCreationKeys) -> CResult_TxCreationKeysErrorZ {
372         CResult_TxCreationKeysErrorZ {
373                 contents: CResult_TxCreationKeysErrorZPtr {
374                         result: Box::into_raw(Box::new(o)),
375                 },
376                 result_ok: true,
377         }
378 }
379 #[no_mangle]
380 /// Creates a new CResult_TxCreationKeysErrorZ in the error state.
381 pub extern "C" fn CResult_TxCreationKeysErrorZ_err(e: crate::c_types::Secp256k1Error) -> CResult_TxCreationKeysErrorZ {
382         CResult_TxCreationKeysErrorZ {
383                 contents: CResult_TxCreationKeysErrorZPtr {
384                         err: Box::into_raw(Box::new(e)),
385                 },
386                 result_ok: false,
387         }
388 }
389 #[no_mangle]
390 /// Frees any resources used by the CResult_TxCreationKeysErrorZ.
391 pub extern "C" fn CResult_TxCreationKeysErrorZ_free(_res: CResult_TxCreationKeysErrorZ) { }
392 impl Drop for CResult_TxCreationKeysErrorZ {
393         fn drop(&mut self) {
394                 if self.result_ok {
395                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
396                                 let _ = unsafe { Box::from_raw(self.contents.result) };
397                         }
398                 } else {
399                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
400                                 let _ = unsafe { Box::from_raw(self.contents.err) };
401                         }
402                 }
403         }
404 }
405 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::TxCreationKeys, crate::c_types::Secp256k1Error>> for CResult_TxCreationKeysErrorZ {
406         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::TxCreationKeys, crate::c_types::Secp256k1Error>) -> Self {
407                 let contents = if o.result_ok {
408                         let result = unsafe { o.contents.result };
409                         unsafe { o.contents.result = std::ptr::null_mut() };
410                         CResult_TxCreationKeysErrorZPtr { result }
411                 } else {
412                         let err = unsafe { o.contents.err };
413                         unsafe { o.contents.err = std::ptr::null_mut(); }
414                         CResult_TxCreationKeysErrorZPtr { err }
415                 };
416                 Self {
417                         contents,
418                         result_ok: o.result_ok,
419                 }
420         }
421 }
422 impl Clone for CResult_TxCreationKeysErrorZ {
423         fn clone(&self) -> Self {
424                 if self.result_ok {
425                         Self { result_ok: true, contents: CResult_TxCreationKeysErrorZPtr {
426                                 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::TxCreationKeys>::clone(unsafe { &*self.contents.result })))
427                         } }
428                 } else {
429                         Self { result_ok: false, contents: CResult_TxCreationKeysErrorZPtr {
430                                 err: Box::into_raw(Box::new(<crate::c_types::Secp256k1Error>::clone(unsafe { &*self.contents.err })))
431                         } }
432                 }
433         }
434 }
435 #[no_mangle]
436 /// Creates a new CResult_TxCreationKeysErrorZ which has the same data as `orig`
437 /// but with all dynamically-allocated buffers duplicated in new buffers.
438 pub extern "C" fn CResult_TxCreationKeysErrorZ_clone(orig: &CResult_TxCreationKeysErrorZ) -> CResult_TxCreationKeysErrorZ { Clone::clone(&orig) }
439 #[repr(C)]
440 #[derive(Clone)]
441 /// An enum which can either contain a u32 or not
442 pub enum COption_u32Z {
443         /// When we're in this state, this COption_u32Z contains a u32
444         Some(u32),
445         /// When we're in this state, this COption_u32Z contains nothing
446         None
447 }
448 impl COption_u32Z {
449         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
450                 if let Self::Some(_) = self { true } else { false }
451         }
452         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
453                 !self.is_some()
454         }
455         #[allow(unused)] pub(crate) fn take(mut self) -> u32 {
456                 if let Self::Some(v) = self { v } else { unreachable!() }
457         }
458 }
459 #[no_mangle]
460 /// Constructs a new COption_u32Z containing a u32
461 pub extern "C" fn COption_u32Z_some(o: u32) -> COption_u32Z {
462         COption_u32Z::Some(o)
463 }
464 #[no_mangle]
465 /// Constructs a new COption_u32Z containing nothing
466 pub extern "C" fn COption_u32Z_none() -> COption_u32Z {
467         COption_u32Z::None
468 }
469 #[no_mangle]
470 /// Frees any resources associated with the u32, if we are in the Some state
471 pub extern "C" fn COption_u32Z_free(_res: COption_u32Z) { }
472 #[no_mangle]
473 /// Creates a new COption_u32Z which has the same data as `orig`
474 /// but with all dynamically-allocated buffers duplicated in new buffers.
475 pub extern "C" fn COption_u32Z_clone(orig: &COption_u32Z) -> COption_u32Z { Clone::clone(&orig) }
476 #[repr(C)]
477 /// The contents of CResult_HTLCOutputInCommitmentDecodeErrorZ
478 pub union CResult_HTLCOutputInCommitmentDecodeErrorZPtr {
479         /// A pointer to the contents in the success state.
480         /// Reading from this pointer when `result_ok` is not set is undefined.
481         pub result: *mut crate::lightning::ln::chan_utils::HTLCOutputInCommitment,
482         /// A pointer to the contents in the error state.
483         /// Reading from this pointer when `result_ok` is set is undefined.
484         pub err: *mut crate::lightning::ln::msgs::DecodeError,
485 }
486 #[repr(C)]
487 /// A CResult_HTLCOutputInCommitmentDecodeErrorZ represents the result of a fallible operation,
488 /// containing a crate::lightning::ln::chan_utils::HTLCOutputInCommitment on success and a crate::lightning::ln::msgs::DecodeError on failure.
489 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
490 pub struct CResult_HTLCOutputInCommitmentDecodeErrorZ {
491         /// The contents of this CResult_HTLCOutputInCommitmentDecodeErrorZ, accessible via either
492         /// `err` or `result` depending on the state of `result_ok`.
493         pub contents: CResult_HTLCOutputInCommitmentDecodeErrorZPtr,
494         /// Whether this CResult_HTLCOutputInCommitmentDecodeErrorZ represents a success state.
495         pub result_ok: bool,
496 }
497 #[no_mangle]
498 /// Creates a new CResult_HTLCOutputInCommitmentDecodeErrorZ in the success state.
499 pub extern "C" fn CResult_HTLCOutputInCommitmentDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::HTLCOutputInCommitment) -> CResult_HTLCOutputInCommitmentDecodeErrorZ {
500         CResult_HTLCOutputInCommitmentDecodeErrorZ {
501                 contents: CResult_HTLCOutputInCommitmentDecodeErrorZPtr {
502                         result: Box::into_raw(Box::new(o)),
503                 },
504                 result_ok: true,
505         }
506 }
507 #[no_mangle]
508 /// Creates a new CResult_HTLCOutputInCommitmentDecodeErrorZ in the error state.
509 pub extern "C" fn CResult_HTLCOutputInCommitmentDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_HTLCOutputInCommitmentDecodeErrorZ {
510         CResult_HTLCOutputInCommitmentDecodeErrorZ {
511                 contents: CResult_HTLCOutputInCommitmentDecodeErrorZPtr {
512                         err: Box::into_raw(Box::new(e)),
513                 },
514                 result_ok: false,
515         }
516 }
517 #[no_mangle]
518 /// Frees any resources used by the CResult_HTLCOutputInCommitmentDecodeErrorZ.
519 pub extern "C" fn CResult_HTLCOutputInCommitmentDecodeErrorZ_free(_res: CResult_HTLCOutputInCommitmentDecodeErrorZ) { }
520 impl Drop for CResult_HTLCOutputInCommitmentDecodeErrorZ {
521         fn drop(&mut self) {
522                 if self.result_ok {
523                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
524                                 let _ = unsafe { Box::from_raw(self.contents.result) };
525                         }
526                 } else {
527                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
528                                 let _ = unsafe { Box::from_raw(self.contents.err) };
529                         }
530                 }
531         }
532 }
533 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::HTLCOutputInCommitment, crate::lightning::ln::msgs::DecodeError>> for CResult_HTLCOutputInCommitmentDecodeErrorZ {
534         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::HTLCOutputInCommitment, crate::lightning::ln::msgs::DecodeError>) -> Self {
535                 let contents = if o.result_ok {
536                         let result = unsafe { o.contents.result };
537                         unsafe { o.contents.result = std::ptr::null_mut() };
538                         CResult_HTLCOutputInCommitmentDecodeErrorZPtr { result }
539                 } else {
540                         let err = unsafe { o.contents.err };
541                         unsafe { o.contents.err = std::ptr::null_mut(); }
542                         CResult_HTLCOutputInCommitmentDecodeErrorZPtr { err }
543                 };
544                 Self {
545                         contents,
546                         result_ok: o.result_ok,
547                 }
548         }
549 }
550 impl Clone for CResult_HTLCOutputInCommitmentDecodeErrorZ {
551         fn clone(&self) -> Self {
552                 if self.result_ok {
553                         Self { result_ok: true, contents: CResult_HTLCOutputInCommitmentDecodeErrorZPtr {
554                                 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::HTLCOutputInCommitment>::clone(unsafe { &*self.contents.result })))
555                         } }
556                 } else {
557                         Self { result_ok: false, contents: CResult_HTLCOutputInCommitmentDecodeErrorZPtr {
558                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
559                         } }
560                 }
561         }
562 }
563 #[no_mangle]
564 /// Creates a new CResult_HTLCOutputInCommitmentDecodeErrorZ which has the same data as `orig`
565 /// but with all dynamically-allocated buffers duplicated in new buffers.
566 pub extern "C" fn CResult_HTLCOutputInCommitmentDecodeErrorZ_clone(orig: &CResult_HTLCOutputInCommitmentDecodeErrorZ) -> CResult_HTLCOutputInCommitmentDecodeErrorZ { Clone::clone(&orig) }
567 #[repr(C)]
568 /// The contents of CResult_CounterpartyChannelTransactionParametersDecodeErrorZ
569 pub union CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr {
570         /// A pointer to the contents in the success state.
571         /// Reading from this pointer when `result_ok` is not set is undefined.
572         pub result: *mut crate::lightning::ln::chan_utils::CounterpartyChannelTransactionParameters,
573         /// A pointer to the contents in the error state.
574         /// Reading from this pointer when `result_ok` is set is undefined.
575         pub err: *mut crate::lightning::ln::msgs::DecodeError,
576 }
577 #[repr(C)]
578 /// A CResult_CounterpartyChannelTransactionParametersDecodeErrorZ represents the result of a fallible operation,
579 /// containing a crate::lightning::ln::chan_utils::CounterpartyChannelTransactionParameters on success and a crate::lightning::ln::msgs::DecodeError on failure.
580 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
581 pub struct CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
582         /// The contents of this CResult_CounterpartyChannelTransactionParametersDecodeErrorZ, accessible via either
583         /// `err` or `result` depending on the state of `result_ok`.
584         pub contents: CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr,
585         /// Whether this CResult_CounterpartyChannelTransactionParametersDecodeErrorZ represents a success state.
586         pub result_ok: bool,
587 }
588 #[no_mangle]
589 /// Creates a new CResult_CounterpartyChannelTransactionParametersDecodeErrorZ in the success state.
590 pub extern "C" fn CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::CounterpartyChannelTransactionParameters) -> CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
591         CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
592                 contents: CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr {
593                         result: Box::into_raw(Box::new(o)),
594                 },
595                 result_ok: true,
596         }
597 }
598 #[no_mangle]
599 /// Creates a new CResult_CounterpartyChannelTransactionParametersDecodeErrorZ in the error state.
600 pub extern "C" fn CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
601         CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
602                 contents: CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr {
603                         err: Box::into_raw(Box::new(e)),
604                 },
605                 result_ok: false,
606         }
607 }
608 #[no_mangle]
609 /// Frees any resources used by the CResult_CounterpartyChannelTransactionParametersDecodeErrorZ.
610 pub extern "C" fn CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_free(_res: CResult_CounterpartyChannelTransactionParametersDecodeErrorZ) { }
611 impl Drop for CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
612         fn drop(&mut self) {
613                 if self.result_ok {
614                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
615                                 let _ = unsafe { Box::from_raw(self.contents.result) };
616                         }
617                 } else {
618                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
619                                 let _ = unsafe { Box::from_raw(self.contents.err) };
620                         }
621                 }
622         }
623 }
624 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::CounterpartyChannelTransactionParameters, crate::lightning::ln::msgs::DecodeError>> for CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
625         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::CounterpartyChannelTransactionParameters, crate::lightning::ln::msgs::DecodeError>) -> Self {
626                 let contents = if o.result_ok {
627                         let result = unsafe { o.contents.result };
628                         unsafe { o.contents.result = std::ptr::null_mut() };
629                         CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr { result }
630                 } else {
631                         let err = unsafe { o.contents.err };
632                         unsafe { o.contents.err = std::ptr::null_mut(); }
633                         CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr { err }
634                 };
635                 Self {
636                         contents,
637                         result_ok: o.result_ok,
638                 }
639         }
640 }
641 impl Clone for CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
642         fn clone(&self) -> Self {
643                 if self.result_ok {
644                         Self { result_ok: true, contents: CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr {
645                                 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::CounterpartyChannelTransactionParameters>::clone(unsafe { &*self.contents.result })))
646                         } }
647                 } else {
648                         Self { result_ok: false, contents: CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr {
649                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
650                         } }
651                 }
652         }
653 }
654 #[no_mangle]
655 /// Creates a new CResult_CounterpartyChannelTransactionParametersDecodeErrorZ which has the same data as `orig`
656 /// but with all dynamically-allocated buffers duplicated in new buffers.
657 pub extern "C" fn CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone(orig: &CResult_CounterpartyChannelTransactionParametersDecodeErrorZ) -> CResult_CounterpartyChannelTransactionParametersDecodeErrorZ { Clone::clone(&orig) }
658 #[repr(C)]
659 /// The contents of CResult_ChannelTransactionParametersDecodeErrorZ
660 pub union CResult_ChannelTransactionParametersDecodeErrorZPtr {
661         /// A pointer to the contents in the success state.
662         /// Reading from this pointer when `result_ok` is not set is undefined.
663         pub result: *mut crate::lightning::ln::chan_utils::ChannelTransactionParameters,
664         /// A pointer to the contents in the error state.
665         /// Reading from this pointer when `result_ok` is set is undefined.
666         pub err: *mut crate::lightning::ln::msgs::DecodeError,
667 }
668 #[repr(C)]
669 /// A CResult_ChannelTransactionParametersDecodeErrorZ represents the result of a fallible operation,
670 /// containing a crate::lightning::ln::chan_utils::ChannelTransactionParameters on success and a crate::lightning::ln::msgs::DecodeError on failure.
671 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
672 pub struct CResult_ChannelTransactionParametersDecodeErrorZ {
673         /// The contents of this CResult_ChannelTransactionParametersDecodeErrorZ, accessible via either
674         /// `err` or `result` depending on the state of `result_ok`.
675         pub contents: CResult_ChannelTransactionParametersDecodeErrorZPtr,
676         /// Whether this CResult_ChannelTransactionParametersDecodeErrorZ represents a success state.
677         pub result_ok: bool,
678 }
679 #[no_mangle]
680 /// Creates a new CResult_ChannelTransactionParametersDecodeErrorZ in the success state.
681 pub extern "C" fn CResult_ChannelTransactionParametersDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::ChannelTransactionParameters) -> CResult_ChannelTransactionParametersDecodeErrorZ {
682         CResult_ChannelTransactionParametersDecodeErrorZ {
683                 contents: CResult_ChannelTransactionParametersDecodeErrorZPtr {
684                         result: Box::into_raw(Box::new(o)),
685                 },
686                 result_ok: true,
687         }
688 }
689 #[no_mangle]
690 /// Creates a new CResult_ChannelTransactionParametersDecodeErrorZ in the error state.
691 pub extern "C" fn CResult_ChannelTransactionParametersDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelTransactionParametersDecodeErrorZ {
692         CResult_ChannelTransactionParametersDecodeErrorZ {
693                 contents: CResult_ChannelTransactionParametersDecodeErrorZPtr {
694                         err: Box::into_raw(Box::new(e)),
695                 },
696                 result_ok: false,
697         }
698 }
699 #[no_mangle]
700 /// Frees any resources used by the CResult_ChannelTransactionParametersDecodeErrorZ.
701 pub extern "C" fn CResult_ChannelTransactionParametersDecodeErrorZ_free(_res: CResult_ChannelTransactionParametersDecodeErrorZ) { }
702 impl Drop for CResult_ChannelTransactionParametersDecodeErrorZ {
703         fn drop(&mut self) {
704                 if self.result_ok {
705                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
706                                 let _ = unsafe { Box::from_raw(self.contents.result) };
707                         }
708                 } else {
709                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
710                                 let _ = unsafe { Box::from_raw(self.contents.err) };
711                         }
712                 }
713         }
714 }
715 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::ChannelTransactionParameters, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelTransactionParametersDecodeErrorZ {
716         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::ChannelTransactionParameters, crate::lightning::ln::msgs::DecodeError>) -> Self {
717                 let contents = if o.result_ok {
718                         let result = unsafe { o.contents.result };
719                         unsafe { o.contents.result = std::ptr::null_mut() };
720                         CResult_ChannelTransactionParametersDecodeErrorZPtr { result }
721                 } else {
722                         let err = unsafe { o.contents.err };
723                         unsafe { o.contents.err = std::ptr::null_mut(); }
724                         CResult_ChannelTransactionParametersDecodeErrorZPtr { err }
725                 };
726                 Self {
727                         contents,
728                         result_ok: o.result_ok,
729                 }
730         }
731 }
732 impl Clone for CResult_ChannelTransactionParametersDecodeErrorZ {
733         fn clone(&self) -> Self {
734                 if self.result_ok {
735                         Self { result_ok: true, contents: CResult_ChannelTransactionParametersDecodeErrorZPtr {
736                                 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::ChannelTransactionParameters>::clone(unsafe { &*self.contents.result })))
737                         } }
738                 } else {
739                         Self { result_ok: false, contents: CResult_ChannelTransactionParametersDecodeErrorZPtr {
740                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
741                         } }
742                 }
743         }
744 }
745 #[no_mangle]
746 /// Creates a new CResult_ChannelTransactionParametersDecodeErrorZ which has the same data as `orig`
747 /// but with all dynamically-allocated buffers duplicated in new buffers.
748 pub extern "C" fn CResult_ChannelTransactionParametersDecodeErrorZ_clone(orig: &CResult_ChannelTransactionParametersDecodeErrorZ) -> CResult_ChannelTransactionParametersDecodeErrorZ { Clone::clone(&orig) }
749 #[repr(C)]
750 /// A dynamically-allocated array of crate::c_types::Signatures of arbitrary size.
751 /// This corresponds to std::vector in C++
752 pub struct CVec_SignatureZ {
753         /// The elements in the array.
754         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
755         pub data: *mut crate::c_types::Signature,
756         /// The number of elements pointed to by `data`.
757         pub datalen: usize
758 }
759 impl CVec_SignatureZ {
760         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::Signature> {
761                 if self.datalen == 0 { return Vec::new(); }
762                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
763                 self.data = std::ptr::null_mut();
764                 self.datalen = 0;
765                 ret
766         }
767         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::Signature] {
768                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
769         }
770 }
771 impl From<Vec<crate::c_types::Signature>> for CVec_SignatureZ {
772         fn from(v: Vec<crate::c_types::Signature>) -> Self {
773                 let datalen = v.len();
774                 let data = Box::into_raw(v.into_boxed_slice());
775                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
776         }
777 }
778 #[no_mangle]
779 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
780 pub extern "C" fn CVec_SignatureZ_free(_res: CVec_SignatureZ) { }
781 impl Drop for CVec_SignatureZ {
782         fn drop(&mut self) {
783                 if self.datalen == 0 { return; }
784                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
785         }
786 }
787 impl Clone for CVec_SignatureZ {
788         fn clone(&self) -> Self {
789                 let mut res = Vec::new();
790                 if self.datalen == 0 { return Self::from(res); }
791                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
792                 Self::from(res)
793         }
794 }
795 #[repr(C)]
796 /// The contents of CResult_HolderCommitmentTransactionDecodeErrorZ
797 pub union CResult_HolderCommitmentTransactionDecodeErrorZPtr {
798         /// A pointer to the contents in the success state.
799         /// Reading from this pointer when `result_ok` is not set is undefined.
800         pub result: *mut crate::lightning::ln::chan_utils::HolderCommitmentTransaction,
801         /// A pointer to the contents in the error state.
802         /// Reading from this pointer when `result_ok` is set is undefined.
803         pub err: *mut crate::lightning::ln::msgs::DecodeError,
804 }
805 #[repr(C)]
806 /// A CResult_HolderCommitmentTransactionDecodeErrorZ represents the result of a fallible operation,
807 /// containing a crate::lightning::ln::chan_utils::HolderCommitmentTransaction on success and a crate::lightning::ln::msgs::DecodeError on failure.
808 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
809 pub struct CResult_HolderCommitmentTransactionDecodeErrorZ {
810         /// The contents of this CResult_HolderCommitmentTransactionDecodeErrorZ, accessible via either
811         /// `err` or `result` depending on the state of `result_ok`.
812         pub contents: CResult_HolderCommitmentTransactionDecodeErrorZPtr,
813         /// Whether this CResult_HolderCommitmentTransactionDecodeErrorZ represents a success state.
814         pub result_ok: bool,
815 }
816 #[no_mangle]
817 /// Creates a new CResult_HolderCommitmentTransactionDecodeErrorZ in the success state.
818 pub extern "C" fn CResult_HolderCommitmentTransactionDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::HolderCommitmentTransaction) -> CResult_HolderCommitmentTransactionDecodeErrorZ {
819         CResult_HolderCommitmentTransactionDecodeErrorZ {
820                 contents: CResult_HolderCommitmentTransactionDecodeErrorZPtr {
821                         result: Box::into_raw(Box::new(o)),
822                 },
823                 result_ok: true,
824         }
825 }
826 #[no_mangle]
827 /// Creates a new CResult_HolderCommitmentTransactionDecodeErrorZ in the error state.
828 pub extern "C" fn CResult_HolderCommitmentTransactionDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_HolderCommitmentTransactionDecodeErrorZ {
829         CResult_HolderCommitmentTransactionDecodeErrorZ {
830                 contents: CResult_HolderCommitmentTransactionDecodeErrorZPtr {
831                         err: Box::into_raw(Box::new(e)),
832                 },
833                 result_ok: false,
834         }
835 }
836 #[no_mangle]
837 /// Frees any resources used by the CResult_HolderCommitmentTransactionDecodeErrorZ.
838 pub extern "C" fn CResult_HolderCommitmentTransactionDecodeErrorZ_free(_res: CResult_HolderCommitmentTransactionDecodeErrorZ) { }
839 impl Drop for CResult_HolderCommitmentTransactionDecodeErrorZ {
840         fn drop(&mut self) {
841                 if self.result_ok {
842                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
843                                 let _ = unsafe { Box::from_raw(self.contents.result) };
844                         }
845                 } else {
846                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
847                                 let _ = unsafe { Box::from_raw(self.contents.err) };
848                         }
849                 }
850         }
851 }
852 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::HolderCommitmentTransaction, crate::lightning::ln::msgs::DecodeError>> for CResult_HolderCommitmentTransactionDecodeErrorZ {
853         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::HolderCommitmentTransaction, crate::lightning::ln::msgs::DecodeError>) -> Self {
854                 let contents = if o.result_ok {
855                         let result = unsafe { o.contents.result };
856                         unsafe { o.contents.result = std::ptr::null_mut() };
857                         CResult_HolderCommitmentTransactionDecodeErrorZPtr { result }
858                 } else {
859                         let err = unsafe { o.contents.err };
860                         unsafe { o.contents.err = std::ptr::null_mut(); }
861                         CResult_HolderCommitmentTransactionDecodeErrorZPtr { err }
862                 };
863                 Self {
864                         contents,
865                         result_ok: o.result_ok,
866                 }
867         }
868 }
869 impl Clone for CResult_HolderCommitmentTransactionDecodeErrorZ {
870         fn clone(&self) -> Self {
871                 if self.result_ok {
872                         Self { result_ok: true, contents: CResult_HolderCommitmentTransactionDecodeErrorZPtr {
873                                 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::HolderCommitmentTransaction>::clone(unsafe { &*self.contents.result })))
874                         } }
875                 } else {
876                         Self { result_ok: false, contents: CResult_HolderCommitmentTransactionDecodeErrorZPtr {
877                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
878                         } }
879                 }
880         }
881 }
882 #[no_mangle]
883 /// Creates a new CResult_HolderCommitmentTransactionDecodeErrorZ which has the same data as `orig`
884 /// but with all dynamically-allocated buffers duplicated in new buffers.
885 pub extern "C" fn CResult_HolderCommitmentTransactionDecodeErrorZ_clone(orig: &CResult_HolderCommitmentTransactionDecodeErrorZ) -> CResult_HolderCommitmentTransactionDecodeErrorZ { Clone::clone(&orig) }
886 #[repr(C)]
887 /// The contents of CResult_BuiltCommitmentTransactionDecodeErrorZ
888 pub union CResult_BuiltCommitmentTransactionDecodeErrorZPtr {
889         /// A pointer to the contents in the success state.
890         /// Reading from this pointer when `result_ok` is not set is undefined.
891         pub result: *mut crate::lightning::ln::chan_utils::BuiltCommitmentTransaction,
892         /// A pointer to the contents in the error state.
893         /// Reading from this pointer when `result_ok` is set is undefined.
894         pub err: *mut crate::lightning::ln::msgs::DecodeError,
895 }
896 #[repr(C)]
897 /// A CResult_BuiltCommitmentTransactionDecodeErrorZ represents the result of a fallible operation,
898 /// containing a crate::lightning::ln::chan_utils::BuiltCommitmentTransaction on success and a crate::lightning::ln::msgs::DecodeError on failure.
899 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
900 pub struct CResult_BuiltCommitmentTransactionDecodeErrorZ {
901         /// The contents of this CResult_BuiltCommitmentTransactionDecodeErrorZ, accessible via either
902         /// `err` or `result` depending on the state of `result_ok`.
903         pub contents: CResult_BuiltCommitmentTransactionDecodeErrorZPtr,
904         /// Whether this CResult_BuiltCommitmentTransactionDecodeErrorZ represents a success state.
905         pub result_ok: bool,
906 }
907 #[no_mangle]
908 /// Creates a new CResult_BuiltCommitmentTransactionDecodeErrorZ in the success state.
909 pub extern "C" fn CResult_BuiltCommitmentTransactionDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::BuiltCommitmentTransaction) -> CResult_BuiltCommitmentTransactionDecodeErrorZ {
910         CResult_BuiltCommitmentTransactionDecodeErrorZ {
911                 contents: CResult_BuiltCommitmentTransactionDecodeErrorZPtr {
912                         result: Box::into_raw(Box::new(o)),
913                 },
914                 result_ok: true,
915         }
916 }
917 #[no_mangle]
918 /// Creates a new CResult_BuiltCommitmentTransactionDecodeErrorZ in the error state.
919 pub extern "C" fn CResult_BuiltCommitmentTransactionDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_BuiltCommitmentTransactionDecodeErrorZ {
920         CResult_BuiltCommitmentTransactionDecodeErrorZ {
921                 contents: CResult_BuiltCommitmentTransactionDecodeErrorZPtr {
922                         err: Box::into_raw(Box::new(e)),
923                 },
924                 result_ok: false,
925         }
926 }
927 #[no_mangle]
928 /// Frees any resources used by the CResult_BuiltCommitmentTransactionDecodeErrorZ.
929 pub extern "C" fn CResult_BuiltCommitmentTransactionDecodeErrorZ_free(_res: CResult_BuiltCommitmentTransactionDecodeErrorZ) { }
930 impl Drop for CResult_BuiltCommitmentTransactionDecodeErrorZ {
931         fn drop(&mut self) {
932                 if self.result_ok {
933                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
934                                 let _ = unsafe { Box::from_raw(self.contents.result) };
935                         }
936                 } else {
937                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
938                                 let _ = unsafe { Box::from_raw(self.contents.err) };
939                         }
940                 }
941         }
942 }
943 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::BuiltCommitmentTransaction, crate::lightning::ln::msgs::DecodeError>> for CResult_BuiltCommitmentTransactionDecodeErrorZ {
944         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::BuiltCommitmentTransaction, crate::lightning::ln::msgs::DecodeError>) -> Self {
945                 let contents = if o.result_ok {
946                         let result = unsafe { o.contents.result };
947                         unsafe { o.contents.result = std::ptr::null_mut() };
948                         CResult_BuiltCommitmentTransactionDecodeErrorZPtr { result }
949                 } else {
950                         let err = unsafe { o.contents.err };
951                         unsafe { o.contents.err = std::ptr::null_mut(); }
952                         CResult_BuiltCommitmentTransactionDecodeErrorZPtr { err }
953                 };
954                 Self {
955                         contents,
956                         result_ok: o.result_ok,
957                 }
958         }
959 }
960 impl Clone for CResult_BuiltCommitmentTransactionDecodeErrorZ {
961         fn clone(&self) -> Self {
962                 if self.result_ok {
963                         Self { result_ok: true, contents: CResult_BuiltCommitmentTransactionDecodeErrorZPtr {
964                                 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::BuiltCommitmentTransaction>::clone(unsafe { &*self.contents.result })))
965                         } }
966                 } else {
967                         Self { result_ok: false, contents: CResult_BuiltCommitmentTransactionDecodeErrorZPtr {
968                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
969                         } }
970                 }
971         }
972 }
973 #[no_mangle]
974 /// Creates a new CResult_BuiltCommitmentTransactionDecodeErrorZ which has the same data as `orig`
975 /// but with all dynamically-allocated buffers duplicated in new buffers.
976 pub extern "C" fn CResult_BuiltCommitmentTransactionDecodeErrorZ_clone(orig: &CResult_BuiltCommitmentTransactionDecodeErrorZ) -> CResult_BuiltCommitmentTransactionDecodeErrorZ { Clone::clone(&orig) }
977 #[repr(C)]
978 /// The contents of CResult_TrustedClosingTransactionNoneZ
979 pub union CResult_TrustedClosingTransactionNoneZPtr {
980         /// A pointer to the contents in the success state.
981         /// Reading from this pointer when `result_ok` is not set is undefined.
982         pub result: *mut crate::lightning::ln::chan_utils::TrustedClosingTransaction,
983         /// Note that this value is always NULL, as there are no contents in the Err variant
984         pub err: *mut std::ffi::c_void,
985 }
986 #[repr(C)]
987 /// A CResult_TrustedClosingTransactionNoneZ represents the result of a fallible operation,
988 /// containing a crate::lightning::ln::chan_utils::TrustedClosingTransaction on success and a () on failure.
989 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
990 pub struct CResult_TrustedClosingTransactionNoneZ {
991         /// The contents of this CResult_TrustedClosingTransactionNoneZ, accessible via either
992         /// `err` or `result` depending on the state of `result_ok`.
993         pub contents: CResult_TrustedClosingTransactionNoneZPtr,
994         /// Whether this CResult_TrustedClosingTransactionNoneZ represents a success state.
995         pub result_ok: bool,
996 }
997 #[no_mangle]
998 /// Creates a new CResult_TrustedClosingTransactionNoneZ in the success state.
999 pub extern "C" fn CResult_TrustedClosingTransactionNoneZ_ok(o: crate::lightning::ln::chan_utils::TrustedClosingTransaction) -> CResult_TrustedClosingTransactionNoneZ {
1000         CResult_TrustedClosingTransactionNoneZ {
1001                 contents: CResult_TrustedClosingTransactionNoneZPtr {
1002                         result: Box::into_raw(Box::new(o)),
1003                 },
1004                 result_ok: true,
1005         }
1006 }
1007 #[no_mangle]
1008 /// Creates a new CResult_TrustedClosingTransactionNoneZ in the error state.
1009 pub extern "C" fn CResult_TrustedClosingTransactionNoneZ_err() -> CResult_TrustedClosingTransactionNoneZ {
1010         CResult_TrustedClosingTransactionNoneZ {
1011                 contents: CResult_TrustedClosingTransactionNoneZPtr {
1012                         err: std::ptr::null_mut(),
1013                 },
1014                 result_ok: false,
1015         }
1016 }
1017 #[no_mangle]
1018 /// Frees any resources used by the CResult_TrustedClosingTransactionNoneZ.
1019 pub extern "C" fn CResult_TrustedClosingTransactionNoneZ_free(_res: CResult_TrustedClosingTransactionNoneZ) { }
1020 impl Drop for CResult_TrustedClosingTransactionNoneZ {
1021         fn drop(&mut self) {
1022                 if self.result_ok {
1023                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
1024                                 let _ = unsafe { Box::from_raw(self.contents.result) };
1025                         }
1026                 } else {
1027                 }
1028         }
1029 }
1030 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::TrustedClosingTransaction, ()>> for CResult_TrustedClosingTransactionNoneZ {
1031         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::TrustedClosingTransaction, ()>) -> Self {
1032                 let contents = if o.result_ok {
1033                         let result = unsafe { o.contents.result };
1034                         unsafe { o.contents.result = std::ptr::null_mut() };
1035                         CResult_TrustedClosingTransactionNoneZPtr { result }
1036                 } else {
1037                         let _ = unsafe { Box::from_raw(o.contents.err) };
1038                         o.contents.err = std::ptr::null_mut();
1039                         CResult_TrustedClosingTransactionNoneZPtr { err: std::ptr::null_mut() }
1040                 };
1041                 Self {
1042                         contents,
1043                         result_ok: o.result_ok,
1044                 }
1045         }
1046 }
1047 #[repr(C)]
1048 /// The contents of CResult_CommitmentTransactionDecodeErrorZ
1049 pub union CResult_CommitmentTransactionDecodeErrorZPtr {
1050         /// A pointer to the contents in the success state.
1051         /// Reading from this pointer when `result_ok` is not set is undefined.
1052         pub result: *mut crate::lightning::ln::chan_utils::CommitmentTransaction,
1053         /// A pointer to the contents in the error state.
1054         /// Reading from this pointer when `result_ok` is set is undefined.
1055         pub err: *mut crate::lightning::ln::msgs::DecodeError,
1056 }
1057 #[repr(C)]
1058 /// A CResult_CommitmentTransactionDecodeErrorZ represents the result of a fallible operation,
1059 /// containing a crate::lightning::ln::chan_utils::CommitmentTransaction on success and a crate::lightning::ln::msgs::DecodeError on failure.
1060 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1061 pub struct CResult_CommitmentTransactionDecodeErrorZ {
1062         /// The contents of this CResult_CommitmentTransactionDecodeErrorZ, accessible via either
1063         /// `err` or `result` depending on the state of `result_ok`.
1064         pub contents: CResult_CommitmentTransactionDecodeErrorZPtr,
1065         /// Whether this CResult_CommitmentTransactionDecodeErrorZ represents a success state.
1066         pub result_ok: bool,
1067 }
1068 #[no_mangle]
1069 /// Creates a new CResult_CommitmentTransactionDecodeErrorZ in the success state.
1070 pub extern "C" fn CResult_CommitmentTransactionDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::CommitmentTransaction) -> CResult_CommitmentTransactionDecodeErrorZ {
1071         CResult_CommitmentTransactionDecodeErrorZ {
1072                 contents: CResult_CommitmentTransactionDecodeErrorZPtr {
1073                         result: Box::into_raw(Box::new(o)),
1074                 },
1075                 result_ok: true,
1076         }
1077 }
1078 #[no_mangle]
1079 /// Creates a new CResult_CommitmentTransactionDecodeErrorZ in the error state.
1080 pub extern "C" fn CResult_CommitmentTransactionDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_CommitmentTransactionDecodeErrorZ {
1081         CResult_CommitmentTransactionDecodeErrorZ {
1082                 contents: CResult_CommitmentTransactionDecodeErrorZPtr {
1083                         err: Box::into_raw(Box::new(e)),
1084                 },
1085                 result_ok: false,
1086         }
1087 }
1088 #[no_mangle]
1089 /// Frees any resources used by the CResult_CommitmentTransactionDecodeErrorZ.
1090 pub extern "C" fn CResult_CommitmentTransactionDecodeErrorZ_free(_res: CResult_CommitmentTransactionDecodeErrorZ) { }
1091 impl Drop for CResult_CommitmentTransactionDecodeErrorZ {
1092         fn drop(&mut self) {
1093                 if self.result_ok {
1094                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
1095                                 let _ = unsafe { Box::from_raw(self.contents.result) };
1096                         }
1097                 } else {
1098                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
1099                                 let _ = unsafe { Box::from_raw(self.contents.err) };
1100                         }
1101                 }
1102         }
1103 }
1104 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::CommitmentTransaction, crate::lightning::ln::msgs::DecodeError>> for CResult_CommitmentTransactionDecodeErrorZ {
1105         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::CommitmentTransaction, crate::lightning::ln::msgs::DecodeError>) -> Self {
1106                 let contents = if o.result_ok {
1107                         let result = unsafe { o.contents.result };
1108                         unsafe { o.contents.result = std::ptr::null_mut() };
1109                         CResult_CommitmentTransactionDecodeErrorZPtr { result }
1110                 } else {
1111                         let err = unsafe { o.contents.err };
1112                         unsafe { o.contents.err = std::ptr::null_mut(); }
1113                         CResult_CommitmentTransactionDecodeErrorZPtr { err }
1114                 };
1115                 Self {
1116                         contents,
1117                         result_ok: o.result_ok,
1118                 }
1119         }
1120 }
1121 impl Clone for CResult_CommitmentTransactionDecodeErrorZ {
1122         fn clone(&self) -> Self {
1123                 if self.result_ok {
1124                         Self { result_ok: true, contents: CResult_CommitmentTransactionDecodeErrorZPtr {
1125                                 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::CommitmentTransaction>::clone(unsafe { &*self.contents.result })))
1126                         } }
1127                 } else {
1128                         Self { result_ok: false, contents: CResult_CommitmentTransactionDecodeErrorZPtr {
1129                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
1130                         } }
1131                 }
1132         }
1133 }
1134 #[no_mangle]
1135 /// Creates a new CResult_CommitmentTransactionDecodeErrorZ which has the same data as `orig`
1136 /// but with all dynamically-allocated buffers duplicated in new buffers.
1137 pub extern "C" fn CResult_CommitmentTransactionDecodeErrorZ_clone(orig: &CResult_CommitmentTransactionDecodeErrorZ) -> CResult_CommitmentTransactionDecodeErrorZ { Clone::clone(&orig) }
1138 #[repr(C)]
1139 /// The contents of CResult_TrustedCommitmentTransactionNoneZ
1140 pub union CResult_TrustedCommitmentTransactionNoneZPtr {
1141         /// A pointer to the contents in the success state.
1142         /// Reading from this pointer when `result_ok` is not set is undefined.
1143         pub result: *mut crate::lightning::ln::chan_utils::TrustedCommitmentTransaction,
1144         /// Note that this value is always NULL, as there are no contents in the Err variant
1145         pub err: *mut std::ffi::c_void,
1146 }
1147 #[repr(C)]
1148 /// A CResult_TrustedCommitmentTransactionNoneZ represents the result of a fallible operation,
1149 /// containing a crate::lightning::ln::chan_utils::TrustedCommitmentTransaction on success and a () on failure.
1150 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1151 pub struct CResult_TrustedCommitmentTransactionNoneZ {
1152         /// The contents of this CResult_TrustedCommitmentTransactionNoneZ, accessible via either
1153         /// `err` or `result` depending on the state of `result_ok`.
1154         pub contents: CResult_TrustedCommitmentTransactionNoneZPtr,
1155         /// Whether this CResult_TrustedCommitmentTransactionNoneZ represents a success state.
1156         pub result_ok: bool,
1157 }
1158 #[no_mangle]
1159 /// Creates a new CResult_TrustedCommitmentTransactionNoneZ in the success state.
1160 pub extern "C" fn CResult_TrustedCommitmentTransactionNoneZ_ok(o: crate::lightning::ln::chan_utils::TrustedCommitmentTransaction) -> CResult_TrustedCommitmentTransactionNoneZ {
1161         CResult_TrustedCommitmentTransactionNoneZ {
1162                 contents: CResult_TrustedCommitmentTransactionNoneZPtr {
1163                         result: Box::into_raw(Box::new(o)),
1164                 },
1165                 result_ok: true,
1166         }
1167 }
1168 #[no_mangle]
1169 /// Creates a new CResult_TrustedCommitmentTransactionNoneZ in the error state.
1170 pub extern "C" fn CResult_TrustedCommitmentTransactionNoneZ_err() -> CResult_TrustedCommitmentTransactionNoneZ {
1171         CResult_TrustedCommitmentTransactionNoneZ {
1172                 contents: CResult_TrustedCommitmentTransactionNoneZPtr {
1173                         err: std::ptr::null_mut(),
1174                 },
1175                 result_ok: false,
1176         }
1177 }
1178 #[no_mangle]
1179 /// Frees any resources used by the CResult_TrustedCommitmentTransactionNoneZ.
1180 pub extern "C" fn CResult_TrustedCommitmentTransactionNoneZ_free(_res: CResult_TrustedCommitmentTransactionNoneZ) { }
1181 impl Drop for CResult_TrustedCommitmentTransactionNoneZ {
1182         fn drop(&mut self) {
1183                 if self.result_ok {
1184                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
1185                                 let _ = unsafe { Box::from_raw(self.contents.result) };
1186                         }
1187                 } else {
1188                 }
1189         }
1190 }
1191 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::TrustedCommitmentTransaction, ()>> for CResult_TrustedCommitmentTransactionNoneZ {
1192         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::TrustedCommitmentTransaction, ()>) -> Self {
1193                 let contents = if o.result_ok {
1194                         let result = unsafe { o.contents.result };
1195                         unsafe { o.contents.result = std::ptr::null_mut() };
1196                         CResult_TrustedCommitmentTransactionNoneZPtr { result }
1197                 } else {
1198                         let _ = unsafe { Box::from_raw(o.contents.err) };
1199                         o.contents.err = std::ptr::null_mut();
1200                         CResult_TrustedCommitmentTransactionNoneZPtr { err: std::ptr::null_mut() }
1201                 };
1202                 Self {
1203                         contents,
1204                         result_ok: o.result_ok,
1205                 }
1206         }
1207 }
1208 #[repr(C)]
1209 /// The contents of CResult_CVec_SignatureZNoneZ
1210 pub union CResult_CVec_SignatureZNoneZPtr {
1211         /// A pointer to the contents in the success state.
1212         /// Reading from this pointer when `result_ok` is not set is undefined.
1213         pub result: *mut crate::c_types::derived::CVec_SignatureZ,
1214         /// Note that this value is always NULL, as there are no contents in the Err variant
1215         pub err: *mut std::ffi::c_void,
1216 }
1217 #[repr(C)]
1218 /// A CResult_CVec_SignatureZNoneZ represents the result of a fallible operation,
1219 /// containing a crate::c_types::derived::CVec_SignatureZ on success and a () on failure.
1220 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1221 pub struct CResult_CVec_SignatureZNoneZ {
1222         /// The contents of this CResult_CVec_SignatureZNoneZ, accessible via either
1223         /// `err` or `result` depending on the state of `result_ok`.
1224         pub contents: CResult_CVec_SignatureZNoneZPtr,
1225         /// Whether this CResult_CVec_SignatureZNoneZ represents a success state.
1226         pub result_ok: bool,
1227 }
1228 #[no_mangle]
1229 /// Creates a new CResult_CVec_SignatureZNoneZ in the success state.
1230 pub extern "C" fn CResult_CVec_SignatureZNoneZ_ok(o: crate::c_types::derived::CVec_SignatureZ) -> CResult_CVec_SignatureZNoneZ {
1231         CResult_CVec_SignatureZNoneZ {
1232                 contents: CResult_CVec_SignatureZNoneZPtr {
1233                         result: Box::into_raw(Box::new(o)),
1234                 },
1235                 result_ok: true,
1236         }
1237 }
1238 #[no_mangle]
1239 /// Creates a new CResult_CVec_SignatureZNoneZ in the error state.
1240 pub extern "C" fn CResult_CVec_SignatureZNoneZ_err() -> CResult_CVec_SignatureZNoneZ {
1241         CResult_CVec_SignatureZNoneZ {
1242                 contents: CResult_CVec_SignatureZNoneZPtr {
1243                         err: std::ptr::null_mut(),
1244                 },
1245                 result_ok: false,
1246         }
1247 }
1248 #[no_mangle]
1249 /// Frees any resources used by the CResult_CVec_SignatureZNoneZ.
1250 pub extern "C" fn CResult_CVec_SignatureZNoneZ_free(_res: CResult_CVec_SignatureZNoneZ) { }
1251 impl Drop for CResult_CVec_SignatureZNoneZ {
1252         fn drop(&mut self) {
1253                 if self.result_ok {
1254                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
1255                                 let _ = unsafe { Box::from_raw(self.contents.result) };
1256                         }
1257                 } else {
1258                 }
1259         }
1260 }
1261 impl From<crate::c_types::CResultTempl<crate::c_types::derived::CVec_SignatureZ, ()>> for CResult_CVec_SignatureZNoneZ {
1262         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CVec_SignatureZ, ()>) -> Self {
1263                 let contents = if o.result_ok {
1264                         let result = unsafe { o.contents.result };
1265                         unsafe { o.contents.result = std::ptr::null_mut() };
1266                         CResult_CVec_SignatureZNoneZPtr { result }
1267                 } else {
1268                         let _ = unsafe { Box::from_raw(o.contents.err) };
1269                         o.contents.err = std::ptr::null_mut();
1270                         CResult_CVec_SignatureZNoneZPtr { err: std::ptr::null_mut() }
1271                 };
1272                 Self {
1273                         contents,
1274                         result_ok: o.result_ok,
1275                 }
1276         }
1277 }
1278 impl Clone for CResult_CVec_SignatureZNoneZ {
1279         fn clone(&self) -> Self {
1280                 if self.result_ok {
1281                         Self { result_ok: true, contents: CResult_CVec_SignatureZNoneZPtr {
1282                                 result: Box::into_raw(Box::new(<crate::c_types::derived::CVec_SignatureZ>::clone(unsafe { &*self.contents.result })))
1283                         } }
1284                 } else {
1285                         Self { result_ok: false, contents: CResult_CVec_SignatureZNoneZPtr {
1286                                 err: std::ptr::null_mut()
1287                         } }
1288                 }
1289         }
1290 }
1291 #[no_mangle]
1292 /// Creates a new CResult_CVec_SignatureZNoneZ which has the same data as `orig`
1293 /// but with all dynamically-allocated buffers duplicated in new buffers.
1294 pub extern "C" fn CResult_CVec_SignatureZNoneZ_clone(orig: &CResult_CVec_SignatureZNoneZ) -> CResult_CVec_SignatureZNoneZ { Clone::clone(&orig) }
1295 #[repr(C)]
1296 /// The contents of CResult_ShutdownScriptDecodeErrorZ
1297 pub union CResult_ShutdownScriptDecodeErrorZPtr {
1298         /// A pointer to the contents in the success state.
1299         /// Reading from this pointer when `result_ok` is not set is undefined.
1300         pub result: *mut crate::lightning::ln::script::ShutdownScript,
1301         /// A pointer to the contents in the error state.
1302         /// Reading from this pointer when `result_ok` is set is undefined.
1303         pub err: *mut crate::lightning::ln::msgs::DecodeError,
1304 }
1305 #[repr(C)]
1306 /// A CResult_ShutdownScriptDecodeErrorZ represents the result of a fallible operation,
1307 /// containing a crate::lightning::ln::script::ShutdownScript on success and a crate::lightning::ln::msgs::DecodeError on failure.
1308 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1309 pub struct CResult_ShutdownScriptDecodeErrorZ {
1310         /// The contents of this CResult_ShutdownScriptDecodeErrorZ, accessible via either
1311         /// `err` or `result` depending on the state of `result_ok`.
1312         pub contents: CResult_ShutdownScriptDecodeErrorZPtr,
1313         /// Whether this CResult_ShutdownScriptDecodeErrorZ represents a success state.
1314         pub result_ok: bool,
1315 }
1316 #[no_mangle]
1317 /// Creates a new CResult_ShutdownScriptDecodeErrorZ in the success state.
1318 pub extern "C" fn CResult_ShutdownScriptDecodeErrorZ_ok(o: crate::lightning::ln::script::ShutdownScript) -> CResult_ShutdownScriptDecodeErrorZ {
1319         CResult_ShutdownScriptDecodeErrorZ {
1320                 contents: CResult_ShutdownScriptDecodeErrorZPtr {
1321                         result: Box::into_raw(Box::new(o)),
1322                 },
1323                 result_ok: true,
1324         }
1325 }
1326 #[no_mangle]
1327 /// Creates a new CResult_ShutdownScriptDecodeErrorZ in the error state.
1328 pub extern "C" fn CResult_ShutdownScriptDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ShutdownScriptDecodeErrorZ {
1329         CResult_ShutdownScriptDecodeErrorZ {
1330                 contents: CResult_ShutdownScriptDecodeErrorZPtr {
1331                         err: Box::into_raw(Box::new(e)),
1332                 },
1333                 result_ok: false,
1334         }
1335 }
1336 #[no_mangle]
1337 /// Frees any resources used by the CResult_ShutdownScriptDecodeErrorZ.
1338 pub extern "C" fn CResult_ShutdownScriptDecodeErrorZ_free(_res: CResult_ShutdownScriptDecodeErrorZ) { }
1339 impl Drop for CResult_ShutdownScriptDecodeErrorZ {
1340         fn drop(&mut self) {
1341                 if self.result_ok {
1342                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
1343                                 let _ = unsafe { Box::from_raw(self.contents.result) };
1344                         }
1345                 } else {
1346                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
1347                                 let _ = unsafe { Box::from_raw(self.contents.err) };
1348                         }
1349                 }
1350         }
1351 }
1352 impl From<crate::c_types::CResultTempl<crate::lightning::ln::script::ShutdownScript, crate::lightning::ln::msgs::DecodeError>> for CResult_ShutdownScriptDecodeErrorZ {
1353         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::script::ShutdownScript, crate::lightning::ln::msgs::DecodeError>) -> Self {
1354                 let contents = if o.result_ok {
1355                         let result = unsafe { o.contents.result };
1356                         unsafe { o.contents.result = std::ptr::null_mut() };
1357                         CResult_ShutdownScriptDecodeErrorZPtr { result }
1358                 } else {
1359                         let err = unsafe { o.contents.err };
1360                         unsafe { o.contents.err = std::ptr::null_mut(); }
1361                         CResult_ShutdownScriptDecodeErrorZPtr { err }
1362                 };
1363                 Self {
1364                         contents,
1365                         result_ok: o.result_ok,
1366                 }
1367         }
1368 }
1369 impl Clone for CResult_ShutdownScriptDecodeErrorZ {
1370         fn clone(&self) -> Self {
1371                 if self.result_ok {
1372                         Self { result_ok: true, contents: CResult_ShutdownScriptDecodeErrorZPtr {
1373                                 result: Box::into_raw(Box::new(<crate::lightning::ln::script::ShutdownScript>::clone(unsafe { &*self.contents.result })))
1374                         } }
1375                 } else {
1376                         Self { result_ok: false, contents: CResult_ShutdownScriptDecodeErrorZPtr {
1377                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
1378                         } }
1379                 }
1380         }
1381 }
1382 #[no_mangle]
1383 /// Creates a new CResult_ShutdownScriptDecodeErrorZ which has the same data as `orig`
1384 /// but with all dynamically-allocated buffers duplicated in new buffers.
1385 pub extern "C" fn CResult_ShutdownScriptDecodeErrorZ_clone(orig: &CResult_ShutdownScriptDecodeErrorZ) -> CResult_ShutdownScriptDecodeErrorZ { Clone::clone(&orig) }
1386 #[repr(C)]
1387 /// The contents of CResult_ShutdownScriptInvalidShutdownScriptZ
1388 pub union CResult_ShutdownScriptInvalidShutdownScriptZPtr {
1389         /// A pointer to the contents in the success state.
1390         /// Reading from this pointer when `result_ok` is not set is undefined.
1391         pub result: *mut crate::lightning::ln::script::ShutdownScript,
1392         /// A pointer to the contents in the error state.
1393         /// Reading from this pointer when `result_ok` is set is undefined.
1394         pub err: *mut crate::lightning::ln::script::InvalidShutdownScript,
1395 }
1396 #[repr(C)]
1397 /// A CResult_ShutdownScriptInvalidShutdownScriptZ represents the result of a fallible operation,
1398 /// containing a crate::lightning::ln::script::ShutdownScript on success and a crate::lightning::ln::script::InvalidShutdownScript on failure.
1399 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1400 pub struct CResult_ShutdownScriptInvalidShutdownScriptZ {
1401         /// The contents of this CResult_ShutdownScriptInvalidShutdownScriptZ, accessible via either
1402         /// `err` or `result` depending on the state of `result_ok`.
1403         pub contents: CResult_ShutdownScriptInvalidShutdownScriptZPtr,
1404         /// Whether this CResult_ShutdownScriptInvalidShutdownScriptZ represents a success state.
1405         pub result_ok: bool,
1406 }
1407 #[no_mangle]
1408 /// Creates a new CResult_ShutdownScriptInvalidShutdownScriptZ in the success state.
1409 pub extern "C" fn CResult_ShutdownScriptInvalidShutdownScriptZ_ok(o: crate::lightning::ln::script::ShutdownScript) -> CResult_ShutdownScriptInvalidShutdownScriptZ {
1410         CResult_ShutdownScriptInvalidShutdownScriptZ {
1411                 contents: CResult_ShutdownScriptInvalidShutdownScriptZPtr {
1412                         result: Box::into_raw(Box::new(o)),
1413                 },
1414                 result_ok: true,
1415         }
1416 }
1417 #[no_mangle]
1418 /// Creates a new CResult_ShutdownScriptInvalidShutdownScriptZ in the error state.
1419 pub extern "C" fn CResult_ShutdownScriptInvalidShutdownScriptZ_err(e: crate::lightning::ln::script::InvalidShutdownScript) -> CResult_ShutdownScriptInvalidShutdownScriptZ {
1420         CResult_ShutdownScriptInvalidShutdownScriptZ {
1421                 contents: CResult_ShutdownScriptInvalidShutdownScriptZPtr {
1422                         err: Box::into_raw(Box::new(e)),
1423                 },
1424                 result_ok: false,
1425         }
1426 }
1427 #[no_mangle]
1428 /// Frees any resources used by the CResult_ShutdownScriptInvalidShutdownScriptZ.
1429 pub extern "C" fn CResult_ShutdownScriptInvalidShutdownScriptZ_free(_res: CResult_ShutdownScriptInvalidShutdownScriptZ) { }
1430 impl Drop for CResult_ShutdownScriptInvalidShutdownScriptZ {
1431         fn drop(&mut self) {
1432                 if self.result_ok {
1433                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
1434                                 let _ = unsafe { Box::from_raw(self.contents.result) };
1435                         }
1436                 } else {
1437                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
1438                                 let _ = unsafe { Box::from_raw(self.contents.err) };
1439                         }
1440                 }
1441         }
1442 }
1443 impl From<crate::c_types::CResultTempl<crate::lightning::ln::script::ShutdownScript, crate::lightning::ln::script::InvalidShutdownScript>> for CResult_ShutdownScriptInvalidShutdownScriptZ {
1444         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::script::ShutdownScript, crate::lightning::ln::script::InvalidShutdownScript>) -> Self {
1445                 let contents = if o.result_ok {
1446                         let result = unsafe { o.contents.result };
1447                         unsafe { o.contents.result = std::ptr::null_mut() };
1448                         CResult_ShutdownScriptInvalidShutdownScriptZPtr { result }
1449                 } else {
1450                         let err = unsafe { o.contents.err };
1451                         unsafe { o.contents.err = std::ptr::null_mut(); }
1452                         CResult_ShutdownScriptInvalidShutdownScriptZPtr { err }
1453                 };
1454                 Self {
1455                         contents,
1456                         result_ok: o.result_ok,
1457                 }
1458         }
1459 }
1460 #[repr(C)]
1461 /// The contents of CResult_NoneErrorZ
1462 pub union CResult_NoneErrorZPtr {
1463         /// Note that this value is always NULL, as there are no contents in the OK variant
1464         pub result: *mut std::ffi::c_void,
1465         /// A pointer to the contents in the error state.
1466         /// Reading from this pointer when `result_ok` is set is undefined.
1467         pub err: *mut crate::c_types::IOError,
1468 }
1469 #[repr(C)]
1470 /// A CResult_NoneErrorZ represents the result of a fallible operation,
1471 /// containing a () on success and a crate::c_types::IOError on failure.
1472 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1473 pub struct CResult_NoneErrorZ {
1474         /// The contents of this CResult_NoneErrorZ, accessible via either
1475         /// `err` or `result` depending on the state of `result_ok`.
1476         pub contents: CResult_NoneErrorZPtr,
1477         /// Whether this CResult_NoneErrorZ represents a success state.
1478         pub result_ok: bool,
1479 }
1480 #[no_mangle]
1481 /// Creates a new CResult_NoneErrorZ in the success state.
1482 pub extern "C" fn CResult_NoneErrorZ_ok() -> CResult_NoneErrorZ {
1483         CResult_NoneErrorZ {
1484                 contents: CResult_NoneErrorZPtr {
1485                         result: std::ptr::null_mut(),
1486                 },
1487                 result_ok: true,
1488         }
1489 }
1490 #[no_mangle]
1491 /// Creates a new CResult_NoneErrorZ in the error state.
1492 pub extern "C" fn CResult_NoneErrorZ_err(e: crate::c_types::IOError) -> CResult_NoneErrorZ {
1493         CResult_NoneErrorZ {
1494                 contents: CResult_NoneErrorZPtr {
1495                         err: Box::into_raw(Box::new(e)),
1496                 },
1497                 result_ok: false,
1498         }
1499 }
1500 #[no_mangle]
1501 /// Frees any resources used by the CResult_NoneErrorZ.
1502 pub extern "C" fn CResult_NoneErrorZ_free(_res: CResult_NoneErrorZ) { }
1503 impl Drop for CResult_NoneErrorZ {
1504         fn drop(&mut self) {
1505                 if self.result_ok {
1506                 } else {
1507                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
1508                                 let _ = unsafe { Box::from_raw(self.contents.err) };
1509                         }
1510                 }
1511         }
1512 }
1513 impl From<crate::c_types::CResultTempl<(), crate::c_types::IOError>> for CResult_NoneErrorZ {
1514         fn from(mut o: crate::c_types::CResultTempl<(), crate::c_types::IOError>) -> Self {
1515                 let contents = if o.result_ok {
1516                         let _ = unsafe { Box::from_raw(o.contents.result) };
1517                         o.contents.result = std::ptr::null_mut();
1518                         CResult_NoneErrorZPtr { result: std::ptr::null_mut() }
1519                 } else {
1520                         let err = unsafe { o.contents.err };
1521                         unsafe { o.contents.err = std::ptr::null_mut(); }
1522                         CResult_NoneErrorZPtr { err }
1523                 };
1524                 Self {
1525                         contents,
1526                         result_ok: o.result_ok,
1527                 }
1528         }
1529 }
1530 impl Clone for CResult_NoneErrorZ {
1531         fn clone(&self) -> Self {
1532                 if self.result_ok {
1533                         Self { result_ok: true, contents: CResult_NoneErrorZPtr {
1534                                 result: std::ptr::null_mut()
1535                         } }
1536                 } else {
1537                         Self { result_ok: false, contents: CResult_NoneErrorZPtr {
1538                                 err: Box::into_raw(Box::new(<crate::c_types::IOError>::clone(unsafe { &*self.contents.err })))
1539                         } }
1540                 }
1541         }
1542 }
1543 #[no_mangle]
1544 /// Creates a new CResult_NoneErrorZ which has the same data as `orig`
1545 /// but with all dynamically-allocated buffers duplicated in new buffers.
1546 pub extern "C" fn CResult_NoneErrorZ_clone(orig: &CResult_NoneErrorZ) -> CResult_NoneErrorZ { Clone::clone(&orig) }
1547 #[repr(C)]
1548 /// The contents of CResult_RouteHopDecodeErrorZ
1549 pub union CResult_RouteHopDecodeErrorZPtr {
1550         /// A pointer to the contents in the success state.
1551         /// Reading from this pointer when `result_ok` is not set is undefined.
1552         pub result: *mut crate::lightning::routing::router::RouteHop,
1553         /// A pointer to the contents in the error state.
1554         /// Reading from this pointer when `result_ok` is set is undefined.
1555         pub err: *mut crate::lightning::ln::msgs::DecodeError,
1556 }
1557 #[repr(C)]
1558 /// A CResult_RouteHopDecodeErrorZ represents the result of a fallible operation,
1559 /// containing a crate::lightning::routing::router::RouteHop on success and a crate::lightning::ln::msgs::DecodeError on failure.
1560 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1561 pub struct CResult_RouteHopDecodeErrorZ {
1562         /// The contents of this CResult_RouteHopDecodeErrorZ, accessible via either
1563         /// `err` or `result` depending on the state of `result_ok`.
1564         pub contents: CResult_RouteHopDecodeErrorZPtr,
1565         /// Whether this CResult_RouteHopDecodeErrorZ represents a success state.
1566         pub result_ok: bool,
1567 }
1568 #[no_mangle]
1569 /// Creates a new CResult_RouteHopDecodeErrorZ in the success state.
1570 pub extern "C" fn CResult_RouteHopDecodeErrorZ_ok(o: crate::lightning::routing::router::RouteHop) -> CResult_RouteHopDecodeErrorZ {
1571         CResult_RouteHopDecodeErrorZ {
1572                 contents: CResult_RouteHopDecodeErrorZPtr {
1573                         result: Box::into_raw(Box::new(o)),
1574                 },
1575                 result_ok: true,
1576         }
1577 }
1578 #[no_mangle]
1579 /// Creates a new CResult_RouteHopDecodeErrorZ in the error state.
1580 pub extern "C" fn CResult_RouteHopDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RouteHopDecodeErrorZ {
1581         CResult_RouteHopDecodeErrorZ {
1582                 contents: CResult_RouteHopDecodeErrorZPtr {
1583                         err: Box::into_raw(Box::new(e)),
1584                 },
1585                 result_ok: false,
1586         }
1587 }
1588 #[no_mangle]
1589 /// Frees any resources used by the CResult_RouteHopDecodeErrorZ.
1590 pub extern "C" fn CResult_RouteHopDecodeErrorZ_free(_res: CResult_RouteHopDecodeErrorZ) { }
1591 impl Drop for CResult_RouteHopDecodeErrorZ {
1592         fn drop(&mut self) {
1593                 if self.result_ok {
1594                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
1595                                 let _ = unsafe { Box::from_raw(self.contents.result) };
1596                         }
1597                 } else {
1598                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
1599                                 let _ = unsafe { Box::from_raw(self.contents.err) };
1600                         }
1601                 }
1602         }
1603 }
1604 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::RouteHop, crate::lightning::ln::msgs::DecodeError>> for CResult_RouteHopDecodeErrorZ {
1605         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::RouteHop, crate::lightning::ln::msgs::DecodeError>) -> Self {
1606                 let contents = if o.result_ok {
1607                         let result = unsafe { o.contents.result };
1608                         unsafe { o.contents.result = std::ptr::null_mut() };
1609                         CResult_RouteHopDecodeErrorZPtr { result }
1610                 } else {
1611                         let err = unsafe { o.contents.err };
1612                         unsafe { o.contents.err = std::ptr::null_mut(); }
1613                         CResult_RouteHopDecodeErrorZPtr { err }
1614                 };
1615                 Self {
1616                         contents,
1617                         result_ok: o.result_ok,
1618                 }
1619         }
1620 }
1621 impl Clone for CResult_RouteHopDecodeErrorZ {
1622         fn clone(&self) -> Self {
1623                 if self.result_ok {
1624                         Self { result_ok: true, contents: CResult_RouteHopDecodeErrorZPtr {
1625                                 result: Box::into_raw(Box::new(<crate::lightning::routing::router::RouteHop>::clone(unsafe { &*self.contents.result })))
1626                         } }
1627                 } else {
1628                         Self { result_ok: false, contents: CResult_RouteHopDecodeErrorZPtr {
1629                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
1630                         } }
1631                 }
1632         }
1633 }
1634 #[no_mangle]
1635 /// Creates a new CResult_RouteHopDecodeErrorZ which has the same data as `orig`
1636 /// but with all dynamically-allocated buffers duplicated in new buffers.
1637 pub extern "C" fn CResult_RouteHopDecodeErrorZ_clone(orig: &CResult_RouteHopDecodeErrorZ) -> CResult_RouteHopDecodeErrorZ { Clone::clone(&orig) }
1638 #[repr(C)]
1639 /// A dynamically-allocated array of crate::lightning::routing::router::RouteHops of arbitrary size.
1640 /// This corresponds to std::vector in C++
1641 pub struct CVec_RouteHopZ {
1642         /// The elements in the array.
1643         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
1644         pub data: *mut crate::lightning::routing::router::RouteHop,
1645         /// The number of elements pointed to by `data`.
1646         pub datalen: usize
1647 }
1648 impl CVec_RouteHopZ {
1649         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::routing::router::RouteHop> {
1650                 if self.datalen == 0 { return Vec::new(); }
1651                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
1652                 self.data = std::ptr::null_mut();
1653                 self.datalen = 0;
1654                 ret
1655         }
1656         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::routing::router::RouteHop] {
1657                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
1658         }
1659 }
1660 impl From<Vec<crate::lightning::routing::router::RouteHop>> for CVec_RouteHopZ {
1661         fn from(v: Vec<crate::lightning::routing::router::RouteHop>) -> Self {
1662                 let datalen = v.len();
1663                 let data = Box::into_raw(v.into_boxed_slice());
1664                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
1665         }
1666 }
1667 #[no_mangle]
1668 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
1669 pub extern "C" fn CVec_RouteHopZ_free(_res: CVec_RouteHopZ) { }
1670 impl Drop for CVec_RouteHopZ {
1671         fn drop(&mut self) {
1672                 if self.datalen == 0 { return; }
1673                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
1674         }
1675 }
1676 impl Clone for CVec_RouteHopZ {
1677         fn clone(&self) -> Self {
1678                 let mut res = Vec::new();
1679                 if self.datalen == 0 { return Self::from(res); }
1680                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
1681                 Self::from(res)
1682         }
1683 }
1684 #[repr(C)]
1685 /// A dynamically-allocated array of crate::c_types::derived::CVec_RouteHopZs of arbitrary size.
1686 /// This corresponds to std::vector in C++
1687 pub struct CVec_CVec_RouteHopZZ {
1688         /// The elements in the array.
1689         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
1690         pub data: *mut crate::c_types::derived::CVec_RouteHopZ,
1691         /// The number of elements pointed to by `data`.
1692         pub datalen: usize
1693 }
1694 impl CVec_CVec_RouteHopZZ {
1695         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::CVec_RouteHopZ> {
1696                 if self.datalen == 0 { return Vec::new(); }
1697                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
1698                 self.data = std::ptr::null_mut();
1699                 self.datalen = 0;
1700                 ret
1701         }
1702         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::CVec_RouteHopZ] {
1703                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
1704         }
1705 }
1706 impl From<Vec<crate::c_types::derived::CVec_RouteHopZ>> for CVec_CVec_RouteHopZZ {
1707         fn from(v: Vec<crate::c_types::derived::CVec_RouteHopZ>) -> Self {
1708                 let datalen = v.len();
1709                 let data = Box::into_raw(v.into_boxed_slice());
1710                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
1711         }
1712 }
1713 #[no_mangle]
1714 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
1715 pub extern "C" fn CVec_CVec_RouteHopZZ_free(_res: CVec_CVec_RouteHopZZ) { }
1716 impl Drop for CVec_CVec_RouteHopZZ {
1717         fn drop(&mut self) {
1718                 if self.datalen == 0 { return; }
1719                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
1720         }
1721 }
1722 impl Clone for CVec_CVec_RouteHopZZ {
1723         fn clone(&self) -> Self {
1724                 let mut res = Vec::new();
1725                 if self.datalen == 0 { return Self::from(res); }
1726                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
1727                 Self::from(res)
1728         }
1729 }
1730 #[repr(C)]
1731 /// The contents of CResult_RouteDecodeErrorZ
1732 pub union CResult_RouteDecodeErrorZPtr {
1733         /// A pointer to the contents in the success state.
1734         /// Reading from this pointer when `result_ok` is not set is undefined.
1735         pub result: *mut crate::lightning::routing::router::Route,
1736         /// A pointer to the contents in the error state.
1737         /// Reading from this pointer when `result_ok` is set is undefined.
1738         pub err: *mut crate::lightning::ln::msgs::DecodeError,
1739 }
1740 #[repr(C)]
1741 /// A CResult_RouteDecodeErrorZ represents the result of a fallible operation,
1742 /// containing a crate::lightning::routing::router::Route on success and a crate::lightning::ln::msgs::DecodeError on failure.
1743 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1744 pub struct CResult_RouteDecodeErrorZ {
1745         /// The contents of this CResult_RouteDecodeErrorZ, accessible via either
1746         /// `err` or `result` depending on the state of `result_ok`.
1747         pub contents: CResult_RouteDecodeErrorZPtr,
1748         /// Whether this CResult_RouteDecodeErrorZ represents a success state.
1749         pub result_ok: bool,
1750 }
1751 #[no_mangle]
1752 /// Creates a new CResult_RouteDecodeErrorZ in the success state.
1753 pub extern "C" fn CResult_RouteDecodeErrorZ_ok(o: crate::lightning::routing::router::Route) -> CResult_RouteDecodeErrorZ {
1754         CResult_RouteDecodeErrorZ {
1755                 contents: CResult_RouteDecodeErrorZPtr {
1756                         result: Box::into_raw(Box::new(o)),
1757                 },
1758                 result_ok: true,
1759         }
1760 }
1761 #[no_mangle]
1762 /// Creates a new CResult_RouteDecodeErrorZ in the error state.
1763 pub extern "C" fn CResult_RouteDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RouteDecodeErrorZ {
1764         CResult_RouteDecodeErrorZ {
1765                 contents: CResult_RouteDecodeErrorZPtr {
1766                         err: Box::into_raw(Box::new(e)),
1767                 },
1768                 result_ok: false,
1769         }
1770 }
1771 #[no_mangle]
1772 /// Frees any resources used by the CResult_RouteDecodeErrorZ.
1773 pub extern "C" fn CResult_RouteDecodeErrorZ_free(_res: CResult_RouteDecodeErrorZ) { }
1774 impl Drop for CResult_RouteDecodeErrorZ {
1775         fn drop(&mut self) {
1776                 if self.result_ok {
1777                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
1778                                 let _ = unsafe { Box::from_raw(self.contents.result) };
1779                         }
1780                 } else {
1781                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
1782                                 let _ = unsafe { Box::from_raw(self.contents.err) };
1783                         }
1784                 }
1785         }
1786 }
1787 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::Route, crate::lightning::ln::msgs::DecodeError>> for CResult_RouteDecodeErrorZ {
1788         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::Route, crate::lightning::ln::msgs::DecodeError>) -> Self {
1789                 let contents = if o.result_ok {
1790                         let result = unsafe { o.contents.result };
1791                         unsafe { o.contents.result = std::ptr::null_mut() };
1792                         CResult_RouteDecodeErrorZPtr { result }
1793                 } else {
1794                         let err = unsafe { o.contents.err };
1795                         unsafe { o.contents.err = std::ptr::null_mut(); }
1796                         CResult_RouteDecodeErrorZPtr { err }
1797                 };
1798                 Self {
1799                         contents,
1800                         result_ok: o.result_ok,
1801                 }
1802         }
1803 }
1804 impl Clone for CResult_RouteDecodeErrorZ {
1805         fn clone(&self) -> Self {
1806                 if self.result_ok {
1807                         Self { result_ok: true, contents: CResult_RouteDecodeErrorZPtr {
1808                                 result: Box::into_raw(Box::new(<crate::lightning::routing::router::Route>::clone(unsafe { &*self.contents.result })))
1809                         } }
1810                 } else {
1811                         Self { result_ok: false, contents: CResult_RouteDecodeErrorZPtr {
1812                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
1813                         } }
1814                 }
1815         }
1816 }
1817 #[no_mangle]
1818 /// Creates a new CResult_RouteDecodeErrorZ which has the same data as `orig`
1819 /// but with all dynamically-allocated buffers duplicated in new buffers.
1820 pub extern "C" fn CResult_RouteDecodeErrorZ_clone(orig: &CResult_RouteDecodeErrorZ) -> CResult_RouteDecodeErrorZ { Clone::clone(&orig) }
1821 #[repr(C)]
1822 #[derive(Clone)]
1823 /// An enum which can either contain a u64 or not
1824 pub enum COption_u64Z {
1825         /// When we're in this state, this COption_u64Z contains a u64
1826         Some(u64),
1827         /// When we're in this state, this COption_u64Z contains nothing
1828         None
1829 }
1830 impl COption_u64Z {
1831         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
1832                 if let Self::Some(_) = self { true } else { false }
1833         }
1834         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
1835                 !self.is_some()
1836         }
1837         #[allow(unused)] pub(crate) fn take(mut self) -> u64 {
1838                 if let Self::Some(v) = self { v } else { unreachable!() }
1839         }
1840 }
1841 #[no_mangle]
1842 /// Constructs a new COption_u64Z containing a u64
1843 pub extern "C" fn COption_u64Z_some(o: u64) -> COption_u64Z {
1844         COption_u64Z::Some(o)
1845 }
1846 #[no_mangle]
1847 /// Constructs a new COption_u64Z containing nothing
1848 pub extern "C" fn COption_u64Z_none() -> COption_u64Z {
1849         COption_u64Z::None
1850 }
1851 #[no_mangle]
1852 /// Frees any resources associated with the u64, if we are in the Some state
1853 pub extern "C" fn COption_u64Z_free(_res: COption_u64Z) { }
1854 #[no_mangle]
1855 /// Creates a new COption_u64Z which has the same data as `orig`
1856 /// but with all dynamically-allocated buffers duplicated in new buffers.
1857 pub extern "C" fn COption_u64Z_clone(orig: &COption_u64Z) -> COption_u64Z { Clone::clone(&orig) }
1858 #[repr(C)]
1859 /// A dynamically-allocated array of crate::lightning::ln::channelmanager::ChannelDetailss of arbitrary size.
1860 /// This corresponds to std::vector in C++
1861 pub struct CVec_ChannelDetailsZ {
1862         /// The elements in the array.
1863         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
1864         pub data: *mut crate::lightning::ln::channelmanager::ChannelDetails,
1865         /// The number of elements pointed to by `data`.
1866         pub datalen: usize
1867 }
1868 impl CVec_ChannelDetailsZ {
1869         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::channelmanager::ChannelDetails> {
1870                 if self.datalen == 0 { return Vec::new(); }
1871                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
1872                 self.data = std::ptr::null_mut();
1873                 self.datalen = 0;
1874                 ret
1875         }
1876         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::channelmanager::ChannelDetails] {
1877                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
1878         }
1879 }
1880 impl From<Vec<crate::lightning::ln::channelmanager::ChannelDetails>> for CVec_ChannelDetailsZ {
1881         fn from(v: Vec<crate::lightning::ln::channelmanager::ChannelDetails>) -> Self {
1882                 let datalen = v.len();
1883                 let data = Box::into_raw(v.into_boxed_slice());
1884                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
1885         }
1886 }
1887 #[no_mangle]
1888 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
1889 pub extern "C" fn CVec_ChannelDetailsZ_free(_res: CVec_ChannelDetailsZ) { }
1890 impl Drop for CVec_ChannelDetailsZ {
1891         fn drop(&mut self) {
1892                 if self.datalen == 0 { return; }
1893                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
1894         }
1895 }
1896 impl Clone for CVec_ChannelDetailsZ {
1897         fn clone(&self) -> Self {
1898                 let mut res = Vec::new();
1899                 if self.datalen == 0 { return Self::from(res); }
1900                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
1901                 Self::from(res)
1902         }
1903 }
1904 #[repr(C)]
1905 /// A dynamically-allocated array of crate::lightning::routing::router::RouteHints of arbitrary size.
1906 /// This corresponds to std::vector in C++
1907 pub struct CVec_RouteHintZ {
1908         /// The elements in the array.
1909         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
1910         pub data: *mut crate::lightning::routing::router::RouteHint,
1911         /// The number of elements pointed to by `data`.
1912         pub datalen: usize
1913 }
1914 impl CVec_RouteHintZ {
1915         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::routing::router::RouteHint> {
1916                 if self.datalen == 0 { return Vec::new(); }
1917                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
1918                 self.data = std::ptr::null_mut();
1919                 self.datalen = 0;
1920                 ret
1921         }
1922         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::routing::router::RouteHint] {
1923                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
1924         }
1925 }
1926 impl From<Vec<crate::lightning::routing::router::RouteHint>> for CVec_RouteHintZ {
1927         fn from(v: Vec<crate::lightning::routing::router::RouteHint>) -> Self {
1928                 let datalen = v.len();
1929                 let data = Box::into_raw(v.into_boxed_slice());
1930                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
1931         }
1932 }
1933 #[no_mangle]
1934 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
1935 pub extern "C" fn CVec_RouteHintZ_free(_res: CVec_RouteHintZ) { }
1936 impl Drop for CVec_RouteHintZ {
1937         fn drop(&mut self) {
1938                 if self.datalen == 0 { return; }
1939                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
1940         }
1941 }
1942 impl Clone for CVec_RouteHintZ {
1943         fn clone(&self) -> Self {
1944                 let mut res = Vec::new();
1945                 if self.datalen == 0 { return Self::from(res); }
1946                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
1947                 Self::from(res)
1948         }
1949 }
1950 #[repr(C)]
1951 /// The contents of CResult_RouteLightningErrorZ
1952 pub union CResult_RouteLightningErrorZPtr {
1953         /// A pointer to the contents in the success state.
1954         /// Reading from this pointer when `result_ok` is not set is undefined.
1955         pub result: *mut crate::lightning::routing::router::Route,
1956         /// A pointer to the contents in the error state.
1957         /// Reading from this pointer when `result_ok` is set is undefined.
1958         pub err: *mut crate::lightning::ln::msgs::LightningError,
1959 }
1960 #[repr(C)]
1961 /// A CResult_RouteLightningErrorZ represents the result of a fallible operation,
1962 /// containing a crate::lightning::routing::router::Route on success and a crate::lightning::ln::msgs::LightningError on failure.
1963 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1964 pub struct CResult_RouteLightningErrorZ {
1965         /// The contents of this CResult_RouteLightningErrorZ, accessible via either
1966         /// `err` or `result` depending on the state of `result_ok`.
1967         pub contents: CResult_RouteLightningErrorZPtr,
1968         /// Whether this CResult_RouteLightningErrorZ represents a success state.
1969         pub result_ok: bool,
1970 }
1971 #[no_mangle]
1972 /// Creates a new CResult_RouteLightningErrorZ in the success state.
1973 pub extern "C" fn CResult_RouteLightningErrorZ_ok(o: crate::lightning::routing::router::Route) -> CResult_RouteLightningErrorZ {
1974         CResult_RouteLightningErrorZ {
1975                 contents: CResult_RouteLightningErrorZPtr {
1976                         result: Box::into_raw(Box::new(o)),
1977                 },
1978                 result_ok: true,
1979         }
1980 }
1981 #[no_mangle]
1982 /// Creates a new CResult_RouteLightningErrorZ in the error state.
1983 pub extern "C" fn CResult_RouteLightningErrorZ_err(e: crate::lightning::ln::msgs::LightningError) -> CResult_RouteLightningErrorZ {
1984         CResult_RouteLightningErrorZ {
1985                 contents: CResult_RouteLightningErrorZPtr {
1986                         err: Box::into_raw(Box::new(e)),
1987                 },
1988                 result_ok: false,
1989         }
1990 }
1991 #[no_mangle]
1992 /// Frees any resources used by the CResult_RouteLightningErrorZ.
1993 pub extern "C" fn CResult_RouteLightningErrorZ_free(_res: CResult_RouteLightningErrorZ) { }
1994 impl Drop for CResult_RouteLightningErrorZ {
1995         fn drop(&mut self) {
1996                 if self.result_ok {
1997                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
1998                                 let _ = unsafe { Box::from_raw(self.contents.result) };
1999                         }
2000                 } else {
2001                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
2002                                 let _ = unsafe { Box::from_raw(self.contents.err) };
2003                         }
2004                 }
2005         }
2006 }
2007 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::Route, crate::lightning::ln::msgs::LightningError>> for CResult_RouteLightningErrorZ {
2008         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::Route, crate::lightning::ln::msgs::LightningError>) -> Self {
2009                 let contents = if o.result_ok {
2010                         let result = unsafe { o.contents.result };
2011                         unsafe { o.contents.result = std::ptr::null_mut() };
2012                         CResult_RouteLightningErrorZPtr { result }
2013                 } else {
2014                         let err = unsafe { o.contents.err };
2015                         unsafe { o.contents.err = std::ptr::null_mut(); }
2016                         CResult_RouteLightningErrorZPtr { err }
2017                 };
2018                 Self {
2019                         contents,
2020                         result_ok: o.result_ok,
2021                 }
2022         }
2023 }
2024 impl Clone for CResult_RouteLightningErrorZ {
2025         fn clone(&self) -> Self {
2026                 if self.result_ok {
2027                         Self { result_ok: true, contents: CResult_RouteLightningErrorZPtr {
2028                                 result: Box::into_raw(Box::new(<crate::lightning::routing::router::Route>::clone(unsafe { &*self.contents.result })))
2029                         } }
2030                 } else {
2031                         Self { result_ok: false, contents: CResult_RouteLightningErrorZPtr {
2032                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::LightningError>::clone(unsafe { &*self.contents.err })))
2033                         } }
2034                 }
2035         }
2036 }
2037 #[no_mangle]
2038 /// Creates a new CResult_RouteLightningErrorZ which has the same data as `orig`
2039 /// but with all dynamically-allocated buffers duplicated in new buffers.
2040 pub extern "C" fn CResult_RouteLightningErrorZ_clone(orig: &CResult_RouteLightningErrorZ) -> CResult_RouteLightningErrorZ { Clone::clone(&orig) }
2041 #[repr(C)]
2042 /// The contents of CResult_TxOutAccessErrorZ
2043 pub union CResult_TxOutAccessErrorZPtr {
2044         /// A pointer to the contents in the success state.
2045         /// Reading from this pointer when `result_ok` is not set is undefined.
2046         pub result: *mut crate::c_types::TxOut,
2047         /// A pointer to the contents in the error state.
2048         /// Reading from this pointer when `result_ok` is set is undefined.
2049         pub err: *mut crate::lightning::chain::AccessError,
2050 }
2051 #[repr(C)]
2052 /// A CResult_TxOutAccessErrorZ represents the result of a fallible operation,
2053 /// containing a crate::c_types::TxOut on success and a crate::lightning::chain::AccessError on failure.
2054 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2055 pub struct CResult_TxOutAccessErrorZ {
2056         /// The contents of this CResult_TxOutAccessErrorZ, accessible via either
2057         /// `err` or `result` depending on the state of `result_ok`.
2058         pub contents: CResult_TxOutAccessErrorZPtr,
2059         /// Whether this CResult_TxOutAccessErrorZ represents a success state.
2060         pub result_ok: bool,
2061 }
2062 #[no_mangle]
2063 /// Creates a new CResult_TxOutAccessErrorZ in the success state.
2064 pub extern "C" fn CResult_TxOutAccessErrorZ_ok(o: crate::c_types::TxOut) -> CResult_TxOutAccessErrorZ {
2065         CResult_TxOutAccessErrorZ {
2066                 contents: CResult_TxOutAccessErrorZPtr {
2067                         result: Box::into_raw(Box::new(o)),
2068                 },
2069                 result_ok: true,
2070         }
2071 }
2072 #[no_mangle]
2073 /// Creates a new CResult_TxOutAccessErrorZ in the error state.
2074 pub extern "C" fn CResult_TxOutAccessErrorZ_err(e: crate::lightning::chain::AccessError) -> CResult_TxOutAccessErrorZ {
2075         CResult_TxOutAccessErrorZ {
2076                 contents: CResult_TxOutAccessErrorZPtr {
2077                         err: Box::into_raw(Box::new(e)),
2078                 },
2079                 result_ok: false,
2080         }
2081 }
2082 #[no_mangle]
2083 /// Frees any resources used by the CResult_TxOutAccessErrorZ.
2084 pub extern "C" fn CResult_TxOutAccessErrorZ_free(_res: CResult_TxOutAccessErrorZ) { }
2085 impl Drop for CResult_TxOutAccessErrorZ {
2086         fn drop(&mut self) {
2087                 if self.result_ok {
2088                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
2089                                 let _ = unsafe { Box::from_raw(self.contents.result) };
2090                         }
2091                 } else {
2092                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
2093                                 let _ = unsafe { Box::from_raw(self.contents.err) };
2094                         }
2095                 }
2096         }
2097 }
2098 impl From<crate::c_types::CResultTempl<crate::c_types::TxOut, crate::lightning::chain::AccessError>> for CResult_TxOutAccessErrorZ {
2099         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::TxOut, crate::lightning::chain::AccessError>) -> Self {
2100                 let contents = if o.result_ok {
2101                         let result = unsafe { o.contents.result };
2102                         unsafe { o.contents.result = std::ptr::null_mut() };
2103                         CResult_TxOutAccessErrorZPtr { result }
2104                 } else {
2105                         let err = unsafe { o.contents.err };
2106                         unsafe { o.contents.err = std::ptr::null_mut(); }
2107                         CResult_TxOutAccessErrorZPtr { err }
2108                 };
2109                 Self {
2110                         contents,
2111                         result_ok: o.result_ok,
2112                 }
2113         }
2114 }
2115 impl Clone for CResult_TxOutAccessErrorZ {
2116         fn clone(&self) -> Self {
2117                 if self.result_ok {
2118                         Self { result_ok: true, contents: CResult_TxOutAccessErrorZPtr {
2119                                 result: Box::into_raw(Box::new(<crate::c_types::TxOut>::clone(unsafe { &*self.contents.result })))
2120                         } }
2121                 } else {
2122                         Self { result_ok: false, contents: CResult_TxOutAccessErrorZPtr {
2123                                 err: Box::into_raw(Box::new(<crate::lightning::chain::AccessError>::clone(unsafe { &*self.contents.err })))
2124                         } }
2125                 }
2126         }
2127 }
2128 #[no_mangle]
2129 /// Creates a new CResult_TxOutAccessErrorZ which has the same data as `orig`
2130 /// but with all dynamically-allocated buffers duplicated in new buffers.
2131 pub extern "C" fn CResult_TxOutAccessErrorZ_clone(orig: &CResult_TxOutAccessErrorZ) -> CResult_TxOutAccessErrorZ { Clone::clone(&orig) }
2132 #[repr(C)]
2133 /// A tuple of 2 elements. See the individual fields for the types contained.
2134 pub struct C2Tuple_usizeTransactionZ {
2135         /// The element at position 0
2136         pub a: usize,
2137         /// The element at position 1
2138         pub b: crate::c_types::Transaction,
2139 }
2140 impl From<(usize, crate::c_types::Transaction)> for C2Tuple_usizeTransactionZ {
2141         fn from (tup: (usize, crate::c_types::Transaction)) -> Self {
2142                 Self {
2143                         a: tup.0,
2144                         b: tup.1,
2145                 }
2146         }
2147 }
2148 impl C2Tuple_usizeTransactionZ {
2149         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (usize, crate::c_types::Transaction) {
2150                 (self.a, self.b)
2151         }
2152 }
2153 impl Clone for C2Tuple_usizeTransactionZ {
2154         fn clone(&self) -> Self {
2155                 Self {
2156                         a: Clone::clone(&self.a),
2157                         b: Clone::clone(&self.b),
2158                 }
2159         }
2160 }
2161 #[no_mangle]
2162 /// Creates a new tuple which has the same data as `orig`
2163 /// but with all dynamically-allocated buffers duplicated in new buffers.
2164 pub extern "C" fn C2Tuple_usizeTransactionZ_clone(orig: &C2Tuple_usizeTransactionZ) -> C2Tuple_usizeTransactionZ { Clone::clone(&orig) }
2165 /// Creates a new C2Tuple_usizeTransactionZ from the contained elements.
2166 #[no_mangle]
2167 pub extern "C" fn C2Tuple_usizeTransactionZ_new(a: usize, b: crate::c_types::Transaction) -> C2Tuple_usizeTransactionZ {
2168         C2Tuple_usizeTransactionZ { a, b, }
2169 }
2170
2171 #[no_mangle]
2172 /// Frees any resources used by the C2Tuple_usizeTransactionZ.
2173 pub extern "C" fn C2Tuple_usizeTransactionZ_free(_res: C2Tuple_usizeTransactionZ) { }
2174 #[repr(C)]
2175 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_usizeTransactionZs of arbitrary size.
2176 /// This corresponds to std::vector in C++
2177 pub struct CVec_C2Tuple_usizeTransactionZZ {
2178         /// The elements in the array.
2179         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2180         pub data: *mut crate::c_types::derived::C2Tuple_usizeTransactionZ,
2181         /// The number of elements pointed to by `data`.
2182         pub datalen: usize
2183 }
2184 impl CVec_C2Tuple_usizeTransactionZZ {
2185         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_usizeTransactionZ> {
2186                 if self.datalen == 0 { return Vec::new(); }
2187                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
2188                 self.data = std::ptr::null_mut();
2189                 self.datalen = 0;
2190                 ret
2191         }
2192         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_usizeTransactionZ] {
2193                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
2194         }
2195 }
2196 impl From<Vec<crate::c_types::derived::C2Tuple_usizeTransactionZ>> for CVec_C2Tuple_usizeTransactionZZ {
2197         fn from(v: Vec<crate::c_types::derived::C2Tuple_usizeTransactionZ>) -> Self {
2198                 let datalen = v.len();
2199                 let data = Box::into_raw(v.into_boxed_slice());
2200                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
2201         }
2202 }
2203 #[no_mangle]
2204 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
2205 pub extern "C" fn CVec_C2Tuple_usizeTransactionZZ_free(_res: CVec_C2Tuple_usizeTransactionZZ) { }
2206 impl Drop for CVec_C2Tuple_usizeTransactionZZ {
2207         fn drop(&mut self) {
2208                 if self.datalen == 0 { return; }
2209                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
2210         }
2211 }
2212 impl Clone for CVec_C2Tuple_usizeTransactionZZ {
2213         fn clone(&self) -> Self {
2214                 let mut res = Vec::new();
2215                 if self.datalen == 0 { return Self::from(res); }
2216                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
2217                 Self::from(res)
2218         }
2219 }
2220 #[repr(C)]
2221 /// A dynamically-allocated array of crate::c_types::ThirtyTwoBytess of arbitrary size.
2222 /// This corresponds to std::vector in C++
2223 pub struct CVec_TxidZ {
2224         /// The elements in the array.
2225         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2226         pub data: *mut crate::c_types::ThirtyTwoBytes,
2227         /// The number of elements pointed to by `data`.
2228         pub datalen: usize
2229 }
2230 impl CVec_TxidZ {
2231         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::ThirtyTwoBytes> {
2232                 if self.datalen == 0 { return Vec::new(); }
2233                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
2234                 self.data = std::ptr::null_mut();
2235                 self.datalen = 0;
2236                 ret
2237         }
2238         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::ThirtyTwoBytes] {
2239                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
2240         }
2241 }
2242 impl From<Vec<crate::c_types::ThirtyTwoBytes>> for CVec_TxidZ {
2243         fn from(v: Vec<crate::c_types::ThirtyTwoBytes>) -> Self {
2244                 let datalen = v.len();
2245                 let data = Box::into_raw(v.into_boxed_slice());
2246                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
2247         }
2248 }
2249 #[no_mangle]
2250 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
2251 pub extern "C" fn CVec_TxidZ_free(_res: CVec_TxidZ) { }
2252 impl Drop for CVec_TxidZ {
2253         fn drop(&mut self) {
2254                 if self.datalen == 0 { return; }
2255                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
2256         }
2257 }
2258 impl Clone for CVec_TxidZ {
2259         fn clone(&self) -> Self {
2260                 let mut res = Vec::new();
2261                 if self.datalen == 0 { return Self::from(res); }
2262                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
2263                 Self::from(res)
2264         }
2265 }
2266 #[repr(C)]
2267 /// The contents of CResult_NoneChannelMonitorUpdateErrZ
2268 pub union CResult_NoneChannelMonitorUpdateErrZPtr {
2269         /// Note that this value is always NULL, as there are no contents in the OK variant
2270         pub result: *mut std::ffi::c_void,
2271         /// A pointer to the contents in the error state.
2272         /// Reading from this pointer when `result_ok` is set is undefined.
2273         pub err: *mut crate::lightning::chain::ChannelMonitorUpdateErr,
2274 }
2275 #[repr(C)]
2276 /// A CResult_NoneChannelMonitorUpdateErrZ represents the result of a fallible operation,
2277 /// containing a () on success and a crate::lightning::chain::ChannelMonitorUpdateErr on failure.
2278 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2279 pub struct CResult_NoneChannelMonitorUpdateErrZ {
2280         /// The contents of this CResult_NoneChannelMonitorUpdateErrZ, accessible via either
2281         /// `err` or `result` depending on the state of `result_ok`.
2282         pub contents: CResult_NoneChannelMonitorUpdateErrZPtr,
2283         /// Whether this CResult_NoneChannelMonitorUpdateErrZ represents a success state.
2284         pub result_ok: bool,
2285 }
2286 #[no_mangle]
2287 /// Creates a new CResult_NoneChannelMonitorUpdateErrZ in the success state.
2288 pub extern "C" fn CResult_NoneChannelMonitorUpdateErrZ_ok() -> CResult_NoneChannelMonitorUpdateErrZ {
2289         CResult_NoneChannelMonitorUpdateErrZ {
2290                 contents: CResult_NoneChannelMonitorUpdateErrZPtr {
2291                         result: std::ptr::null_mut(),
2292                 },
2293                 result_ok: true,
2294         }
2295 }
2296 #[no_mangle]
2297 /// Creates a new CResult_NoneChannelMonitorUpdateErrZ in the error state.
2298 pub extern "C" fn CResult_NoneChannelMonitorUpdateErrZ_err(e: crate::lightning::chain::ChannelMonitorUpdateErr) -> CResult_NoneChannelMonitorUpdateErrZ {
2299         CResult_NoneChannelMonitorUpdateErrZ {
2300                 contents: CResult_NoneChannelMonitorUpdateErrZPtr {
2301                         err: Box::into_raw(Box::new(e)),
2302                 },
2303                 result_ok: false,
2304         }
2305 }
2306 #[no_mangle]
2307 /// Frees any resources used by the CResult_NoneChannelMonitorUpdateErrZ.
2308 pub extern "C" fn CResult_NoneChannelMonitorUpdateErrZ_free(_res: CResult_NoneChannelMonitorUpdateErrZ) { }
2309 impl Drop for CResult_NoneChannelMonitorUpdateErrZ {
2310         fn drop(&mut self) {
2311                 if self.result_ok {
2312                 } else {
2313                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
2314                                 let _ = unsafe { Box::from_raw(self.contents.err) };
2315                         }
2316                 }
2317         }
2318 }
2319 impl From<crate::c_types::CResultTempl<(), crate::lightning::chain::ChannelMonitorUpdateErr>> for CResult_NoneChannelMonitorUpdateErrZ {
2320         fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::chain::ChannelMonitorUpdateErr>) -> Self {
2321                 let contents = if o.result_ok {
2322                         let _ = unsafe { Box::from_raw(o.contents.result) };
2323                         o.contents.result = std::ptr::null_mut();
2324                         CResult_NoneChannelMonitorUpdateErrZPtr { result: std::ptr::null_mut() }
2325                 } else {
2326                         let err = unsafe { o.contents.err };
2327                         unsafe { o.contents.err = std::ptr::null_mut(); }
2328                         CResult_NoneChannelMonitorUpdateErrZPtr { err }
2329                 };
2330                 Self {
2331                         contents,
2332                         result_ok: o.result_ok,
2333                 }
2334         }
2335 }
2336 impl Clone for CResult_NoneChannelMonitorUpdateErrZ {
2337         fn clone(&self) -> Self {
2338                 if self.result_ok {
2339                         Self { result_ok: true, contents: CResult_NoneChannelMonitorUpdateErrZPtr {
2340                                 result: std::ptr::null_mut()
2341                         } }
2342                 } else {
2343                         Self { result_ok: false, contents: CResult_NoneChannelMonitorUpdateErrZPtr {
2344                                 err: Box::into_raw(Box::new(<crate::lightning::chain::ChannelMonitorUpdateErr>::clone(unsafe { &*self.contents.err })))
2345                         } }
2346                 }
2347         }
2348 }
2349 #[no_mangle]
2350 /// Creates a new CResult_NoneChannelMonitorUpdateErrZ which has the same data as `orig`
2351 /// but with all dynamically-allocated buffers duplicated in new buffers.
2352 pub extern "C" fn CResult_NoneChannelMonitorUpdateErrZ_clone(orig: &CResult_NoneChannelMonitorUpdateErrZ) -> CResult_NoneChannelMonitorUpdateErrZ { Clone::clone(&orig) }
2353 #[repr(C)]
2354 /// A dynamically-allocated array of crate::lightning::chain::channelmonitor::MonitorEvents of arbitrary size.
2355 /// This corresponds to std::vector in C++
2356 pub struct CVec_MonitorEventZ {
2357         /// The elements in the array.
2358         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2359         pub data: *mut crate::lightning::chain::channelmonitor::MonitorEvent,
2360         /// The number of elements pointed to by `data`.
2361         pub datalen: usize
2362 }
2363 impl CVec_MonitorEventZ {
2364         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::chain::channelmonitor::MonitorEvent> {
2365                 if self.datalen == 0 { return Vec::new(); }
2366                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
2367                 self.data = std::ptr::null_mut();
2368                 self.datalen = 0;
2369                 ret
2370         }
2371         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::chain::channelmonitor::MonitorEvent] {
2372                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
2373         }
2374 }
2375 impl From<Vec<crate::lightning::chain::channelmonitor::MonitorEvent>> for CVec_MonitorEventZ {
2376         fn from(v: Vec<crate::lightning::chain::channelmonitor::MonitorEvent>) -> Self {
2377                 let datalen = v.len();
2378                 let data = Box::into_raw(v.into_boxed_slice());
2379                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
2380         }
2381 }
2382 #[no_mangle]
2383 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
2384 pub extern "C" fn CVec_MonitorEventZ_free(_res: CVec_MonitorEventZ) { }
2385 impl Drop for CVec_MonitorEventZ {
2386         fn drop(&mut self) {
2387                 if self.datalen == 0 { return; }
2388                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
2389         }
2390 }
2391 impl Clone for CVec_MonitorEventZ {
2392         fn clone(&self) -> Self {
2393                 let mut res = Vec::new();
2394                 if self.datalen == 0 { return Self::from(res); }
2395                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
2396                 Self::from(res)
2397         }
2398 }
2399 #[repr(C)]
2400 #[derive(Clone)]
2401 /// An enum which can either contain a crate::c_types::derived::C2Tuple_usizeTransactionZ or not
2402 pub enum COption_C2Tuple_usizeTransactionZZ {
2403         /// When we're in this state, this COption_C2Tuple_usizeTransactionZZ contains a crate::c_types::derived::C2Tuple_usizeTransactionZ
2404         Some(crate::c_types::derived::C2Tuple_usizeTransactionZ),
2405         /// When we're in this state, this COption_C2Tuple_usizeTransactionZZ contains nothing
2406         None
2407 }
2408 impl COption_C2Tuple_usizeTransactionZZ {
2409         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
2410                 if let Self::Some(_) = self { true } else { false }
2411         }
2412         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
2413                 !self.is_some()
2414         }
2415         #[allow(unused)] pub(crate) fn take(mut self) -> crate::c_types::derived::C2Tuple_usizeTransactionZ {
2416                 if let Self::Some(v) = self { v } else { unreachable!() }
2417         }
2418 }
2419 #[no_mangle]
2420 /// Constructs a new COption_C2Tuple_usizeTransactionZZ containing a crate::c_types::derived::C2Tuple_usizeTransactionZ
2421 pub extern "C" fn COption_C2Tuple_usizeTransactionZZ_some(o: crate::c_types::derived::C2Tuple_usizeTransactionZ) -> COption_C2Tuple_usizeTransactionZZ {
2422         COption_C2Tuple_usizeTransactionZZ::Some(o)
2423 }
2424 #[no_mangle]
2425 /// Constructs a new COption_C2Tuple_usizeTransactionZZ containing nothing
2426 pub extern "C" fn COption_C2Tuple_usizeTransactionZZ_none() -> COption_C2Tuple_usizeTransactionZZ {
2427         COption_C2Tuple_usizeTransactionZZ::None
2428 }
2429 #[no_mangle]
2430 /// Frees any resources associated with the crate::c_types::derived::C2Tuple_usizeTransactionZ, if we are in the Some state
2431 pub extern "C" fn COption_C2Tuple_usizeTransactionZZ_free(_res: COption_C2Tuple_usizeTransactionZZ) { }
2432 #[no_mangle]
2433 /// Creates a new COption_C2Tuple_usizeTransactionZZ which has the same data as `orig`
2434 /// but with all dynamically-allocated buffers duplicated in new buffers.
2435 pub extern "C" fn COption_C2Tuple_usizeTransactionZZ_clone(orig: &COption_C2Tuple_usizeTransactionZZ) -> COption_C2Tuple_usizeTransactionZZ { Clone::clone(&orig) }
2436 #[repr(C)]
2437 #[derive(Clone)]
2438 /// An enum which can either contain a crate::lightning::routing::network_graph::NetworkUpdate or not
2439 pub enum COption_NetworkUpdateZ {
2440         /// When we're in this state, this COption_NetworkUpdateZ contains a crate::lightning::routing::network_graph::NetworkUpdate
2441         Some(crate::lightning::routing::network_graph::NetworkUpdate),
2442         /// When we're in this state, this COption_NetworkUpdateZ contains nothing
2443         None
2444 }
2445 impl COption_NetworkUpdateZ {
2446         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
2447                 if let Self::Some(_) = self { true } else { false }
2448         }
2449         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
2450                 !self.is_some()
2451         }
2452         #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::routing::network_graph::NetworkUpdate {
2453                 if let Self::Some(v) = self { v } else { unreachable!() }
2454         }
2455 }
2456 #[no_mangle]
2457 /// Constructs a new COption_NetworkUpdateZ containing a crate::lightning::routing::network_graph::NetworkUpdate
2458 pub extern "C" fn COption_NetworkUpdateZ_some(o: crate::lightning::routing::network_graph::NetworkUpdate) -> COption_NetworkUpdateZ {
2459         COption_NetworkUpdateZ::Some(o)
2460 }
2461 #[no_mangle]
2462 /// Constructs a new COption_NetworkUpdateZ containing nothing
2463 pub extern "C" fn COption_NetworkUpdateZ_none() -> COption_NetworkUpdateZ {
2464         COption_NetworkUpdateZ::None
2465 }
2466 #[no_mangle]
2467 /// Frees any resources associated with the crate::lightning::routing::network_graph::NetworkUpdate, if we are in the Some state
2468 pub extern "C" fn COption_NetworkUpdateZ_free(_res: COption_NetworkUpdateZ) { }
2469 #[no_mangle]
2470 /// Creates a new COption_NetworkUpdateZ which has the same data as `orig`
2471 /// but with all dynamically-allocated buffers duplicated in new buffers.
2472 pub extern "C" fn COption_NetworkUpdateZ_clone(orig: &COption_NetworkUpdateZ) -> COption_NetworkUpdateZ { Clone::clone(&orig) }
2473 #[repr(C)]
2474 /// A dynamically-allocated array of crate::lightning::chain::keysinterface::SpendableOutputDescriptors of arbitrary size.
2475 /// This corresponds to std::vector in C++
2476 pub struct CVec_SpendableOutputDescriptorZ {
2477         /// The elements in the array.
2478         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2479         pub data: *mut crate::lightning::chain::keysinterface::SpendableOutputDescriptor,
2480         /// The number of elements pointed to by `data`.
2481         pub datalen: usize
2482 }
2483 impl CVec_SpendableOutputDescriptorZ {
2484         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::chain::keysinterface::SpendableOutputDescriptor> {
2485                 if self.datalen == 0 { return Vec::new(); }
2486                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
2487                 self.data = std::ptr::null_mut();
2488                 self.datalen = 0;
2489                 ret
2490         }
2491         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::chain::keysinterface::SpendableOutputDescriptor] {
2492                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
2493         }
2494 }
2495 impl From<Vec<crate::lightning::chain::keysinterface::SpendableOutputDescriptor>> for CVec_SpendableOutputDescriptorZ {
2496         fn from(v: Vec<crate::lightning::chain::keysinterface::SpendableOutputDescriptor>) -> Self {
2497                 let datalen = v.len();
2498                 let data = Box::into_raw(v.into_boxed_slice());
2499                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
2500         }
2501 }
2502 #[no_mangle]
2503 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
2504 pub extern "C" fn CVec_SpendableOutputDescriptorZ_free(_res: CVec_SpendableOutputDescriptorZ) { }
2505 impl Drop for CVec_SpendableOutputDescriptorZ {
2506         fn drop(&mut self) {
2507                 if self.datalen == 0 { return; }
2508                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
2509         }
2510 }
2511 impl Clone for CVec_SpendableOutputDescriptorZ {
2512         fn clone(&self) -> Self {
2513                 let mut res = Vec::new();
2514                 if self.datalen == 0 { return Self::from(res); }
2515                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
2516                 Self::from(res)
2517         }
2518 }
2519 #[repr(C)]
2520 /// A dynamically-allocated array of crate::lightning::util::events::MessageSendEvents of arbitrary size.
2521 /// This corresponds to std::vector in C++
2522 pub struct CVec_MessageSendEventZ {
2523         /// The elements in the array.
2524         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2525         pub data: *mut crate::lightning::util::events::MessageSendEvent,
2526         /// The number of elements pointed to by `data`.
2527         pub datalen: usize
2528 }
2529 impl CVec_MessageSendEventZ {
2530         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::util::events::MessageSendEvent> {
2531                 if self.datalen == 0 { return Vec::new(); }
2532                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
2533                 self.data = std::ptr::null_mut();
2534                 self.datalen = 0;
2535                 ret
2536         }
2537         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::util::events::MessageSendEvent] {
2538                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
2539         }
2540 }
2541 impl From<Vec<crate::lightning::util::events::MessageSendEvent>> for CVec_MessageSendEventZ {
2542         fn from(v: Vec<crate::lightning::util::events::MessageSendEvent>) -> Self {
2543                 let datalen = v.len();
2544                 let data = Box::into_raw(v.into_boxed_slice());
2545                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
2546         }
2547 }
2548 #[no_mangle]
2549 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
2550 pub extern "C" fn CVec_MessageSendEventZ_free(_res: CVec_MessageSendEventZ) { }
2551 impl Drop for CVec_MessageSendEventZ {
2552         fn drop(&mut self) {
2553                 if self.datalen == 0 { return; }
2554                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
2555         }
2556 }
2557 impl Clone for CVec_MessageSendEventZ {
2558         fn clone(&self) -> Self {
2559                 let mut res = Vec::new();
2560                 if self.datalen == 0 { return Self::from(res); }
2561                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
2562                 Self::from(res)
2563         }
2564 }
2565 #[repr(C)]
2566 /// The contents of CResult_InitFeaturesDecodeErrorZ
2567 pub union CResult_InitFeaturesDecodeErrorZPtr {
2568         /// A pointer to the contents in the success state.
2569         /// Reading from this pointer when `result_ok` is not set is undefined.
2570         pub result: *mut crate::lightning::ln::features::InitFeatures,
2571         /// A pointer to the contents in the error state.
2572         /// Reading from this pointer when `result_ok` is set is undefined.
2573         pub err: *mut crate::lightning::ln::msgs::DecodeError,
2574 }
2575 #[repr(C)]
2576 /// A CResult_InitFeaturesDecodeErrorZ represents the result of a fallible operation,
2577 /// containing a crate::lightning::ln::features::InitFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
2578 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2579 pub struct CResult_InitFeaturesDecodeErrorZ {
2580         /// The contents of this CResult_InitFeaturesDecodeErrorZ, accessible via either
2581         /// `err` or `result` depending on the state of `result_ok`.
2582         pub contents: CResult_InitFeaturesDecodeErrorZPtr,
2583         /// Whether this CResult_InitFeaturesDecodeErrorZ represents a success state.
2584         pub result_ok: bool,
2585 }
2586 #[no_mangle]
2587 /// Creates a new CResult_InitFeaturesDecodeErrorZ in the success state.
2588 pub extern "C" fn CResult_InitFeaturesDecodeErrorZ_ok(o: crate::lightning::ln::features::InitFeatures) -> CResult_InitFeaturesDecodeErrorZ {
2589         CResult_InitFeaturesDecodeErrorZ {
2590                 contents: CResult_InitFeaturesDecodeErrorZPtr {
2591                         result: Box::into_raw(Box::new(o)),
2592                 },
2593                 result_ok: true,
2594         }
2595 }
2596 #[no_mangle]
2597 /// Creates a new CResult_InitFeaturesDecodeErrorZ in the error state.
2598 pub extern "C" fn CResult_InitFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_InitFeaturesDecodeErrorZ {
2599         CResult_InitFeaturesDecodeErrorZ {
2600                 contents: CResult_InitFeaturesDecodeErrorZPtr {
2601                         err: Box::into_raw(Box::new(e)),
2602                 },
2603                 result_ok: false,
2604         }
2605 }
2606 #[no_mangle]
2607 /// Frees any resources used by the CResult_InitFeaturesDecodeErrorZ.
2608 pub extern "C" fn CResult_InitFeaturesDecodeErrorZ_free(_res: CResult_InitFeaturesDecodeErrorZ) { }
2609 impl Drop for CResult_InitFeaturesDecodeErrorZ {
2610         fn drop(&mut self) {
2611                 if self.result_ok {
2612                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
2613                                 let _ = unsafe { Box::from_raw(self.contents.result) };
2614                         }
2615                 } else {
2616                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
2617                                 let _ = unsafe { Box::from_raw(self.contents.err) };
2618                         }
2619                 }
2620         }
2621 }
2622 impl From<crate::c_types::CResultTempl<crate::lightning::ln::features::InitFeatures, crate::lightning::ln::msgs::DecodeError>> for CResult_InitFeaturesDecodeErrorZ {
2623         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::features::InitFeatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
2624                 let contents = if o.result_ok {
2625                         let result = unsafe { o.contents.result };
2626                         unsafe { o.contents.result = std::ptr::null_mut() };
2627                         CResult_InitFeaturesDecodeErrorZPtr { result }
2628                 } else {
2629                         let err = unsafe { o.contents.err };
2630                         unsafe { o.contents.err = std::ptr::null_mut(); }
2631                         CResult_InitFeaturesDecodeErrorZPtr { err }
2632                 };
2633                 Self {
2634                         contents,
2635                         result_ok: o.result_ok,
2636                 }
2637         }
2638 }
2639 #[repr(C)]
2640 /// The contents of CResult_NodeFeaturesDecodeErrorZ
2641 pub union CResult_NodeFeaturesDecodeErrorZPtr {
2642         /// A pointer to the contents in the success state.
2643         /// Reading from this pointer when `result_ok` is not set is undefined.
2644         pub result: *mut crate::lightning::ln::features::NodeFeatures,
2645         /// A pointer to the contents in the error state.
2646         /// Reading from this pointer when `result_ok` is set is undefined.
2647         pub err: *mut crate::lightning::ln::msgs::DecodeError,
2648 }
2649 #[repr(C)]
2650 /// A CResult_NodeFeaturesDecodeErrorZ represents the result of a fallible operation,
2651 /// containing a crate::lightning::ln::features::NodeFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
2652 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2653 pub struct CResult_NodeFeaturesDecodeErrorZ {
2654         /// The contents of this CResult_NodeFeaturesDecodeErrorZ, accessible via either
2655         /// `err` or `result` depending on the state of `result_ok`.
2656         pub contents: CResult_NodeFeaturesDecodeErrorZPtr,
2657         /// Whether this CResult_NodeFeaturesDecodeErrorZ represents a success state.
2658         pub result_ok: bool,
2659 }
2660 #[no_mangle]
2661 /// Creates a new CResult_NodeFeaturesDecodeErrorZ in the success state.
2662 pub extern "C" fn CResult_NodeFeaturesDecodeErrorZ_ok(o: crate::lightning::ln::features::NodeFeatures) -> CResult_NodeFeaturesDecodeErrorZ {
2663         CResult_NodeFeaturesDecodeErrorZ {
2664                 contents: CResult_NodeFeaturesDecodeErrorZPtr {
2665                         result: Box::into_raw(Box::new(o)),
2666                 },
2667                 result_ok: true,
2668         }
2669 }
2670 #[no_mangle]
2671 /// Creates a new CResult_NodeFeaturesDecodeErrorZ in the error state.
2672 pub extern "C" fn CResult_NodeFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeFeaturesDecodeErrorZ {
2673         CResult_NodeFeaturesDecodeErrorZ {
2674                 contents: CResult_NodeFeaturesDecodeErrorZPtr {
2675                         err: Box::into_raw(Box::new(e)),
2676                 },
2677                 result_ok: false,
2678         }
2679 }
2680 #[no_mangle]
2681 /// Frees any resources used by the CResult_NodeFeaturesDecodeErrorZ.
2682 pub extern "C" fn CResult_NodeFeaturesDecodeErrorZ_free(_res: CResult_NodeFeaturesDecodeErrorZ) { }
2683 impl Drop for CResult_NodeFeaturesDecodeErrorZ {
2684         fn drop(&mut self) {
2685                 if self.result_ok {
2686                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
2687                                 let _ = unsafe { Box::from_raw(self.contents.result) };
2688                         }
2689                 } else {
2690                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
2691                                 let _ = unsafe { Box::from_raw(self.contents.err) };
2692                         }
2693                 }
2694         }
2695 }
2696 impl From<crate::c_types::CResultTempl<crate::lightning::ln::features::NodeFeatures, crate::lightning::ln::msgs::DecodeError>> for CResult_NodeFeaturesDecodeErrorZ {
2697         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::features::NodeFeatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
2698                 let contents = if o.result_ok {
2699                         let result = unsafe { o.contents.result };
2700                         unsafe { o.contents.result = std::ptr::null_mut() };
2701                         CResult_NodeFeaturesDecodeErrorZPtr { result }
2702                 } else {
2703                         let err = unsafe { o.contents.err };
2704                         unsafe { o.contents.err = std::ptr::null_mut(); }
2705                         CResult_NodeFeaturesDecodeErrorZPtr { err }
2706                 };
2707                 Self {
2708                         contents,
2709                         result_ok: o.result_ok,
2710                 }
2711         }
2712 }
2713 #[repr(C)]
2714 /// The contents of CResult_ChannelFeaturesDecodeErrorZ
2715 pub union CResult_ChannelFeaturesDecodeErrorZPtr {
2716         /// A pointer to the contents in the success state.
2717         /// Reading from this pointer when `result_ok` is not set is undefined.
2718         pub result: *mut crate::lightning::ln::features::ChannelFeatures,
2719         /// A pointer to the contents in the error state.
2720         /// Reading from this pointer when `result_ok` is set is undefined.
2721         pub err: *mut crate::lightning::ln::msgs::DecodeError,
2722 }
2723 #[repr(C)]
2724 /// A CResult_ChannelFeaturesDecodeErrorZ represents the result of a fallible operation,
2725 /// containing a crate::lightning::ln::features::ChannelFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
2726 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2727 pub struct CResult_ChannelFeaturesDecodeErrorZ {
2728         /// The contents of this CResult_ChannelFeaturesDecodeErrorZ, accessible via either
2729         /// `err` or `result` depending on the state of `result_ok`.
2730         pub contents: CResult_ChannelFeaturesDecodeErrorZPtr,
2731         /// Whether this CResult_ChannelFeaturesDecodeErrorZ represents a success state.
2732         pub result_ok: bool,
2733 }
2734 #[no_mangle]
2735 /// Creates a new CResult_ChannelFeaturesDecodeErrorZ in the success state.
2736 pub extern "C" fn CResult_ChannelFeaturesDecodeErrorZ_ok(o: crate::lightning::ln::features::ChannelFeatures) -> CResult_ChannelFeaturesDecodeErrorZ {
2737         CResult_ChannelFeaturesDecodeErrorZ {
2738                 contents: CResult_ChannelFeaturesDecodeErrorZPtr {
2739                         result: Box::into_raw(Box::new(o)),
2740                 },
2741                 result_ok: true,
2742         }
2743 }
2744 #[no_mangle]
2745 /// Creates a new CResult_ChannelFeaturesDecodeErrorZ in the error state.
2746 pub extern "C" fn CResult_ChannelFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelFeaturesDecodeErrorZ {
2747         CResult_ChannelFeaturesDecodeErrorZ {
2748                 contents: CResult_ChannelFeaturesDecodeErrorZPtr {
2749                         err: Box::into_raw(Box::new(e)),
2750                 },
2751                 result_ok: false,
2752         }
2753 }
2754 #[no_mangle]
2755 /// Frees any resources used by the CResult_ChannelFeaturesDecodeErrorZ.
2756 pub extern "C" fn CResult_ChannelFeaturesDecodeErrorZ_free(_res: CResult_ChannelFeaturesDecodeErrorZ) { }
2757 impl Drop for CResult_ChannelFeaturesDecodeErrorZ {
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::ln::features::ChannelFeatures, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelFeaturesDecodeErrorZ {
2771         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::features::ChannelFeatures, 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 = std::ptr::null_mut() };
2775                         CResult_ChannelFeaturesDecodeErrorZPtr { result }
2776                 } else {
2777                         let err = unsafe { o.contents.err };
2778                         unsafe { o.contents.err = std::ptr::null_mut(); }
2779                         CResult_ChannelFeaturesDecodeErrorZPtr { err }
2780                 };
2781                 Self {
2782                         contents,
2783                         result_ok: o.result_ok,
2784                 }
2785         }
2786 }
2787 #[repr(C)]
2788 /// The contents of CResult_InvoiceFeaturesDecodeErrorZ
2789 pub union CResult_InvoiceFeaturesDecodeErrorZPtr {
2790         /// A pointer to the contents in the success state.
2791         /// Reading from this pointer when `result_ok` is not set is undefined.
2792         pub result: *mut crate::lightning::ln::features::InvoiceFeatures,
2793         /// A pointer to the contents in the error state.
2794         /// Reading from this pointer when `result_ok` is set is undefined.
2795         pub err: *mut crate::lightning::ln::msgs::DecodeError,
2796 }
2797 #[repr(C)]
2798 /// A CResult_InvoiceFeaturesDecodeErrorZ represents the result of a fallible operation,
2799 /// containing a crate::lightning::ln::features::InvoiceFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
2800 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2801 pub struct CResult_InvoiceFeaturesDecodeErrorZ {
2802         /// The contents of this CResult_InvoiceFeaturesDecodeErrorZ, accessible via either
2803         /// `err` or `result` depending on the state of `result_ok`.
2804         pub contents: CResult_InvoiceFeaturesDecodeErrorZPtr,
2805         /// Whether this CResult_InvoiceFeaturesDecodeErrorZ represents a success state.
2806         pub result_ok: bool,
2807 }
2808 #[no_mangle]
2809 /// Creates a new CResult_InvoiceFeaturesDecodeErrorZ in the success state.
2810 pub extern "C" fn CResult_InvoiceFeaturesDecodeErrorZ_ok(o: crate::lightning::ln::features::InvoiceFeatures) -> CResult_InvoiceFeaturesDecodeErrorZ {
2811         CResult_InvoiceFeaturesDecodeErrorZ {
2812                 contents: CResult_InvoiceFeaturesDecodeErrorZPtr {
2813                         result: Box::into_raw(Box::new(o)),
2814                 },
2815                 result_ok: true,
2816         }
2817 }
2818 #[no_mangle]
2819 /// Creates a new CResult_InvoiceFeaturesDecodeErrorZ in the error state.
2820 pub extern "C" fn CResult_InvoiceFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_InvoiceFeaturesDecodeErrorZ {
2821         CResult_InvoiceFeaturesDecodeErrorZ {
2822                 contents: CResult_InvoiceFeaturesDecodeErrorZPtr {
2823                         err: Box::into_raw(Box::new(e)),
2824                 },
2825                 result_ok: false,
2826         }
2827 }
2828 #[no_mangle]
2829 /// Frees any resources used by the CResult_InvoiceFeaturesDecodeErrorZ.
2830 pub extern "C" fn CResult_InvoiceFeaturesDecodeErrorZ_free(_res: CResult_InvoiceFeaturesDecodeErrorZ) { }
2831 impl Drop for CResult_InvoiceFeaturesDecodeErrorZ {
2832         fn drop(&mut self) {
2833                 if self.result_ok {
2834                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
2835                                 let _ = unsafe { Box::from_raw(self.contents.result) };
2836                         }
2837                 } else {
2838                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
2839                                 let _ = unsafe { Box::from_raw(self.contents.err) };
2840                         }
2841                 }
2842         }
2843 }
2844 impl From<crate::c_types::CResultTempl<crate::lightning::ln::features::InvoiceFeatures, crate::lightning::ln::msgs::DecodeError>> for CResult_InvoiceFeaturesDecodeErrorZ {
2845         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::features::InvoiceFeatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
2846                 let contents = if o.result_ok {
2847                         let result = unsafe { o.contents.result };
2848                         unsafe { o.contents.result = std::ptr::null_mut() };
2849                         CResult_InvoiceFeaturesDecodeErrorZPtr { result }
2850                 } else {
2851                         let err = unsafe { o.contents.err };
2852                         unsafe { o.contents.err = std::ptr::null_mut(); }
2853                         CResult_InvoiceFeaturesDecodeErrorZPtr { err }
2854                 };
2855                 Self {
2856                         contents,
2857                         result_ok: o.result_ok,
2858                 }
2859         }
2860 }
2861 #[repr(C)]
2862 /// The contents of CResult_DelayedPaymentOutputDescriptorDecodeErrorZ
2863 pub union CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr {
2864         /// A pointer to the contents in the success state.
2865         /// Reading from this pointer when `result_ok` is not set is undefined.
2866         pub result: *mut crate::lightning::chain::keysinterface::DelayedPaymentOutputDescriptor,
2867         /// A pointer to the contents in the error state.
2868         /// Reading from this pointer when `result_ok` is set is undefined.
2869         pub err: *mut crate::lightning::ln::msgs::DecodeError,
2870 }
2871 #[repr(C)]
2872 /// A CResult_DelayedPaymentOutputDescriptorDecodeErrorZ represents the result of a fallible operation,
2873 /// containing a crate::lightning::chain::keysinterface::DelayedPaymentOutputDescriptor on success and a crate::lightning::ln::msgs::DecodeError on failure.
2874 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2875 pub struct CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
2876         /// The contents of this CResult_DelayedPaymentOutputDescriptorDecodeErrorZ, accessible via either
2877         /// `err` or `result` depending on the state of `result_ok`.
2878         pub contents: CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr,
2879         /// Whether this CResult_DelayedPaymentOutputDescriptorDecodeErrorZ represents a success state.
2880         pub result_ok: bool,
2881 }
2882 #[no_mangle]
2883 /// Creates a new CResult_DelayedPaymentOutputDescriptorDecodeErrorZ in the success state.
2884 pub extern "C" fn CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_ok(o: crate::lightning::chain::keysinterface::DelayedPaymentOutputDescriptor) -> CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
2885         CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
2886                 contents: CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr {
2887                         result: Box::into_raw(Box::new(o)),
2888                 },
2889                 result_ok: true,
2890         }
2891 }
2892 #[no_mangle]
2893 /// Creates a new CResult_DelayedPaymentOutputDescriptorDecodeErrorZ in the error state.
2894 pub extern "C" fn CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
2895         CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
2896                 contents: CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr {
2897                         err: Box::into_raw(Box::new(e)),
2898                 },
2899                 result_ok: false,
2900         }
2901 }
2902 #[no_mangle]
2903 /// Frees any resources used by the CResult_DelayedPaymentOutputDescriptorDecodeErrorZ.
2904 pub extern "C" fn CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_free(_res: CResult_DelayedPaymentOutputDescriptorDecodeErrorZ) { }
2905 impl Drop for CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
2906         fn drop(&mut self) {
2907                 if self.result_ok {
2908                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
2909                                 let _ = unsafe { Box::from_raw(self.contents.result) };
2910                         }
2911                 } else {
2912                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
2913                                 let _ = unsafe { Box::from_raw(self.contents.err) };
2914                         }
2915                 }
2916         }
2917 }
2918 impl From<crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::DelayedPaymentOutputDescriptor, crate::lightning::ln::msgs::DecodeError>> for CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
2919         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::DelayedPaymentOutputDescriptor, crate::lightning::ln::msgs::DecodeError>) -> Self {
2920                 let contents = if o.result_ok {
2921                         let result = unsafe { o.contents.result };
2922                         unsafe { o.contents.result = std::ptr::null_mut() };
2923                         CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr { result }
2924                 } else {
2925                         let err = unsafe { o.contents.err };
2926                         unsafe { o.contents.err = std::ptr::null_mut(); }
2927                         CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr { err }
2928                 };
2929                 Self {
2930                         contents,
2931                         result_ok: o.result_ok,
2932                 }
2933         }
2934 }
2935 impl Clone for CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
2936         fn clone(&self) -> Self {
2937                 if self.result_ok {
2938                         Self { result_ok: true, contents: CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr {
2939                                 result: Box::into_raw(Box::new(<crate::lightning::chain::keysinterface::DelayedPaymentOutputDescriptor>::clone(unsafe { &*self.contents.result })))
2940                         } }
2941                 } else {
2942                         Self { result_ok: false, contents: CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr {
2943                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
2944                         } }
2945                 }
2946         }
2947 }
2948 #[no_mangle]
2949 /// Creates a new CResult_DelayedPaymentOutputDescriptorDecodeErrorZ which has the same data as `orig`
2950 /// but with all dynamically-allocated buffers duplicated in new buffers.
2951 pub extern "C" fn CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone(orig: &CResult_DelayedPaymentOutputDescriptorDecodeErrorZ) -> CResult_DelayedPaymentOutputDescriptorDecodeErrorZ { Clone::clone(&orig) }
2952 #[repr(C)]
2953 /// The contents of CResult_StaticPaymentOutputDescriptorDecodeErrorZ
2954 pub union CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr {
2955         /// A pointer to the contents in the success state.
2956         /// Reading from this pointer when `result_ok` is not set is undefined.
2957         pub result: *mut crate::lightning::chain::keysinterface::StaticPaymentOutputDescriptor,
2958         /// A pointer to the contents in the error state.
2959         /// Reading from this pointer when `result_ok` is set is undefined.
2960         pub err: *mut crate::lightning::ln::msgs::DecodeError,
2961 }
2962 #[repr(C)]
2963 /// A CResult_StaticPaymentOutputDescriptorDecodeErrorZ represents the result of a fallible operation,
2964 /// containing a crate::lightning::chain::keysinterface::StaticPaymentOutputDescriptor on success and a crate::lightning::ln::msgs::DecodeError on failure.
2965 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2966 pub struct CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
2967         /// The contents of this CResult_StaticPaymentOutputDescriptorDecodeErrorZ, accessible via either
2968         /// `err` or `result` depending on the state of `result_ok`.
2969         pub contents: CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr,
2970         /// Whether this CResult_StaticPaymentOutputDescriptorDecodeErrorZ represents a success state.
2971         pub result_ok: bool,
2972 }
2973 #[no_mangle]
2974 /// Creates a new CResult_StaticPaymentOutputDescriptorDecodeErrorZ in the success state.
2975 pub extern "C" fn CResult_StaticPaymentOutputDescriptorDecodeErrorZ_ok(o: crate::lightning::chain::keysinterface::StaticPaymentOutputDescriptor) -> CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
2976         CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
2977                 contents: CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr {
2978                         result: Box::into_raw(Box::new(o)),
2979                 },
2980                 result_ok: true,
2981         }
2982 }
2983 #[no_mangle]
2984 /// Creates a new CResult_StaticPaymentOutputDescriptorDecodeErrorZ in the error state.
2985 pub extern "C" fn CResult_StaticPaymentOutputDescriptorDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
2986         CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
2987                 contents: CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr {
2988                         err: Box::into_raw(Box::new(e)),
2989                 },
2990                 result_ok: false,
2991         }
2992 }
2993 #[no_mangle]
2994 /// Frees any resources used by the CResult_StaticPaymentOutputDescriptorDecodeErrorZ.
2995 pub extern "C" fn CResult_StaticPaymentOutputDescriptorDecodeErrorZ_free(_res: CResult_StaticPaymentOutputDescriptorDecodeErrorZ) { }
2996 impl Drop for CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
2997         fn drop(&mut self) {
2998                 if self.result_ok {
2999                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
3000                                 let _ = unsafe { Box::from_raw(self.contents.result) };
3001                         }
3002                 } else {
3003                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
3004                                 let _ = unsafe { Box::from_raw(self.contents.err) };
3005                         }
3006                 }
3007         }
3008 }
3009 impl From<crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::StaticPaymentOutputDescriptor, crate::lightning::ln::msgs::DecodeError>> for CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
3010         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::StaticPaymentOutputDescriptor, crate::lightning::ln::msgs::DecodeError>) -> Self {
3011                 let contents = if o.result_ok {
3012                         let result = unsafe { o.contents.result };
3013                         unsafe { o.contents.result = std::ptr::null_mut() };
3014                         CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr { result }
3015                 } else {
3016                         let err = unsafe { o.contents.err };
3017                         unsafe { o.contents.err = std::ptr::null_mut(); }
3018                         CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr { err }
3019                 };
3020                 Self {
3021                         contents,
3022                         result_ok: o.result_ok,
3023                 }
3024         }
3025 }
3026 impl Clone for CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
3027         fn clone(&self) -> Self {
3028                 if self.result_ok {
3029                         Self { result_ok: true, contents: CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr {
3030                                 result: Box::into_raw(Box::new(<crate::lightning::chain::keysinterface::StaticPaymentOutputDescriptor>::clone(unsafe { &*self.contents.result })))
3031                         } }
3032                 } else {
3033                         Self { result_ok: false, contents: CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr {
3034                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
3035                         } }
3036                 }
3037         }
3038 }
3039 #[no_mangle]
3040 /// Creates a new CResult_StaticPaymentOutputDescriptorDecodeErrorZ which has the same data as `orig`
3041 /// but with all dynamically-allocated buffers duplicated in new buffers.
3042 pub extern "C" fn CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone(orig: &CResult_StaticPaymentOutputDescriptorDecodeErrorZ) -> CResult_StaticPaymentOutputDescriptorDecodeErrorZ { Clone::clone(&orig) }
3043 #[repr(C)]
3044 /// The contents of CResult_SpendableOutputDescriptorDecodeErrorZ
3045 pub union CResult_SpendableOutputDescriptorDecodeErrorZPtr {
3046         /// A pointer to the contents in the success state.
3047         /// Reading from this pointer when `result_ok` is not set is undefined.
3048         pub result: *mut crate::lightning::chain::keysinterface::SpendableOutputDescriptor,
3049         /// A pointer to the contents in the error state.
3050         /// Reading from this pointer when `result_ok` is set is undefined.
3051         pub err: *mut crate::lightning::ln::msgs::DecodeError,
3052 }
3053 #[repr(C)]
3054 /// A CResult_SpendableOutputDescriptorDecodeErrorZ represents the result of a fallible operation,
3055 /// containing a crate::lightning::chain::keysinterface::SpendableOutputDescriptor on success and a crate::lightning::ln::msgs::DecodeError on failure.
3056 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3057 pub struct CResult_SpendableOutputDescriptorDecodeErrorZ {
3058         /// The contents of this CResult_SpendableOutputDescriptorDecodeErrorZ, accessible via either
3059         /// `err` or `result` depending on the state of `result_ok`.
3060         pub contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr,
3061         /// Whether this CResult_SpendableOutputDescriptorDecodeErrorZ represents a success state.
3062         pub result_ok: bool,
3063 }
3064 #[no_mangle]
3065 /// Creates a new CResult_SpendableOutputDescriptorDecodeErrorZ in the success state.
3066 pub extern "C" fn CResult_SpendableOutputDescriptorDecodeErrorZ_ok(o: crate::lightning::chain::keysinterface::SpendableOutputDescriptor) -> CResult_SpendableOutputDescriptorDecodeErrorZ {
3067         CResult_SpendableOutputDescriptorDecodeErrorZ {
3068                 contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr {
3069                         result: Box::into_raw(Box::new(o)),
3070                 },
3071                 result_ok: true,
3072         }
3073 }
3074 #[no_mangle]
3075 /// Creates a new CResult_SpendableOutputDescriptorDecodeErrorZ in the error state.
3076 pub extern "C" fn CResult_SpendableOutputDescriptorDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_SpendableOutputDescriptorDecodeErrorZ {
3077         CResult_SpendableOutputDescriptorDecodeErrorZ {
3078                 contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr {
3079                         err: Box::into_raw(Box::new(e)),
3080                 },
3081                 result_ok: false,
3082         }
3083 }
3084 #[no_mangle]
3085 /// Frees any resources used by the CResult_SpendableOutputDescriptorDecodeErrorZ.
3086 pub extern "C" fn CResult_SpendableOutputDescriptorDecodeErrorZ_free(_res: CResult_SpendableOutputDescriptorDecodeErrorZ) { }
3087 impl Drop for CResult_SpendableOutputDescriptorDecodeErrorZ {
3088         fn drop(&mut self) {
3089                 if self.result_ok {
3090                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
3091                                 let _ = unsafe { Box::from_raw(self.contents.result) };
3092                         }
3093                 } else {
3094                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
3095                                 let _ = unsafe { Box::from_raw(self.contents.err) };
3096                         }
3097                 }
3098         }
3099 }
3100 impl From<crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::SpendableOutputDescriptor, crate::lightning::ln::msgs::DecodeError>> for CResult_SpendableOutputDescriptorDecodeErrorZ {
3101         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::SpendableOutputDescriptor, crate::lightning::ln::msgs::DecodeError>) -> Self {
3102                 let contents = if o.result_ok {
3103                         let result = unsafe { o.contents.result };
3104                         unsafe { o.contents.result = std::ptr::null_mut() };
3105                         CResult_SpendableOutputDescriptorDecodeErrorZPtr { result }
3106                 } else {
3107                         let err = unsafe { o.contents.err };
3108                         unsafe { o.contents.err = std::ptr::null_mut(); }
3109                         CResult_SpendableOutputDescriptorDecodeErrorZPtr { err }
3110                 };
3111                 Self {
3112                         contents,
3113                         result_ok: o.result_ok,
3114                 }
3115         }
3116 }
3117 impl Clone for CResult_SpendableOutputDescriptorDecodeErrorZ {
3118         fn clone(&self) -> Self {
3119                 if self.result_ok {
3120                         Self { result_ok: true, contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr {
3121                                 result: Box::into_raw(Box::new(<crate::lightning::chain::keysinterface::SpendableOutputDescriptor>::clone(unsafe { &*self.contents.result })))
3122                         } }
3123                 } else {
3124                         Self { result_ok: false, contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr {
3125                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
3126                         } }
3127                 }
3128         }
3129 }
3130 #[no_mangle]
3131 /// Creates a new CResult_SpendableOutputDescriptorDecodeErrorZ which has the same data as `orig`
3132 /// but with all dynamically-allocated buffers duplicated in new buffers.
3133 pub extern "C" fn CResult_SpendableOutputDescriptorDecodeErrorZ_clone(orig: &CResult_SpendableOutputDescriptorDecodeErrorZ) -> CResult_SpendableOutputDescriptorDecodeErrorZ { Clone::clone(&orig) }
3134 #[repr(C)]
3135 /// The contents of CResult_NoneNoneZ
3136 pub union CResult_NoneNoneZPtr {
3137         /// Note that this value is always NULL, as there are no contents in the OK variant
3138         pub result: *mut std::ffi::c_void,
3139         /// Note that this value is always NULL, as there are no contents in the Err variant
3140         pub err: *mut std::ffi::c_void,
3141 }
3142 #[repr(C)]
3143 /// A CResult_NoneNoneZ represents the result of a fallible operation,
3144 /// containing a () on success and a () on failure.
3145 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3146 pub struct CResult_NoneNoneZ {
3147         /// The contents of this CResult_NoneNoneZ, accessible via either
3148         /// `err` or `result` depending on the state of `result_ok`.
3149         pub contents: CResult_NoneNoneZPtr,
3150         /// Whether this CResult_NoneNoneZ represents a success state.
3151         pub result_ok: bool,
3152 }
3153 #[no_mangle]
3154 /// Creates a new CResult_NoneNoneZ in the success state.
3155 pub extern "C" fn CResult_NoneNoneZ_ok() -> CResult_NoneNoneZ {
3156         CResult_NoneNoneZ {
3157                 contents: CResult_NoneNoneZPtr {
3158                         result: std::ptr::null_mut(),
3159                 },
3160                 result_ok: true,
3161         }
3162 }
3163 #[no_mangle]
3164 /// Creates a new CResult_NoneNoneZ in the error state.
3165 pub extern "C" fn CResult_NoneNoneZ_err() -> CResult_NoneNoneZ {
3166         CResult_NoneNoneZ {
3167                 contents: CResult_NoneNoneZPtr {
3168                         err: std::ptr::null_mut(),
3169                 },
3170                 result_ok: false,
3171         }
3172 }
3173 #[no_mangle]
3174 /// Frees any resources used by the CResult_NoneNoneZ.
3175 pub extern "C" fn CResult_NoneNoneZ_free(_res: CResult_NoneNoneZ) { }
3176 impl Drop for CResult_NoneNoneZ {
3177         fn drop(&mut self) {
3178                 if self.result_ok {
3179                 } else {
3180                 }
3181         }
3182 }
3183 impl From<crate::c_types::CResultTempl<(), ()>> for CResult_NoneNoneZ {
3184         fn from(mut o: crate::c_types::CResultTempl<(), ()>) -> Self {
3185                 let contents = if o.result_ok {
3186                         let _ = unsafe { Box::from_raw(o.contents.result) };
3187                         o.contents.result = std::ptr::null_mut();
3188                         CResult_NoneNoneZPtr { result: std::ptr::null_mut() }
3189                 } else {
3190                         let _ = unsafe { Box::from_raw(o.contents.err) };
3191                         o.contents.err = std::ptr::null_mut();
3192                         CResult_NoneNoneZPtr { err: std::ptr::null_mut() }
3193                 };
3194                 Self {
3195                         contents,
3196                         result_ok: o.result_ok,
3197                 }
3198         }
3199 }
3200 impl Clone for CResult_NoneNoneZ {
3201         fn clone(&self) -> Self {
3202                 if self.result_ok {
3203                         Self { result_ok: true, contents: CResult_NoneNoneZPtr {
3204                                 result: std::ptr::null_mut()
3205                         } }
3206                 } else {
3207                         Self { result_ok: false, contents: CResult_NoneNoneZPtr {
3208                                 err: std::ptr::null_mut()
3209                         } }
3210                 }
3211         }
3212 }
3213 #[no_mangle]
3214 /// Creates a new CResult_NoneNoneZ which has the same data as `orig`
3215 /// but with all dynamically-allocated buffers duplicated in new buffers.
3216 pub extern "C" fn CResult_NoneNoneZ_clone(orig: &CResult_NoneNoneZ) -> CResult_NoneNoneZ { Clone::clone(&orig) }
3217 #[repr(C)]
3218 /// A tuple of 2 elements. See the individual fields for the types contained.
3219 pub struct C2Tuple_SignatureCVec_SignatureZZ {
3220         /// The element at position 0
3221         pub a: crate::c_types::Signature,
3222         /// The element at position 1
3223         pub b: crate::c_types::derived::CVec_SignatureZ,
3224 }
3225 impl From<(crate::c_types::Signature, crate::c_types::derived::CVec_SignatureZ)> for C2Tuple_SignatureCVec_SignatureZZ {
3226         fn from (tup: (crate::c_types::Signature, crate::c_types::derived::CVec_SignatureZ)) -> Self {
3227                 Self {
3228                         a: tup.0,
3229                         b: tup.1,
3230                 }
3231         }
3232 }
3233 impl C2Tuple_SignatureCVec_SignatureZZ {
3234         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::Signature, crate::c_types::derived::CVec_SignatureZ) {
3235                 (self.a, self.b)
3236         }
3237 }
3238 impl Clone for C2Tuple_SignatureCVec_SignatureZZ {
3239         fn clone(&self) -> Self {
3240                 Self {
3241                         a: Clone::clone(&self.a),
3242                         b: Clone::clone(&self.b),
3243                 }
3244         }
3245 }
3246 #[no_mangle]
3247 /// Creates a new tuple which has the same data as `orig`
3248 /// but with all dynamically-allocated buffers duplicated in new buffers.
3249 pub extern "C" fn C2Tuple_SignatureCVec_SignatureZZ_clone(orig: &C2Tuple_SignatureCVec_SignatureZZ) -> C2Tuple_SignatureCVec_SignatureZZ { Clone::clone(&orig) }
3250 /// Creates a new C2Tuple_SignatureCVec_SignatureZZ from the contained elements.
3251 #[no_mangle]
3252 pub extern "C" fn C2Tuple_SignatureCVec_SignatureZZ_new(a: crate::c_types::Signature, b: crate::c_types::derived::CVec_SignatureZ) -> C2Tuple_SignatureCVec_SignatureZZ {
3253         C2Tuple_SignatureCVec_SignatureZZ { a, b, }
3254 }
3255
3256 #[no_mangle]
3257 /// Frees any resources used by the C2Tuple_SignatureCVec_SignatureZZ.
3258 pub extern "C" fn C2Tuple_SignatureCVec_SignatureZZ_free(_res: C2Tuple_SignatureCVec_SignatureZZ) { }
3259 #[repr(C)]
3260 /// The contents of CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ
3261 pub union CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
3262         /// A pointer to the contents in the success state.
3263         /// Reading from this pointer when `result_ok` is not set is undefined.
3264         pub result: *mut crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ,
3265         /// Note that this value is always NULL, as there are no contents in the Err variant
3266         pub err: *mut std::ffi::c_void,
3267 }
3268 #[repr(C)]
3269 /// A CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ represents the result of a fallible operation,
3270 /// containing a crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ on success and a () on failure.
3271 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3272 pub struct CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
3273         /// The contents of this CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ, accessible via either
3274         /// `err` or `result` depending on the state of `result_ok`.
3275         pub contents: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr,
3276         /// Whether this CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ represents a success state.
3277         pub result_ok: bool,
3278 }
3279 #[no_mangle]
3280 /// Creates a new CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ in the success state.
3281 pub extern "C" fn CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_ok(o: crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ) -> CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
3282         CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
3283                 contents: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
3284                         result: Box::into_raw(Box::new(o)),
3285                 },
3286                 result_ok: true,
3287         }
3288 }
3289 #[no_mangle]
3290 /// Creates a new CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ in the error state.
3291 pub extern "C" fn CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_err() -> CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
3292         CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
3293                 contents: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
3294                         err: std::ptr::null_mut(),
3295                 },
3296                 result_ok: false,
3297         }
3298 }
3299 #[no_mangle]
3300 /// Frees any resources used by the CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ.
3301 pub extern "C" fn CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_free(_res: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ) { }
3302 impl Drop for CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
3303         fn drop(&mut self) {
3304                 if self.result_ok {
3305                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
3306                                 let _ = unsafe { Box::from_raw(self.contents.result) };
3307                         }
3308                 } else {
3309                 }
3310         }
3311 }
3312 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ, ()>> for CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
3313         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ, ()>) -> Self {
3314                 let contents = if o.result_ok {
3315                         let result = unsafe { o.contents.result };
3316                         unsafe { o.contents.result = std::ptr::null_mut() };
3317                         CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr { result }
3318                 } else {
3319                         let _ = unsafe { Box::from_raw(o.contents.err) };
3320                         o.contents.err = std::ptr::null_mut();
3321                         CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr { err: std::ptr::null_mut() }
3322                 };
3323                 Self {
3324                         contents,
3325                         result_ok: o.result_ok,
3326                 }
3327         }
3328 }
3329 impl Clone for CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
3330         fn clone(&self) -> Self {
3331                 if self.result_ok {
3332                         Self { result_ok: true, contents: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
3333                                 result: Box::into_raw(Box::new(<crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ>::clone(unsafe { &*self.contents.result })))
3334                         } }
3335                 } else {
3336                         Self { result_ok: false, contents: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
3337                                 err: std::ptr::null_mut()
3338                         } }
3339                 }
3340         }
3341 }
3342 #[no_mangle]
3343 /// Creates a new CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ which has the same data as `orig`
3344 /// but with all dynamically-allocated buffers duplicated in new buffers.
3345 pub extern "C" fn CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone(orig: &CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ) -> CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ { Clone::clone(&orig) }
3346 #[repr(C)]
3347 /// The contents of CResult_SignatureNoneZ
3348 pub union CResult_SignatureNoneZPtr {
3349         /// A pointer to the contents in the success state.
3350         /// Reading from this pointer when `result_ok` is not set is undefined.
3351         pub result: *mut crate::c_types::Signature,
3352         /// Note that this value is always NULL, as there are no contents in the Err variant
3353         pub err: *mut std::ffi::c_void,
3354 }
3355 #[repr(C)]
3356 /// A CResult_SignatureNoneZ represents the result of a fallible operation,
3357 /// containing a crate::c_types::Signature on success and a () on failure.
3358 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3359 pub struct CResult_SignatureNoneZ {
3360         /// The contents of this CResult_SignatureNoneZ, accessible via either
3361         /// `err` or `result` depending on the state of `result_ok`.
3362         pub contents: CResult_SignatureNoneZPtr,
3363         /// Whether this CResult_SignatureNoneZ represents a success state.
3364         pub result_ok: bool,
3365 }
3366 #[no_mangle]
3367 /// Creates a new CResult_SignatureNoneZ in the success state.
3368 pub extern "C" fn CResult_SignatureNoneZ_ok(o: crate::c_types::Signature) -> CResult_SignatureNoneZ {
3369         CResult_SignatureNoneZ {
3370                 contents: CResult_SignatureNoneZPtr {
3371                         result: Box::into_raw(Box::new(o)),
3372                 },
3373                 result_ok: true,
3374         }
3375 }
3376 #[no_mangle]
3377 /// Creates a new CResult_SignatureNoneZ in the error state.
3378 pub extern "C" fn CResult_SignatureNoneZ_err() -> CResult_SignatureNoneZ {
3379         CResult_SignatureNoneZ {
3380                 contents: CResult_SignatureNoneZPtr {
3381                         err: std::ptr::null_mut(),
3382                 },
3383                 result_ok: false,
3384         }
3385 }
3386 #[no_mangle]
3387 /// Frees any resources used by the CResult_SignatureNoneZ.
3388 pub extern "C" fn CResult_SignatureNoneZ_free(_res: CResult_SignatureNoneZ) { }
3389 impl Drop for CResult_SignatureNoneZ {
3390         fn drop(&mut self) {
3391                 if self.result_ok {
3392                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
3393                                 let _ = unsafe { Box::from_raw(self.contents.result) };
3394                         }
3395                 } else {
3396                 }
3397         }
3398 }
3399 impl From<crate::c_types::CResultTempl<crate::c_types::Signature, ()>> for CResult_SignatureNoneZ {
3400         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::Signature, ()>) -> Self {
3401                 let contents = if o.result_ok {
3402                         let result = unsafe { o.contents.result };
3403                         unsafe { o.contents.result = std::ptr::null_mut() };
3404                         CResult_SignatureNoneZPtr { result }
3405                 } else {
3406                         let _ = unsafe { Box::from_raw(o.contents.err) };
3407                         o.contents.err = std::ptr::null_mut();
3408                         CResult_SignatureNoneZPtr { err: std::ptr::null_mut() }
3409                 };
3410                 Self {
3411                         contents,
3412                         result_ok: o.result_ok,
3413                 }
3414         }
3415 }
3416 impl Clone for CResult_SignatureNoneZ {
3417         fn clone(&self) -> Self {
3418                 if self.result_ok {
3419                         Self { result_ok: true, contents: CResult_SignatureNoneZPtr {
3420                                 result: Box::into_raw(Box::new(<crate::c_types::Signature>::clone(unsafe { &*self.contents.result })))
3421                         } }
3422                 } else {
3423                         Self { result_ok: false, contents: CResult_SignatureNoneZPtr {
3424                                 err: std::ptr::null_mut()
3425                         } }
3426                 }
3427         }
3428 }
3429 #[no_mangle]
3430 /// Creates a new CResult_SignatureNoneZ which has the same data as `orig`
3431 /// but with all dynamically-allocated buffers duplicated in new buffers.
3432 pub extern "C" fn CResult_SignatureNoneZ_clone(orig: &CResult_SignatureNoneZ) -> CResult_SignatureNoneZ { Clone::clone(&orig) }
3433 #[repr(C)]
3434 /// The contents of CResult_SignDecodeErrorZ
3435 pub union CResult_SignDecodeErrorZPtr {
3436         /// A pointer to the contents in the success state.
3437         /// Reading from this pointer when `result_ok` is not set is undefined.
3438         pub result: *mut crate::lightning::chain::keysinterface::Sign,
3439         /// A pointer to the contents in the error state.
3440         /// Reading from this pointer when `result_ok` is set is undefined.
3441         pub err: *mut crate::lightning::ln::msgs::DecodeError,
3442 }
3443 #[repr(C)]
3444 /// A CResult_SignDecodeErrorZ represents the result of a fallible operation,
3445 /// containing a crate::lightning::chain::keysinterface::Sign on success and a crate::lightning::ln::msgs::DecodeError on failure.
3446 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3447 pub struct CResult_SignDecodeErrorZ {
3448         /// The contents of this CResult_SignDecodeErrorZ, accessible via either
3449         /// `err` or `result` depending on the state of `result_ok`.
3450         pub contents: CResult_SignDecodeErrorZPtr,
3451         /// Whether this CResult_SignDecodeErrorZ represents a success state.
3452         pub result_ok: bool,
3453 }
3454 #[no_mangle]
3455 /// Creates a new CResult_SignDecodeErrorZ in the success state.
3456 pub extern "C" fn CResult_SignDecodeErrorZ_ok(o: crate::lightning::chain::keysinterface::Sign) -> CResult_SignDecodeErrorZ {
3457         CResult_SignDecodeErrorZ {
3458                 contents: CResult_SignDecodeErrorZPtr {
3459                         result: Box::into_raw(Box::new(o)),
3460                 },
3461                 result_ok: true,
3462         }
3463 }
3464 #[no_mangle]
3465 /// Creates a new CResult_SignDecodeErrorZ in the error state.
3466 pub extern "C" fn CResult_SignDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_SignDecodeErrorZ {
3467         CResult_SignDecodeErrorZ {
3468                 contents: CResult_SignDecodeErrorZPtr {
3469                         err: Box::into_raw(Box::new(e)),
3470                 },
3471                 result_ok: false,
3472         }
3473 }
3474 #[no_mangle]
3475 /// Frees any resources used by the CResult_SignDecodeErrorZ.
3476 pub extern "C" fn CResult_SignDecodeErrorZ_free(_res: CResult_SignDecodeErrorZ) { }
3477 impl Drop for CResult_SignDecodeErrorZ {
3478         fn drop(&mut self) {
3479                 if self.result_ok {
3480                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
3481                                 let _ = unsafe { Box::from_raw(self.contents.result) };
3482                         }
3483                 } else {
3484                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
3485                                 let _ = unsafe { Box::from_raw(self.contents.err) };
3486                         }
3487                 }
3488         }
3489 }
3490 impl From<crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::Sign, crate::lightning::ln::msgs::DecodeError>> for CResult_SignDecodeErrorZ {
3491         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::Sign, crate::lightning::ln::msgs::DecodeError>) -> Self {
3492                 let contents = if o.result_ok {
3493                         let result = unsafe { o.contents.result };
3494                         unsafe { o.contents.result = std::ptr::null_mut() };
3495                         CResult_SignDecodeErrorZPtr { result }
3496                 } else {
3497                         let err = unsafe { o.contents.err };
3498                         unsafe { o.contents.err = std::ptr::null_mut(); }
3499                         CResult_SignDecodeErrorZPtr { err }
3500                 };
3501                 Self {
3502                         contents,
3503                         result_ok: o.result_ok,
3504                 }
3505         }
3506 }
3507 impl Clone for CResult_SignDecodeErrorZ {
3508         fn clone(&self) -> Self {
3509                 if self.result_ok {
3510                         Self { result_ok: true, contents: CResult_SignDecodeErrorZPtr {
3511                                 result: Box::into_raw(Box::new(<crate::lightning::chain::keysinterface::Sign>::clone(unsafe { &*self.contents.result })))
3512                         } }
3513                 } else {
3514                         Self { result_ok: false, contents: CResult_SignDecodeErrorZPtr {
3515                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
3516                         } }
3517                 }
3518         }
3519 }
3520 #[no_mangle]
3521 /// Creates a new CResult_SignDecodeErrorZ which has the same data as `orig`
3522 /// but with all dynamically-allocated buffers duplicated in new buffers.
3523 pub extern "C" fn CResult_SignDecodeErrorZ_clone(orig: &CResult_SignDecodeErrorZ) -> CResult_SignDecodeErrorZ { Clone::clone(&orig) }
3524 #[repr(C)]
3525 /// A dynamically-allocated array of u8s of arbitrary size.
3526 /// This corresponds to std::vector in C++
3527 pub struct CVec_u8Z {
3528         /// The elements in the array.
3529         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3530         pub data: *mut u8,
3531         /// The number of elements pointed to by `data`.
3532         pub datalen: usize
3533 }
3534 impl CVec_u8Z {
3535         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<u8> {
3536                 if self.datalen == 0 { return Vec::new(); }
3537                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
3538                 self.data = std::ptr::null_mut();
3539                 self.datalen = 0;
3540                 ret
3541         }
3542         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[u8] {
3543                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
3544         }
3545 }
3546 impl From<Vec<u8>> for CVec_u8Z {
3547         fn from(v: Vec<u8>) -> Self {
3548                 let datalen = v.len();
3549                 let data = Box::into_raw(v.into_boxed_slice());
3550                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
3551         }
3552 }
3553 #[no_mangle]
3554 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
3555 pub extern "C" fn CVec_u8Z_free(_res: CVec_u8Z) { }
3556 impl Drop for CVec_u8Z {
3557         fn drop(&mut self) {
3558                 if self.datalen == 0 { return; }
3559                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
3560         }
3561 }
3562 impl Clone for CVec_u8Z {
3563         fn clone(&self) -> Self {
3564                 let mut res = Vec::new();
3565                 if self.datalen == 0 { return Self::from(res); }
3566                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
3567                 Self::from(res)
3568         }
3569 }
3570 #[repr(C)]
3571 /// The contents of CResult_RecoverableSignatureNoneZ
3572 pub union CResult_RecoverableSignatureNoneZPtr {
3573         /// A pointer to the contents in the success state.
3574         /// Reading from this pointer when `result_ok` is not set is undefined.
3575         pub result: *mut crate::c_types::RecoverableSignature,
3576         /// Note that this value is always NULL, as there are no contents in the Err variant
3577         pub err: *mut std::ffi::c_void,
3578 }
3579 #[repr(C)]
3580 /// A CResult_RecoverableSignatureNoneZ represents the result of a fallible operation,
3581 /// containing a crate::c_types::RecoverableSignature on success and a () on failure.
3582 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3583 pub struct CResult_RecoverableSignatureNoneZ {
3584         /// The contents of this CResult_RecoverableSignatureNoneZ, accessible via either
3585         /// `err` or `result` depending on the state of `result_ok`.
3586         pub contents: CResult_RecoverableSignatureNoneZPtr,
3587         /// Whether this CResult_RecoverableSignatureNoneZ represents a success state.
3588         pub result_ok: bool,
3589 }
3590 #[no_mangle]
3591 /// Creates a new CResult_RecoverableSignatureNoneZ in the success state.
3592 pub extern "C" fn CResult_RecoverableSignatureNoneZ_ok(o: crate::c_types::RecoverableSignature) -> CResult_RecoverableSignatureNoneZ {
3593         CResult_RecoverableSignatureNoneZ {
3594                 contents: CResult_RecoverableSignatureNoneZPtr {
3595                         result: Box::into_raw(Box::new(o)),
3596                 },
3597                 result_ok: true,
3598         }
3599 }
3600 #[no_mangle]
3601 /// Creates a new CResult_RecoverableSignatureNoneZ in the error state.
3602 pub extern "C" fn CResult_RecoverableSignatureNoneZ_err() -> CResult_RecoverableSignatureNoneZ {
3603         CResult_RecoverableSignatureNoneZ {
3604                 contents: CResult_RecoverableSignatureNoneZPtr {
3605                         err: std::ptr::null_mut(),
3606                 },
3607                 result_ok: false,
3608         }
3609 }
3610 #[no_mangle]
3611 /// Frees any resources used by the CResult_RecoverableSignatureNoneZ.
3612 pub extern "C" fn CResult_RecoverableSignatureNoneZ_free(_res: CResult_RecoverableSignatureNoneZ) { }
3613 impl Drop for CResult_RecoverableSignatureNoneZ {
3614         fn drop(&mut self) {
3615                 if self.result_ok {
3616                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
3617                                 let _ = unsafe { Box::from_raw(self.contents.result) };
3618                         }
3619                 } else {
3620                 }
3621         }
3622 }
3623 impl From<crate::c_types::CResultTempl<crate::c_types::RecoverableSignature, ()>> for CResult_RecoverableSignatureNoneZ {
3624         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::RecoverableSignature, ()>) -> Self {
3625                 let contents = if o.result_ok {
3626                         let result = unsafe { o.contents.result };
3627                         unsafe { o.contents.result = std::ptr::null_mut() };
3628                         CResult_RecoverableSignatureNoneZPtr { result }
3629                 } else {
3630                         let _ = unsafe { Box::from_raw(o.contents.err) };
3631                         o.contents.err = std::ptr::null_mut();
3632                         CResult_RecoverableSignatureNoneZPtr { err: std::ptr::null_mut() }
3633                 };
3634                 Self {
3635                         contents,
3636                         result_ok: o.result_ok,
3637                 }
3638         }
3639 }
3640 impl Clone for CResult_RecoverableSignatureNoneZ {
3641         fn clone(&self) -> Self {
3642                 if self.result_ok {
3643                         Self { result_ok: true, contents: CResult_RecoverableSignatureNoneZPtr {
3644                                 result: Box::into_raw(Box::new(<crate::c_types::RecoverableSignature>::clone(unsafe { &*self.contents.result })))
3645                         } }
3646                 } else {
3647                         Self { result_ok: false, contents: CResult_RecoverableSignatureNoneZPtr {
3648                                 err: std::ptr::null_mut()
3649                         } }
3650                 }
3651         }
3652 }
3653 #[no_mangle]
3654 /// Creates a new CResult_RecoverableSignatureNoneZ which has the same data as `orig`
3655 /// but with all dynamically-allocated buffers duplicated in new buffers.
3656 pub extern "C" fn CResult_RecoverableSignatureNoneZ_clone(orig: &CResult_RecoverableSignatureNoneZ) -> CResult_RecoverableSignatureNoneZ { Clone::clone(&orig) }
3657 #[repr(C)]
3658 /// A dynamically-allocated array of crate::c_types::derived::CVec_u8Zs of arbitrary size.
3659 /// This corresponds to std::vector in C++
3660 pub struct CVec_CVec_u8ZZ {
3661         /// The elements in the array.
3662         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3663         pub data: *mut crate::c_types::derived::CVec_u8Z,
3664         /// The number of elements pointed to by `data`.
3665         pub datalen: usize
3666 }
3667 impl CVec_CVec_u8ZZ {
3668         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::CVec_u8Z> {
3669                 if self.datalen == 0 { return Vec::new(); }
3670                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
3671                 self.data = std::ptr::null_mut();
3672                 self.datalen = 0;
3673                 ret
3674         }
3675         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::CVec_u8Z] {
3676                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
3677         }
3678 }
3679 impl From<Vec<crate::c_types::derived::CVec_u8Z>> for CVec_CVec_u8ZZ {
3680         fn from(v: Vec<crate::c_types::derived::CVec_u8Z>) -> Self {
3681                 let datalen = v.len();
3682                 let data = Box::into_raw(v.into_boxed_slice());
3683                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
3684         }
3685 }
3686 #[no_mangle]
3687 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
3688 pub extern "C" fn CVec_CVec_u8ZZ_free(_res: CVec_CVec_u8ZZ) { }
3689 impl Drop for CVec_CVec_u8ZZ {
3690         fn drop(&mut self) {
3691                 if self.datalen == 0 { return; }
3692                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
3693         }
3694 }
3695 impl Clone for CVec_CVec_u8ZZ {
3696         fn clone(&self) -> Self {
3697                 let mut res = Vec::new();
3698                 if self.datalen == 0 { return Self::from(res); }
3699                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
3700                 Self::from(res)
3701         }
3702 }
3703 #[repr(C)]
3704 /// The contents of CResult_CVec_CVec_u8ZZNoneZ
3705 pub union CResult_CVec_CVec_u8ZZNoneZPtr {
3706         /// A pointer to the contents in the success state.
3707         /// Reading from this pointer when `result_ok` is not set is undefined.
3708         pub result: *mut crate::c_types::derived::CVec_CVec_u8ZZ,
3709         /// Note that this value is always NULL, as there are no contents in the Err variant
3710         pub err: *mut std::ffi::c_void,
3711 }
3712 #[repr(C)]
3713 /// A CResult_CVec_CVec_u8ZZNoneZ represents the result of a fallible operation,
3714 /// containing a crate::c_types::derived::CVec_CVec_u8ZZ on success and a () on failure.
3715 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3716 pub struct CResult_CVec_CVec_u8ZZNoneZ {
3717         /// The contents of this CResult_CVec_CVec_u8ZZNoneZ, accessible via either
3718         /// `err` or `result` depending on the state of `result_ok`.
3719         pub contents: CResult_CVec_CVec_u8ZZNoneZPtr,
3720         /// Whether this CResult_CVec_CVec_u8ZZNoneZ represents a success state.
3721         pub result_ok: bool,
3722 }
3723 #[no_mangle]
3724 /// Creates a new CResult_CVec_CVec_u8ZZNoneZ in the success state.
3725 pub extern "C" fn CResult_CVec_CVec_u8ZZNoneZ_ok(o: crate::c_types::derived::CVec_CVec_u8ZZ) -> CResult_CVec_CVec_u8ZZNoneZ {
3726         CResult_CVec_CVec_u8ZZNoneZ {
3727                 contents: CResult_CVec_CVec_u8ZZNoneZPtr {
3728                         result: Box::into_raw(Box::new(o)),
3729                 },
3730                 result_ok: true,
3731         }
3732 }
3733 #[no_mangle]
3734 /// Creates a new CResult_CVec_CVec_u8ZZNoneZ in the error state.
3735 pub extern "C" fn CResult_CVec_CVec_u8ZZNoneZ_err() -> CResult_CVec_CVec_u8ZZNoneZ {
3736         CResult_CVec_CVec_u8ZZNoneZ {
3737                 contents: CResult_CVec_CVec_u8ZZNoneZPtr {
3738                         err: std::ptr::null_mut(),
3739                 },
3740                 result_ok: false,
3741         }
3742 }
3743 #[no_mangle]
3744 /// Frees any resources used by the CResult_CVec_CVec_u8ZZNoneZ.
3745 pub extern "C" fn CResult_CVec_CVec_u8ZZNoneZ_free(_res: CResult_CVec_CVec_u8ZZNoneZ) { }
3746 impl Drop for CResult_CVec_CVec_u8ZZNoneZ {
3747         fn drop(&mut self) {
3748                 if self.result_ok {
3749                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
3750                                 let _ = unsafe { Box::from_raw(self.contents.result) };
3751                         }
3752                 } else {
3753                 }
3754         }
3755 }
3756 impl From<crate::c_types::CResultTempl<crate::c_types::derived::CVec_CVec_u8ZZ, ()>> for CResult_CVec_CVec_u8ZZNoneZ {
3757         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CVec_CVec_u8ZZ, ()>) -> Self {
3758                 let contents = if o.result_ok {
3759                         let result = unsafe { o.contents.result };
3760                         unsafe { o.contents.result = std::ptr::null_mut() };
3761                         CResult_CVec_CVec_u8ZZNoneZPtr { result }
3762                 } else {
3763                         let _ = unsafe { Box::from_raw(o.contents.err) };
3764                         o.contents.err = std::ptr::null_mut();
3765                         CResult_CVec_CVec_u8ZZNoneZPtr { err: std::ptr::null_mut() }
3766                 };
3767                 Self {
3768                         contents,
3769                         result_ok: o.result_ok,
3770                 }
3771         }
3772 }
3773 impl Clone for CResult_CVec_CVec_u8ZZNoneZ {
3774         fn clone(&self) -> Self {
3775                 if self.result_ok {
3776                         Self { result_ok: true, contents: CResult_CVec_CVec_u8ZZNoneZPtr {
3777                                 result: Box::into_raw(Box::new(<crate::c_types::derived::CVec_CVec_u8ZZ>::clone(unsafe { &*self.contents.result })))
3778                         } }
3779                 } else {
3780                         Self { result_ok: false, contents: CResult_CVec_CVec_u8ZZNoneZPtr {
3781                                 err: std::ptr::null_mut()
3782                         } }
3783                 }
3784         }
3785 }
3786 #[no_mangle]
3787 /// Creates a new CResult_CVec_CVec_u8ZZNoneZ which has the same data as `orig`
3788 /// but with all dynamically-allocated buffers duplicated in new buffers.
3789 pub extern "C" fn CResult_CVec_CVec_u8ZZNoneZ_clone(orig: &CResult_CVec_CVec_u8ZZNoneZ) -> CResult_CVec_CVec_u8ZZNoneZ { Clone::clone(&orig) }
3790 #[repr(C)]
3791 /// The contents of CResult_InMemorySignerDecodeErrorZ
3792 pub union CResult_InMemorySignerDecodeErrorZPtr {
3793         /// A pointer to the contents in the success state.
3794         /// Reading from this pointer when `result_ok` is not set is undefined.
3795         pub result: *mut crate::lightning::chain::keysinterface::InMemorySigner,
3796         /// A pointer to the contents in the error state.
3797         /// Reading from this pointer when `result_ok` is set is undefined.
3798         pub err: *mut crate::lightning::ln::msgs::DecodeError,
3799 }
3800 #[repr(C)]
3801 /// A CResult_InMemorySignerDecodeErrorZ represents the result of a fallible operation,
3802 /// containing a crate::lightning::chain::keysinterface::InMemorySigner on success and a crate::lightning::ln::msgs::DecodeError on failure.
3803 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3804 pub struct CResult_InMemorySignerDecodeErrorZ {
3805         /// The contents of this CResult_InMemorySignerDecodeErrorZ, accessible via either
3806         /// `err` or `result` depending on the state of `result_ok`.
3807         pub contents: CResult_InMemorySignerDecodeErrorZPtr,
3808         /// Whether this CResult_InMemorySignerDecodeErrorZ represents a success state.
3809         pub result_ok: bool,
3810 }
3811 #[no_mangle]
3812 /// Creates a new CResult_InMemorySignerDecodeErrorZ in the success state.
3813 pub extern "C" fn CResult_InMemorySignerDecodeErrorZ_ok(o: crate::lightning::chain::keysinterface::InMemorySigner) -> CResult_InMemorySignerDecodeErrorZ {
3814         CResult_InMemorySignerDecodeErrorZ {
3815                 contents: CResult_InMemorySignerDecodeErrorZPtr {
3816                         result: Box::into_raw(Box::new(o)),
3817                 },
3818                 result_ok: true,
3819         }
3820 }
3821 #[no_mangle]
3822 /// Creates a new CResult_InMemorySignerDecodeErrorZ in the error state.
3823 pub extern "C" fn CResult_InMemorySignerDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_InMemorySignerDecodeErrorZ {
3824         CResult_InMemorySignerDecodeErrorZ {
3825                 contents: CResult_InMemorySignerDecodeErrorZPtr {
3826                         err: Box::into_raw(Box::new(e)),
3827                 },
3828                 result_ok: false,
3829         }
3830 }
3831 #[no_mangle]
3832 /// Frees any resources used by the CResult_InMemorySignerDecodeErrorZ.
3833 pub extern "C" fn CResult_InMemorySignerDecodeErrorZ_free(_res: CResult_InMemorySignerDecodeErrorZ) { }
3834 impl Drop for CResult_InMemorySignerDecodeErrorZ {
3835         fn drop(&mut self) {
3836                 if self.result_ok {
3837                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
3838                                 let _ = unsafe { Box::from_raw(self.contents.result) };
3839                         }
3840                 } else {
3841                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
3842                                 let _ = unsafe { Box::from_raw(self.contents.err) };
3843                         }
3844                 }
3845         }
3846 }
3847 impl From<crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::InMemorySigner, crate::lightning::ln::msgs::DecodeError>> for CResult_InMemorySignerDecodeErrorZ {
3848         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::InMemorySigner, crate::lightning::ln::msgs::DecodeError>) -> Self {
3849                 let contents = if o.result_ok {
3850                         let result = unsafe { o.contents.result };
3851                         unsafe { o.contents.result = std::ptr::null_mut() };
3852                         CResult_InMemorySignerDecodeErrorZPtr { result }
3853                 } else {
3854                         let err = unsafe { o.contents.err };
3855                         unsafe { o.contents.err = std::ptr::null_mut(); }
3856                         CResult_InMemorySignerDecodeErrorZPtr { err }
3857                 };
3858                 Self {
3859                         contents,
3860                         result_ok: o.result_ok,
3861                 }
3862         }
3863 }
3864 impl Clone for CResult_InMemorySignerDecodeErrorZ {
3865         fn clone(&self) -> Self {
3866                 if self.result_ok {
3867                         Self { result_ok: true, contents: CResult_InMemorySignerDecodeErrorZPtr {
3868                                 result: Box::into_raw(Box::new(<crate::lightning::chain::keysinterface::InMemorySigner>::clone(unsafe { &*self.contents.result })))
3869                         } }
3870                 } else {
3871                         Self { result_ok: false, contents: CResult_InMemorySignerDecodeErrorZPtr {
3872                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
3873                         } }
3874                 }
3875         }
3876 }
3877 #[no_mangle]
3878 /// Creates a new CResult_InMemorySignerDecodeErrorZ which has the same data as `orig`
3879 /// but with all dynamically-allocated buffers duplicated in new buffers.
3880 pub extern "C" fn CResult_InMemorySignerDecodeErrorZ_clone(orig: &CResult_InMemorySignerDecodeErrorZ) -> CResult_InMemorySignerDecodeErrorZ { Clone::clone(&orig) }
3881 #[repr(C)]
3882 /// A dynamically-allocated array of crate::c_types::TxOuts of arbitrary size.
3883 /// This corresponds to std::vector in C++
3884 pub struct CVec_TxOutZ {
3885         /// The elements in the array.
3886         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3887         pub data: *mut crate::c_types::TxOut,
3888         /// The number of elements pointed to by `data`.
3889         pub datalen: usize
3890 }
3891 impl CVec_TxOutZ {
3892         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::TxOut> {
3893                 if self.datalen == 0 { return Vec::new(); }
3894                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
3895                 self.data = std::ptr::null_mut();
3896                 self.datalen = 0;
3897                 ret
3898         }
3899         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::TxOut] {
3900                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
3901         }
3902 }
3903 impl From<Vec<crate::c_types::TxOut>> for CVec_TxOutZ {
3904         fn from(v: Vec<crate::c_types::TxOut>) -> Self {
3905                 let datalen = v.len();
3906                 let data = Box::into_raw(v.into_boxed_slice());
3907                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
3908         }
3909 }
3910 #[no_mangle]
3911 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
3912 pub extern "C" fn CVec_TxOutZ_free(_res: CVec_TxOutZ) { }
3913 impl Drop for CVec_TxOutZ {
3914         fn drop(&mut self) {
3915                 if self.datalen == 0 { return; }
3916                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
3917         }
3918 }
3919 impl Clone for CVec_TxOutZ {
3920         fn clone(&self) -> Self {
3921                 let mut res = Vec::new();
3922                 if self.datalen == 0 { return Self::from(res); }
3923                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
3924                 Self::from(res)
3925         }
3926 }
3927 #[repr(C)]
3928 /// The contents of CResult_TransactionNoneZ
3929 pub union CResult_TransactionNoneZPtr {
3930         /// A pointer to the contents in the success state.
3931         /// Reading from this pointer when `result_ok` is not set is undefined.
3932         pub result: *mut crate::c_types::Transaction,
3933         /// Note that this value is always NULL, as there are no contents in the Err variant
3934         pub err: *mut std::ffi::c_void,
3935 }
3936 #[repr(C)]
3937 /// A CResult_TransactionNoneZ represents the result of a fallible operation,
3938 /// containing a crate::c_types::Transaction on success and a () on failure.
3939 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3940 pub struct CResult_TransactionNoneZ {
3941         /// The contents of this CResult_TransactionNoneZ, accessible via either
3942         /// `err` or `result` depending on the state of `result_ok`.
3943         pub contents: CResult_TransactionNoneZPtr,
3944         /// Whether this CResult_TransactionNoneZ represents a success state.
3945         pub result_ok: bool,
3946 }
3947 #[no_mangle]
3948 /// Creates a new CResult_TransactionNoneZ in the success state.
3949 pub extern "C" fn CResult_TransactionNoneZ_ok(o: crate::c_types::Transaction) -> CResult_TransactionNoneZ {
3950         CResult_TransactionNoneZ {
3951                 contents: CResult_TransactionNoneZPtr {
3952                         result: Box::into_raw(Box::new(o)),
3953                 },
3954                 result_ok: true,
3955         }
3956 }
3957 #[no_mangle]
3958 /// Creates a new CResult_TransactionNoneZ in the error state.
3959 pub extern "C" fn CResult_TransactionNoneZ_err() -> CResult_TransactionNoneZ {
3960         CResult_TransactionNoneZ {
3961                 contents: CResult_TransactionNoneZPtr {
3962                         err: std::ptr::null_mut(),
3963                 },
3964                 result_ok: false,
3965         }
3966 }
3967 #[no_mangle]
3968 /// Frees any resources used by the CResult_TransactionNoneZ.
3969 pub extern "C" fn CResult_TransactionNoneZ_free(_res: CResult_TransactionNoneZ) { }
3970 impl Drop for CResult_TransactionNoneZ {
3971         fn drop(&mut self) {
3972                 if self.result_ok {
3973                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
3974                                 let _ = unsafe { Box::from_raw(self.contents.result) };
3975                         }
3976                 } else {
3977                 }
3978         }
3979 }
3980 impl From<crate::c_types::CResultTempl<crate::c_types::Transaction, ()>> for CResult_TransactionNoneZ {
3981         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::Transaction, ()>) -> Self {
3982                 let contents = if o.result_ok {
3983                         let result = unsafe { o.contents.result };
3984                         unsafe { o.contents.result = std::ptr::null_mut() };
3985                         CResult_TransactionNoneZPtr { result }
3986                 } else {
3987                         let _ = unsafe { Box::from_raw(o.contents.err) };
3988                         o.contents.err = std::ptr::null_mut();
3989                         CResult_TransactionNoneZPtr { err: std::ptr::null_mut() }
3990                 };
3991                 Self {
3992                         contents,
3993                         result_ok: o.result_ok,
3994                 }
3995         }
3996 }
3997 impl Clone for CResult_TransactionNoneZ {
3998         fn clone(&self) -> Self {
3999                 if self.result_ok {
4000                         Self { result_ok: true, contents: CResult_TransactionNoneZPtr {
4001                                 result: Box::into_raw(Box::new(<crate::c_types::Transaction>::clone(unsafe { &*self.contents.result })))
4002                         } }
4003                 } else {
4004                         Self { result_ok: false, contents: CResult_TransactionNoneZPtr {
4005                                 err: std::ptr::null_mut()
4006                         } }
4007                 }
4008         }
4009 }
4010 #[no_mangle]
4011 /// Creates a new CResult_TransactionNoneZ which has the same data as `orig`
4012 /// but with all dynamically-allocated buffers duplicated in new buffers.
4013 pub extern "C" fn CResult_TransactionNoneZ_clone(orig: &CResult_TransactionNoneZ) -> CResult_TransactionNoneZ { Clone::clone(&orig) }
4014 #[repr(C)]
4015 /// A tuple of 2 elements. See the individual fields for the types contained.
4016 pub struct C2Tuple_BlockHashChannelMonitorZ {
4017         /// The element at position 0
4018         pub a: crate::c_types::ThirtyTwoBytes,
4019         /// The element at position 1
4020         pub b: crate::lightning::chain::channelmonitor::ChannelMonitor,
4021 }
4022 impl From<(crate::c_types::ThirtyTwoBytes, crate::lightning::chain::channelmonitor::ChannelMonitor)> for C2Tuple_BlockHashChannelMonitorZ {
4023         fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::lightning::chain::channelmonitor::ChannelMonitor)) -> Self {
4024                 Self {
4025                         a: tup.0,
4026                         b: tup.1,
4027                 }
4028         }
4029 }
4030 impl C2Tuple_BlockHashChannelMonitorZ {
4031         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::lightning::chain::channelmonitor::ChannelMonitor) {
4032                 (self.a, self.b)
4033         }
4034 }
4035 /// Creates a new C2Tuple_BlockHashChannelMonitorZ from the contained elements.
4036 #[no_mangle]
4037 pub extern "C" fn C2Tuple_BlockHashChannelMonitorZ_new(a: crate::c_types::ThirtyTwoBytes, b: crate::lightning::chain::channelmonitor::ChannelMonitor) -> C2Tuple_BlockHashChannelMonitorZ {
4038         C2Tuple_BlockHashChannelMonitorZ { a, b, }
4039 }
4040
4041 #[no_mangle]
4042 /// Frees any resources used by the C2Tuple_BlockHashChannelMonitorZ.
4043 pub extern "C" fn C2Tuple_BlockHashChannelMonitorZ_free(_res: C2Tuple_BlockHashChannelMonitorZ) { }
4044 #[repr(C)]
4045 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZs of arbitrary size.
4046 /// This corresponds to std::vector in C++
4047 pub struct CVec_C2Tuple_BlockHashChannelMonitorZZ {
4048         /// The elements in the array.
4049         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4050         pub data: *mut crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ,
4051         /// The number of elements pointed to by `data`.
4052         pub datalen: usize
4053 }
4054 impl CVec_C2Tuple_BlockHashChannelMonitorZZ {
4055         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ> {
4056                 if self.datalen == 0 { return Vec::new(); }
4057                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
4058                 self.data = std::ptr::null_mut();
4059                 self.datalen = 0;
4060                 ret
4061         }
4062         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ] {
4063                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
4064         }
4065 }
4066 impl From<Vec<crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ>> for CVec_C2Tuple_BlockHashChannelMonitorZZ {
4067         fn from(v: Vec<crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ>) -> Self {
4068                 let datalen = v.len();
4069                 let data = Box::into_raw(v.into_boxed_slice());
4070                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
4071         }
4072 }
4073 #[no_mangle]
4074 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
4075 pub extern "C" fn CVec_C2Tuple_BlockHashChannelMonitorZZ_free(_res: CVec_C2Tuple_BlockHashChannelMonitorZZ) { }
4076 impl Drop for CVec_C2Tuple_BlockHashChannelMonitorZZ {
4077         fn drop(&mut self) {
4078                 if self.datalen == 0 { return; }
4079                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
4080         }
4081 }
4082 #[repr(C)]
4083 /// The contents of CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ
4084 pub union CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr {
4085         /// A pointer to the contents in the success state.
4086         /// Reading from this pointer when `result_ok` is not set is undefined.
4087         pub result: *mut crate::c_types::derived::CVec_C2Tuple_BlockHashChannelMonitorZZ,
4088         /// A pointer to the contents in the error state.
4089         /// Reading from this pointer when `result_ok` is set is undefined.
4090         pub err: *mut crate::c_types::IOError,
4091 }
4092 #[repr(C)]
4093 /// A CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ represents the result of a fallible operation,
4094 /// containing a crate::c_types::derived::CVec_C2Tuple_BlockHashChannelMonitorZZ on success and a crate::c_types::IOError on failure.
4095 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4096 pub struct CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
4097         /// The contents of this CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ, accessible via either
4098         /// `err` or `result` depending on the state of `result_ok`.
4099         pub contents: CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr,
4100         /// Whether this CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ represents a success state.
4101         pub result_ok: bool,
4102 }
4103 #[no_mangle]
4104 /// Creates a new CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ in the success state.
4105 pub extern "C" fn CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_ok(o: crate::c_types::derived::CVec_C2Tuple_BlockHashChannelMonitorZZ) -> CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
4106         CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
4107                 contents: CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr {
4108                         result: Box::into_raw(Box::new(o)),
4109                 },
4110                 result_ok: true,
4111         }
4112 }
4113 #[no_mangle]
4114 /// Creates a new CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ in the error state.
4115 pub extern "C" fn CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_err(e: crate::c_types::IOError) -> CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
4116         CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
4117                 contents: CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr {
4118                         err: Box::into_raw(Box::new(e)),
4119                 },
4120                 result_ok: false,
4121         }
4122 }
4123 #[no_mangle]
4124 /// Frees any resources used by the CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ.
4125 pub extern "C" fn CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_free(_res: CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ) { }
4126 impl Drop for CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
4127         fn drop(&mut self) {
4128                 if self.result_ok {
4129                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
4130                                 let _ = unsafe { Box::from_raw(self.contents.result) };
4131                         }
4132                 } else {
4133                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
4134                                 let _ = unsafe { Box::from_raw(self.contents.err) };
4135                         }
4136                 }
4137         }
4138 }
4139 impl From<crate::c_types::CResultTempl<crate::c_types::derived::CVec_C2Tuple_BlockHashChannelMonitorZZ, crate::c_types::IOError>> for CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
4140         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CVec_C2Tuple_BlockHashChannelMonitorZZ, crate::c_types::IOError>) -> Self {
4141                 let contents = if o.result_ok {
4142                         let result = unsafe { o.contents.result };
4143                         unsafe { o.contents.result = std::ptr::null_mut() };
4144                         CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr { result }
4145                 } else {
4146                         let err = unsafe { o.contents.err };
4147                         unsafe { o.contents.err = std::ptr::null_mut(); }
4148                         CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr { err }
4149                 };
4150                 Self {
4151                         contents,
4152                         result_ok: o.result_ok,
4153                 }
4154         }
4155 }
4156 #[repr(C)]
4157 /// The contents of CResult_PaymentIdDecodeErrorZ
4158 pub union CResult_PaymentIdDecodeErrorZPtr {
4159         /// A pointer to the contents in the success state.
4160         /// Reading from this pointer when `result_ok` is not set is undefined.
4161         pub result: *mut crate::lightning::ln::channelmanager::PaymentId,
4162         /// A pointer to the contents in the error state.
4163         /// Reading from this pointer when `result_ok` is set is undefined.
4164         pub err: *mut crate::lightning::ln::msgs::DecodeError,
4165 }
4166 #[repr(C)]
4167 /// A CResult_PaymentIdDecodeErrorZ represents the result of a fallible operation,
4168 /// containing a crate::lightning::ln::channelmanager::PaymentId on success and a crate::lightning::ln::msgs::DecodeError on failure.
4169 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4170 pub struct CResult_PaymentIdDecodeErrorZ {
4171         /// The contents of this CResult_PaymentIdDecodeErrorZ, accessible via either
4172         /// `err` or `result` depending on the state of `result_ok`.
4173         pub contents: CResult_PaymentIdDecodeErrorZPtr,
4174         /// Whether this CResult_PaymentIdDecodeErrorZ represents a success state.
4175         pub result_ok: bool,
4176 }
4177 #[no_mangle]
4178 /// Creates a new CResult_PaymentIdDecodeErrorZ in the success state.
4179 pub extern "C" fn CResult_PaymentIdDecodeErrorZ_ok(o: crate::lightning::ln::channelmanager::PaymentId) -> CResult_PaymentIdDecodeErrorZ {
4180         CResult_PaymentIdDecodeErrorZ {
4181                 contents: CResult_PaymentIdDecodeErrorZPtr {
4182                         result: Box::into_raw(Box::new(o)),
4183                 },
4184                 result_ok: true,
4185         }
4186 }
4187 #[no_mangle]
4188 /// Creates a new CResult_PaymentIdDecodeErrorZ in the error state.
4189 pub extern "C" fn CResult_PaymentIdDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_PaymentIdDecodeErrorZ {
4190         CResult_PaymentIdDecodeErrorZ {
4191                 contents: CResult_PaymentIdDecodeErrorZPtr {
4192                         err: Box::into_raw(Box::new(e)),
4193                 },
4194                 result_ok: false,
4195         }
4196 }
4197 #[no_mangle]
4198 /// Frees any resources used by the CResult_PaymentIdDecodeErrorZ.
4199 pub extern "C" fn CResult_PaymentIdDecodeErrorZ_free(_res: CResult_PaymentIdDecodeErrorZ) { }
4200 impl Drop for CResult_PaymentIdDecodeErrorZ {
4201         fn drop(&mut self) {
4202                 if self.result_ok {
4203                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
4204                                 let _ = unsafe { Box::from_raw(self.contents.result) };
4205                         }
4206                 } else {
4207                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
4208                                 let _ = unsafe { Box::from_raw(self.contents.err) };
4209                         }
4210                 }
4211         }
4212 }
4213 impl From<crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::PaymentId, crate::lightning::ln::msgs::DecodeError>> for CResult_PaymentIdDecodeErrorZ {
4214         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::PaymentId, crate::lightning::ln::msgs::DecodeError>) -> Self {
4215                 let contents = if o.result_ok {
4216                         let result = unsafe { o.contents.result };
4217                         unsafe { o.contents.result = std::ptr::null_mut() };
4218                         CResult_PaymentIdDecodeErrorZPtr { result }
4219                 } else {
4220                         let err = unsafe { o.contents.err };
4221                         unsafe { o.contents.err = std::ptr::null_mut(); }
4222                         CResult_PaymentIdDecodeErrorZPtr { err }
4223                 };
4224                 Self {
4225                         contents,
4226                         result_ok: o.result_ok,
4227                 }
4228         }
4229 }
4230 impl Clone for CResult_PaymentIdDecodeErrorZ {
4231         fn clone(&self) -> Self {
4232                 if self.result_ok {
4233                         Self { result_ok: true, contents: CResult_PaymentIdDecodeErrorZPtr {
4234                                 result: Box::into_raw(Box::new(<crate::lightning::ln::channelmanager::PaymentId>::clone(unsafe { &*self.contents.result })))
4235                         } }
4236                 } else {
4237                         Self { result_ok: false, contents: CResult_PaymentIdDecodeErrorZPtr {
4238                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
4239                         } }
4240                 }
4241         }
4242 }
4243 #[no_mangle]
4244 /// Creates a new CResult_PaymentIdDecodeErrorZ which has the same data as `orig`
4245 /// but with all dynamically-allocated buffers duplicated in new buffers.
4246 pub extern "C" fn CResult_PaymentIdDecodeErrorZ_clone(orig: &CResult_PaymentIdDecodeErrorZ) -> CResult_PaymentIdDecodeErrorZ { Clone::clone(&orig) }
4247 #[repr(C)]
4248 #[derive(Clone)]
4249 /// An enum which can either contain a u16 or not
4250 pub enum COption_u16Z {
4251         /// When we're in this state, this COption_u16Z contains a u16
4252         Some(u16),
4253         /// When we're in this state, this COption_u16Z contains nothing
4254         None
4255 }
4256 impl COption_u16Z {
4257         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
4258                 if let Self::Some(_) = self { true } else { false }
4259         }
4260         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
4261                 !self.is_some()
4262         }
4263         #[allow(unused)] pub(crate) fn take(mut self) -> u16 {
4264                 if let Self::Some(v) = self { v } else { unreachable!() }
4265         }
4266 }
4267 #[no_mangle]
4268 /// Constructs a new COption_u16Z containing a u16
4269 pub extern "C" fn COption_u16Z_some(o: u16) -> COption_u16Z {
4270         COption_u16Z::Some(o)
4271 }
4272 #[no_mangle]
4273 /// Constructs a new COption_u16Z containing nothing
4274 pub extern "C" fn COption_u16Z_none() -> COption_u16Z {
4275         COption_u16Z::None
4276 }
4277 #[no_mangle]
4278 /// Frees any resources associated with the u16, if we are in the Some state
4279 pub extern "C" fn COption_u16Z_free(_res: COption_u16Z) { }
4280 #[no_mangle]
4281 /// Creates a new COption_u16Z which has the same data as `orig`
4282 /// but with all dynamically-allocated buffers duplicated in new buffers.
4283 pub extern "C" fn COption_u16Z_clone(orig: &COption_u16Z) -> COption_u16Z { Clone::clone(&orig) }
4284 #[repr(C)]
4285 /// The contents of CResult_NoneAPIErrorZ
4286 pub union CResult_NoneAPIErrorZPtr {
4287         /// Note that this value is always NULL, as there are no contents in the OK variant
4288         pub result: *mut std::ffi::c_void,
4289         /// A pointer to the contents in the error state.
4290         /// Reading from this pointer when `result_ok` is set is undefined.
4291         pub err: *mut crate::lightning::util::errors::APIError,
4292 }
4293 #[repr(C)]
4294 /// A CResult_NoneAPIErrorZ represents the result of a fallible operation,
4295 /// containing a () on success and a crate::lightning::util::errors::APIError on failure.
4296 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4297 pub struct CResult_NoneAPIErrorZ {
4298         /// The contents of this CResult_NoneAPIErrorZ, accessible via either
4299         /// `err` or `result` depending on the state of `result_ok`.
4300         pub contents: CResult_NoneAPIErrorZPtr,
4301         /// Whether this CResult_NoneAPIErrorZ represents a success state.
4302         pub result_ok: bool,
4303 }
4304 #[no_mangle]
4305 /// Creates a new CResult_NoneAPIErrorZ in the success state.
4306 pub extern "C" fn CResult_NoneAPIErrorZ_ok() -> CResult_NoneAPIErrorZ {
4307         CResult_NoneAPIErrorZ {
4308                 contents: CResult_NoneAPIErrorZPtr {
4309                         result: std::ptr::null_mut(),
4310                 },
4311                 result_ok: true,
4312         }
4313 }
4314 #[no_mangle]
4315 /// Creates a new CResult_NoneAPIErrorZ in the error state.
4316 pub extern "C" fn CResult_NoneAPIErrorZ_err(e: crate::lightning::util::errors::APIError) -> CResult_NoneAPIErrorZ {
4317         CResult_NoneAPIErrorZ {
4318                 contents: CResult_NoneAPIErrorZPtr {
4319                         err: Box::into_raw(Box::new(e)),
4320                 },
4321                 result_ok: false,
4322         }
4323 }
4324 #[no_mangle]
4325 /// Frees any resources used by the CResult_NoneAPIErrorZ.
4326 pub extern "C" fn CResult_NoneAPIErrorZ_free(_res: CResult_NoneAPIErrorZ) { }
4327 impl Drop for CResult_NoneAPIErrorZ {
4328         fn drop(&mut self) {
4329                 if self.result_ok {
4330                 } else {
4331                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
4332                                 let _ = unsafe { Box::from_raw(self.contents.err) };
4333                         }
4334                 }
4335         }
4336 }
4337 impl From<crate::c_types::CResultTempl<(), crate::lightning::util::errors::APIError>> for CResult_NoneAPIErrorZ {
4338         fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::util::errors::APIError>) -> Self {
4339                 let contents = if o.result_ok {
4340                         let _ = unsafe { Box::from_raw(o.contents.result) };
4341                         o.contents.result = std::ptr::null_mut();
4342                         CResult_NoneAPIErrorZPtr { result: std::ptr::null_mut() }
4343                 } else {
4344                         let err = unsafe { o.contents.err };
4345                         unsafe { o.contents.err = std::ptr::null_mut(); }
4346                         CResult_NoneAPIErrorZPtr { err }
4347                 };
4348                 Self {
4349                         contents,
4350                         result_ok: o.result_ok,
4351                 }
4352         }
4353 }
4354 impl Clone for CResult_NoneAPIErrorZ {
4355         fn clone(&self) -> Self {
4356                 if self.result_ok {
4357                         Self { result_ok: true, contents: CResult_NoneAPIErrorZPtr {
4358                                 result: std::ptr::null_mut()
4359                         } }
4360                 } else {
4361                         Self { result_ok: false, contents: CResult_NoneAPIErrorZPtr {
4362                                 err: Box::into_raw(Box::new(<crate::lightning::util::errors::APIError>::clone(unsafe { &*self.contents.err })))
4363                         } }
4364                 }
4365         }
4366 }
4367 #[no_mangle]
4368 /// Creates a new CResult_NoneAPIErrorZ which has the same data as `orig`
4369 /// but with all dynamically-allocated buffers duplicated in new buffers.
4370 pub extern "C" fn CResult_NoneAPIErrorZ_clone(orig: &CResult_NoneAPIErrorZ) -> CResult_NoneAPIErrorZ { Clone::clone(&orig) }
4371 #[repr(C)]
4372 /// A dynamically-allocated array of crate::c_types::derived::CResult_NoneAPIErrorZs of arbitrary size.
4373 /// This corresponds to std::vector in C++
4374 pub struct CVec_CResult_NoneAPIErrorZZ {
4375         /// The elements in the array.
4376         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4377         pub data: *mut crate::c_types::derived::CResult_NoneAPIErrorZ,
4378         /// The number of elements pointed to by `data`.
4379         pub datalen: usize
4380 }
4381 impl CVec_CResult_NoneAPIErrorZZ {
4382         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::CResult_NoneAPIErrorZ> {
4383                 if self.datalen == 0 { return Vec::new(); }
4384                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
4385                 self.data = std::ptr::null_mut();
4386                 self.datalen = 0;
4387                 ret
4388         }
4389         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::CResult_NoneAPIErrorZ] {
4390                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
4391         }
4392 }
4393 impl From<Vec<crate::c_types::derived::CResult_NoneAPIErrorZ>> for CVec_CResult_NoneAPIErrorZZ {
4394         fn from(v: Vec<crate::c_types::derived::CResult_NoneAPIErrorZ>) -> Self {
4395                 let datalen = v.len();
4396                 let data = Box::into_raw(v.into_boxed_slice());
4397                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
4398         }
4399 }
4400 #[no_mangle]
4401 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
4402 pub extern "C" fn CVec_CResult_NoneAPIErrorZZ_free(_res: CVec_CResult_NoneAPIErrorZZ) { }
4403 impl Drop for CVec_CResult_NoneAPIErrorZZ {
4404         fn drop(&mut self) {
4405                 if self.datalen == 0 { return; }
4406                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
4407         }
4408 }
4409 impl Clone for CVec_CResult_NoneAPIErrorZZ {
4410         fn clone(&self) -> Self {
4411                 let mut res = Vec::new();
4412                 if self.datalen == 0 { return Self::from(res); }
4413                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
4414                 Self::from(res)
4415         }
4416 }
4417 #[repr(C)]
4418 /// A dynamically-allocated array of crate::lightning::util::errors::APIErrors of arbitrary size.
4419 /// This corresponds to std::vector in C++
4420 pub struct CVec_APIErrorZ {
4421         /// The elements in the array.
4422         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4423         pub data: *mut crate::lightning::util::errors::APIError,
4424         /// The number of elements pointed to by `data`.
4425         pub datalen: usize
4426 }
4427 impl CVec_APIErrorZ {
4428         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::util::errors::APIError> {
4429                 if self.datalen == 0 { return Vec::new(); }
4430                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
4431                 self.data = std::ptr::null_mut();
4432                 self.datalen = 0;
4433                 ret
4434         }
4435         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::util::errors::APIError] {
4436                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
4437         }
4438 }
4439 impl From<Vec<crate::lightning::util::errors::APIError>> for CVec_APIErrorZ {
4440         fn from(v: Vec<crate::lightning::util::errors::APIError>) -> Self {
4441                 let datalen = v.len();
4442                 let data = Box::into_raw(v.into_boxed_slice());
4443                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
4444         }
4445 }
4446 #[no_mangle]
4447 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
4448 pub extern "C" fn CVec_APIErrorZ_free(_res: CVec_APIErrorZ) { }
4449 impl Drop for CVec_APIErrorZ {
4450         fn drop(&mut self) {
4451                 if self.datalen == 0 { return; }
4452                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
4453         }
4454 }
4455 impl Clone for CVec_APIErrorZ {
4456         fn clone(&self) -> Self {
4457                 let mut res = Vec::new();
4458                 if self.datalen == 0 { return Self::from(res); }
4459                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
4460                 Self::from(res)
4461         }
4462 }
4463 #[repr(C)]
4464 /// The contents of CResult__u832APIErrorZ
4465 pub union CResult__u832APIErrorZPtr {
4466         /// A pointer to the contents in the success state.
4467         /// Reading from this pointer when `result_ok` is not set is undefined.
4468         pub result: *mut crate::c_types::ThirtyTwoBytes,
4469         /// A pointer to the contents in the error state.
4470         /// Reading from this pointer when `result_ok` is set is undefined.
4471         pub err: *mut crate::lightning::util::errors::APIError,
4472 }
4473 #[repr(C)]
4474 /// A CResult__u832APIErrorZ represents the result of a fallible operation,
4475 /// containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning::util::errors::APIError on failure.
4476 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4477 pub struct CResult__u832APIErrorZ {
4478         /// The contents of this CResult__u832APIErrorZ, accessible via either
4479         /// `err` or `result` depending on the state of `result_ok`.
4480         pub contents: CResult__u832APIErrorZPtr,
4481         /// Whether this CResult__u832APIErrorZ represents a success state.
4482         pub result_ok: bool,
4483 }
4484 #[no_mangle]
4485 /// Creates a new CResult__u832APIErrorZ in the success state.
4486 pub extern "C" fn CResult__u832APIErrorZ_ok(o: crate::c_types::ThirtyTwoBytes) -> CResult__u832APIErrorZ {
4487         CResult__u832APIErrorZ {
4488                 contents: CResult__u832APIErrorZPtr {
4489                         result: Box::into_raw(Box::new(o)),
4490                 },
4491                 result_ok: true,
4492         }
4493 }
4494 #[no_mangle]
4495 /// Creates a new CResult__u832APIErrorZ in the error state.
4496 pub extern "C" fn CResult__u832APIErrorZ_err(e: crate::lightning::util::errors::APIError) -> CResult__u832APIErrorZ {
4497         CResult__u832APIErrorZ {
4498                 contents: CResult__u832APIErrorZPtr {
4499                         err: Box::into_raw(Box::new(e)),
4500                 },
4501                 result_ok: false,
4502         }
4503 }
4504 #[no_mangle]
4505 /// Frees any resources used by the CResult__u832APIErrorZ.
4506 pub extern "C" fn CResult__u832APIErrorZ_free(_res: CResult__u832APIErrorZ) { }
4507 impl Drop for CResult__u832APIErrorZ {
4508         fn drop(&mut self) {
4509                 if self.result_ok {
4510                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
4511                                 let _ = unsafe { Box::from_raw(self.contents.result) };
4512                         }
4513                 } else {
4514                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
4515                                 let _ = unsafe { Box::from_raw(self.contents.err) };
4516                         }
4517                 }
4518         }
4519 }
4520 impl From<crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::util::errors::APIError>> for CResult__u832APIErrorZ {
4521         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::util::errors::APIError>) -> Self {
4522                 let contents = if o.result_ok {
4523                         let result = unsafe { o.contents.result };
4524                         unsafe { o.contents.result = std::ptr::null_mut() };
4525                         CResult__u832APIErrorZPtr { result }
4526                 } else {
4527                         let err = unsafe { o.contents.err };
4528                         unsafe { o.contents.err = std::ptr::null_mut(); }
4529                         CResult__u832APIErrorZPtr { err }
4530                 };
4531                 Self {
4532                         contents,
4533                         result_ok: o.result_ok,
4534                 }
4535         }
4536 }
4537 impl Clone for CResult__u832APIErrorZ {
4538         fn clone(&self) -> Self {
4539                 if self.result_ok {
4540                         Self { result_ok: true, contents: CResult__u832APIErrorZPtr {
4541                                 result: Box::into_raw(Box::new(<crate::c_types::ThirtyTwoBytes>::clone(unsafe { &*self.contents.result })))
4542                         } }
4543                 } else {
4544                         Self { result_ok: false, contents: CResult__u832APIErrorZPtr {
4545                                 err: Box::into_raw(Box::new(<crate::lightning::util::errors::APIError>::clone(unsafe { &*self.contents.err })))
4546                         } }
4547                 }
4548         }
4549 }
4550 #[no_mangle]
4551 /// Creates a new CResult__u832APIErrorZ which has the same data as `orig`
4552 /// but with all dynamically-allocated buffers duplicated in new buffers.
4553 pub extern "C" fn CResult__u832APIErrorZ_clone(orig: &CResult__u832APIErrorZ) -> CResult__u832APIErrorZ { Clone::clone(&orig) }
4554 #[repr(C)]
4555 /// The contents of CResult_PaymentIdPaymentSendFailureZ
4556 pub union CResult_PaymentIdPaymentSendFailureZPtr {
4557         /// A pointer to the contents in the success state.
4558         /// Reading from this pointer when `result_ok` is not set is undefined.
4559         pub result: *mut crate::lightning::ln::channelmanager::PaymentId,
4560         /// A pointer to the contents in the error state.
4561         /// Reading from this pointer when `result_ok` is set is undefined.
4562         pub err: *mut crate::lightning::ln::channelmanager::PaymentSendFailure,
4563 }
4564 #[repr(C)]
4565 /// A CResult_PaymentIdPaymentSendFailureZ represents the result of a fallible operation,
4566 /// containing a crate::lightning::ln::channelmanager::PaymentId on success and a crate::lightning::ln::channelmanager::PaymentSendFailure on failure.
4567 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4568 pub struct CResult_PaymentIdPaymentSendFailureZ {
4569         /// The contents of this CResult_PaymentIdPaymentSendFailureZ, accessible via either
4570         /// `err` or `result` depending on the state of `result_ok`.
4571         pub contents: CResult_PaymentIdPaymentSendFailureZPtr,
4572         /// Whether this CResult_PaymentIdPaymentSendFailureZ represents a success state.
4573         pub result_ok: bool,
4574 }
4575 #[no_mangle]
4576 /// Creates a new CResult_PaymentIdPaymentSendFailureZ in the success state.
4577 pub extern "C" fn CResult_PaymentIdPaymentSendFailureZ_ok(o: crate::lightning::ln::channelmanager::PaymentId) -> CResult_PaymentIdPaymentSendFailureZ {
4578         CResult_PaymentIdPaymentSendFailureZ {
4579                 contents: CResult_PaymentIdPaymentSendFailureZPtr {
4580                         result: Box::into_raw(Box::new(o)),
4581                 },
4582                 result_ok: true,
4583         }
4584 }
4585 #[no_mangle]
4586 /// Creates a new CResult_PaymentIdPaymentSendFailureZ in the error state.
4587 pub extern "C" fn CResult_PaymentIdPaymentSendFailureZ_err(e: crate::lightning::ln::channelmanager::PaymentSendFailure) -> CResult_PaymentIdPaymentSendFailureZ {
4588         CResult_PaymentIdPaymentSendFailureZ {
4589                 contents: CResult_PaymentIdPaymentSendFailureZPtr {
4590                         err: Box::into_raw(Box::new(e)),
4591                 },
4592                 result_ok: false,
4593         }
4594 }
4595 #[no_mangle]
4596 /// Frees any resources used by the CResult_PaymentIdPaymentSendFailureZ.
4597 pub extern "C" fn CResult_PaymentIdPaymentSendFailureZ_free(_res: CResult_PaymentIdPaymentSendFailureZ) { }
4598 impl Drop for CResult_PaymentIdPaymentSendFailureZ {
4599         fn drop(&mut self) {
4600                 if self.result_ok {
4601                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
4602                                 let _ = unsafe { Box::from_raw(self.contents.result) };
4603                         }
4604                 } else {
4605                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
4606                                 let _ = unsafe { Box::from_raw(self.contents.err) };
4607                         }
4608                 }
4609         }
4610 }
4611 impl From<crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::PaymentId, crate::lightning::ln::channelmanager::PaymentSendFailure>> for CResult_PaymentIdPaymentSendFailureZ {
4612         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::PaymentId, crate::lightning::ln::channelmanager::PaymentSendFailure>) -> Self {
4613                 let contents = if o.result_ok {
4614                         let result = unsafe { o.contents.result };
4615                         unsafe { o.contents.result = std::ptr::null_mut() };
4616                         CResult_PaymentIdPaymentSendFailureZPtr { result }
4617                 } else {
4618                         let err = unsafe { o.contents.err };
4619                         unsafe { o.contents.err = std::ptr::null_mut(); }
4620                         CResult_PaymentIdPaymentSendFailureZPtr { err }
4621                 };
4622                 Self {
4623                         contents,
4624                         result_ok: o.result_ok,
4625                 }
4626         }
4627 }
4628 impl Clone for CResult_PaymentIdPaymentSendFailureZ {
4629         fn clone(&self) -> Self {
4630                 if self.result_ok {
4631                         Self { result_ok: true, contents: CResult_PaymentIdPaymentSendFailureZPtr {
4632                                 result: Box::into_raw(Box::new(<crate::lightning::ln::channelmanager::PaymentId>::clone(unsafe { &*self.contents.result })))
4633                         } }
4634                 } else {
4635                         Self { result_ok: false, contents: CResult_PaymentIdPaymentSendFailureZPtr {
4636                                 err: Box::into_raw(Box::new(<crate::lightning::ln::channelmanager::PaymentSendFailure>::clone(unsafe { &*self.contents.err })))
4637                         } }
4638                 }
4639         }
4640 }
4641 #[no_mangle]
4642 /// Creates a new CResult_PaymentIdPaymentSendFailureZ which has the same data as `orig`
4643 /// but with all dynamically-allocated buffers duplicated in new buffers.
4644 pub extern "C" fn CResult_PaymentIdPaymentSendFailureZ_clone(orig: &CResult_PaymentIdPaymentSendFailureZ) -> CResult_PaymentIdPaymentSendFailureZ { Clone::clone(&orig) }
4645 #[repr(C)]
4646 /// The contents of CResult_NonePaymentSendFailureZ
4647 pub union CResult_NonePaymentSendFailureZPtr {
4648         /// Note that this value is always NULL, as there are no contents in the OK variant
4649         pub result: *mut std::ffi::c_void,
4650         /// A pointer to the contents in the error state.
4651         /// Reading from this pointer when `result_ok` is set is undefined.
4652         pub err: *mut crate::lightning::ln::channelmanager::PaymentSendFailure,
4653 }
4654 #[repr(C)]
4655 /// A CResult_NonePaymentSendFailureZ represents the result of a fallible operation,
4656 /// containing a () on success and a crate::lightning::ln::channelmanager::PaymentSendFailure on failure.
4657 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4658 pub struct CResult_NonePaymentSendFailureZ {
4659         /// The contents of this CResult_NonePaymentSendFailureZ, accessible via either
4660         /// `err` or `result` depending on the state of `result_ok`.
4661         pub contents: CResult_NonePaymentSendFailureZPtr,
4662         /// Whether this CResult_NonePaymentSendFailureZ represents a success state.
4663         pub result_ok: bool,
4664 }
4665 #[no_mangle]
4666 /// Creates a new CResult_NonePaymentSendFailureZ in the success state.
4667 pub extern "C" fn CResult_NonePaymentSendFailureZ_ok() -> CResult_NonePaymentSendFailureZ {
4668         CResult_NonePaymentSendFailureZ {
4669                 contents: CResult_NonePaymentSendFailureZPtr {
4670                         result: std::ptr::null_mut(),
4671                 },
4672                 result_ok: true,
4673         }
4674 }
4675 #[no_mangle]
4676 /// Creates a new CResult_NonePaymentSendFailureZ in the error state.
4677 pub extern "C" fn CResult_NonePaymentSendFailureZ_err(e: crate::lightning::ln::channelmanager::PaymentSendFailure) -> CResult_NonePaymentSendFailureZ {
4678         CResult_NonePaymentSendFailureZ {
4679                 contents: CResult_NonePaymentSendFailureZPtr {
4680                         err: Box::into_raw(Box::new(e)),
4681                 },
4682                 result_ok: false,
4683         }
4684 }
4685 #[no_mangle]
4686 /// Frees any resources used by the CResult_NonePaymentSendFailureZ.
4687 pub extern "C" fn CResult_NonePaymentSendFailureZ_free(_res: CResult_NonePaymentSendFailureZ) { }
4688 impl Drop for CResult_NonePaymentSendFailureZ {
4689         fn drop(&mut self) {
4690                 if self.result_ok {
4691                 } else {
4692                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
4693                                 let _ = unsafe { Box::from_raw(self.contents.err) };
4694                         }
4695                 }
4696         }
4697 }
4698 impl From<crate::c_types::CResultTempl<(), crate::lightning::ln::channelmanager::PaymentSendFailure>> for CResult_NonePaymentSendFailureZ {
4699         fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::ln::channelmanager::PaymentSendFailure>) -> Self {
4700                 let contents = if o.result_ok {
4701                         let _ = unsafe { Box::from_raw(o.contents.result) };
4702                         o.contents.result = std::ptr::null_mut();
4703                         CResult_NonePaymentSendFailureZPtr { result: std::ptr::null_mut() }
4704                 } else {
4705                         let err = unsafe { o.contents.err };
4706                         unsafe { o.contents.err = std::ptr::null_mut(); }
4707                         CResult_NonePaymentSendFailureZPtr { err }
4708                 };
4709                 Self {
4710                         contents,
4711                         result_ok: o.result_ok,
4712                 }
4713         }
4714 }
4715 impl Clone for CResult_NonePaymentSendFailureZ {
4716         fn clone(&self) -> Self {
4717                 if self.result_ok {
4718                         Self { result_ok: true, contents: CResult_NonePaymentSendFailureZPtr {
4719                                 result: std::ptr::null_mut()
4720                         } }
4721                 } else {
4722                         Self { result_ok: false, contents: CResult_NonePaymentSendFailureZPtr {
4723                                 err: Box::into_raw(Box::new(<crate::lightning::ln::channelmanager::PaymentSendFailure>::clone(unsafe { &*self.contents.err })))
4724                         } }
4725                 }
4726         }
4727 }
4728 #[no_mangle]
4729 /// Creates a new CResult_NonePaymentSendFailureZ which has the same data as `orig`
4730 /// but with all dynamically-allocated buffers duplicated in new buffers.
4731 pub extern "C" fn CResult_NonePaymentSendFailureZ_clone(orig: &CResult_NonePaymentSendFailureZ) -> CResult_NonePaymentSendFailureZ { Clone::clone(&orig) }
4732 #[repr(C)]
4733 /// A tuple of 2 elements. See the individual fields for the types contained.
4734 pub struct C2Tuple_PaymentHashPaymentIdZ {
4735         /// The element at position 0
4736         pub a: crate::c_types::ThirtyTwoBytes,
4737         /// The element at position 1
4738         pub b: crate::lightning::ln::channelmanager::PaymentId,
4739 }
4740 impl From<(crate::c_types::ThirtyTwoBytes, crate::lightning::ln::channelmanager::PaymentId)> for C2Tuple_PaymentHashPaymentIdZ {
4741         fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::lightning::ln::channelmanager::PaymentId)) -> Self {
4742                 Self {
4743                         a: tup.0,
4744                         b: tup.1,
4745                 }
4746         }
4747 }
4748 impl C2Tuple_PaymentHashPaymentIdZ {
4749         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::lightning::ln::channelmanager::PaymentId) {
4750                 (self.a, self.b)
4751         }
4752 }
4753 impl Clone for C2Tuple_PaymentHashPaymentIdZ {
4754         fn clone(&self) -> Self {
4755                 Self {
4756                         a: Clone::clone(&self.a),
4757                         b: Clone::clone(&self.b),
4758                 }
4759         }
4760 }
4761 #[no_mangle]
4762 /// Creates a new tuple which has the same data as `orig`
4763 /// but with all dynamically-allocated buffers duplicated in new buffers.
4764 pub extern "C" fn C2Tuple_PaymentHashPaymentIdZ_clone(orig: &C2Tuple_PaymentHashPaymentIdZ) -> C2Tuple_PaymentHashPaymentIdZ { Clone::clone(&orig) }
4765 /// Creates a new C2Tuple_PaymentHashPaymentIdZ from the contained elements.
4766 #[no_mangle]
4767 pub extern "C" fn C2Tuple_PaymentHashPaymentIdZ_new(a: crate::c_types::ThirtyTwoBytes, b: crate::lightning::ln::channelmanager::PaymentId) -> C2Tuple_PaymentHashPaymentIdZ {
4768         C2Tuple_PaymentHashPaymentIdZ { a, b, }
4769 }
4770
4771 #[no_mangle]
4772 /// Frees any resources used by the C2Tuple_PaymentHashPaymentIdZ.
4773 pub extern "C" fn C2Tuple_PaymentHashPaymentIdZ_free(_res: C2Tuple_PaymentHashPaymentIdZ) { }
4774 #[repr(C)]
4775 /// The contents of CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ
4776 pub union CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr {
4777         /// A pointer to the contents in the success state.
4778         /// Reading from this pointer when `result_ok` is not set is undefined.
4779         pub result: *mut crate::c_types::derived::C2Tuple_PaymentHashPaymentIdZ,
4780         /// A pointer to the contents in the error state.
4781         /// Reading from this pointer when `result_ok` is set is undefined.
4782         pub err: *mut crate::lightning::ln::channelmanager::PaymentSendFailure,
4783 }
4784 #[repr(C)]
4785 /// A CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ represents the result of a fallible operation,
4786 /// containing a crate::c_types::derived::C2Tuple_PaymentHashPaymentIdZ on success and a crate::lightning::ln::channelmanager::PaymentSendFailure on failure.
4787 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4788 pub struct CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
4789         /// The contents of this CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ, accessible via either
4790         /// `err` or `result` depending on the state of `result_ok`.
4791         pub contents: CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr,
4792         /// Whether this CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ represents a success state.
4793         pub result_ok: bool,
4794 }
4795 #[no_mangle]
4796 /// Creates a new CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ in the success state.
4797 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_ok(o: crate::c_types::derived::C2Tuple_PaymentHashPaymentIdZ) -> CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
4798         CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
4799                 contents: CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr {
4800                         result: Box::into_raw(Box::new(o)),
4801                 },
4802                 result_ok: true,
4803         }
4804 }
4805 #[no_mangle]
4806 /// Creates a new CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ in the error state.
4807 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_err(e: crate::lightning::ln::channelmanager::PaymentSendFailure) -> CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
4808         CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
4809                 contents: CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr {
4810                         err: Box::into_raw(Box::new(e)),
4811                 },
4812                 result_ok: false,
4813         }
4814 }
4815 #[no_mangle]
4816 /// Frees any resources used by the CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ.
4817 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_free(_res: CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ) { }
4818 impl Drop for CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
4819         fn drop(&mut self) {
4820                 if self.result_ok {
4821                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
4822                                 let _ = unsafe { Box::from_raw(self.contents.result) };
4823                         }
4824                 } else {
4825                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
4826                                 let _ = unsafe { Box::from_raw(self.contents.err) };
4827                         }
4828                 }
4829         }
4830 }
4831 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_PaymentHashPaymentIdZ, crate::lightning::ln::channelmanager::PaymentSendFailure>> for CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
4832         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_PaymentHashPaymentIdZ, crate::lightning::ln::channelmanager::PaymentSendFailure>) -> Self {
4833                 let contents = if o.result_ok {
4834                         let result = unsafe { o.contents.result };
4835                         unsafe { o.contents.result = std::ptr::null_mut() };
4836                         CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr { result }
4837                 } else {
4838                         let err = unsafe { o.contents.err };
4839                         unsafe { o.contents.err = std::ptr::null_mut(); }
4840                         CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr { err }
4841                 };
4842                 Self {
4843                         contents,
4844                         result_ok: o.result_ok,
4845                 }
4846         }
4847 }
4848 impl Clone for CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
4849         fn clone(&self) -> Self {
4850                 if self.result_ok {
4851                         Self { result_ok: true, contents: CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr {
4852                                 result: Box::into_raw(Box::new(<crate::c_types::derived::C2Tuple_PaymentHashPaymentIdZ>::clone(unsafe { &*self.contents.result })))
4853                         } }
4854                 } else {
4855                         Self { result_ok: false, contents: CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr {
4856                                 err: Box::into_raw(Box::new(<crate::lightning::ln::channelmanager::PaymentSendFailure>::clone(unsafe { &*self.contents.err })))
4857                         } }
4858                 }
4859         }
4860 }
4861 #[no_mangle]
4862 /// Creates a new CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ which has the same data as `orig`
4863 /// but with all dynamically-allocated buffers duplicated in new buffers.
4864 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone(orig: &CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ) -> CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ { Clone::clone(&orig) }
4865 #[repr(C)]
4866 /// A dynamically-allocated array of crate::lightning::ln::msgs::NetAddresss of arbitrary size.
4867 /// This corresponds to std::vector in C++
4868 pub struct CVec_NetAddressZ {
4869         /// The elements in the array.
4870         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4871         pub data: *mut crate::lightning::ln::msgs::NetAddress,
4872         /// The number of elements pointed to by `data`.
4873         pub datalen: usize
4874 }
4875 impl CVec_NetAddressZ {
4876         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::NetAddress> {
4877                 if self.datalen == 0 { return Vec::new(); }
4878                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
4879                 self.data = std::ptr::null_mut();
4880                 self.datalen = 0;
4881                 ret
4882         }
4883         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::NetAddress] {
4884                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
4885         }
4886 }
4887 impl From<Vec<crate::lightning::ln::msgs::NetAddress>> for CVec_NetAddressZ {
4888         fn from(v: Vec<crate::lightning::ln::msgs::NetAddress>) -> Self {
4889                 let datalen = v.len();
4890                 let data = Box::into_raw(v.into_boxed_slice());
4891                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
4892         }
4893 }
4894 #[no_mangle]
4895 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
4896 pub extern "C" fn CVec_NetAddressZ_free(_res: CVec_NetAddressZ) { }
4897 impl Drop for CVec_NetAddressZ {
4898         fn drop(&mut self) {
4899                 if self.datalen == 0 { return; }
4900                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
4901         }
4902 }
4903 impl Clone for CVec_NetAddressZ {
4904         fn clone(&self) -> Self {
4905                 let mut res = Vec::new();
4906                 if self.datalen == 0 { return Self::from(res); }
4907                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
4908                 Self::from(res)
4909         }
4910 }
4911 #[repr(C)]
4912 /// A tuple of 2 elements. See the individual fields for the types contained.
4913 pub struct C2Tuple_PaymentHashPaymentSecretZ {
4914         /// The element at position 0
4915         pub a: crate::c_types::ThirtyTwoBytes,
4916         /// The element at position 1
4917         pub b: crate::c_types::ThirtyTwoBytes,
4918 }
4919 impl From<(crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes)> for C2Tuple_PaymentHashPaymentSecretZ {
4920         fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes)) -> Self {
4921                 Self {
4922                         a: tup.0,
4923                         b: tup.1,
4924                 }
4925         }
4926 }
4927 impl C2Tuple_PaymentHashPaymentSecretZ {
4928         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes) {
4929                 (self.a, self.b)
4930         }
4931 }
4932 impl Clone for C2Tuple_PaymentHashPaymentSecretZ {
4933         fn clone(&self) -> Self {
4934                 Self {
4935                         a: Clone::clone(&self.a),
4936                         b: Clone::clone(&self.b),
4937                 }
4938         }
4939 }
4940 #[no_mangle]
4941 /// Creates a new tuple which has the same data as `orig`
4942 /// but with all dynamically-allocated buffers duplicated in new buffers.
4943 pub extern "C" fn C2Tuple_PaymentHashPaymentSecretZ_clone(orig: &C2Tuple_PaymentHashPaymentSecretZ) -> C2Tuple_PaymentHashPaymentSecretZ { Clone::clone(&orig) }
4944 /// Creates a new C2Tuple_PaymentHashPaymentSecretZ from the contained elements.
4945 #[no_mangle]
4946 pub extern "C" fn C2Tuple_PaymentHashPaymentSecretZ_new(a: crate::c_types::ThirtyTwoBytes, b: crate::c_types::ThirtyTwoBytes) -> C2Tuple_PaymentHashPaymentSecretZ {
4947         C2Tuple_PaymentHashPaymentSecretZ { a, b, }
4948 }
4949
4950 #[no_mangle]
4951 /// Frees any resources used by the C2Tuple_PaymentHashPaymentSecretZ.
4952 pub extern "C" fn C2Tuple_PaymentHashPaymentSecretZ_free(_res: C2Tuple_PaymentHashPaymentSecretZ) { }
4953 #[repr(C)]
4954 /// The contents of CResult_PaymentSecretAPIErrorZ
4955 pub union CResult_PaymentSecretAPIErrorZPtr {
4956         /// A pointer to the contents in the success state.
4957         /// Reading from this pointer when `result_ok` is not set is undefined.
4958         pub result: *mut crate::c_types::ThirtyTwoBytes,
4959         /// A pointer to the contents in the error state.
4960         /// Reading from this pointer when `result_ok` is set is undefined.
4961         pub err: *mut crate::lightning::util::errors::APIError,
4962 }
4963 #[repr(C)]
4964 /// A CResult_PaymentSecretAPIErrorZ represents the result of a fallible operation,
4965 /// containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning::util::errors::APIError on failure.
4966 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4967 pub struct CResult_PaymentSecretAPIErrorZ {
4968         /// The contents of this CResult_PaymentSecretAPIErrorZ, accessible via either
4969         /// `err` or `result` depending on the state of `result_ok`.
4970         pub contents: CResult_PaymentSecretAPIErrorZPtr,
4971         /// Whether this CResult_PaymentSecretAPIErrorZ represents a success state.
4972         pub result_ok: bool,
4973 }
4974 #[no_mangle]
4975 /// Creates a new CResult_PaymentSecretAPIErrorZ in the success state.
4976 pub extern "C" fn CResult_PaymentSecretAPIErrorZ_ok(o: crate::c_types::ThirtyTwoBytes) -> CResult_PaymentSecretAPIErrorZ {
4977         CResult_PaymentSecretAPIErrorZ {
4978                 contents: CResult_PaymentSecretAPIErrorZPtr {
4979                         result: Box::into_raw(Box::new(o)),
4980                 },
4981                 result_ok: true,
4982         }
4983 }
4984 #[no_mangle]
4985 /// Creates a new CResult_PaymentSecretAPIErrorZ in the error state.
4986 pub extern "C" fn CResult_PaymentSecretAPIErrorZ_err(e: crate::lightning::util::errors::APIError) -> CResult_PaymentSecretAPIErrorZ {
4987         CResult_PaymentSecretAPIErrorZ {
4988                 contents: CResult_PaymentSecretAPIErrorZPtr {
4989                         err: Box::into_raw(Box::new(e)),
4990                 },
4991                 result_ok: false,
4992         }
4993 }
4994 #[no_mangle]
4995 /// Frees any resources used by the CResult_PaymentSecretAPIErrorZ.
4996 pub extern "C" fn CResult_PaymentSecretAPIErrorZ_free(_res: CResult_PaymentSecretAPIErrorZ) { }
4997 impl Drop for CResult_PaymentSecretAPIErrorZ {
4998         fn drop(&mut self) {
4999                 if self.result_ok {
5000                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
5001                                 let _ = unsafe { Box::from_raw(self.contents.result) };
5002                         }
5003                 } else {
5004                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
5005                                 let _ = unsafe { Box::from_raw(self.contents.err) };
5006                         }
5007                 }
5008         }
5009 }
5010 impl From<crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::util::errors::APIError>> for CResult_PaymentSecretAPIErrorZ {
5011         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::util::errors::APIError>) -> Self {
5012                 let contents = if o.result_ok {
5013                         let result = unsafe { o.contents.result };
5014                         unsafe { o.contents.result = std::ptr::null_mut() };
5015                         CResult_PaymentSecretAPIErrorZPtr { result }
5016                 } else {
5017                         let err = unsafe { o.contents.err };
5018                         unsafe { o.contents.err = std::ptr::null_mut(); }
5019                         CResult_PaymentSecretAPIErrorZPtr { err }
5020                 };
5021                 Self {
5022                         contents,
5023                         result_ok: o.result_ok,
5024                 }
5025         }
5026 }
5027 impl Clone for CResult_PaymentSecretAPIErrorZ {
5028         fn clone(&self) -> Self {
5029                 if self.result_ok {
5030                         Self { result_ok: true, contents: CResult_PaymentSecretAPIErrorZPtr {
5031                                 result: Box::into_raw(Box::new(<crate::c_types::ThirtyTwoBytes>::clone(unsafe { &*self.contents.result })))
5032                         } }
5033                 } else {
5034                         Self { result_ok: false, contents: CResult_PaymentSecretAPIErrorZPtr {
5035                                 err: Box::into_raw(Box::new(<crate::lightning::util::errors::APIError>::clone(unsafe { &*self.contents.err })))
5036                         } }
5037                 }
5038         }
5039 }
5040 #[no_mangle]
5041 /// Creates a new CResult_PaymentSecretAPIErrorZ which has the same data as `orig`
5042 /// but with all dynamically-allocated buffers duplicated in new buffers.
5043 pub extern "C" fn CResult_PaymentSecretAPIErrorZ_clone(orig: &CResult_PaymentSecretAPIErrorZ) -> CResult_PaymentSecretAPIErrorZ { Clone::clone(&orig) }
5044 #[repr(C)]
5045 /// A dynamically-allocated array of crate::lightning::chain::channelmonitor::ChannelMonitors of arbitrary size.
5046 /// This corresponds to std::vector in C++
5047 pub struct CVec_ChannelMonitorZ {
5048         /// The elements in the array.
5049         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
5050         pub data: *mut crate::lightning::chain::channelmonitor::ChannelMonitor,
5051         /// The number of elements pointed to by `data`.
5052         pub datalen: usize
5053 }
5054 impl CVec_ChannelMonitorZ {
5055         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::chain::channelmonitor::ChannelMonitor> {
5056                 if self.datalen == 0 { return Vec::new(); }
5057                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
5058                 self.data = std::ptr::null_mut();
5059                 self.datalen = 0;
5060                 ret
5061         }
5062         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::chain::channelmonitor::ChannelMonitor] {
5063                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
5064         }
5065 }
5066 impl From<Vec<crate::lightning::chain::channelmonitor::ChannelMonitor>> for CVec_ChannelMonitorZ {
5067         fn from(v: Vec<crate::lightning::chain::channelmonitor::ChannelMonitor>) -> Self {
5068                 let datalen = v.len();
5069                 let data = Box::into_raw(v.into_boxed_slice());
5070                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
5071         }
5072 }
5073 #[no_mangle]
5074 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
5075 pub extern "C" fn CVec_ChannelMonitorZ_free(_res: CVec_ChannelMonitorZ) { }
5076 impl Drop for CVec_ChannelMonitorZ {
5077         fn drop(&mut self) {
5078                 if self.datalen == 0 { return; }
5079                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
5080         }
5081 }
5082 #[repr(C)]
5083 /// A tuple of 2 elements. See the individual fields for the types contained.
5084 pub struct C2Tuple_BlockHashChannelManagerZ {
5085         /// The element at position 0
5086         pub a: crate::c_types::ThirtyTwoBytes,
5087         /// The element at position 1
5088         pub b: crate::lightning::ln::channelmanager::ChannelManager,
5089 }
5090 impl From<(crate::c_types::ThirtyTwoBytes, crate::lightning::ln::channelmanager::ChannelManager)> for C2Tuple_BlockHashChannelManagerZ {
5091         fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::lightning::ln::channelmanager::ChannelManager)) -> Self {
5092                 Self {
5093                         a: tup.0,
5094                         b: tup.1,
5095                 }
5096         }
5097 }
5098 impl C2Tuple_BlockHashChannelManagerZ {
5099         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::lightning::ln::channelmanager::ChannelManager) {
5100                 (self.a, self.b)
5101         }
5102 }
5103 /// Creates a new C2Tuple_BlockHashChannelManagerZ from the contained elements.
5104 #[no_mangle]
5105 pub extern "C" fn C2Tuple_BlockHashChannelManagerZ_new(a: crate::c_types::ThirtyTwoBytes, b: crate::lightning::ln::channelmanager::ChannelManager) -> C2Tuple_BlockHashChannelManagerZ {
5106         C2Tuple_BlockHashChannelManagerZ { a, b, }
5107 }
5108
5109 #[no_mangle]
5110 /// Frees any resources used by the C2Tuple_BlockHashChannelManagerZ.
5111 pub extern "C" fn C2Tuple_BlockHashChannelManagerZ_free(_res: C2Tuple_BlockHashChannelManagerZ) { }
5112 #[repr(C)]
5113 /// The contents of CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ
5114 pub union CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr {
5115         /// A pointer to the contents in the success state.
5116         /// Reading from this pointer when `result_ok` is not set is undefined.
5117         pub result: *mut crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ,
5118         /// A pointer to the contents in the error state.
5119         /// Reading from this pointer when `result_ok` is set is undefined.
5120         pub err: *mut crate::lightning::ln::msgs::DecodeError,
5121 }
5122 #[repr(C)]
5123 /// A CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ represents the result of a fallible operation,
5124 /// containing a crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
5125 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5126 pub struct CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
5127         /// The contents of this CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ, accessible via either
5128         /// `err` or `result` depending on the state of `result_ok`.
5129         pub contents: CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr,
5130         /// Whether this CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ represents a success state.
5131         pub result_ok: bool,
5132 }
5133 #[no_mangle]
5134 /// Creates a new CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ in the success state.
5135 pub extern "C" fn CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_ok(o: crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ) -> CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
5136         CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
5137                 contents: CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr {
5138                         result: Box::into_raw(Box::new(o)),
5139                 },
5140                 result_ok: true,
5141         }
5142 }
5143 #[no_mangle]
5144 /// Creates a new CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ in the error state.
5145 pub extern "C" fn CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
5146         CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
5147                 contents: CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr {
5148                         err: Box::into_raw(Box::new(e)),
5149                 },
5150                 result_ok: false,
5151         }
5152 }
5153 #[no_mangle]
5154 /// Frees any resources used by the CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ.
5155 pub extern "C" fn CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_free(_res: CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ) { }
5156 impl Drop for CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
5157         fn drop(&mut self) {
5158                 if self.result_ok {
5159                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
5160                                 let _ = unsafe { Box::from_raw(self.contents.result) };
5161                         }
5162                 } else {
5163                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
5164                                 let _ = unsafe { Box::from_raw(self.contents.err) };
5165                         }
5166                 }
5167         }
5168 }
5169 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ, crate::lightning::ln::msgs::DecodeError>> for CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
5170         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
5171                 let contents = if o.result_ok {
5172                         let result = unsafe { o.contents.result };
5173                         unsafe { o.contents.result = std::ptr::null_mut() };
5174                         CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr { result }
5175                 } else {
5176                         let err = unsafe { o.contents.err };
5177                         unsafe { o.contents.err = std::ptr::null_mut(); }
5178                         CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr { err }
5179                 };
5180                 Self {
5181                         contents,
5182                         result_ok: o.result_ok,
5183                 }
5184         }
5185 }
5186 #[repr(C)]
5187 /// The contents of CResult_ChannelConfigDecodeErrorZ
5188 pub union CResult_ChannelConfigDecodeErrorZPtr {
5189         /// A pointer to the contents in the success state.
5190         /// Reading from this pointer when `result_ok` is not set is undefined.
5191         pub result: *mut crate::lightning::util::config::ChannelConfig,
5192         /// A pointer to the contents in the error state.
5193         /// Reading from this pointer when `result_ok` is set is undefined.
5194         pub err: *mut crate::lightning::ln::msgs::DecodeError,
5195 }
5196 #[repr(C)]
5197 /// A CResult_ChannelConfigDecodeErrorZ represents the result of a fallible operation,
5198 /// containing a crate::lightning::util::config::ChannelConfig on success and a crate::lightning::ln::msgs::DecodeError on failure.
5199 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5200 pub struct CResult_ChannelConfigDecodeErrorZ {
5201         /// The contents of this CResult_ChannelConfigDecodeErrorZ, accessible via either
5202         /// `err` or `result` depending on the state of `result_ok`.
5203         pub contents: CResult_ChannelConfigDecodeErrorZPtr,
5204         /// Whether this CResult_ChannelConfigDecodeErrorZ represents a success state.
5205         pub result_ok: bool,
5206 }
5207 #[no_mangle]
5208 /// Creates a new CResult_ChannelConfigDecodeErrorZ in the success state.
5209 pub extern "C" fn CResult_ChannelConfigDecodeErrorZ_ok(o: crate::lightning::util::config::ChannelConfig) -> CResult_ChannelConfigDecodeErrorZ {
5210         CResult_ChannelConfigDecodeErrorZ {
5211                 contents: CResult_ChannelConfigDecodeErrorZPtr {
5212                         result: Box::into_raw(Box::new(o)),
5213                 },
5214                 result_ok: true,
5215         }
5216 }
5217 #[no_mangle]
5218 /// Creates a new CResult_ChannelConfigDecodeErrorZ in the error state.
5219 pub extern "C" fn CResult_ChannelConfigDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelConfigDecodeErrorZ {
5220         CResult_ChannelConfigDecodeErrorZ {
5221                 contents: CResult_ChannelConfigDecodeErrorZPtr {
5222                         err: Box::into_raw(Box::new(e)),
5223                 },
5224                 result_ok: false,
5225         }
5226 }
5227 #[no_mangle]
5228 /// Frees any resources used by the CResult_ChannelConfigDecodeErrorZ.
5229 pub extern "C" fn CResult_ChannelConfigDecodeErrorZ_free(_res: CResult_ChannelConfigDecodeErrorZ) { }
5230 impl Drop for CResult_ChannelConfigDecodeErrorZ {
5231         fn drop(&mut self) {
5232                 if self.result_ok {
5233                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
5234                                 let _ = unsafe { Box::from_raw(self.contents.result) };
5235                         }
5236                 } else {
5237                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
5238                                 let _ = unsafe { Box::from_raw(self.contents.err) };
5239                         }
5240                 }
5241         }
5242 }
5243 impl From<crate::c_types::CResultTempl<crate::lightning::util::config::ChannelConfig, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelConfigDecodeErrorZ {
5244         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::util::config::ChannelConfig, crate::lightning::ln::msgs::DecodeError>) -> Self {
5245                 let contents = if o.result_ok {
5246                         let result = unsafe { o.contents.result };
5247                         unsafe { o.contents.result = std::ptr::null_mut() };
5248                         CResult_ChannelConfigDecodeErrorZPtr { result }
5249                 } else {
5250                         let err = unsafe { o.contents.err };
5251                         unsafe { o.contents.err = std::ptr::null_mut(); }
5252                         CResult_ChannelConfigDecodeErrorZPtr { err }
5253                 };
5254                 Self {
5255                         contents,
5256                         result_ok: o.result_ok,
5257                 }
5258         }
5259 }
5260 impl Clone for CResult_ChannelConfigDecodeErrorZ {
5261         fn clone(&self) -> Self {
5262                 if self.result_ok {
5263                         Self { result_ok: true, contents: CResult_ChannelConfigDecodeErrorZPtr {
5264                                 result: Box::into_raw(Box::new(<crate::lightning::util::config::ChannelConfig>::clone(unsafe { &*self.contents.result })))
5265                         } }
5266                 } else {
5267                         Self { result_ok: false, contents: CResult_ChannelConfigDecodeErrorZPtr {
5268                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
5269                         } }
5270                 }
5271         }
5272 }
5273 #[no_mangle]
5274 /// Creates a new CResult_ChannelConfigDecodeErrorZ which has the same data as `orig`
5275 /// but with all dynamically-allocated buffers duplicated in new buffers.
5276 pub extern "C" fn CResult_ChannelConfigDecodeErrorZ_clone(orig: &CResult_ChannelConfigDecodeErrorZ) -> CResult_ChannelConfigDecodeErrorZ { Clone::clone(&orig) }
5277 #[repr(C)]
5278 /// The contents of CResult_OutPointDecodeErrorZ
5279 pub union CResult_OutPointDecodeErrorZPtr {
5280         /// A pointer to the contents in the success state.
5281         /// Reading from this pointer when `result_ok` is not set is undefined.
5282         pub result: *mut crate::lightning::chain::transaction::OutPoint,
5283         /// A pointer to the contents in the error state.
5284         /// Reading from this pointer when `result_ok` is set is undefined.
5285         pub err: *mut crate::lightning::ln::msgs::DecodeError,
5286 }
5287 #[repr(C)]
5288 /// A CResult_OutPointDecodeErrorZ represents the result of a fallible operation,
5289 /// containing a crate::lightning::chain::transaction::OutPoint on success and a crate::lightning::ln::msgs::DecodeError on failure.
5290 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5291 pub struct CResult_OutPointDecodeErrorZ {
5292         /// The contents of this CResult_OutPointDecodeErrorZ, accessible via either
5293         /// `err` or `result` depending on the state of `result_ok`.
5294         pub contents: CResult_OutPointDecodeErrorZPtr,
5295         /// Whether this CResult_OutPointDecodeErrorZ represents a success state.
5296         pub result_ok: bool,
5297 }
5298 #[no_mangle]
5299 /// Creates a new CResult_OutPointDecodeErrorZ in the success state.
5300 pub extern "C" fn CResult_OutPointDecodeErrorZ_ok(o: crate::lightning::chain::transaction::OutPoint) -> CResult_OutPointDecodeErrorZ {
5301         CResult_OutPointDecodeErrorZ {
5302                 contents: CResult_OutPointDecodeErrorZPtr {
5303                         result: Box::into_raw(Box::new(o)),
5304                 },
5305                 result_ok: true,
5306         }
5307 }
5308 #[no_mangle]
5309 /// Creates a new CResult_OutPointDecodeErrorZ in the error state.
5310 pub extern "C" fn CResult_OutPointDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_OutPointDecodeErrorZ {
5311         CResult_OutPointDecodeErrorZ {
5312                 contents: CResult_OutPointDecodeErrorZPtr {
5313                         err: Box::into_raw(Box::new(e)),
5314                 },
5315                 result_ok: false,
5316         }
5317 }
5318 #[no_mangle]
5319 /// Frees any resources used by the CResult_OutPointDecodeErrorZ.
5320 pub extern "C" fn CResult_OutPointDecodeErrorZ_free(_res: CResult_OutPointDecodeErrorZ) { }
5321 impl Drop for CResult_OutPointDecodeErrorZ {
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<crate::lightning::chain::transaction::OutPoint, crate::lightning::ln::msgs::DecodeError>> for CResult_OutPointDecodeErrorZ {
5335         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::transaction::OutPoint, crate::lightning::ln::msgs::DecodeError>) -> Self {
5336                 let contents = if o.result_ok {
5337                         let result = unsafe { o.contents.result };
5338                         unsafe { o.contents.result = std::ptr::null_mut() };
5339                         CResult_OutPointDecodeErrorZPtr { result }
5340                 } else {
5341                         let err = unsafe { o.contents.err };
5342                         unsafe { o.contents.err = std::ptr::null_mut(); }
5343                         CResult_OutPointDecodeErrorZPtr { err }
5344                 };
5345                 Self {
5346                         contents,
5347                         result_ok: o.result_ok,
5348                 }
5349         }
5350 }
5351 impl Clone for CResult_OutPointDecodeErrorZ {
5352         fn clone(&self) -> Self {
5353                 if self.result_ok {
5354                         Self { result_ok: true, contents: CResult_OutPointDecodeErrorZPtr {
5355                                 result: Box::into_raw(Box::new(<crate::lightning::chain::transaction::OutPoint>::clone(unsafe { &*self.contents.result })))
5356                         } }
5357                 } else {
5358                         Self { result_ok: false, contents: CResult_OutPointDecodeErrorZPtr {
5359                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
5360                         } }
5361                 }
5362         }
5363 }
5364 #[no_mangle]
5365 /// Creates a new CResult_OutPointDecodeErrorZ which has the same data as `orig`
5366 /// but with all dynamically-allocated buffers duplicated in new buffers.
5367 pub extern "C" fn CResult_OutPointDecodeErrorZ_clone(orig: &CResult_OutPointDecodeErrorZ) -> CResult_OutPointDecodeErrorZ { Clone::clone(&orig) }
5368 #[repr(C)]
5369 /// An enum which can either contain a crate::lightning::ln::wire::Type or not
5370 pub enum COption_TypeZ {
5371         /// When we're in this state, this COption_TypeZ contains a crate::lightning::ln::wire::Type
5372         Some(crate::lightning::ln::wire::Type),
5373         /// When we're in this state, this COption_TypeZ contains nothing
5374         None
5375 }
5376 impl COption_TypeZ {
5377         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
5378                 if let Self::Some(_) = self { true } else { false }
5379         }
5380         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
5381                 !self.is_some()
5382         }
5383         #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::ln::wire::Type {
5384                 if let Self::Some(v) = self { v } else { unreachable!() }
5385         }
5386 }
5387 #[no_mangle]
5388 /// Constructs a new COption_TypeZ containing a crate::lightning::ln::wire::Type
5389 pub extern "C" fn COption_TypeZ_some(o: crate::lightning::ln::wire::Type) -> COption_TypeZ {
5390         COption_TypeZ::Some(o)
5391 }
5392 #[no_mangle]
5393 /// Constructs a new COption_TypeZ containing nothing
5394 pub extern "C" fn COption_TypeZ_none() -> COption_TypeZ {
5395         COption_TypeZ::None
5396 }
5397 #[no_mangle]
5398 /// Frees any resources associated with the crate::lightning::ln::wire::Type, if we are in the Some state
5399 pub extern "C" fn COption_TypeZ_free(_res: COption_TypeZ) { }
5400 #[repr(C)]
5401 /// The contents of CResult_COption_TypeZDecodeErrorZ
5402 pub union CResult_COption_TypeZDecodeErrorZPtr {
5403         /// A pointer to the contents in the success state.
5404         /// Reading from this pointer when `result_ok` is not set is undefined.
5405         pub result: *mut crate::c_types::derived::COption_TypeZ,
5406         /// A pointer to the contents in the error state.
5407         /// Reading from this pointer when `result_ok` is set is undefined.
5408         pub err: *mut crate::lightning::ln::msgs::DecodeError,
5409 }
5410 #[repr(C)]
5411 /// A CResult_COption_TypeZDecodeErrorZ represents the result of a fallible operation,
5412 /// containing a crate::c_types::derived::COption_TypeZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
5413 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5414 pub struct CResult_COption_TypeZDecodeErrorZ {
5415         /// The contents of this CResult_COption_TypeZDecodeErrorZ, accessible via either
5416         /// `err` or `result` depending on the state of `result_ok`.
5417         pub contents: CResult_COption_TypeZDecodeErrorZPtr,
5418         /// Whether this CResult_COption_TypeZDecodeErrorZ represents a success state.
5419         pub result_ok: bool,
5420 }
5421 #[no_mangle]
5422 /// Creates a new CResult_COption_TypeZDecodeErrorZ in the success state.
5423 pub extern "C" fn CResult_COption_TypeZDecodeErrorZ_ok(o: crate::c_types::derived::COption_TypeZ) -> CResult_COption_TypeZDecodeErrorZ {
5424         CResult_COption_TypeZDecodeErrorZ {
5425                 contents: CResult_COption_TypeZDecodeErrorZPtr {
5426                         result: Box::into_raw(Box::new(o)),
5427                 },
5428                 result_ok: true,
5429         }
5430 }
5431 #[no_mangle]
5432 /// Creates a new CResult_COption_TypeZDecodeErrorZ in the error state.
5433 pub extern "C" fn CResult_COption_TypeZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_TypeZDecodeErrorZ {
5434         CResult_COption_TypeZDecodeErrorZ {
5435                 contents: CResult_COption_TypeZDecodeErrorZPtr {
5436                         err: Box::into_raw(Box::new(e)),
5437                 },
5438                 result_ok: false,
5439         }
5440 }
5441 #[no_mangle]
5442 /// Frees any resources used by the CResult_COption_TypeZDecodeErrorZ.
5443 pub extern "C" fn CResult_COption_TypeZDecodeErrorZ_free(_res: CResult_COption_TypeZDecodeErrorZ) { }
5444 impl Drop for CResult_COption_TypeZDecodeErrorZ {
5445         fn drop(&mut self) {
5446                 if self.result_ok {
5447                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
5448                                 let _ = unsafe { Box::from_raw(self.contents.result) };
5449                         }
5450                 } else {
5451                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
5452                                 let _ = unsafe { Box::from_raw(self.contents.err) };
5453                         }
5454                 }
5455         }
5456 }
5457 impl From<crate::c_types::CResultTempl<crate::c_types::derived::COption_TypeZ, crate::lightning::ln::msgs::DecodeError>> for CResult_COption_TypeZDecodeErrorZ {
5458         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::COption_TypeZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
5459                 let contents = if o.result_ok {
5460                         let result = unsafe { o.contents.result };
5461                         unsafe { o.contents.result = std::ptr::null_mut() };
5462                         CResult_COption_TypeZDecodeErrorZPtr { result }
5463                 } else {
5464                         let err = unsafe { o.contents.err };
5465                         unsafe { o.contents.err = std::ptr::null_mut(); }
5466                         CResult_COption_TypeZDecodeErrorZPtr { err }
5467                 };
5468                 Self {
5469                         contents,
5470                         result_ok: o.result_ok,
5471                 }
5472         }
5473 }
5474 #[repr(C)]
5475 /// The contents of CResult_SiPrefixNoneZ
5476 pub union CResult_SiPrefixNoneZPtr {
5477         /// A pointer to the contents in the success state.
5478         /// Reading from this pointer when `result_ok` is not set is undefined.
5479         pub result: *mut crate::lightning_invoice::SiPrefix,
5480         /// Note that this value is always NULL, as there are no contents in the Err variant
5481         pub err: *mut std::ffi::c_void,
5482 }
5483 #[repr(C)]
5484 /// A CResult_SiPrefixNoneZ represents the result of a fallible operation,
5485 /// containing a crate::lightning_invoice::SiPrefix on success and a () on failure.
5486 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5487 pub struct CResult_SiPrefixNoneZ {
5488         /// The contents of this CResult_SiPrefixNoneZ, accessible via either
5489         /// `err` or `result` depending on the state of `result_ok`.
5490         pub contents: CResult_SiPrefixNoneZPtr,
5491         /// Whether this CResult_SiPrefixNoneZ represents a success state.
5492         pub result_ok: bool,
5493 }
5494 #[no_mangle]
5495 /// Creates a new CResult_SiPrefixNoneZ in the success state.
5496 pub extern "C" fn CResult_SiPrefixNoneZ_ok(o: crate::lightning_invoice::SiPrefix) -> CResult_SiPrefixNoneZ {
5497         CResult_SiPrefixNoneZ {
5498                 contents: CResult_SiPrefixNoneZPtr {
5499                         result: Box::into_raw(Box::new(o)),
5500                 },
5501                 result_ok: true,
5502         }
5503 }
5504 #[no_mangle]
5505 /// Creates a new CResult_SiPrefixNoneZ in the error state.
5506 pub extern "C" fn CResult_SiPrefixNoneZ_err() -> CResult_SiPrefixNoneZ {
5507         CResult_SiPrefixNoneZ {
5508                 contents: CResult_SiPrefixNoneZPtr {
5509                         err: std::ptr::null_mut(),
5510                 },
5511                 result_ok: false,
5512         }
5513 }
5514 #[no_mangle]
5515 /// Frees any resources used by the CResult_SiPrefixNoneZ.
5516 pub extern "C" fn CResult_SiPrefixNoneZ_free(_res: CResult_SiPrefixNoneZ) { }
5517 impl Drop for CResult_SiPrefixNoneZ {
5518         fn drop(&mut self) {
5519                 if self.result_ok {
5520                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
5521                                 let _ = unsafe { Box::from_raw(self.contents.result) };
5522                         }
5523                 } else {
5524                 }
5525         }
5526 }
5527 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::SiPrefix, ()>> for CResult_SiPrefixNoneZ {
5528         fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::SiPrefix, ()>) -> Self {
5529                 let contents = if o.result_ok {
5530                         let result = unsafe { o.contents.result };
5531                         unsafe { o.contents.result = std::ptr::null_mut() };
5532                         CResult_SiPrefixNoneZPtr { result }
5533                 } else {
5534                         let _ = unsafe { Box::from_raw(o.contents.err) };
5535                         o.contents.err = std::ptr::null_mut();
5536                         CResult_SiPrefixNoneZPtr { err: std::ptr::null_mut() }
5537                 };
5538                 Self {
5539                         contents,
5540                         result_ok: o.result_ok,
5541                 }
5542         }
5543 }
5544 impl Clone for CResult_SiPrefixNoneZ {
5545         fn clone(&self) -> Self {
5546                 if self.result_ok {
5547                         Self { result_ok: true, contents: CResult_SiPrefixNoneZPtr {
5548                                 result: Box::into_raw(Box::new(<crate::lightning_invoice::SiPrefix>::clone(unsafe { &*self.contents.result })))
5549                         } }
5550                 } else {
5551                         Self { result_ok: false, contents: CResult_SiPrefixNoneZPtr {
5552                                 err: std::ptr::null_mut()
5553                         } }
5554                 }
5555         }
5556 }
5557 #[no_mangle]
5558 /// Creates a new CResult_SiPrefixNoneZ which has the same data as `orig`
5559 /// but with all dynamically-allocated buffers duplicated in new buffers.
5560 pub extern "C" fn CResult_SiPrefixNoneZ_clone(orig: &CResult_SiPrefixNoneZ) -> CResult_SiPrefixNoneZ { Clone::clone(&orig) }
5561 #[repr(C)]
5562 /// The contents of CResult_InvoiceNoneZ
5563 pub union CResult_InvoiceNoneZPtr {
5564         /// A pointer to the contents in the success state.
5565         /// Reading from this pointer when `result_ok` is not set is undefined.
5566         pub result: *mut crate::lightning_invoice::Invoice,
5567         /// Note that this value is always NULL, as there are no contents in the Err variant
5568         pub err: *mut std::ffi::c_void,
5569 }
5570 #[repr(C)]
5571 /// A CResult_InvoiceNoneZ represents the result of a fallible operation,
5572 /// containing a crate::lightning_invoice::Invoice on success and a () on failure.
5573 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5574 pub struct CResult_InvoiceNoneZ {
5575         /// The contents of this CResult_InvoiceNoneZ, accessible via either
5576         /// `err` or `result` depending on the state of `result_ok`.
5577         pub contents: CResult_InvoiceNoneZPtr,
5578         /// Whether this CResult_InvoiceNoneZ represents a success state.
5579         pub result_ok: bool,
5580 }
5581 #[no_mangle]
5582 /// Creates a new CResult_InvoiceNoneZ in the success state.
5583 pub extern "C" fn CResult_InvoiceNoneZ_ok(o: crate::lightning_invoice::Invoice) -> CResult_InvoiceNoneZ {
5584         CResult_InvoiceNoneZ {
5585                 contents: CResult_InvoiceNoneZPtr {
5586                         result: Box::into_raw(Box::new(o)),
5587                 },
5588                 result_ok: true,
5589         }
5590 }
5591 #[no_mangle]
5592 /// Creates a new CResult_InvoiceNoneZ in the error state.
5593 pub extern "C" fn CResult_InvoiceNoneZ_err() -> CResult_InvoiceNoneZ {
5594         CResult_InvoiceNoneZ {
5595                 contents: CResult_InvoiceNoneZPtr {
5596                         err: std::ptr::null_mut(),
5597                 },
5598                 result_ok: false,
5599         }
5600 }
5601 #[no_mangle]
5602 /// Frees any resources used by the CResult_InvoiceNoneZ.
5603 pub extern "C" fn CResult_InvoiceNoneZ_free(_res: CResult_InvoiceNoneZ) { }
5604 impl Drop for CResult_InvoiceNoneZ {
5605         fn drop(&mut self) {
5606                 if self.result_ok {
5607                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
5608                                 let _ = unsafe { Box::from_raw(self.contents.result) };
5609                         }
5610                 } else {
5611                 }
5612         }
5613 }
5614 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::Invoice, ()>> for CResult_InvoiceNoneZ {
5615         fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::Invoice, ()>) -> Self {
5616                 let contents = if o.result_ok {
5617                         let result = unsafe { o.contents.result };
5618                         unsafe { o.contents.result = std::ptr::null_mut() };
5619                         CResult_InvoiceNoneZPtr { result }
5620                 } else {
5621                         let _ = unsafe { Box::from_raw(o.contents.err) };
5622                         o.contents.err = std::ptr::null_mut();
5623                         CResult_InvoiceNoneZPtr { err: std::ptr::null_mut() }
5624                 };
5625                 Self {
5626                         contents,
5627                         result_ok: o.result_ok,
5628                 }
5629         }
5630 }
5631 impl Clone for CResult_InvoiceNoneZ {
5632         fn clone(&self) -> Self {
5633                 if self.result_ok {
5634                         Self { result_ok: true, contents: CResult_InvoiceNoneZPtr {
5635                                 result: Box::into_raw(Box::new(<crate::lightning_invoice::Invoice>::clone(unsafe { &*self.contents.result })))
5636                         } }
5637                 } else {
5638                         Self { result_ok: false, contents: CResult_InvoiceNoneZPtr {
5639                                 err: std::ptr::null_mut()
5640                         } }
5641                 }
5642         }
5643 }
5644 #[no_mangle]
5645 /// Creates a new CResult_InvoiceNoneZ which has the same data as `orig`
5646 /// but with all dynamically-allocated buffers duplicated in new buffers.
5647 pub extern "C" fn CResult_InvoiceNoneZ_clone(orig: &CResult_InvoiceNoneZ) -> CResult_InvoiceNoneZ { Clone::clone(&orig) }
5648 #[repr(C)]
5649 /// The contents of CResult_SignedRawInvoiceNoneZ
5650 pub union CResult_SignedRawInvoiceNoneZPtr {
5651         /// A pointer to the contents in the success state.
5652         /// Reading from this pointer when `result_ok` is not set is undefined.
5653         pub result: *mut crate::lightning_invoice::SignedRawInvoice,
5654         /// Note that this value is always NULL, as there are no contents in the Err variant
5655         pub err: *mut std::ffi::c_void,
5656 }
5657 #[repr(C)]
5658 /// A CResult_SignedRawInvoiceNoneZ represents the result of a fallible operation,
5659 /// containing a crate::lightning_invoice::SignedRawInvoice on success and a () on failure.
5660 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5661 pub struct CResult_SignedRawInvoiceNoneZ {
5662         /// The contents of this CResult_SignedRawInvoiceNoneZ, accessible via either
5663         /// `err` or `result` depending on the state of `result_ok`.
5664         pub contents: CResult_SignedRawInvoiceNoneZPtr,
5665         /// Whether this CResult_SignedRawInvoiceNoneZ represents a success state.
5666         pub result_ok: bool,
5667 }
5668 #[no_mangle]
5669 /// Creates a new CResult_SignedRawInvoiceNoneZ in the success state.
5670 pub extern "C" fn CResult_SignedRawInvoiceNoneZ_ok(o: crate::lightning_invoice::SignedRawInvoice) -> CResult_SignedRawInvoiceNoneZ {
5671         CResult_SignedRawInvoiceNoneZ {
5672                 contents: CResult_SignedRawInvoiceNoneZPtr {
5673                         result: Box::into_raw(Box::new(o)),
5674                 },
5675                 result_ok: true,
5676         }
5677 }
5678 #[no_mangle]
5679 /// Creates a new CResult_SignedRawInvoiceNoneZ in the error state.
5680 pub extern "C" fn CResult_SignedRawInvoiceNoneZ_err() -> CResult_SignedRawInvoiceNoneZ {
5681         CResult_SignedRawInvoiceNoneZ {
5682                 contents: CResult_SignedRawInvoiceNoneZPtr {
5683                         err: std::ptr::null_mut(),
5684                 },
5685                 result_ok: false,
5686         }
5687 }
5688 #[no_mangle]
5689 /// Frees any resources used by the CResult_SignedRawInvoiceNoneZ.
5690 pub extern "C" fn CResult_SignedRawInvoiceNoneZ_free(_res: CResult_SignedRawInvoiceNoneZ) { }
5691 impl Drop for CResult_SignedRawInvoiceNoneZ {
5692         fn drop(&mut self) {
5693                 if self.result_ok {
5694                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
5695                                 let _ = unsafe { Box::from_raw(self.contents.result) };
5696                         }
5697                 } else {
5698                 }
5699         }
5700 }
5701 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::SignedRawInvoice, ()>> for CResult_SignedRawInvoiceNoneZ {
5702         fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::SignedRawInvoice, ()>) -> Self {
5703                 let contents = if o.result_ok {
5704                         let result = unsafe { o.contents.result };
5705                         unsafe { o.contents.result = std::ptr::null_mut() };
5706                         CResult_SignedRawInvoiceNoneZPtr { result }
5707                 } else {
5708                         let _ = unsafe { Box::from_raw(o.contents.err) };
5709                         o.contents.err = std::ptr::null_mut();
5710                         CResult_SignedRawInvoiceNoneZPtr { err: std::ptr::null_mut() }
5711                 };
5712                 Self {
5713                         contents,
5714                         result_ok: o.result_ok,
5715                 }
5716         }
5717 }
5718 impl Clone for CResult_SignedRawInvoiceNoneZ {
5719         fn clone(&self) -> Self {
5720                 if self.result_ok {
5721                         Self { result_ok: true, contents: CResult_SignedRawInvoiceNoneZPtr {
5722                                 result: Box::into_raw(Box::new(<crate::lightning_invoice::SignedRawInvoice>::clone(unsafe { &*self.contents.result })))
5723                         } }
5724                 } else {
5725                         Self { result_ok: false, contents: CResult_SignedRawInvoiceNoneZPtr {
5726                                 err: std::ptr::null_mut()
5727                         } }
5728                 }
5729         }
5730 }
5731 #[no_mangle]
5732 /// Creates a new CResult_SignedRawInvoiceNoneZ which has the same data as `orig`
5733 /// but with all dynamically-allocated buffers duplicated in new buffers.
5734 pub extern "C" fn CResult_SignedRawInvoiceNoneZ_clone(orig: &CResult_SignedRawInvoiceNoneZ) -> CResult_SignedRawInvoiceNoneZ { Clone::clone(&orig) }
5735 #[repr(C)]
5736 /// A tuple of 3 elements. See the individual fields for the types contained.
5737 pub struct C3Tuple_RawInvoice_u832InvoiceSignatureZ {
5738         /// The element at position 0
5739         pub a: crate::lightning_invoice::RawInvoice,
5740         /// The element at position 1
5741         pub b: crate::c_types::ThirtyTwoBytes,
5742         /// The element at position 2
5743         pub c: crate::lightning_invoice::InvoiceSignature,
5744 }
5745 impl From<(crate::lightning_invoice::RawInvoice, crate::c_types::ThirtyTwoBytes, crate::lightning_invoice::InvoiceSignature)> for C3Tuple_RawInvoice_u832InvoiceSignatureZ {
5746         fn from (tup: (crate::lightning_invoice::RawInvoice, crate::c_types::ThirtyTwoBytes, crate::lightning_invoice::InvoiceSignature)) -> Self {
5747                 Self {
5748                         a: tup.0,
5749                         b: tup.1,
5750                         c: tup.2,
5751                 }
5752         }
5753 }
5754 impl C3Tuple_RawInvoice_u832InvoiceSignatureZ {
5755         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::lightning_invoice::RawInvoice, crate::c_types::ThirtyTwoBytes, crate::lightning_invoice::InvoiceSignature) {
5756                 (self.a, self.b, self.c)
5757         }
5758 }
5759 impl Clone for C3Tuple_RawInvoice_u832InvoiceSignatureZ {
5760         fn clone(&self) -> Self {
5761                 Self {
5762                         a: Clone::clone(&self.a),
5763                         b: Clone::clone(&self.b),
5764                         c: Clone::clone(&self.c),
5765                 }
5766         }
5767 }
5768 #[no_mangle]
5769 /// Creates a new tuple which has the same data as `orig`
5770 /// but with all dynamically-allocated buffers duplicated in new buffers.
5771 pub extern "C" fn C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone(orig: &C3Tuple_RawInvoice_u832InvoiceSignatureZ) -> C3Tuple_RawInvoice_u832InvoiceSignatureZ { Clone::clone(&orig) }
5772 /// Creates a new C3Tuple_RawInvoice_u832InvoiceSignatureZ from the contained elements.
5773 #[no_mangle]
5774 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 {
5775         C3Tuple_RawInvoice_u832InvoiceSignatureZ { a, b, c, }
5776 }
5777
5778 #[no_mangle]
5779 /// Frees any resources used by the C3Tuple_RawInvoice_u832InvoiceSignatureZ.
5780 pub extern "C" fn C3Tuple_RawInvoice_u832InvoiceSignatureZ_free(_res: C3Tuple_RawInvoice_u832InvoiceSignatureZ) { }
5781 #[repr(C)]
5782 /// The contents of CResult_PayeePubKeyErrorZ
5783 pub union CResult_PayeePubKeyErrorZPtr {
5784         /// A pointer to the contents in the success state.
5785         /// Reading from this pointer when `result_ok` is not set is undefined.
5786         pub result: *mut crate::lightning_invoice::PayeePubKey,
5787         /// A pointer to the contents in the error state.
5788         /// Reading from this pointer when `result_ok` is set is undefined.
5789         pub err: *mut crate::c_types::Secp256k1Error,
5790 }
5791 #[repr(C)]
5792 /// A CResult_PayeePubKeyErrorZ represents the result of a fallible operation,
5793 /// containing a crate::lightning_invoice::PayeePubKey on success and a crate::c_types::Secp256k1Error on failure.
5794 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5795 pub struct CResult_PayeePubKeyErrorZ {
5796         /// The contents of this CResult_PayeePubKeyErrorZ, accessible via either
5797         /// `err` or `result` depending on the state of `result_ok`.
5798         pub contents: CResult_PayeePubKeyErrorZPtr,
5799         /// Whether this CResult_PayeePubKeyErrorZ represents a success state.
5800         pub result_ok: bool,
5801 }
5802 #[no_mangle]
5803 /// Creates a new CResult_PayeePubKeyErrorZ in the success state.
5804 pub extern "C" fn CResult_PayeePubKeyErrorZ_ok(o: crate::lightning_invoice::PayeePubKey) -> CResult_PayeePubKeyErrorZ {
5805         CResult_PayeePubKeyErrorZ {
5806                 contents: CResult_PayeePubKeyErrorZPtr {
5807                         result: Box::into_raw(Box::new(o)),
5808                 },
5809                 result_ok: true,
5810         }
5811 }
5812 #[no_mangle]
5813 /// Creates a new CResult_PayeePubKeyErrorZ in the error state.
5814 pub extern "C" fn CResult_PayeePubKeyErrorZ_err(e: crate::c_types::Secp256k1Error) -> CResult_PayeePubKeyErrorZ {
5815         CResult_PayeePubKeyErrorZ {
5816                 contents: CResult_PayeePubKeyErrorZPtr {
5817                         err: Box::into_raw(Box::new(e)),
5818                 },
5819                 result_ok: false,
5820         }
5821 }
5822 #[no_mangle]
5823 /// Frees any resources used by the CResult_PayeePubKeyErrorZ.
5824 pub extern "C" fn CResult_PayeePubKeyErrorZ_free(_res: CResult_PayeePubKeyErrorZ) { }
5825 impl Drop for CResult_PayeePubKeyErrorZ {
5826         fn drop(&mut self) {
5827                 if self.result_ok {
5828                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
5829                                 let _ = unsafe { Box::from_raw(self.contents.result) };
5830                         }
5831                 } else {
5832                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
5833                                 let _ = unsafe { Box::from_raw(self.contents.err) };
5834                         }
5835                 }
5836         }
5837 }
5838 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::PayeePubKey, crate::c_types::Secp256k1Error>> for CResult_PayeePubKeyErrorZ {
5839         fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::PayeePubKey, crate::c_types::Secp256k1Error>) -> Self {
5840                 let contents = if o.result_ok {
5841                         let result = unsafe { o.contents.result };
5842                         unsafe { o.contents.result = std::ptr::null_mut() };
5843                         CResult_PayeePubKeyErrorZPtr { result }
5844                 } else {
5845                         let err = unsafe { o.contents.err };
5846                         unsafe { o.contents.err = std::ptr::null_mut(); }
5847                         CResult_PayeePubKeyErrorZPtr { err }
5848                 };
5849                 Self {
5850                         contents,
5851                         result_ok: o.result_ok,
5852                 }
5853         }
5854 }
5855 impl Clone for CResult_PayeePubKeyErrorZ {
5856         fn clone(&self) -> Self {
5857                 if self.result_ok {
5858                         Self { result_ok: true, contents: CResult_PayeePubKeyErrorZPtr {
5859                                 result: Box::into_raw(Box::new(<crate::lightning_invoice::PayeePubKey>::clone(unsafe { &*self.contents.result })))
5860                         } }
5861                 } else {
5862                         Self { result_ok: false, contents: CResult_PayeePubKeyErrorZPtr {
5863                                 err: Box::into_raw(Box::new(<crate::c_types::Secp256k1Error>::clone(unsafe { &*self.contents.err })))
5864                         } }
5865                 }
5866         }
5867 }
5868 #[no_mangle]
5869 /// Creates a new CResult_PayeePubKeyErrorZ which has the same data as `orig`
5870 /// but with all dynamically-allocated buffers duplicated in new buffers.
5871 pub extern "C" fn CResult_PayeePubKeyErrorZ_clone(orig: &CResult_PayeePubKeyErrorZ) -> CResult_PayeePubKeyErrorZ { Clone::clone(&orig) }
5872 #[repr(C)]
5873 /// A dynamically-allocated array of crate::lightning_invoice::PrivateRoutes of arbitrary size.
5874 /// This corresponds to std::vector in C++
5875 pub struct CVec_PrivateRouteZ {
5876         /// The elements in the array.
5877         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
5878         pub data: *mut crate::lightning_invoice::PrivateRoute,
5879         /// The number of elements pointed to by `data`.
5880         pub datalen: usize
5881 }
5882 impl CVec_PrivateRouteZ {
5883         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning_invoice::PrivateRoute> {
5884                 if self.datalen == 0 { return Vec::new(); }
5885                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
5886                 self.data = std::ptr::null_mut();
5887                 self.datalen = 0;
5888                 ret
5889         }
5890         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning_invoice::PrivateRoute] {
5891                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
5892         }
5893 }
5894 impl From<Vec<crate::lightning_invoice::PrivateRoute>> for CVec_PrivateRouteZ {
5895         fn from(v: Vec<crate::lightning_invoice::PrivateRoute>) -> Self {
5896                 let datalen = v.len();
5897                 let data = Box::into_raw(v.into_boxed_slice());
5898                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
5899         }
5900 }
5901 #[no_mangle]
5902 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
5903 pub extern "C" fn CVec_PrivateRouteZ_free(_res: CVec_PrivateRouteZ) { }
5904 impl Drop for CVec_PrivateRouteZ {
5905         fn drop(&mut self) {
5906                 if self.datalen == 0 { return; }
5907                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
5908         }
5909 }
5910 impl Clone for CVec_PrivateRouteZ {
5911         fn clone(&self) -> Self {
5912                 let mut res = Vec::new();
5913                 if self.datalen == 0 { return Self::from(res); }
5914                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
5915                 Self::from(res)
5916         }
5917 }
5918 #[repr(C)]
5919 /// The contents of CResult_PositiveTimestampCreationErrorZ
5920 pub union CResult_PositiveTimestampCreationErrorZPtr {
5921         /// A pointer to the contents in the success state.
5922         /// Reading from this pointer when `result_ok` is not set is undefined.
5923         pub result: *mut crate::lightning_invoice::PositiveTimestamp,
5924         /// A pointer to the contents in the error state.
5925         /// Reading from this pointer when `result_ok` is set is undefined.
5926         pub err: *mut crate::lightning_invoice::CreationError,
5927 }
5928 #[repr(C)]
5929 /// A CResult_PositiveTimestampCreationErrorZ represents the result of a fallible operation,
5930 /// containing a crate::lightning_invoice::PositiveTimestamp on success and a crate::lightning_invoice::CreationError on failure.
5931 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5932 pub struct CResult_PositiveTimestampCreationErrorZ {
5933         /// The contents of this CResult_PositiveTimestampCreationErrorZ, accessible via either
5934         /// `err` or `result` depending on the state of `result_ok`.
5935         pub contents: CResult_PositiveTimestampCreationErrorZPtr,
5936         /// Whether this CResult_PositiveTimestampCreationErrorZ represents a success state.
5937         pub result_ok: bool,
5938 }
5939 #[no_mangle]
5940 /// Creates a new CResult_PositiveTimestampCreationErrorZ in the success state.
5941 pub extern "C" fn CResult_PositiveTimestampCreationErrorZ_ok(o: crate::lightning_invoice::PositiveTimestamp) -> CResult_PositiveTimestampCreationErrorZ {
5942         CResult_PositiveTimestampCreationErrorZ {
5943                 contents: CResult_PositiveTimestampCreationErrorZPtr {
5944                         result: Box::into_raw(Box::new(o)),
5945                 },
5946                 result_ok: true,
5947         }
5948 }
5949 #[no_mangle]
5950 /// Creates a new CResult_PositiveTimestampCreationErrorZ in the error state.
5951 pub extern "C" fn CResult_PositiveTimestampCreationErrorZ_err(e: crate::lightning_invoice::CreationError) -> CResult_PositiveTimestampCreationErrorZ {
5952         CResult_PositiveTimestampCreationErrorZ {
5953                 contents: CResult_PositiveTimestampCreationErrorZPtr {
5954                         err: Box::into_raw(Box::new(e)),
5955                 },
5956                 result_ok: false,
5957         }
5958 }
5959 #[no_mangle]
5960 /// Frees any resources used by the CResult_PositiveTimestampCreationErrorZ.
5961 pub extern "C" fn CResult_PositiveTimestampCreationErrorZ_free(_res: CResult_PositiveTimestampCreationErrorZ) { }
5962 impl Drop for CResult_PositiveTimestampCreationErrorZ {
5963         fn drop(&mut self) {
5964                 if self.result_ok {
5965                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
5966                                 let _ = unsafe { Box::from_raw(self.contents.result) };
5967                         }
5968                 } else {
5969                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
5970                                 let _ = unsafe { Box::from_raw(self.contents.err) };
5971                         }
5972                 }
5973         }
5974 }
5975 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::PositiveTimestamp, crate::lightning_invoice::CreationError>> for CResult_PositiveTimestampCreationErrorZ {
5976         fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::PositiveTimestamp, crate::lightning_invoice::CreationError>) -> Self {
5977                 let contents = if o.result_ok {
5978                         let result = unsafe { o.contents.result };
5979                         unsafe { o.contents.result = std::ptr::null_mut() };
5980                         CResult_PositiveTimestampCreationErrorZPtr { result }
5981                 } else {
5982                         let err = unsafe { o.contents.err };
5983                         unsafe { o.contents.err = std::ptr::null_mut(); }
5984                         CResult_PositiveTimestampCreationErrorZPtr { err }
5985                 };
5986                 Self {
5987                         contents,
5988                         result_ok: o.result_ok,
5989                 }
5990         }
5991 }
5992 impl Clone for CResult_PositiveTimestampCreationErrorZ {
5993         fn clone(&self) -> Self {
5994                 if self.result_ok {
5995                         Self { result_ok: true, contents: CResult_PositiveTimestampCreationErrorZPtr {
5996                                 result: Box::into_raw(Box::new(<crate::lightning_invoice::PositiveTimestamp>::clone(unsafe { &*self.contents.result })))
5997                         } }
5998                 } else {
5999                         Self { result_ok: false, contents: CResult_PositiveTimestampCreationErrorZPtr {
6000                                 err: Box::into_raw(Box::new(<crate::lightning_invoice::CreationError>::clone(unsafe { &*self.contents.err })))
6001                         } }
6002                 }
6003         }
6004 }
6005 #[no_mangle]
6006 /// Creates a new CResult_PositiveTimestampCreationErrorZ which has the same data as `orig`
6007 /// but with all dynamically-allocated buffers duplicated in new buffers.
6008 pub extern "C" fn CResult_PositiveTimestampCreationErrorZ_clone(orig: &CResult_PositiveTimestampCreationErrorZ) -> CResult_PositiveTimestampCreationErrorZ { Clone::clone(&orig) }
6009 #[repr(C)]
6010 /// The contents of CResult_NoneSemanticErrorZ
6011 pub union CResult_NoneSemanticErrorZPtr {
6012         /// Note that this value is always NULL, as there are no contents in the OK variant
6013         pub result: *mut std::ffi::c_void,
6014         /// A pointer to the contents in the error state.
6015         /// Reading from this pointer when `result_ok` is set is undefined.
6016         pub err: *mut crate::lightning_invoice::SemanticError,
6017 }
6018 #[repr(C)]
6019 /// A CResult_NoneSemanticErrorZ represents the result of a fallible operation,
6020 /// containing a () on success and a crate::lightning_invoice::SemanticError on failure.
6021 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6022 pub struct CResult_NoneSemanticErrorZ {
6023         /// The contents of this CResult_NoneSemanticErrorZ, accessible via either
6024         /// `err` or `result` depending on the state of `result_ok`.
6025         pub contents: CResult_NoneSemanticErrorZPtr,
6026         /// Whether this CResult_NoneSemanticErrorZ represents a success state.
6027         pub result_ok: bool,
6028 }
6029 #[no_mangle]
6030 /// Creates a new CResult_NoneSemanticErrorZ in the success state.
6031 pub extern "C" fn CResult_NoneSemanticErrorZ_ok() -> CResult_NoneSemanticErrorZ {
6032         CResult_NoneSemanticErrorZ {
6033                 contents: CResult_NoneSemanticErrorZPtr {
6034                         result: std::ptr::null_mut(),
6035                 },
6036                 result_ok: true,
6037         }
6038 }
6039 #[no_mangle]
6040 /// Creates a new CResult_NoneSemanticErrorZ in the error state.
6041 pub extern "C" fn CResult_NoneSemanticErrorZ_err(e: crate::lightning_invoice::SemanticError) -> CResult_NoneSemanticErrorZ {
6042         CResult_NoneSemanticErrorZ {
6043                 contents: CResult_NoneSemanticErrorZPtr {
6044                         err: Box::into_raw(Box::new(e)),
6045                 },
6046                 result_ok: false,
6047         }
6048 }
6049 #[no_mangle]
6050 /// Frees any resources used by the CResult_NoneSemanticErrorZ.
6051 pub extern "C" fn CResult_NoneSemanticErrorZ_free(_res: CResult_NoneSemanticErrorZ) { }
6052 impl Drop for CResult_NoneSemanticErrorZ {
6053         fn drop(&mut self) {
6054                 if self.result_ok {
6055                 } else {
6056                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
6057                                 let _ = unsafe { Box::from_raw(self.contents.err) };
6058                         }
6059                 }
6060         }
6061 }
6062 impl From<crate::c_types::CResultTempl<(), crate::lightning_invoice::SemanticError>> for CResult_NoneSemanticErrorZ {
6063         fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning_invoice::SemanticError>) -> Self {
6064                 let contents = if o.result_ok {
6065                         let _ = unsafe { Box::from_raw(o.contents.result) };
6066                         o.contents.result = std::ptr::null_mut();
6067                         CResult_NoneSemanticErrorZPtr { result: std::ptr::null_mut() }
6068                 } else {
6069                         let err = unsafe { o.contents.err };
6070                         unsafe { o.contents.err = std::ptr::null_mut(); }
6071                         CResult_NoneSemanticErrorZPtr { err }
6072                 };
6073                 Self {
6074                         contents,
6075                         result_ok: o.result_ok,
6076                 }
6077         }
6078 }
6079 impl Clone for CResult_NoneSemanticErrorZ {
6080         fn clone(&self) -> Self {
6081                 if self.result_ok {
6082                         Self { result_ok: true, contents: CResult_NoneSemanticErrorZPtr {
6083                                 result: std::ptr::null_mut()
6084                         } }
6085                 } else {
6086                         Self { result_ok: false, contents: CResult_NoneSemanticErrorZPtr {
6087                                 err: Box::into_raw(Box::new(<crate::lightning_invoice::SemanticError>::clone(unsafe { &*self.contents.err })))
6088                         } }
6089                 }
6090         }
6091 }
6092 #[no_mangle]
6093 /// Creates a new CResult_NoneSemanticErrorZ which has the same data as `orig`
6094 /// but with all dynamically-allocated buffers duplicated in new buffers.
6095 pub extern "C" fn CResult_NoneSemanticErrorZ_clone(orig: &CResult_NoneSemanticErrorZ) -> CResult_NoneSemanticErrorZ { Clone::clone(&orig) }
6096 #[repr(C)]
6097 /// The contents of CResult_InvoiceSemanticErrorZ
6098 pub union CResult_InvoiceSemanticErrorZPtr {
6099         /// A pointer to the contents in the success state.
6100         /// Reading from this pointer when `result_ok` is not set is undefined.
6101         pub result: *mut crate::lightning_invoice::Invoice,
6102         /// A pointer to the contents in the error state.
6103         /// Reading from this pointer when `result_ok` is set is undefined.
6104         pub err: *mut crate::lightning_invoice::SemanticError,
6105 }
6106 #[repr(C)]
6107 /// A CResult_InvoiceSemanticErrorZ represents the result of a fallible operation,
6108 /// containing a crate::lightning_invoice::Invoice on success and a crate::lightning_invoice::SemanticError on failure.
6109 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6110 pub struct CResult_InvoiceSemanticErrorZ {
6111         /// The contents of this CResult_InvoiceSemanticErrorZ, accessible via either
6112         /// `err` or `result` depending on the state of `result_ok`.
6113         pub contents: CResult_InvoiceSemanticErrorZPtr,
6114         /// Whether this CResult_InvoiceSemanticErrorZ represents a success state.
6115         pub result_ok: bool,
6116 }
6117 #[no_mangle]
6118 /// Creates a new CResult_InvoiceSemanticErrorZ in the success state.
6119 pub extern "C" fn CResult_InvoiceSemanticErrorZ_ok(o: crate::lightning_invoice::Invoice) -> CResult_InvoiceSemanticErrorZ {
6120         CResult_InvoiceSemanticErrorZ {
6121                 contents: CResult_InvoiceSemanticErrorZPtr {
6122                         result: Box::into_raw(Box::new(o)),
6123                 },
6124                 result_ok: true,
6125         }
6126 }
6127 #[no_mangle]
6128 /// Creates a new CResult_InvoiceSemanticErrorZ in the error state.
6129 pub extern "C" fn CResult_InvoiceSemanticErrorZ_err(e: crate::lightning_invoice::SemanticError) -> CResult_InvoiceSemanticErrorZ {
6130         CResult_InvoiceSemanticErrorZ {
6131                 contents: CResult_InvoiceSemanticErrorZPtr {
6132                         err: Box::into_raw(Box::new(e)),
6133                 },
6134                 result_ok: false,
6135         }
6136 }
6137 #[no_mangle]
6138 /// Frees any resources used by the CResult_InvoiceSemanticErrorZ.
6139 pub extern "C" fn CResult_InvoiceSemanticErrorZ_free(_res: CResult_InvoiceSemanticErrorZ) { }
6140 impl Drop for CResult_InvoiceSemanticErrorZ {
6141         fn drop(&mut self) {
6142                 if self.result_ok {
6143                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
6144                                 let _ = unsafe { Box::from_raw(self.contents.result) };
6145                         }
6146                 } else {
6147                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
6148                                 let _ = unsafe { Box::from_raw(self.contents.err) };
6149                         }
6150                 }
6151         }
6152 }
6153 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::Invoice, crate::lightning_invoice::SemanticError>> for CResult_InvoiceSemanticErrorZ {
6154         fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::Invoice, crate::lightning_invoice::SemanticError>) -> Self {
6155                 let contents = if o.result_ok {
6156                         let result = unsafe { o.contents.result };
6157                         unsafe { o.contents.result = std::ptr::null_mut() };
6158                         CResult_InvoiceSemanticErrorZPtr { result }
6159                 } else {
6160                         let err = unsafe { o.contents.err };
6161                         unsafe { o.contents.err = std::ptr::null_mut(); }
6162                         CResult_InvoiceSemanticErrorZPtr { err }
6163                 };
6164                 Self {
6165                         contents,
6166                         result_ok: o.result_ok,
6167                 }
6168         }
6169 }
6170 impl Clone for CResult_InvoiceSemanticErrorZ {
6171         fn clone(&self) -> Self {
6172                 if self.result_ok {
6173                         Self { result_ok: true, contents: CResult_InvoiceSemanticErrorZPtr {
6174                                 result: Box::into_raw(Box::new(<crate::lightning_invoice::Invoice>::clone(unsafe { &*self.contents.result })))
6175                         } }
6176                 } else {
6177                         Self { result_ok: false, contents: CResult_InvoiceSemanticErrorZPtr {
6178                                 err: Box::into_raw(Box::new(<crate::lightning_invoice::SemanticError>::clone(unsafe { &*self.contents.err })))
6179                         } }
6180                 }
6181         }
6182 }
6183 #[no_mangle]
6184 /// Creates a new CResult_InvoiceSemanticErrorZ which has the same data as `orig`
6185 /// but with all dynamically-allocated buffers duplicated in new buffers.
6186 pub extern "C" fn CResult_InvoiceSemanticErrorZ_clone(orig: &CResult_InvoiceSemanticErrorZ) -> CResult_InvoiceSemanticErrorZ { Clone::clone(&orig) }
6187 #[repr(C)]
6188 /// The contents of CResult_DescriptionCreationErrorZ
6189 pub union CResult_DescriptionCreationErrorZPtr {
6190         /// A pointer to the contents in the success state.
6191         /// Reading from this pointer when `result_ok` is not set is undefined.
6192         pub result: *mut crate::lightning_invoice::Description,
6193         /// A pointer to the contents in the error state.
6194         /// Reading from this pointer when `result_ok` is set is undefined.
6195         pub err: *mut crate::lightning_invoice::CreationError,
6196 }
6197 #[repr(C)]
6198 /// A CResult_DescriptionCreationErrorZ represents the result of a fallible operation,
6199 /// containing a crate::lightning_invoice::Description on success and a crate::lightning_invoice::CreationError on failure.
6200 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6201 pub struct CResult_DescriptionCreationErrorZ {
6202         /// The contents of this CResult_DescriptionCreationErrorZ, accessible via either
6203         /// `err` or `result` depending on the state of `result_ok`.
6204         pub contents: CResult_DescriptionCreationErrorZPtr,
6205         /// Whether this CResult_DescriptionCreationErrorZ represents a success state.
6206         pub result_ok: bool,
6207 }
6208 #[no_mangle]
6209 /// Creates a new CResult_DescriptionCreationErrorZ in the success state.
6210 pub extern "C" fn CResult_DescriptionCreationErrorZ_ok(o: crate::lightning_invoice::Description) -> CResult_DescriptionCreationErrorZ {
6211         CResult_DescriptionCreationErrorZ {
6212                 contents: CResult_DescriptionCreationErrorZPtr {
6213                         result: Box::into_raw(Box::new(o)),
6214                 },
6215                 result_ok: true,
6216         }
6217 }
6218 #[no_mangle]
6219 /// Creates a new CResult_DescriptionCreationErrorZ in the error state.
6220 pub extern "C" fn CResult_DescriptionCreationErrorZ_err(e: crate::lightning_invoice::CreationError) -> CResult_DescriptionCreationErrorZ {
6221         CResult_DescriptionCreationErrorZ {
6222                 contents: CResult_DescriptionCreationErrorZPtr {
6223                         err: Box::into_raw(Box::new(e)),
6224                 },
6225                 result_ok: false,
6226         }
6227 }
6228 #[no_mangle]
6229 /// Frees any resources used by the CResult_DescriptionCreationErrorZ.
6230 pub extern "C" fn CResult_DescriptionCreationErrorZ_free(_res: CResult_DescriptionCreationErrorZ) { }
6231 impl Drop for CResult_DescriptionCreationErrorZ {
6232         fn drop(&mut self) {
6233                 if self.result_ok {
6234                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
6235                                 let _ = unsafe { Box::from_raw(self.contents.result) };
6236                         }
6237                 } else {
6238                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
6239                                 let _ = unsafe { Box::from_raw(self.contents.err) };
6240                         }
6241                 }
6242         }
6243 }
6244 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::Description, crate::lightning_invoice::CreationError>> for CResult_DescriptionCreationErrorZ {
6245         fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::Description, crate::lightning_invoice::CreationError>) -> Self {
6246                 let contents = if o.result_ok {
6247                         let result = unsafe { o.contents.result };
6248                         unsafe { o.contents.result = std::ptr::null_mut() };
6249                         CResult_DescriptionCreationErrorZPtr { result }
6250                 } else {
6251                         let err = unsafe { o.contents.err };
6252                         unsafe { o.contents.err = std::ptr::null_mut(); }
6253                         CResult_DescriptionCreationErrorZPtr { err }
6254                 };
6255                 Self {
6256                         contents,
6257                         result_ok: o.result_ok,
6258                 }
6259         }
6260 }
6261 impl Clone for CResult_DescriptionCreationErrorZ {
6262         fn clone(&self) -> Self {
6263                 if self.result_ok {
6264                         Self { result_ok: true, contents: CResult_DescriptionCreationErrorZPtr {
6265                                 result: Box::into_raw(Box::new(<crate::lightning_invoice::Description>::clone(unsafe { &*self.contents.result })))
6266                         } }
6267                 } else {
6268                         Self { result_ok: false, contents: CResult_DescriptionCreationErrorZPtr {
6269                                 err: Box::into_raw(Box::new(<crate::lightning_invoice::CreationError>::clone(unsafe { &*self.contents.err })))
6270                         } }
6271                 }
6272         }
6273 }
6274 #[no_mangle]
6275 /// Creates a new CResult_DescriptionCreationErrorZ which has the same data as `orig`
6276 /// but with all dynamically-allocated buffers duplicated in new buffers.
6277 pub extern "C" fn CResult_DescriptionCreationErrorZ_clone(orig: &CResult_DescriptionCreationErrorZ) -> CResult_DescriptionCreationErrorZ { Clone::clone(&orig) }
6278 #[repr(C)]
6279 /// The contents of CResult_ExpiryTimeCreationErrorZ
6280 pub union CResult_ExpiryTimeCreationErrorZPtr {
6281         /// A pointer to the contents in the success state.
6282         /// Reading from this pointer when `result_ok` is not set is undefined.
6283         pub result: *mut crate::lightning_invoice::ExpiryTime,
6284         /// A pointer to the contents in the error state.
6285         /// Reading from this pointer when `result_ok` is set is undefined.
6286         pub err: *mut crate::lightning_invoice::CreationError,
6287 }
6288 #[repr(C)]
6289 /// A CResult_ExpiryTimeCreationErrorZ represents the result of a fallible operation,
6290 /// containing a crate::lightning_invoice::ExpiryTime on success and a crate::lightning_invoice::CreationError on failure.
6291 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6292 pub struct CResult_ExpiryTimeCreationErrorZ {
6293         /// The contents of this CResult_ExpiryTimeCreationErrorZ, accessible via either
6294         /// `err` or `result` depending on the state of `result_ok`.
6295         pub contents: CResult_ExpiryTimeCreationErrorZPtr,
6296         /// Whether this CResult_ExpiryTimeCreationErrorZ represents a success state.
6297         pub result_ok: bool,
6298 }
6299 #[no_mangle]
6300 /// Creates a new CResult_ExpiryTimeCreationErrorZ in the success state.
6301 pub extern "C" fn CResult_ExpiryTimeCreationErrorZ_ok(o: crate::lightning_invoice::ExpiryTime) -> CResult_ExpiryTimeCreationErrorZ {
6302         CResult_ExpiryTimeCreationErrorZ {
6303                 contents: CResult_ExpiryTimeCreationErrorZPtr {
6304                         result: Box::into_raw(Box::new(o)),
6305                 },
6306                 result_ok: true,
6307         }
6308 }
6309 #[no_mangle]
6310 /// Creates a new CResult_ExpiryTimeCreationErrorZ in the error state.
6311 pub extern "C" fn CResult_ExpiryTimeCreationErrorZ_err(e: crate::lightning_invoice::CreationError) -> CResult_ExpiryTimeCreationErrorZ {
6312         CResult_ExpiryTimeCreationErrorZ {
6313                 contents: CResult_ExpiryTimeCreationErrorZPtr {
6314                         err: Box::into_raw(Box::new(e)),
6315                 },
6316                 result_ok: false,
6317         }
6318 }
6319 #[no_mangle]
6320 /// Frees any resources used by the CResult_ExpiryTimeCreationErrorZ.
6321 pub extern "C" fn CResult_ExpiryTimeCreationErrorZ_free(_res: CResult_ExpiryTimeCreationErrorZ) { }
6322 impl Drop for CResult_ExpiryTimeCreationErrorZ {
6323         fn drop(&mut self) {
6324                 if self.result_ok {
6325                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
6326                                 let _ = unsafe { Box::from_raw(self.contents.result) };
6327                         }
6328                 } else {
6329                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
6330                                 let _ = unsafe { Box::from_raw(self.contents.err) };
6331                         }
6332                 }
6333         }
6334 }
6335 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::ExpiryTime, crate::lightning_invoice::CreationError>> for CResult_ExpiryTimeCreationErrorZ {
6336         fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::ExpiryTime, crate::lightning_invoice::CreationError>) -> Self {
6337                 let contents = if o.result_ok {
6338                         let result = unsafe { o.contents.result };
6339                         unsafe { o.contents.result = std::ptr::null_mut() };
6340                         CResult_ExpiryTimeCreationErrorZPtr { result }
6341                 } else {
6342                         let err = unsafe { o.contents.err };
6343                         unsafe { o.contents.err = std::ptr::null_mut(); }
6344                         CResult_ExpiryTimeCreationErrorZPtr { err }
6345                 };
6346                 Self {
6347                         contents,
6348                         result_ok: o.result_ok,
6349                 }
6350         }
6351 }
6352 impl Clone for CResult_ExpiryTimeCreationErrorZ {
6353         fn clone(&self) -> Self {
6354                 if self.result_ok {
6355                         Self { result_ok: true, contents: CResult_ExpiryTimeCreationErrorZPtr {
6356                                 result: Box::into_raw(Box::new(<crate::lightning_invoice::ExpiryTime>::clone(unsafe { &*self.contents.result })))
6357                         } }
6358                 } else {
6359                         Self { result_ok: false, contents: CResult_ExpiryTimeCreationErrorZPtr {
6360                                 err: Box::into_raw(Box::new(<crate::lightning_invoice::CreationError>::clone(unsafe { &*self.contents.err })))
6361                         } }
6362                 }
6363         }
6364 }
6365 #[no_mangle]
6366 /// Creates a new CResult_ExpiryTimeCreationErrorZ which has the same data as `orig`
6367 /// but with all dynamically-allocated buffers duplicated in new buffers.
6368 pub extern "C" fn CResult_ExpiryTimeCreationErrorZ_clone(orig: &CResult_ExpiryTimeCreationErrorZ) -> CResult_ExpiryTimeCreationErrorZ { Clone::clone(&orig) }
6369 #[repr(C)]
6370 /// The contents of CResult_PrivateRouteCreationErrorZ
6371 pub union CResult_PrivateRouteCreationErrorZPtr {
6372         /// A pointer to the contents in the success state.
6373         /// Reading from this pointer when `result_ok` is not set is undefined.
6374         pub result: *mut crate::lightning_invoice::PrivateRoute,
6375         /// A pointer to the contents in the error state.
6376         /// Reading from this pointer when `result_ok` is set is undefined.
6377         pub err: *mut crate::lightning_invoice::CreationError,
6378 }
6379 #[repr(C)]
6380 /// A CResult_PrivateRouteCreationErrorZ represents the result of a fallible operation,
6381 /// containing a crate::lightning_invoice::PrivateRoute on success and a crate::lightning_invoice::CreationError on failure.
6382 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6383 pub struct CResult_PrivateRouteCreationErrorZ {
6384         /// The contents of this CResult_PrivateRouteCreationErrorZ, accessible via either
6385         /// `err` or `result` depending on the state of `result_ok`.
6386         pub contents: CResult_PrivateRouteCreationErrorZPtr,
6387         /// Whether this CResult_PrivateRouteCreationErrorZ represents a success state.
6388         pub result_ok: bool,
6389 }
6390 #[no_mangle]
6391 /// Creates a new CResult_PrivateRouteCreationErrorZ in the success state.
6392 pub extern "C" fn CResult_PrivateRouteCreationErrorZ_ok(o: crate::lightning_invoice::PrivateRoute) -> CResult_PrivateRouteCreationErrorZ {
6393         CResult_PrivateRouteCreationErrorZ {
6394                 contents: CResult_PrivateRouteCreationErrorZPtr {
6395                         result: Box::into_raw(Box::new(o)),
6396                 },
6397                 result_ok: true,
6398         }
6399 }
6400 #[no_mangle]
6401 /// Creates a new CResult_PrivateRouteCreationErrorZ in the error state.
6402 pub extern "C" fn CResult_PrivateRouteCreationErrorZ_err(e: crate::lightning_invoice::CreationError) -> CResult_PrivateRouteCreationErrorZ {
6403         CResult_PrivateRouteCreationErrorZ {
6404                 contents: CResult_PrivateRouteCreationErrorZPtr {
6405                         err: Box::into_raw(Box::new(e)),
6406                 },
6407                 result_ok: false,
6408         }
6409 }
6410 #[no_mangle]
6411 /// Frees any resources used by the CResult_PrivateRouteCreationErrorZ.
6412 pub extern "C" fn CResult_PrivateRouteCreationErrorZ_free(_res: CResult_PrivateRouteCreationErrorZ) { }
6413 impl Drop for CResult_PrivateRouteCreationErrorZ {
6414         fn drop(&mut self) {
6415                 if self.result_ok {
6416                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
6417                                 let _ = unsafe { Box::from_raw(self.contents.result) };
6418                         }
6419                 } else {
6420                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
6421                                 let _ = unsafe { Box::from_raw(self.contents.err) };
6422                         }
6423                 }
6424         }
6425 }
6426 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::PrivateRoute, crate::lightning_invoice::CreationError>> for CResult_PrivateRouteCreationErrorZ {
6427         fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::PrivateRoute, crate::lightning_invoice::CreationError>) -> Self {
6428                 let contents = if o.result_ok {
6429                         let result = unsafe { o.contents.result };
6430                         unsafe { o.contents.result = std::ptr::null_mut() };
6431                         CResult_PrivateRouteCreationErrorZPtr { result }
6432                 } else {
6433                         let err = unsafe { o.contents.err };
6434                         unsafe { o.contents.err = std::ptr::null_mut(); }
6435                         CResult_PrivateRouteCreationErrorZPtr { err }
6436                 };
6437                 Self {
6438                         contents,
6439                         result_ok: o.result_ok,
6440                 }
6441         }
6442 }
6443 impl Clone for CResult_PrivateRouteCreationErrorZ {
6444         fn clone(&self) -> Self {
6445                 if self.result_ok {
6446                         Self { result_ok: true, contents: CResult_PrivateRouteCreationErrorZPtr {
6447                                 result: Box::into_raw(Box::new(<crate::lightning_invoice::PrivateRoute>::clone(unsafe { &*self.contents.result })))
6448                         } }
6449                 } else {
6450                         Self { result_ok: false, contents: CResult_PrivateRouteCreationErrorZPtr {
6451                                 err: Box::into_raw(Box::new(<crate::lightning_invoice::CreationError>::clone(unsafe { &*self.contents.err })))
6452                         } }
6453                 }
6454         }
6455 }
6456 #[no_mangle]
6457 /// Creates a new CResult_PrivateRouteCreationErrorZ which has the same data as `orig`
6458 /// but with all dynamically-allocated buffers duplicated in new buffers.
6459 pub extern "C" fn CResult_PrivateRouteCreationErrorZ_clone(orig: &CResult_PrivateRouteCreationErrorZ) -> CResult_PrivateRouteCreationErrorZ { Clone::clone(&orig) }
6460 #[repr(C)]
6461 /// The contents of CResult_StringErrorZ
6462 pub union CResult_StringErrorZPtr {
6463         /// A pointer to the contents in the success state.
6464         /// Reading from this pointer when `result_ok` is not set is undefined.
6465         pub result: *mut crate::c_types::Str,
6466         /// A pointer to the contents in the error state.
6467         /// Reading from this pointer when `result_ok` is set is undefined.
6468         pub err: *mut crate::c_types::Secp256k1Error,
6469 }
6470 #[repr(C)]
6471 /// A CResult_StringErrorZ represents the result of a fallible operation,
6472 /// containing a crate::c_types::Str on success and a crate::c_types::Secp256k1Error on failure.
6473 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6474 pub struct CResult_StringErrorZ {
6475         /// The contents of this CResult_StringErrorZ, accessible via either
6476         /// `err` or `result` depending on the state of `result_ok`.
6477         pub contents: CResult_StringErrorZPtr,
6478         /// Whether this CResult_StringErrorZ represents a success state.
6479         pub result_ok: bool,
6480 }
6481 #[no_mangle]
6482 /// Creates a new CResult_StringErrorZ in the success state.
6483 pub extern "C" fn CResult_StringErrorZ_ok(o: crate::c_types::Str) -> CResult_StringErrorZ {
6484         CResult_StringErrorZ {
6485                 contents: CResult_StringErrorZPtr {
6486                         result: Box::into_raw(Box::new(o)),
6487                 },
6488                 result_ok: true,
6489         }
6490 }
6491 #[no_mangle]
6492 /// Creates a new CResult_StringErrorZ in the error state.
6493 pub extern "C" fn CResult_StringErrorZ_err(e: crate::c_types::Secp256k1Error) -> CResult_StringErrorZ {
6494         CResult_StringErrorZ {
6495                 contents: CResult_StringErrorZPtr {
6496                         err: Box::into_raw(Box::new(e)),
6497                 },
6498                 result_ok: false,
6499         }
6500 }
6501 #[no_mangle]
6502 /// Frees any resources used by the CResult_StringErrorZ.
6503 pub extern "C" fn CResult_StringErrorZ_free(_res: CResult_StringErrorZ) { }
6504 impl Drop for CResult_StringErrorZ {
6505         fn drop(&mut self) {
6506                 if self.result_ok {
6507                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
6508                                 let _ = unsafe { Box::from_raw(self.contents.result) };
6509                         }
6510                 } else {
6511                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
6512                                 let _ = unsafe { Box::from_raw(self.contents.err) };
6513                         }
6514                 }
6515         }
6516 }
6517 impl From<crate::c_types::CResultTempl<crate::c_types::Str, crate::c_types::Secp256k1Error>> for CResult_StringErrorZ {
6518         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::Str, crate::c_types::Secp256k1Error>) -> Self {
6519                 let contents = if o.result_ok {
6520                         let result = unsafe { o.contents.result };
6521                         unsafe { o.contents.result = std::ptr::null_mut() };
6522                         CResult_StringErrorZPtr { result }
6523                 } else {
6524                         let err = unsafe { o.contents.err };
6525                         unsafe { o.contents.err = std::ptr::null_mut(); }
6526                         CResult_StringErrorZPtr { err }
6527                 };
6528                 Self {
6529                         contents,
6530                         result_ok: o.result_ok,
6531                 }
6532         }
6533 }
6534 #[repr(C)]
6535 /// The contents of CResult_ChannelMonitorUpdateDecodeErrorZ
6536 pub union CResult_ChannelMonitorUpdateDecodeErrorZPtr {
6537         /// A pointer to the contents in the success state.
6538         /// Reading from this pointer when `result_ok` is not set is undefined.
6539         pub result: *mut crate::lightning::chain::channelmonitor::ChannelMonitorUpdate,
6540         /// A pointer to the contents in the error state.
6541         /// Reading from this pointer when `result_ok` is set is undefined.
6542         pub err: *mut crate::lightning::ln::msgs::DecodeError,
6543 }
6544 #[repr(C)]
6545 /// A CResult_ChannelMonitorUpdateDecodeErrorZ represents the result of a fallible operation,
6546 /// containing a crate::lightning::chain::channelmonitor::ChannelMonitorUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
6547 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6548 pub struct CResult_ChannelMonitorUpdateDecodeErrorZ {
6549         /// The contents of this CResult_ChannelMonitorUpdateDecodeErrorZ, accessible via either
6550         /// `err` or `result` depending on the state of `result_ok`.
6551         pub contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr,
6552         /// Whether this CResult_ChannelMonitorUpdateDecodeErrorZ represents a success state.
6553         pub result_ok: bool,
6554 }
6555 #[no_mangle]
6556 /// Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ in the success state.
6557 pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_ok(o: crate::lightning::chain::channelmonitor::ChannelMonitorUpdate) -> CResult_ChannelMonitorUpdateDecodeErrorZ {
6558         CResult_ChannelMonitorUpdateDecodeErrorZ {
6559                 contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr {
6560                         result: Box::into_raw(Box::new(o)),
6561                 },
6562                 result_ok: true,
6563         }
6564 }
6565 #[no_mangle]
6566 /// Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ in the error state.
6567 pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelMonitorUpdateDecodeErrorZ {
6568         CResult_ChannelMonitorUpdateDecodeErrorZ {
6569                 contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr {
6570                         err: Box::into_raw(Box::new(e)),
6571                 },
6572                 result_ok: false,
6573         }
6574 }
6575 #[no_mangle]
6576 /// Frees any resources used by the CResult_ChannelMonitorUpdateDecodeErrorZ.
6577 pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_free(_res: CResult_ChannelMonitorUpdateDecodeErrorZ) { }
6578 impl Drop for CResult_ChannelMonitorUpdateDecodeErrorZ {
6579         fn drop(&mut self) {
6580                 if self.result_ok {
6581                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
6582                                 let _ = unsafe { Box::from_raw(self.contents.result) };
6583                         }
6584                 } else {
6585                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
6586                                 let _ = unsafe { Box::from_raw(self.contents.err) };
6587                         }
6588                 }
6589         }
6590 }
6591 impl From<crate::c_types::CResultTempl<crate::lightning::chain::channelmonitor::ChannelMonitorUpdate, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelMonitorUpdateDecodeErrorZ {
6592         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::channelmonitor::ChannelMonitorUpdate, crate::lightning::ln::msgs::DecodeError>) -> Self {
6593                 let contents = if o.result_ok {
6594                         let result = unsafe { o.contents.result };
6595                         unsafe { o.contents.result = std::ptr::null_mut() };
6596                         CResult_ChannelMonitorUpdateDecodeErrorZPtr { result }
6597                 } else {
6598                         let err = unsafe { o.contents.err };
6599                         unsafe { o.contents.err = std::ptr::null_mut(); }
6600                         CResult_ChannelMonitorUpdateDecodeErrorZPtr { err }
6601                 };
6602                 Self {
6603                         contents,
6604                         result_ok: o.result_ok,
6605                 }
6606         }
6607 }
6608 impl Clone for CResult_ChannelMonitorUpdateDecodeErrorZ {
6609         fn clone(&self) -> Self {
6610                 if self.result_ok {
6611                         Self { result_ok: true, contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr {
6612                                 result: Box::into_raw(Box::new(<crate::lightning::chain::channelmonitor::ChannelMonitorUpdate>::clone(unsafe { &*self.contents.result })))
6613                         } }
6614                 } else {
6615                         Self { result_ok: false, contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr {
6616                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
6617                         } }
6618                 }
6619         }
6620 }
6621 #[no_mangle]
6622 /// Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ which has the same data as `orig`
6623 /// but with all dynamically-allocated buffers duplicated in new buffers.
6624 pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_clone(orig: &CResult_ChannelMonitorUpdateDecodeErrorZ) -> CResult_ChannelMonitorUpdateDecodeErrorZ { Clone::clone(&orig) }
6625 #[repr(C)]
6626 /// The contents of CResult_HTLCUpdateDecodeErrorZ
6627 pub union CResult_HTLCUpdateDecodeErrorZPtr {
6628         /// A pointer to the contents in the success state.
6629         /// Reading from this pointer when `result_ok` is not set is undefined.
6630         pub result: *mut crate::lightning::chain::channelmonitor::HTLCUpdate,
6631         /// A pointer to the contents in the error state.
6632         /// Reading from this pointer when `result_ok` is set is undefined.
6633         pub err: *mut crate::lightning::ln::msgs::DecodeError,
6634 }
6635 #[repr(C)]
6636 /// A CResult_HTLCUpdateDecodeErrorZ represents the result of a fallible operation,
6637 /// containing a crate::lightning::chain::channelmonitor::HTLCUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
6638 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6639 pub struct CResult_HTLCUpdateDecodeErrorZ {
6640         /// The contents of this CResult_HTLCUpdateDecodeErrorZ, accessible via either
6641         /// `err` or `result` depending on the state of `result_ok`.
6642         pub contents: CResult_HTLCUpdateDecodeErrorZPtr,
6643         /// Whether this CResult_HTLCUpdateDecodeErrorZ represents a success state.
6644         pub result_ok: bool,
6645 }
6646 #[no_mangle]
6647 /// Creates a new CResult_HTLCUpdateDecodeErrorZ in the success state.
6648 pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_ok(o: crate::lightning::chain::channelmonitor::HTLCUpdate) -> CResult_HTLCUpdateDecodeErrorZ {
6649         CResult_HTLCUpdateDecodeErrorZ {
6650                 contents: CResult_HTLCUpdateDecodeErrorZPtr {
6651                         result: Box::into_raw(Box::new(o)),
6652                 },
6653                 result_ok: true,
6654         }
6655 }
6656 #[no_mangle]
6657 /// Creates a new CResult_HTLCUpdateDecodeErrorZ in the error state.
6658 pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_HTLCUpdateDecodeErrorZ {
6659         CResult_HTLCUpdateDecodeErrorZ {
6660                 contents: CResult_HTLCUpdateDecodeErrorZPtr {
6661                         err: Box::into_raw(Box::new(e)),
6662                 },
6663                 result_ok: false,
6664         }
6665 }
6666 #[no_mangle]
6667 /// Frees any resources used by the CResult_HTLCUpdateDecodeErrorZ.
6668 pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_free(_res: CResult_HTLCUpdateDecodeErrorZ) { }
6669 impl Drop for CResult_HTLCUpdateDecodeErrorZ {
6670         fn drop(&mut self) {
6671                 if self.result_ok {
6672                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
6673                                 let _ = unsafe { Box::from_raw(self.contents.result) };
6674                         }
6675                 } else {
6676                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
6677                                 let _ = unsafe { Box::from_raw(self.contents.err) };
6678                         }
6679                 }
6680         }
6681 }
6682 impl From<crate::c_types::CResultTempl<crate::lightning::chain::channelmonitor::HTLCUpdate, crate::lightning::ln::msgs::DecodeError>> for CResult_HTLCUpdateDecodeErrorZ {
6683         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::channelmonitor::HTLCUpdate, crate::lightning::ln::msgs::DecodeError>) -> Self {
6684                 let contents = if o.result_ok {
6685                         let result = unsafe { o.contents.result };
6686                         unsafe { o.contents.result = std::ptr::null_mut() };
6687                         CResult_HTLCUpdateDecodeErrorZPtr { result }
6688                 } else {
6689                         let err = unsafe { o.contents.err };
6690                         unsafe { o.contents.err = std::ptr::null_mut(); }
6691                         CResult_HTLCUpdateDecodeErrorZPtr { err }
6692                 };
6693                 Self {
6694                         contents,
6695                         result_ok: o.result_ok,
6696                 }
6697         }
6698 }
6699 impl Clone for CResult_HTLCUpdateDecodeErrorZ {
6700         fn clone(&self) -> Self {
6701                 if self.result_ok {
6702                         Self { result_ok: true, contents: CResult_HTLCUpdateDecodeErrorZPtr {
6703                                 result: Box::into_raw(Box::new(<crate::lightning::chain::channelmonitor::HTLCUpdate>::clone(unsafe { &*self.contents.result })))
6704                         } }
6705                 } else {
6706                         Self { result_ok: false, contents: CResult_HTLCUpdateDecodeErrorZPtr {
6707                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
6708                         } }
6709                 }
6710         }
6711 }
6712 #[no_mangle]
6713 /// Creates a new CResult_HTLCUpdateDecodeErrorZ which has the same data as `orig`
6714 /// but with all dynamically-allocated buffers duplicated in new buffers.
6715 pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_clone(orig: &CResult_HTLCUpdateDecodeErrorZ) -> CResult_HTLCUpdateDecodeErrorZ { Clone::clone(&orig) }
6716 #[repr(C)]
6717 /// The contents of CResult_NoneMonitorUpdateErrorZ
6718 pub union CResult_NoneMonitorUpdateErrorZPtr {
6719         /// Note that this value is always NULL, as there are no contents in the OK variant
6720         pub result: *mut std::ffi::c_void,
6721         /// A pointer to the contents in the error state.
6722         /// Reading from this pointer when `result_ok` is set is undefined.
6723         pub err: *mut crate::lightning::chain::channelmonitor::MonitorUpdateError,
6724 }
6725 #[repr(C)]
6726 /// A CResult_NoneMonitorUpdateErrorZ represents the result of a fallible operation,
6727 /// containing a () on success and a crate::lightning::chain::channelmonitor::MonitorUpdateError on failure.
6728 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6729 pub struct CResult_NoneMonitorUpdateErrorZ {
6730         /// The contents of this CResult_NoneMonitorUpdateErrorZ, accessible via either
6731         /// `err` or `result` depending on the state of `result_ok`.
6732         pub contents: CResult_NoneMonitorUpdateErrorZPtr,
6733         /// Whether this CResult_NoneMonitorUpdateErrorZ represents a success state.
6734         pub result_ok: bool,
6735 }
6736 #[no_mangle]
6737 /// Creates a new CResult_NoneMonitorUpdateErrorZ in the success state.
6738 pub extern "C" fn CResult_NoneMonitorUpdateErrorZ_ok() -> CResult_NoneMonitorUpdateErrorZ {
6739         CResult_NoneMonitorUpdateErrorZ {
6740                 contents: CResult_NoneMonitorUpdateErrorZPtr {
6741                         result: std::ptr::null_mut(),
6742                 },
6743                 result_ok: true,
6744         }
6745 }
6746 #[no_mangle]
6747 /// Creates a new CResult_NoneMonitorUpdateErrorZ in the error state.
6748 pub extern "C" fn CResult_NoneMonitorUpdateErrorZ_err(e: crate::lightning::chain::channelmonitor::MonitorUpdateError) -> CResult_NoneMonitorUpdateErrorZ {
6749         CResult_NoneMonitorUpdateErrorZ {
6750                 contents: CResult_NoneMonitorUpdateErrorZPtr {
6751                         err: Box::into_raw(Box::new(e)),
6752                 },
6753                 result_ok: false,
6754         }
6755 }
6756 #[no_mangle]
6757 /// Frees any resources used by the CResult_NoneMonitorUpdateErrorZ.
6758 pub extern "C" fn CResult_NoneMonitorUpdateErrorZ_free(_res: CResult_NoneMonitorUpdateErrorZ) { }
6759 impl Drop for CResult_NoneMonitorUpdateErrorZ {
6760         fn drop(&mut self) {
6761                 if self.result_ok {
6762                 } else {
6763                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
6764                                 let _ = unsafe { Box::from_raw(self.contents.err) };
6765                         }
6766                 }
6767         }
6768 }
6769 impl From<crate::c_types::CResultTempl<(), crate::lightning::chain::channelmonitor::MonitorUpdateError>> for CResult_NoneMonitorUpdateErrorZ {
6770         fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::chain::channelmonitor::MonitorUpdateError>) -> Self {
6771                 let contents = if o.result_ok {
6772                         let _ = unsafe { Box::from_raw(o.contents.result) };
6773                         o.contents.result = std::ptr::null_mut();
6774                         CResult_NoneMonitorUpdateErrorZPtr { result: std::ptr::null_mut() }
6775                 } else {
6776                         let err = unsafe { o.contents.err };
6777                         unsafe { o.contents.err = std::ptr::null_mut(); }
6778                         CResult_NoneMonitorUpdateErrorZPtr { err }
6779                 };
6780                 Self {
6781                         contents,
6782                         result_ok: o.result_ok,
6783                 }
6784         }
6785 }
6786 impl Clone for CResult_NoneMonitorUpdateErrorZ {
6787         fn clone(&self) -> Self {
6788                 if self.result_ok {
6789                         Self { result_ok: true, contents: CResult_NoneMonitorUpdateErrorZPtr {
6790                                 result: std::ptr::null_mut()
6791                         } }
6792                 } else {
6793                         Self { result_ok: false, contents: CResult_NoneMonitorUpdateErrorZPtr {
6794                                 err: Box::into_raw(Box::new(<crate::lightning::chain::channelmonitor::MonitorUpdateError>::clone(unsafe { &*self.contents.err })))
6795                         } }
6796                 }
6797         }
6798 }
6799 #[no_mangle]
6800 /// Creates a new CResult_NoneMonitorUpdateErrorZ which has the same data as `orig`
6801 /// but with all dynamically-allocated buffers duplicated in new buffers.
6802 pub extern "C" fn CResult_NoneMonitorUpdateErrorZ_clone(orig: &CResult_NoneMonitorUpdateErrorZ) -> CResult_NoneMonitorUpdateErrorZ { Clone::clone(&orig) }
6803 #[repr(C)]
6804 /// A tuple of 2 elements. See the individual fields for the types contained.
6805 pub struct C2Tuple_OutPointScriptZ {
6806         /// The element at position 0
6807         pub a: crate::lightning::chain::transaction::OutPoint,
6808         /// The element at position 1
6809         pub b: crate::c_types::derived::CVec_u8Z,
6810 }
6811 impl From<(crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_u8Z)> for C2Tuple_OutPointScriptZ {
6812         fn from (tup: (crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_u8Z)) -> Self {
6813                 Self {
6814                         a: tup.0,
6815                         b: tup.1,
6816                 }
6817         }
6818 }
6819 impl C2Tuple_OutPointScriptZ {
6820         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_u8Z) {
6821                 (self.a, self.b)
6822         }
6823 }
6824 impl Clone for C2Tuple_OutPointScriptZ {
6825         fn clone(&self) -> Self {
6826                 Self {
6827                         a: Clone::clone(&self.a),
6828                         b: Clone::clone(&self.b),
6829                 }
6830         }
6831 }
6832 #[no_mangle]
6833 /// Creates a new tuple which has the same data as `orig`
6834 /// but with all dynamically-allocated buffers duplicated in new buffers.
6835 pub extern "C" fn C2Tuple_OutPointScriptZ_clone(orig: &C2Tuple_OutPointScriptZ) -> C2Tuple_OutPointScriptZ { Clone::clone(&orig) }
6836 /// Creates a new C2Tuple_OutPointScriptZ from the contained elements.
6837 #[no_mangle]
6838 pub extern "C" fn C2Tuple_OutPointScriptZ_new(a: crate::lightning::chain::transaction::OutPoint, b: crate::c_types::derived::CVec_u8Z) -> C2Tuple_OutPointScriptZ {
6839         C2Tuple_OutPointScriptZ { a, b, }
6840 }
6841
6842 #[no_mangle]
6843 /// Frees any resources used by the C2Tuple_OutPointScriptZ.
6844 pub extern "C" fn C2Tuple_OutPointScriptZ_free(_res: C2Tuple_OutPointScriptZ) { }
6845 #[repr(C)]
6846 /// A tuple of 2 elements. See the individual fields for the types contained.
6847 pub struct C2Tuple_u32ScriptZ {
6848         /// The element at position 0
6849         pub a: u32,
6850         /// The element at position 1
6851         pub b: crate::c_types::derived::CVec_u8Z,
6852 }
6853 impl From<(u32, crate::c_types::derived::CVec_u8Z)> for C2Tuple_u32ScriptZ {
6854         fn from (tup: (u32, crate::c_types::derived::CVec_u8Z)) -> Self {
6855                 Self {
6856                         a: tup.0,
6857                         b: tup.1,
6858                 }
6859         }
6860 }
6861 impl C2Tuple_u32ScriptZ {
6862         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (u32, crate::c_types::derived::CVec_u8Z) {
6863                 (self.a, self.b)
6864         }
6865 }
6866 impl Clone for C2Tuple_u32ScriptZ {
6867         fn clone(&self) -> Self {
6868                 Self {
6869                         a: Clone::clone(&self.a),
6870                         b: Clone::clone(&self.b),
6871                 }
6872         }
6873 }
6874 #[no_mangle]
6875 /// Creates a new tuple which has the same data as `orig`
6876 /// but with all dynamically-allocated buffers duplicated in new buffers.
6877 pub extern "C" fn C2Tuple_u32ScriptZ_clone(orig: &C2Tuple_u32ScriptZ) -> C2Tuple_u32ScriptZ { Clone::clone(&orig) }
6878 /// Creates a new C2Tuple_u32ScriptZ from the contained elements.
6879 #[no_mangle]
6880 pub extern "C" fn C2Tuple_u32ScriptZ_new(a: u32, b: crate::c_types::derived::CVec_u8Z) -> C2Tuple_u32ScriptZ {
6881         C2Tuple_u32ScriptZ { a, b, }
6882 }
6883
6884 #[no_mangle]
6885 /// Frees any resources used by the C2Tuple_u32ScriptZ.
6886 pub extern "C" fn C2Tuple_u32ScriptZ_free(_res: C2Tuple_u32ScriptZ) { }
6887 #[repr(C)]
6888 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_u32ScriptZs of arbitrary size.
6889 /// This corresponds to std::vector in C++
6890 pub struct CVec_C2Tuple_u32ScriptZZ {
6891         /// The elements in the array.
6892         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
6893         pub data: *mut crate::c_types::derived::C2Tuple_u32ScriptZ,
6894         /// The number of elements pointed to by `data`.
6895         pub datalen: usize
6896 }
6897 impl CVec_C2Tuple_u32ScriptZZ {
6898         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_u32ScriptZ> {
6899                 if self.datalen == 0 { return Vec::new(); }
6900                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
6901                 self.data = std::ptr::null_mut();
6902                 self.datalen = 0;
6903                 ret
6904         }
6905         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_u32ScriptZ] {
6906                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
6907         }
6908 }
6909 impl From<Vec<crate::c_types::derived::C2Tuple_u32ScriptZ>> for CVec_C2Tuple_u32ScriptZZ {
6910         fn from(v: Vec<crate::c_types::derived::C2Tuple_u32ScriptZ>) -> Self {
6911                 let datalen = v.len();
6912                 let data = Box::into_raw(v.into_boxed_slice());
6913                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
6914         }
6915 }
6916 #[no_mangle]
6917 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
6918 pub extern "C" fn CVec_C2Tuple_u32ScriptZZ_free(_res: CVec_C2Tuple_u32ScriptZZ) { }
6919 impl Drop for CVec_C2Tuple_u32ScriptZZ {
6920         fn drop(&mut self) {
6921                 if self.datalen == 0 { return; }
6922                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
6923         }
6924 }
6925 impl Clone for CVec_C2Tuple_u32ScriptZZ {
6926         fn clone(&self) -> Self {
6927                 let mut res = Vec::new();
6928                 if self.datalen == 0 { return Self::from(res); }
6929                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
6930                 Self::from(res)
6931         }
6932 }
6933 #[repr(C)]
6934 /// A tuple of 2 elements. See the individual fields for the types contained.
6935 pub struct C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ {
6936         /// The element at position 0
6937         pub a: crate::c_types::ThirtyTwoBytes,
6938         /// The element at position 1
6939         pub b: crate::c_types::derived::CVec_C2Tuple_u32ScriptZZ,
6940 }
6941 impl From<(crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32ScriptZZ)> for C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ {
6942         fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32ScriptZZ)) -> Self {
6943                 Self {
6944                         a: tup.0,
6945                         b: tup.1,
6946                 }
6947         }
6948 }
6949 impl C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ {
6950         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32ScriptZZ) {
6951                 (self.a, self.b)
6952         }
6953 }
6954 impl Clone for C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ {
6955         fn clone(&self) -> Self {
6956                 Self {
6957                         a: Clone::clone(&self.a),
6958                         b: Clone::clone(&self.b),
6959                 }
6960         }
6961 }
6962 #[no_mangle]
6963 /// Creates a new tuple which has the same data as `orig`
6964 /// but with all dynamically-allocated buffers duplicated in new buffers.
6965 pub extern "C" fn C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone(orig: &C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ) -> C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ { Clone::clone(&orig) }
6966 /// Creates a new C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ from the contained elements.
6967 #[no_mangle]
6968 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 {
6969         C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ { a, b, }
6970 }
6971
6972 #[no_mangle]
6973 /// Frees any resources used by the C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ.
6974 pub extern "C" fn C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_free(_res: C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ) { }
6975 #[repr(C)]
6976 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZs of arbitrary size.
6977 /// This corresponds to std::vector in C++
6978 pub struct CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ {
6979         /// The elements in the array.
6980         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
6981         pub data: *mut crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ,
6982         /// The number of elements pointed to by `data`.
6983         pub datalen: usize
6984 }
6985 impl CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ {
6986         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ> {
6987                 if self.datalen == 0 { return Vec::new(); }
6988                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
6989                 self.data = std::ptr::null_mut();
6990                 self.datalen = 0;
6991                 ret
6992         }
6993         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ] {
6994                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
6995         }
6996 }
6997 impl From<Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ>> for CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ {
6998         fn from(v: Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ>) -> Self {
6999                 let datalen = v.len();
7000                 let data = Box::into_raw(v.into_boxed_slice());
7001                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
7002         }
7003 }
7004 #[no_mangle]
7005 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
7006 pub extern "C" fn CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ_free(_res: CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ) { }
7007 impl Drop for CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ {
7008         fn drop(&mut self) {
7009                 if self.datalen == 0 { return; }
7010                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
7011         }
7012 }
7013 impl Clone for CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ {
7014         fn clone(&self) -> Self {
7015                 let mut res = Vec::new();
7016                 if self.datalen == 0 { return Self::from(res); }
7017                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
7018                 Self::from(res)
7019         }
7020 }
7021 #[repr(C)]
7022 /// A dynamically-allocated array of crate::lightning::util::events::Events of arbitrary size.
7023 /// This corresponds to std::vector in C++
7024 pub struct CVec_EventZ {
7025         /// The elements in the array.
7026         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
7027         pub data: *mut crate::lightning::util::events::Event,
7028         /// The number of elements pointed to by `data`.
7029         pub datalen: usize
7030 }
7031 impl CVec_EventZ {
7032         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::util::events::Event> {
7033                 if self.datalen == 0 { return Vec::new(); }
7034                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
7035                 self.data = std::ptr::null_mut();
7036                 self.datalen = 0;
7037                 ret
7038         }
7039         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::util::events::Event] {
7040                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
7041         }
7042 }
7043 impl From<Vec<crate::lightning::util::events::Event>> for CVec_EventZ {
7044         fn from(v: Vec<crate::lightning::util::events::Event>) -> Self {
7045                 let datalen = v.len();
7046                 let data = Box::into_raw(v.into_boxed_slice());
7047                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
7048         }
7049 }
7050 #[no_mangle]
7051 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
7052 pub extern "C" fn CVec_EventZ_free(_res: CVec_EventZ) { }
7053 impl Drop for CVec_EventZ {
7054         fn drop(&mut self) {
7055                 if self.datalen == 0 { return; }
7056                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
7057         }
7058 }
7059 impl Clone for CVec_EventZ {
7060         fn clone(&self) -> Self {
7061                 let mut res = Vec::new();
7062                 if self.datalen == 0 { return Self::from(res); }
7063                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
7064                 Self::from(res)
7065         }
7066 }
7067 #[repr(C)]
7068 /// A dynamically-allocated array of crate::c_types::Transactions of arbitrary size.
7069 /// This corresponds to std::vector in C++
7070 pub struct CVec_TransactionZ {
7071         /// The elements in the array.
7072         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
7073         pub data: *mut crate::c_types::Transaction,
7074         /// The number of elements pointed to by `data`.
7075         pub datalen: usize
7076 }
7077 impl CVec_TransactionZ {
7078         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::Transaction> {
7079                 if self.datalen == 0 { return Vec::new(); }
7080                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
7081                 self.data = std::ptr::null_mut();
7082                 self.datalen = 0;
7083                 ret
7084         }
7085         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::Transaction] {
7086                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
7087         }
7088 }
7089 impl From<Vec<crate::c_types::Transaction>> for CVec_TransactionZ {
7090         fn from(v: Vec<crate::c_types::Transaction>) -> Self {
7091                 let datalen = v.len();
7092                 let data = Box::into_raw(v.into_boxed_slice());
7093                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
7094         }
7095 }
7096 #[no_mangle]
7097 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
7098 pub extern "C" fn CVec_TransactionZ_free(_res: CVec_TransactionZ) { }
7099 impl Drop for CVec_TransactionZ {
7100         fn drop(&mut self) {
7101                 if self.datalen == 0 { return; }
7102                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
7103         }
7104 }
7105 impl Clone for CVec_TransactionZ {
7106         fn clone(&self) -> Self {
7107                 let mut res = Vec::new();
7108                 if self.datalen == 0 { return Self::from(res); }
7109                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
7110                 Self::from(res)
7111         }
7112 }
7113 #[repr(C)]
7114 /// A tuple of 2 elements. See the individual fields for the types contained.
7115 pub struct C2Tuple_u32TxOutZ {
7116         /// The element at position 0
7117         pub a: u32,
7118         /// The element at position 1
7119         pub b: crate::c_types::TxOut,
7120 }
7121 impl From<(u32, crate::c_types::TxOut)> for C2Tuple_u32TxOutZ {
7122         fn from (tup: (u32, crate::c_types::TxOut)) -> Self {
7123                 Self {
7124                         a: tup.0,
7125                         b: tup.1,
7126                 }
7127         }
7128 }
7129 impl C2Tuple_u32TxOutZ {
7130         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (u32, crate::c_types::TxOut) {
7131                 (self.a, self.b)
7132         }
7133 }
7134 impl Clone for C2Tuple_u32TxOutZ {
7135         fn clone(&self) -> Self {
7136                 Self {
7137                         a: Clone::clone(&self.a),
7138                         b: Clone::clone(&self.b),
7139                 }
7140         }
7141 }
7142 #[no_mangle]
7143 /// Creates a new tuple which has the same data as `orig`
7144 /// but with all dynamically-allocated buffers duplicated in new buffers.
7145 pub extern "C" fn C2Tuple_u32TxOutZ_clone(orig: &C2Tuple_u32TxOutZ) -> C2Tuple_u32TxOutZ { Clone::clone(&orig) }
7146 /// Creates a new C2Tuple_u32TxOutZ from the contained elements.
7147 #[no_mangle]
7148 pub extern "C" fn C2Tuple_u32TxOutZ_new(a: u32, b: crate::c_types::TxOut) -> C2Tuple_u32TxOutZ {
7149         C2Tuple_u32TxOutZ { a, b, }
7150 }
7151
7152 #[no_mangle]
7153 /// Frees any resources used by the C2Tuple_u32TxOutZ.
7154 pub extern "C" fn C2Tuple_u32TxOutZ_free(_res: C2Tuple_u32TxOutZ) { }
7155 #[repr(C)]
7156 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_u32TxOutZs of arbitrary size.
7157 /// This corresponds to std::vector in C++
7158 pub struct CVec_C2Tuple_u32TxOutZZ {
7159         /// The elements in the array.
7160         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
7161         pub data: *mut crate::c_types::derived::C2Tuple_u32TxOutZ,
7162         /// The number of elements pointed to by `data`.
7163         pub datalen: usize
7164 }
7165 impl CVec_C2Tuple_u32TxOutZZ {
7166         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_u32TxOutZ> {
7167                 if self.datalen == 0 { return Vec::new(); }
7168                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
7169                 self.data = std::ptr::null_mut();
7170                 self.datalen = 0;
7171                 ret
7172         }
7173         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_u32TxOutZ] {
7174                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
7175         }
7176 }
7177 impl From<Vec<crate::c_types::derived::C2Tuple_u32TxOutZ>> for CVec_C2Tuple_u32TxOutZZ {
7178         fn from(v: Vec<crate::c_types::derived::C2Tuple_u32TxOutZ>) -> Self {
7179                 let datalen = v.len();
7180                 let data = Box::into_raw(v.into_boxed_slice());
7181                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
7182         }
7183 }
7184 #[no_mangle]
7185 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
7186 pub extern "C" fn CVec_C2Tuple_u32TxOutZZ_free(_res: CVec_C2Tuple_u32TxOutZZ) { }
7187 impl Drop for CVec_C2Tuple_u32TxOutZZ {
7188         fn drop(&mut self) {
7189                 if self.datalen == 0 { return; }
7190                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
7191         }
7192 }
7193 impl Clone for CVec_C2Tuple_u32TxOutZZ {
7194         fn clone(&self) -> Self {
7195                 let mut res = Vec::new();
7196                 if self.datalen == 0 { return Self::from(res); }
7197                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
7198                 Self::from(res)
7199         }
7200 }
7201 #[repr(C)]
7202 /// A tuple of 2 elements. See the individual fields for the types contained.
7203 pub struct C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ {
7204         /// The element at position 0
7205         pub a: crate::c_types::ThirtyTwoBytes,
7206         /// The element at position 1
7207         pub b: crate::c_types::derived::CVec_C2Tuple_u32TxOutZZ,
7208 }
7209 impl From<(crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32TxOutZZ)> for C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ {
7210         fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32TxOutZZ)) -> Self {
7211                 Self {
7212                         a: tup.0,
7213                         b: tup.1,
7214                 }
7215         }
7216 }
7217 impl C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ {
7218         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32TxOutZZ) {
7219                 (self.a, self.b)
7220         }
7221 }
7222 impl Clone for C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ {
7223         fn clone(&self) -> Self {
7224                 Self {
7225                         a: Clone::clone(&self.a),
7226                         b: Clone::clone(&self.b),
7227                 }
7228         }
7229 }
7230 #[no_mangle]
7231 /// Creates a new tuple which has the same data as `orig`
7232 /// but with all dynamically-allocated buffers duplicated in new buffers.
7233 pub extern "C" fn C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone(orig: &C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ) -> C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ { Clone::clone(&orig) }
7234 /// Creates a new C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ from the contained elements.
7235 #[no_mangle]
7236 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 {
7237         C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ { a, b, }
7238 }
7239
7240 #[no_mangle]
7241 /// Frees any resources used by the C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ.
7242 pub extern "C" fn C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_free(_res: C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ) { }
7243 #[repr(C)]
7244 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZs of arbitrary size.
7245 /// This corresponds to std::vector in C++
7246 pub struct CVec_TransactionOutputsZ {
7247         /// The elements in the array.
7248         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
7249         pub data: *mut crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ,
7250         /// The number of elements pointed to by `data`.
7251         pub datalen: usize
7252 }
7253 impl CVec_TransactionOutputsZ {
7254         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ> {
7255                 if self.datalen == 0 { return Vec::new(); }
7256                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
7257                 self.data = std::ptr::null_mut();
7258                 self.datalen = 0;
7259                 ret
7260         }
7261         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ] {
7262                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
7263         }
7264 }
7265 impl From<Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ>> for CVec_TransactionOutputsZ {
7266         fn from(v: Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ>) -> Self {
7267                 let datalen = v.len();
7268                 let data = Box::into_raw(v.into_boxed_slice());
7269                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
7270         }
7271 }
7272 #[no_mangle]
7273 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
7274 pub extern "C" fn CVec_TransactionOutputsZ_free(_res: CVec_TransactionOutputsZ) { }
7275 impl Drop for CVec_TransactionOutputsZ {
7276         fn drop(&mut self) {
7277                 if self.datalen == 0 { return; }
7278                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
7279         }
7280 }
7281 impl Clone for CVec_TransactionOutputsZ {
7282         fn clone(&self) -> Self {
7283                 let mut res = Vec::new();
7284                 if self.datalen == 0 { return Self::from(res); }
7285                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
7286                 Self::from(res)
7287         }
7288 }
7289 #[repr(C)]
7290 /// A dynamically-allocated array of crate::lightning::chain::channelmonitor::Balances of arbitrary size.
7291 /// This corresponds to std::vector in C++
7292 pub struct CVec_BalanceZ {
7293         /// The elements in the array.
7294         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
7295         pub data: *mut crate::lightning::chain::channelmonitor::Balance,
7296         /// The number of elements pointed to by `data`.
7297         pub datalen: usize
7298 }
7299 impl CVec_BalanceZ {
7300         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::chain::channelmonitor::Balance> {
7301                 if self.datalen == 0 { return Vec::new(); }
7302                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
7303                 self.data = std::ptr::null_mut();
7304                 self.datalen = 0;
7305                 ret
7306         }
7307         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::chain::channelmonitor::Balance] {
7308                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
7309         }
7310 }
7311 impl From<Vec<crate::lightning::chain::channelmonitor::Balance>> for CVec_BalanceZ {
7312         fn from(v: Vec<crate::lightning::chain::channelmonitor::Balance>) -> Self {
7313                 let datalen = v.len();
7314                 let data = Box::into_raw(v.into_boxed_slice());
7315                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
7316         }
7317 }
7318 #[no_mangle]
7319 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
7320 pub extern "C" fn CVec_BalanceZ_free(_res: CVec_BalanceZ) { }
7321 impl Drop for CVec_BalanceZ {
7322         fn drop(&mut self) {
7323                 if self.datalen == 0 { return; }
7324                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
7325         }
7326 }
7327 impl Clone for CVec_BalanceZ {
7328         fn clone(&self) -> Self {
7329                 let mut res = Vec::new();
7330                 if self.datalen == 0 { return Self::from(res); }
7331                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
7332                 Self::from(res)
7333         }
7334 }
7335 #[repr(C)]
7336 /// The contents of CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ
7337 pub union CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr {
7338         /// A pointer to the contents in the success state.
7339         /// Reading from this pointer when `result_ok` is not set is undefined.
7340         pub result: *mut crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ,
7341         /// A pointer to the contents in the error state.
7342         /// Reading from this pointer when `result_ok` is set is undefined.
7343         pub err: *mut crate::lightning::ln::msgs::DecodeError,
7344 }
7345 #[repr(C)]
7346 /// A CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ represents the result of a fallible operation,
7347 /// containing a crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
7348 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7349 pub struct CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
7350         /// The contents of this CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ, accessible via either
7351         /// `err` or `result` depending on the state of `result_ok`.
7352         pub contents: CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr,
7353         /// Whether this CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ represents a success state.
7354         pub result_ok: bool,
7355 }
7356 #[no_mangle]
7357 /// Creates a new CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ in the success state.
7358 pub extern "C" fn CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_ok(o: crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ) -> CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
7359         CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
7360                 contents: CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr {
7361                         result: Box::into_raw(Box::new(o)),
7362                 },
7363                 result_ok: true,
7364         }
7365 }
7366 #[no_mangle]
7367 /// Creates a new CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ in the error state.
7368 pub extern "C" fn CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
7369         CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
7370                 contents: CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr {
7371                         err: Box::into_raw(Box::new(e)),
7372                 },
7373                 result_ok: false,
7374         }
7375 }
7376 #[no_mangle]
7377 /// Frees any resources used by the CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ.
7378 pub extern "C" fn CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_free(_res: CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ) { }
7379 impl Drop for CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
7380         fn drop(&mut self) {
7381                 if self.result_ok {
7382                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
7383                                 let _ = unsafe { Box::from_raw(self.contents.result) };
7384                         }
7385                 } else {
7386                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
7387                                 let _ = unsafe { Box::from_raw(self.contents.err) };
7388                         }
7389                 }
7390         }
7391 }
7392 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ, crate::lightning::ln::msgs::DecodeError>> for CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
7393         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
7394                 let contents = if o.result_ok {
7395                         let result = unsafe { o.contents.result };
7396                         unsafe { o.contents.result = std::ptr::null_mut() };
7397                         CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr { result }
7398                 } else {
7399                         let err = unsafe { o.contents.err };
7400                         unsafe { o.contents.err = std::ptr::null_mut(); }
7401                         CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr { err }
7402                 };
7403                 Self {
7404                         contents,
7405                         result_ok: o.result_ok,
7406                 }
7407         }
7408 }
7409 #[repr(C)]
7410 /// The contents of CResult_NoneLightningErrorZ
7411 pub union CResult_NoneLightningErrorZPtr {
7412         /// Note that this value is always NULL, as there are no contents in the OK variant
7413         pub result: *mut std::ffi::c_void,
7414         /// A pointer to the contents in the error state.
7415         /// Reading from this pointer when `result_ok` is set is undefined.
7416         pub err: *mut crate::lightning::ln::msgs::LightningError,
7417 }
7418 #[repr(C)]
7419 /// A CResult_NoneLightningErrorZ represents the result of a fallible operation,
7420 /// containing a () on success and a crate::lightning::ln::msgs::LightningError on failure.
7421 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7422 pub struct CResult_NoneLightningErrorZ {
7423         /// The contents of this CResult_NoneLightningErrorZ, accessible via either
7424         /// `err` or `result` depending on the state of `result_ok`.
7425         pub contents: CResult_NoneLightningErrorZPtr,
7426         /// Whether this CResult_NoneLightningErrorZ represents a success state.
7427         pub result_ok: bool,
7428 }
7429 #[no_mangle]
7430 /// Creates a new CResult_NoneLightningErrorZ in the success state.
7431 pub extern "C" fn CResult_NoneLightningErrorZ_ok() -> CResult_NoneLightningErrorZ {
7432         CResult_NoneLightningErrorZ {
7433                 contents: CResult_NoneLightningErrorZPtr {
7434                         result: std::ptr::null_mut(),
7435                 },
7436                 result_ok: true,
7437         }
7438 }
7439 #[no_mangle]
7440 /// Creates a new CResult_NoneLightningErrorZ in the error state.
7441 pub extern "C" fn CResult_NoneLightningErrorZ_err(e: crate::lightning::ln::msgs::LightningError) -> CResult_NoneLightningErrorZ {
7442         CResult_NoneLightningErrorZ {
7443                 contents: CResult_NoneLightningErrorZPtr {
7444                         err: Box::into_raw(Box::new(e)),
7445                 },
7446                 result_ok: false,
7447         }
7448 }
7449 #[no_mangle]
7450 /// Frees any resources used by the CResult_NoneLightningErrorZ.
7451 pub extern "C" fn CResult_NoneLightningErrorZ_free(_res: CResult_NoneLightningErrorZ) { }
7452 impl Drop for CResult_NoneLightningErrorZ {
7453         fn drop(&mut self) {
7454                 if self.result_ok {
7455                 } else {
7456                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
7457                                 let _ = unsafe { Box::from_raw(self.contents.err) };
7458                         }
7459                 }
7460         }
7461 }
7462 impl From<crate::c_types::CResultTempl<(), crate::lightning::ln::msgs::LightningError>> for CResult_NoneLightningErrorZ {
7463         fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::ln::msgs::LightningError>) -> Self {
7464                 let contents = if o.result_ok {
7465                         let _ = unsafe { Box::from_raw(o.contents.result) };
7466                         o.contents.result = std::ptr::null_mut();
7467                         CResult_NoneLightningErrorZPtr { result: std::ptr::null_mut() }
7468                 } else {
7469                         let err = unsafe { o.contents.err };
7470                         unsafe { o.contents.err = std::ptr::null_mut(); }
7471                         CResult_NoneLightningErrorZPtr { err }
7472                 };
7473                 Self {
7474                         contents,
7475                         result_ok: o.result_ok,
7476                 }
7477         }
7478 }
7479 impl Clone for CResult_NoneLightningErrorZ {
7480         fn clone(&self) -> Self {
7481                 if self.result_ok {
7482                         Self { result_ok: true, contents: CResult_NoneLightningErrorZPtr {
7483                                 result: std::ptr::null_mut()
7484                         } }
7485                 } else {
7486                         Self { result_ok: false, contents: CResult_NoneLightningErrorZPtr {
7487                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::LightningError>::clone(unsafe { &*self.contents.err })))
7488                         } }
7489                 }
7490         }
7491 }
7492 #[no_mangle]
7493 /// Creates a new CResult_NoneLightningErrorZ which has the same data as `orig`
7494 /// but with all dynamically-allocated buffers duplicated in new buffers.
7495 pub extern "C" fn CResult_NoneLightningErrorZ_clone(orig: &CResult_NoneLightningErrorZ) -> CResult_NoneLightningErrorZ { Clone::clone(&orig) }
7496 #[repr(C)]
7497 /// A tuple of 2 elements. See the individual fields for the types contained.
7498 pub struct C2Tuple_PublicKeyTypeZ {
7499         /// The element at position 0
7500         pub a: crate::c_types::PublicKey,
7501         /// The element at position 1
7502         pub b: crate::lightning::ln::wire::Type,
7503 }
7504 impl From<(crate::c_types::PublicKey, crate::lightning::ln::wire::Type)> for C2Tuple_PublicKeyTypeZ {
7505         fn from (tup: (crate::c_types::PublicKey, crate::lightning::ln::wire::Type)) -> Self {
7506                 Self {
7507                         a: tup.0,
7508                         b: tup.1,
7509                 }
7510         }
7511 }
7512 impl C2Tuple_PublicKeyTypeZ {
7513         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::PublicKey, crate::lightning::ln::wire::Type) {
7514                 (self.a, self.b)
7515         }
7516 }
7517 /// Creates a new C2Tuple_PublicKeyTypeZ from the contained elements.
7518 #[no_mangle]
7519 pub extern "C" fn C2Tuple_PublicKeyTypeZ_new(a: crate::c_types::PublicKey, b: crate::lightning::ln::wire::Type) -> C2Tuple_PublicKeyTypeZ {
7520         C2Tuple_PublicKeyTypeZ { a, b, }
7521 }
7522
7523 #[no_mangle]
7524 /// Frees any resources used by the C2Tuple_PublicKeyTypeZ.
7525 pub extern "C" fn C2Tuple_PublicKeyTypeZ_free(_res: C2Tuple_PublicKeyTypeZ) { }
7526 #[repr(C)]
7527 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_PublicKeyTypeZs of arbitrary size.
7528 /// This corresponds to std::vector in C++
7529 pub struct CVec_C2Tuple_PublicKeyTypeZZ {
7530         /// The elements in the array.
7531         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
7532         pub data: *mut crate::c_types::derived::C2Tuple_PublicKeyTypeZ,
7533         /// The number of elements pointed to by `data`.
7534         pub datalen: usize
7535 }
7536 impl CVec_C2Tuple_PublicKeyTypeZZ {
7537         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_PublicKeyTypeZ> {
7538                 if self.datalen == 0 { return Vec::new(); }
7539                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
7540                 self.data = std::ptr::null_mut();
7541                 self.datalen = 0;
7542                 ret
7543         }
7544         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_PublicKeyTypeZ] {
7545                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
7546         }
7547 }
7548 impl From<Vec<crate::c_types::derived::C2Tuple_PublicKeyTypeZ>> for CVec_C2Tuple_PublicKeyTypeZZ {
7549         fn from(v: Vec<crate::c_types::derived::C2Tuple_PublicKeyTypeZ>) -> Self {
7550                 let datalen = v.len();
7551                 let data = Box::into_raw(v.into_boxed_slice());
7552                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
7553         }
7554 }
7555 #[no_mangle]
7556 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
7557 pub extern "C" fn CVec_C2Tuple_PublicKeyTypeZZ_free(_res: CVec_C2Tuple_PublicKeyTypeZZ) { }
7558 impl Drop for CVec_C2Tuple_PublicKeyTypeZZ {
7559         fn drop(&mut self) {
7560                 if self.datalen == 0 { return; }
7561                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
7562         }
7563 }
7564 #[repr(C)]
7565 /// The contents of CResult_boolLightningErrorZ
7566 pub union CResult_boolLightningErrorZPtr {
7567         /// A pointer to the contents in the success state.
7568         /// Reading from this pointer when `result_ok` is not set is undefined.
7569         pub result: *mut bool,
7570         /// A pointer to the contents in the error state.
7571         /// Reading from this pointer when `result_ok` is set is undefined.
7572         pub err: *mut crate::lightning::ln::msgs::LightningError,
7573 }
7574 #[repr(C)]
7575 /// A CResult_boolLightningErrorZ represents the result of a fallible operation,
7576 /// containing a bool on success and a crate::lightning::ln::msgs::LightningError on failure.
7577 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7578 pub struct CResult_boolLightningErrorZ {
7579         /// The contents of this CResult_boolLightningErrorZ, accessible via either
7580         /// `err` or `result` depending on the state of `result_ok`.
7581         pub contents: CResult_boolLightningErrorZPtr,
7582         /// Whether this CResult_boolLightningErrorZ represents a success state.
7583         pub result_ok: bool,
7584 }
7585 #[no_mangle]
7586 /// Creates a new CResult_boolLightningErrorZ in the success state.
7587 pub extern "C" fn CResult_boolLightningErrorZ_ok(o: bool) -> CResult_boolLightningErrorZ {
7588         CResult_boolLightningErrorZ {
7589                 contents: CResult_boolLightningErrorZPtr {
7590                         result: Box::into_raw(Box::new(o)),
7591                 },
7592                 result_ok: true,
7593         }
7594 }
7595 #[no_mangle]
7596 /// Creates a new CResult_boolLightningErrorZ in the error state.
7597 pub extern "C" fn CResult_boolLightningErrorZ_err(e: crate::lightning::ln::msgs::LightningError) -> CResult_boolLightningErrorZ {
7598         CResult_boolLightningErrorZ {
7599                 contents: CResult_boolLightningErrorZPtr {
7600                         err: Box::into_raw(Box::new(e)),
7601                 },
7602                 result_ok: false,
7603         }
7604 }
7605 #[no_mangle]
7606 /// Frees any resources used by the CResult_boolLightningErrorZ.
7607 pub extern "C" fn CResult_boolLightningErrorZ_free(_res: CResult_boolLightningErrorZ) { }
7608 impl Drop for CResult_boolLightningErrorZ {
7609         fn drop(&mut self) {
7610                 if self.result_ok {
7611                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
7612                                 let _ = unsafe { Box::from_raw(self.contents.result) };
7613                         }
7614                 } else {
7615                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
7616                                 let _ = unsafe { Box::from_raw(self.contents.err) };
7617                         }
7618                 }
7619         }
7620 }
7621 impl From<crate::c_types::CResultTempl<bool, crate::lightning::ln::msgs::LightningError>> for CResult_boolLightningErrorZ {
7622         fn from(mut o: crate::c_types::CResultTempl<bool, crate::lightning::ln::msgs::LightningError>) -> Self {
7623                 let contents = if o.result_ok {
7624                         let result = unsafe { o.contents.result };
7625                         unsafe { o.contents.result = std::ptr::null_mut() };
7626                         CResult_boolLightningErrorZPtr { result }
7627                 } else {
7628                         let err = unsafe { o.contents.err };
7629                         unsafe { o.contents.err = std::ptr::null_mut(); }
7630                         CResult_boolLightningErrorZPtr { err }
7631                 };
7632                 Self {
7633                         contents,
7634                         result_ok: o.result_ok,
7635                 }
7636         }
7637 }
7638 impl Clone for CResult_boolLightningErrorZ {
7639         fn clone(&self) -> Self {
7640                 if self.result_ok {
7641                         Self { result_ok: true, contents: CResult_boolLightningErrorZPtr {
7642                                 result: Box::into_raw(Box::new(<bool>::clone(unsafe { &*self.contents.result })))
7643                         } }
7644                 } else {
7645                         Self { result_ok: false, contents: CResult_boolLightningErrorZPtr {
7646                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::LightningError>::clone(unsafe { &*self.contents.err })))
7647                         } }
7648                 }
7649         }
7650 }
7651 #[no_mangle]
7652 /// Creates a new CResult_boolLightningErrorZ which has the same data as `orig`
7653 /// but with all dynamically-allocated buffers duplicated in new buffers.
7654 pub extern "C" fn CResult_boolLightningErrorZ_clone(orig: &CResult_boolLightningErrorZ) -> CResult_boolLightningErrorZ { Clone::clone(&orig) }
7655 #[repr(C)]
7656 /// A tuple of 3 elements. See the individual fields for the types contained.
7657 pub struct C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
7658         /// The element at position 0
7659         pub a: crate::lightning::ln::msgs::ChannelAnnouncement,
7660         /// The element at position 1
7661         pub b: crate::lightning::ln::msgs::ChannelUpdate,
7662         /// The element at position 2
7663         pub c: crate::lightning::ln::msgs::ChannelUpdate,
7664 }
7665 impl From<(crate::lightning::ln::msgs::ChannelAnnouncement, crate::lightning::ln::msgs::ChannelUpdate, crate::lightning::ln::msgs::ChannelUpdate)> for C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
7666         fn from (tup: (crate::lightning::ln::msgs::ChannelAnnouncement, crate::lightning::ln::msgs::ChannelUpdate, crate::lightning::ln::msgs::ChannelUpdate)) -> Self {
7667                 Self {
7668                         a: tup.0,
7669                         b: tup.1,
7670                         c: tup.2,
7671                 }
7672         }
7673 }
7674 impl C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
7675         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::lightning::ln::msgs::ChannelAnnouncement, crate::lightning::ln::msgs::ChannelUpdate, crate::lightning::ln::msgs::ChannelUpdate) {
7676                 (self.a, self.b, self.c)
7677         }
7678 }
7679 impl Clone for C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
7680         fn clone(&self) -> Self {
7681                 Self {
7682                         a: Clone::clone(&self.a),
7683                         b: Clone::clone(&self.b),
7684                         c: Clone::clone(&self.c),
7685                 }
7686         }
7687 }
7688 #[no_mangle]
7689 /// Creates a new tuple which has the same data as `orig`
7690 /// but with all dynamically-allocated buffers duplicated in new buffers.
7691 pub extern "C" fn C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(orig: &C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ) -> C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ { Clone::clone(&orig) }
7692 /// Creates a new C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ from the contained elements.
7693 #[no_mangle]
7694 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 {
7695         C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ { a, b, c, }
7696 }
7697
7698 #[no_mangle]
7699 /// Frees any resources used by the C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ.
7700 pub extern "C" fn C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free(_res: C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ) { }
7701 #[repr(C)]
7702 /// A dynamically-allocated array of crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZs of arbitrary size.
7703 /// This corresponds to std::vector in C++
7704 pub struct CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
7705         /// The elements in the array.
7706         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
7707         pub data: *mut crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ,
7708         /// The number of elements pointed to by `data`.
7709         pub datalen: usize
7710 }
7711 impl CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
7712         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ> {
7713                 if self.datalen == 0 { return Vec::new(); }
7714                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
7715                 self.data = std::ptr::null_mut();
7716                 self.datalen = 0;
7717                 ret
7718         }
7719         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ] {
7720                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
7721         }
7722 }
7723 impl From<Vec<crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ>> for CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
7724         fn from(v: Vec<crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ>) -> Self {
7725                 let datalen = v.len();
7726                 let data = Box::into_raw(v.into_boxed_slice());
7727                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
7728         }
7729 }
7730 #[no_mangle]
7731 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
7732 pub extern "C" fn CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free(_res: CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ) { }
7733 impl Drop for CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
7734         fn drop(&mut self) {
7735                 if self.datalen == 0 { return; }
7736                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
7737         }
7738 }
7739 impl Clone for CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
7740         fn clone(&self) -> Self {
7741                 let mut res = Vec::new();
7742                 if self.datalen == 0 { return Self::from(res); }
7743                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
7744                 Self::from(res)
7745         }
7746 }
7747 #[repr(C)]
7748 /// A dynamically-allocated array of crate::lightning::ln::msgs::NodeAnnouncements of arbitrary size.
7749 /// This corresponds to std::vector in C++
7750 pub struct CVec_NodeAnnouncementZ {
7751         /// The elements in the array.
7752         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
7753         pub data: *mut crate::lightning::ln::msgs::NodeAnnouncement,
7754         /// The number of elements pointed to by `data`.
7755         pub datalen: usize
7756 }
7757 impl CVec_NodeAnnouncementZ {
7758         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::NodeAnnouncement> {
7759                 if self.datalen == 0 { return Vec::new(); }
7760                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
7761                 self.data = std::ptr::null_mut();
7762                 self.datalen = 0;
7763                 ret
7764         }
7765         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::NodeAnnouncement] {
7766                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
7767         }
7768 }
7769 impl From<Vec<crate::lightning::ln::msgs::NodeAnnouncement>> for CVec_NodeAnnouncementZ {
7770         fn from(v: Vec<crate::lightning::ln::msgs::NodeAnnouncement>) -> Self {
7771                 let datalen = v.len();
7772                 let data = Box::into_raw(v.into_boxed_slice());
7773                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
7774         }
7775 }
7776 #[no_mangle]
7777 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
7778 pub extern "C" fn CVec_NodeAnnouncementZ_free(_res: CVec_NodeAnnouncementZ) { }
7779 impl Drop for CVec_NodeAnnouncementZ {
7780         fn drop(&mut self) {
7781                 if self.datalen == 0 { return; }
7782                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
7783         }
7784 }
7785 impl Clone for CVec_NodeAnnouncementZ {
7786         fn clone(&self) -> Self {
7787                 let mut res = Vec::new();
7788                 if self.datalen == 0 { return Self::from(res); }
7789                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
7790                 Self::from(res)
7791         }
7792 }
7793 #[repr(C)]
7794 /// A dynamically-allocated array of crate::c_types::PublicKeys of arbitrary size.
7795 /// This corresponds to std::vector in C++
7796 pub struct CVec_PublicKeyZ {
7797         /// The elements in the array.
7798         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
7799         pub data: *mut crate::c_types::PublicKey,
7800         /// The number of elements pointed to by `data`.
7801         pub datalen: usize
7802 }
7803 impl CVec_PublicKeyZ {
7804         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::PublicKey> {
7805                 if self.datalen == 0 { return Vec::new(); }
7806                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
7807                 self.data = std::ptr::null_mut();
7808                 self.datalen = 0;
7809                 ret
7810         }
7811         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::PublicKey] {
7812                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
7813         }
7814 }
7815 impl From<Vec<crate::c_types::PublicKey>> for CVec_PublicKeyZ {
7816         fn from(v: Vec<crate::c_types::PublicKey>) -> Self {
7817                 let datalen = v.len();
7818                 let data = Box::into_raw(v.into_boxed_slice());
7819                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
7820         }
7821 }
7822 #[no_mangle]
7823 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
7824 pub extern "C" fn CVec_PublicKeyZ_free(_res: CVec_PublicKeyZ) { }
7825 impl Drop for CVec_PublicKeyZ {
7826         fn drop(&mut self) {
7827                 if self.datalen == 0 { return; }
7828                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
7829         }
7830 }
7831 impl Clone for CVec_PublicKeyZ {
7832         fn clone(&self) -> Self {
7833                 let mut res = Vec::new();
7834                 if self.datalen == 0 { return Self::from(res); }
7835                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
7836                 Self::from(res)
7837         }
7838 }
7839 #[repr(C)]
7840 /// The contents of CResult_CVec_u8ZPeerHandleErrorZ
7841 pub union CResult_CVec_u8ZPeerHandleErrorZPtr {
7842         /// A pointer to the contents in the success state.
7843         /// Reading from this pointer when `result_ok` is not set is undefined.
7844         pub result: *mut crate::c_types::derived::CVec_u8Z,
7845         /// A pointer to the contents in the error state.
7846         /// Reading from this pointer when `result_ok` is set is undefined.
7847         pub err: *mut crate::lightning::ln::peer_handler::PeerHandleError,
7848 }
7849 #[repr(C)]
7850 /// A CResult_CVec_u8ZPeerHandleErrorZ represents the result of a fallible operation,
7851 /// containing a crate::c_types::derived::CVec_u8Z on success and a crate::lightning::ln::peer_handler::PeerHandleError on failure.
7852 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7853 pub struct CResult_CVec_u8ZPeerHandleErrorZ {
7854         /// The contents of this CResult_CVec_u8ZPeerHandleErrorZ, accessible via either
7855         /// `err` or `result` depending on the state of `result_ok`.
7856         pub contents: CResult_CVec_u8ZPeerHandleErrorZPtr,
7857         /// Whether this CResult_CVec_u8ZPeerHandleErrorZ represents a success state.
7858         pub result_ok: bool,
7859 }
7860 #[no_mangle]
7861 /// Creates a new CResult_CVec_u8ZPeerHandleErrorZ in the success state.
7862 pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_ok(o: crate::c_types::derived::CVec_u8Z) -> CResult_CVec_u8ZPeerHandleErrorZ {
7863         CResult_CVec_u8ZPeerHandleErrorZ {
7864                 contents: CResult_CVec_u8ZPeerHandleErrorZPtr {
7865                         result: Box::into_raw(Box::new(o)),
7866                 },
7867                 result_ok: true,
7868         }
7869 }
7870 #[no_mangle]
7871 /// Creates a new CResult_CVec_u8ZPeerHandleErrorZ in the error state.
7872 pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_err(e: crate::lightning::ln::peer_handler::PeerHandleError) -> CResult_CVec_u8ZPeerHandleErrorZ {
7873         CResult_CVec_u8ZPeerHandleErrorZ {
7874                 contents: CResult_CVec_u8ZPeerHandleErrorZPtr {
7875                         err: Box::into_raw(Box::new(e)),
7876                 },
7877                 result_ok: false,
7878         }
7879 }
7880 #[no_mangle]
7881 /// Frees any resources used by the CResult_CVec_u8ZPeerHandleErrorZ.
7882 pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_free(_res: CResult_CVec_u8ZPeerHandleErrorZ) { }
7883 impl Drop for CResult_CVec_u8ZPeerHandleErrorZ {
7884         fn drop(&mut self) {
7885                 if self.result_ok {
7886                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
7887                                 let _ = unsafe { Box::from_raw(self.contents.result) };
7888                         }
7889                 } else {
7890                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
7891                                 let _ = unsafe { Box::from_raw(self.contents.err) };
7892                         }
7893                 }
7894         }
7895 }
7896 impl From<crate::c_types::CResultTempl<crate::c_types::derived::CVec_u8Z, crate::lightning::ln::peer_handler::PeerHandleError>> for CResult_CVec_u8ZPeerHandleErrorZ {
7897         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CVec_u8Z, crate::lightning::ln::peer_handler::PeerHandleError>) -> Self {
7898                 let contents = if o.result_ok {
7899                         let result = unsafe { o.contents.result };
7900                         unsafe { o.contents.result = std::ptr::null_mut() };
7901                         CResult_CVec_u8ZPeerHandleErrorZPtr { result }
7902                 } else {
7903                         let err = unsafe { o.contents.err };
7904                         unsafe { o.contents.err = std::ptr::null_mut(); }
7905                         CResult_CVec_u8ZPeerHandleErrorZPtr { err }
7906                 };
7907                 Self {
7908                         contents,
7909                         result_ok: o.result_ok,
7910                 }
7911         }
7912 }
7913 impl Clone for CResult_CVec_u8ZPeerHandleErrorZ {
7914         fn clone(&self) -> Self {
7915                 if self.result_ok {
7916                         Self { result_ok: true, contents: CResult_CVec_u8ZPeerHandleErrorZPtr {
7917                                 result: Box::into_raw(Box::new(<crate::c_types::derived::CVec_u8Z>::clone(unsafe { &*self.contents.result })))
7918                         } }
7919                 } else {
7920                         Self { result_ok: false, contents: CResult_CVec_u8ZPeerHandleErrorZPtr {
7921                                 err: Box::into_raw(Box::new(<crate::lightning::ln::peer_handler::PeerHandleError>::clone(unsafe { &*self.contents.err })))
7922                         } }
7923                 }
7924         }
7925 }
7926 #[no_mangle]
7927 /// Creates a new CResult_CVec_u8ZPeerHandleErrorZ which has the same data as `orig`
7928 /// but with all dynamically-allocated buffers duplicated in new buffers.
7929 pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_clone(orig: &CResult_CVec_u8ZPeerHandleErrorZ) -> CResult_CVec_u8ZPeerHandleErrorZ { Clone::clone(&orig) }
7930 #[repr(C)]
7931 /// The contents of CResult_NonePeerHandleErrorZ
7932 pub union CResult_NonePeerHandleErrorZPtr {
7933         /// Note that this value is always NULL, as there are no contents in the OK variant
7934         pub result: *mut std::ffi::c_void,
7935         /// A pointer to the contents in the error state.
7936         /// Reading from this pointer when `result_ok` is set is undefined.
7937         pub err: *mut crate::lightning::ln::peer_handler::PeerHandleError,
7938 }
7939 #[repr(C)]
7940 /// A CResult_NonePeerHandleErrorZ represents the result of a fallible operation,
7941 /// containing a () on success and a crate::lightning::ln::peer_handler::PeerHandleError on failure.
7942 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7943 pub struct CResult_NonePeerHandleErrorZ {
7944         /// The contents of this CResult_NonePeerHandleErrorZ, accessible via either
7945         /// `err` or `result` depending on the state of `result_ok`.
7946         pub contents: CResult_NonePeerHandleErrorZPtr,
7947         /// Whether this CResult_NonePeerHandleErrorZ represents a success state.
7948         pub result_ok: bool,
7949 }
7950 #[no_mangle]
7951 /// Creates a new CResult_NonePeerHandleErrorZ in the success state.
7952 pub extern "C" fn CResult_NonePeerHandleErrorZ_ok() -> CResult_NonePeerHandleErrorZ {
7953         CResult_NonePeerHandleErrorZ {
7954                 contents: CResult_NonePeerHandleErrorZPtr {
7955                         result: std::ptr::null_mut(),
7956                 },
7957                 result_ok: true,
7958         }
7959 }
7960 #[no_mangle]
7961 /// Creates a new CResult_NonePeerHandleErrorZ in the error state.
7962 pub extern "C" fn CResult_NonePeerHandleErrorZ_err(e: crate::lightning::ln::peer_handler::PeerHandleError) -> CResult_NonePeerHandleErrorZ {
7963         CResult_NonePeerHandleErrorZ {
7964                 contents: CResult_NonePeerHandleErrorZPtr {
7965                         err: Box::into_raw(Box::new(e)),
7966                 },
7967                 result_ok: false,
7968         }
7969 }
7970 #[no_mangle]
7971 /// Frees any resources used by the CResult_NonePeerHandleErrorZ.
7972 pub extern "C" fn CResult_NonePeerHandleErrorZ_free(_res: CResult_NonePeerHandleErrorZ) { }
7973 impl Drop for CResult_NonePeerHandleErrorZ {
7974         fn drop(&mut self) {
7975                 if self.result_ok {
7976                 } else {
7977                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
7978                                 let _ = unsafe { Box::from_raw(self.contents.err) };
7979                         }
7980                 }
7981         }
7982 }
7983 impl From<crate::c_types::CResultTempl<(), crate::lightning::ln::peer_handler::PeerHandleError>> for CResult_NonePeerHandleErrorZ {
7984         fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::ln::peer_handler::PeerHandleError>) -> Self {
7985                 let contents = if o.result_ok {
7986                         let _ = unsafe { Box::from_raw(o.contents.result) };
7987                         o.contents.result = std::ptr::null_mut();
7988                         CResult_NonePeerHandleErrorZPtr { result: std::ptr::null_mut() }
7989                 } else {
7990                         let err = unsafe { o.contents.err };
7991                         unsafe { o.contents.err = std::ptr::null_mut(); }
7992                         CResult_NonePeerHandleErrorZPtr { err }
7993                 };
7994                 Self {
7995                         contents,
7996                         result_ok: o.result_ok,
7997                 }
7998         }
7999 }
8000 impl Clone for CResult_NonePeerHandleErrorZ {
8001         fn clone(&self) -> Self {
8002                 if self.result_ok {
8003                         Self { result_ok: true, contents: CResult_NonePeerHandleErrorZPtr {
8004                                 result: std::ptr::null_mut()
8005                         } }
8006                 } else {
8007                         Self { result_ok: false, contents: CResult_NonePeerHandleErrorZPtr {
8008                                 err: Box::into_raw(Box::new(<crate::lightning::ln::peer_handler::PeerHandleError>::clone(unsafe { &*self.contents.err })))
8009                         } }
8010                 }
8011         }
8012 }
8013 #[no_mangle]
8014 /// Creates a new CResult_NonePeerHandleErrorZ which has the same data as `orig`
8015 /// but with all dynamically-allocated buffers duplicated in new buffers.
8016 pub extern "C" fn CResult_NonePeerHandleErrorZ_clone(orig: &CResult_NonePeerHandleErrorZ) -> CResult_NonePeerHandleErrorZ { Clone::clone(&orig) }
8017 #[repr(C)]
8018 /// The contents of CResult_boolPeerHandleErrorZ
8019 pub union CResult_boolPeerHandleErrorZPtr {
8020         /// A pointer to the contents in the success state.
8021         /// Reading from this pointer when `result_ok` is not set is undefined.
8022         pub result: *mut bool,
8023         /// A pointer to the contents in the error state.
8024         /// Reading from this pointer when `result_ok` is set is undefined.
8025         pub err: *mut crate::lightning::ln::peer_handler::PeerHandleError,
8026 }
8027 #[repr(C)]
8028 /// A CResult_boolPeerHandleErrorZ represents the result of a fallible operation,
8029 /// containing a bool on success and a crate::lightning::ln::peer_handler::PeerHandleError on failure.
8030 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8031 pub struct CResult_boolPeerHandleErrorZ {
8032         /// The contents of this CResult_boolPeerHandleErrorZ, accessible via either
8033         /// `err` or `result` depending on the state of `result_ok`.
8034         pub contents: CResult_boolPeerHandleErrorZPtr,
8035         /// Whether this CResult_boolPeerHandleErrorZ represents a success state.
8036         pub result_ok: bool,
8037 }
8038 #[no_mangle]
8039 /// Creates a new CResult_boolPeerHandleErrorZ in the success state.
8040 pub extern "C" fn CResult_boolPeerHandleErrorZ_ok(o: bool) -> CResult_boolPeerHandleErrorZ {
8041         CResult_boolPeerHandleErrorZ {
8042                 contents: CResult_boolPeerHandleErrorZPtr {
8043                         result: Box::into_raw(Box::new(o)),
8044                 },
8045                 result_ok: true,
8046         }
8047 }
8048 #[no_mangle]
8049 /// Creates a new CResult_boolPeerHandleErrorZ in the error state.
8050 pub extern "C" fn CResult_boolPeerHandleErrorZ_err(e: crate::lightning::ln::peer_handler::PeerHandleError) -> CResult_boolPeerHandleErrorZ {
8051         CResult_boolPeerHandleErrorZ {
8052                 contents: CResult_boolPeerHandleErrorZPtr {
8053                         err: Box::into_raw(Box::new(e)),
8054                 },
8055                 result_ok: false,
8056         }
8057 }
8058 #[no_mangle]
8059 /// Frees any resources used by the CResult_boolPeerHandleErrorZ.
8060 pub extern "C" fn CResult_boolPeerHandleErrorZ_free(_res: CResult_boolPeerHandleErrorZ) { }
8061 impl Drop for CResult_boolPeerHandleErrorZ {
8062         fn drop(&mut self) {
8063                 if self.result_ok {
8064                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
8065                                 let _ = unsafe { Box::from_raw(self.contents.result) };
8066                         }
8067                 } else {
8068                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
8069                                 let _ = unsafe { Box::from_raw(self.contents.err) };
8070                         }
8071                 }
8072         }
8073 }
8074 impl From<crate::c_types::CResultTempl<bool, crate::lightning::ln::peer_handler::PeerHandleError>> for CResult_boolPeerHandleErrorZ {
8075         fn from(mut o: crate::c_types::CResultTempl<bool, crate::lightning::ln::peer_handler::PeerHandleError>) -> Self {
8076                 let contents = if o.result_ok {
8077                         let result = unsafe { o.contents.result };
8078                         unsafe { o.contents.result = std::ptr::null_mut() };
8079                         CResult_boolPeerHandleErrorZPtr { result }
8080                 } else {
8081                         let err = unsafe { o.contents.err };
8082                         unsafe { o.contents.err = std::ptr::null_mut(); }
8083                         CResult_boolPeerHandleErrorZPtr { err }
8084                 };
8085                 Self {
8086                         contents,
8087                         result_ok: o.result_ok,
8088                 }
8089         }
8090 }
8091 impl Clone for CResult_boolPeerHandleErrorZ {
8092         fn clone(&self) -> Self {
8093                 if self.result_ok {
8094                         Self { result_ok: true, contents: CResult_boolPeerHandleErrorZPtr {
8095                                 result: Box::into_raw(Box::new(<bool>::clone(unsafe { &*self.contents.result })))
8096                         } }
8097                 } else {
8098                         Self { result_ok: false, contents: CResult_boolPeerHandleErrorZPtr {
8099                                 err: Box::into_raw(Box::new(<crate::lightning::ln::peer_handler::PeerHandleError>::clone(unsafe { &*self.contents.err })))
8100                         } }
8101                 }
8102         }
8103 }
8104 #[no_mangle]
8105 /// Creates a new CResult_boolPeerHandleErrorZ which has the same data as `orig`
8106 /// but with all dynamically-allocated buffers duplicated in new buffers.
8107 pub extern "C" fn CResult_boolPeerHandleErrorZ_clone(orig: &CResult_boolPeerHandleErrorZ) -> CResult_boolPeerHandleErrorZ { Clone::clone(&orig) }
8108 #[repr(C)]
8109 /// The contents of CResult_NodeIdDecodeErrorZ
8110 pub union CResult_NodeIdDecodeErrorZPtr {
8111         /// A pointer to the contents in the success state.
8112         /// Reading from this pointer when `result_ok` is not set is undefined.
8113         pub result: *mut crate::lightning::routing::network_graph::NodeId,
8114         /// A pointer to the contents in the error state.
8115         /// Reading from this pointer when `result_ok` is set is undefined.
8116         pub err: *mut crate::lightning::ln::msgs::DecodeError,
8117 }
8118 #[repr(C)]
8119 /// A CResult_NodeIdDecodeErrorZ represents the result of a fallible operation,
8120 /// containing a crate::lightning::routing::network_graph::NodeId on success and a crate::lightning::ln::msgs::DecodeError on failure.
8121 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8122 pub struct CResult_NodeIdDecodeErrorZ {
8123         /// The contents of this CResult_NodeIdDecodeErrorZ, accessible via either
8124         /// `err` or `result` depending on the state of `result_ok`.
8125         pub contents: CResult_NodeIdDecodeErrorZPtr,
8126         /// Whether this CResult_NodeIdDecodeErrorZ represents a success state.
8127         pub result_ok: bool,
8128 }
8129 #[no_mangle]
8130 /// Creates a new CResult_NodeIdDecodeErrorZ in the success state.
8131 pub extern "C" fn CResult_NodeIdDecodeErrorZ_ok(o: crate::lightning::routing::network_graph::NodeId) -> CResult_NodeIdDecodeErrorZ {
8132         CResult_NodeIdDecodeErrorZ {
8133                 contents: CResult_NodeIdDecodeErrorZPtr {
8134                         result: Box::into_raw(Box::new(o)),
8135                 },
8136                 result_ok: true,
8137         }
8138 }
8139 #[no_mangle]
8140 /// Creates a new CResult_NodeIdDecodeErrorZ in the error state.
8141 pub extern "C" fn CResult_NodeIdDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeIdDecodeErrorZ {
8142         CResult_NodeIdDecodeErrorZ {
8143                 contents: CResult_NodeIdDecodeErrorZPtr {
8144                         err: Box::into_raw(Box::new(e)),
8145                 },
8146                 result_ok: false,
8147         }
8148 }
8149 #[no_mangle]
8150 /// Frees any resources used by the CResult_NodeIdDecodeErrorZ.
8151 pub extern "C" fn CResult_NodeIdDecodeErrorZ_free(_res: CResult_NodeIdDecodeErrorZ) { }
8152 impl Drop for CResult_NodeIdDecodeErrorZ {
8153         fn drop(&mut self) {
8154                 if self.result_ok {
8155                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
8156                                 let _ = unsafe { Box::from_raw(self.contents.result) };
8157                         }
8158                 } else {
8159                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
8160                                 let _ = unsafe { Box::from_raw(self.contents.err) };
8161                         }
8162                 }
8163         }
8164 }
8165 impl From<crate::c_types::CResultTempl<crate::lightning::routing::network_graph::NodeId, crate::lightning::ln::msgs::DecodeError>> for CResult_NodeIdDecodeErrorZ {
8166         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::network_graph::NodeId, crate::lightning::ln::msgs::DecodeError>) -> Self {
8167                 let contents = if o.result_ok {
8168                         let result = unsafe { o.contents.result };
8169                         unsafe { o.contents.result = std::ptr::null_mut() };
8170                         CResult_NodeIdDecodeErrorZPtr { result }
8171                 } else {
8172                         let err = unsafe { o.contents.err };
8173                         unsafe { o.contents.err = std::ptr::null_mut(); }
8174                         CResult_NodeIdDecodeErrorZPtr { err }
8175                 };
8176                 Self {
8177                         contents,
8178                         result_ok: o.result_ok,
8179                 }
8180         }
8181 }
8182 impl Clone for CResult_NodeIdDecodeErrorZ {
8183         fn clone(&self) -> Self {
8184                 if self.result_ok {
8185                         Self { result_ok: true, contents: CResult_NodeIdDecodeErrorZPtr {
8186                                 result: Box::into_raw(Box::new(<crate::lightning::routing::network_graph::NodeId>::clone(unsafe { &*self.contents.result })))
8187                         } }
8188                 } else {
8189                         Self { result_ok: false, contents: CResult_NodeIdDecodeErrorZPtr {
8190                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
8191                         } }
8192                 }
8193         }
8194 }
8195 #[no_mangle]
8196 /// Creates a new CResult_NodeIdDecodeErrorZ which has the same data as `orig`
8197 /// but with all dynamically-allocated buffers duplicated in new buffers.
8198 pub extern "C" fn CResult_NodeIdDecodeErrorZ_clone(orig: &CResult_NodeIdDecodeErrorZ) -> CResult_NodeIdDecodeErrorZ { Clone::clone(&orig) }
8199 #[repr(C)]
8200 /// An enum which can either contain a crate::lightning::chain::Access or not
8201 pub enum COption_AccessZ {
8202         /// When we're in this state, this COption_AccessZ contains a crate::lightning::chain::Access
8203         Some(crate::lightning::chain::Access),
8204         /// When we're in this state, this COption_AccessZ contains nothing
8205         None
8206 }
8207 impl COption_AccessZ {
8208         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
8209                 if let Self::Some(_) = self { true } else { false }
8210         }
8211         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
8212                 !self.is_some()
8213         }
8214         #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::chain::Access {
8215                 if let Self::Some(v) = self { v } else { unreachable!() }
8216         }
8217 }
8218 #[no_mangle]
8219 /// Constructs a new COption_AccessZ containing a crate::lightning::chain::Access
8220 pub extern "C" fn COption_AccessZ_some(o: crate::lightning::chain::Access) -> COption_AccessZ {
8221         COption_AccessZ::Some(o)
8222 }
8223 #[no_mangle]
8224 /// Constructs a new COption_AccessZ containing nothing
8225 pub extern "C" fn COption_AccessZ_none() -> COption_AccessZ {
8226         COption_AccessZ::None
8227 }
8228 #[no_mangle]
8229 /// Frees any resources associated with the crate::lightning::chain::Access, if we are in the Some state
8230 pub extern "C" fn COption_AccessZ_free(_res: COption_AccessZ) { }
8231 #[repr(C)]
8232 /// The contents of CResult_DirectionalChannelInfoDecodeErrorZ
8233 pub union CResult_DirectionalChannelInfoDecodeErrorZPtr {
8234         /// A pointer to the contents in the success state.
8235         /// Reading from this pointer when `result_ok` is not set is undefined.
8236         pub result: *mut crate::lightning::routing::network_graph::DirectionalChannelInfo,
8237         /// A pointer to the contents in the error state.
8238         /// Reading from this pointer when `result_ok` is set is undefined.
8239         pub err: *mut crate::lightning::ln::msgs::DecodeError,
8240 }
8241 #[repr(C)]
8242 /// A CResult_DirectionalChannelInfoDecodeErrorZ represents the result of a fallible operation,
8243 /// containing a crate::lightning::routing::network_graph::DirectionalChannelInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
8244 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8245 pub struct CResult_DirectionalChannelInfoDecodeErrorZ {
8246         /// The contents of this CResult_DirectionalChannelInfoDecodeErrorZ, accessible via either
8247         /// `err` or `result` depending on the state of `result_ok`.
8248         pub contents: CResult_DirectionalChannelInfoDecodeErrorZPtr,
8249         /// Whether this CResult_DirectionalChannelInfoDecodeErrorZ represents a success state.
8250         pub result_ok: bool,
8251 }
8252 #[no_mangle]
8253 /// Creates a new CResult_DirectionalChannelInfoDecodeErrorZ in the success state.
8254 pub extern "C" fn CResult_DirectionalChannelInfoDecodeErrorZ_ok(o: crate::lightning::routing::network_graph::DirectionalChannelInfo) -> CResult_DirectionalChannelInfoDecodeErrorZ {
8255         CResult_DirectionalChannelInfoDecodeErrorZ {
8256                 contents: CResult_DirectionalChannelInfoDecodeErrorZPtr {
8257                         result: Box::into_raw(Box::new(o)),
8258                 },
8259                 result_ok: true,
8260         }
8261 }
8262 #[no_mangle]
8263 /// Creates a new CResult_DirectionalChannelInfoDecodeErrorZ in the error state.
8264 pub extern "C" fn CResult_DirectionalChannelInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_DirectionalChannelInfoDecodeErrorZ {
8265         CResult_DirectionalChannelInfoDecodeErrorZ {
8266                 contents: CResult_DirectionalChannelInfoDecodeErrorZPtr {
8267                         err: Box::into_raw(Box::new(e)),
8268                 },
8269                 result_ok: false,
8270         }
8271 }
8272 #[no_mangle]
8273 /// Frees any resources used by the CResult_DirectionalChannelInfoDecodeErrorZ.
8274 pub extern "C" fn CResult_DirectionalChannelInfoDecodeErrorZ_free(_res: CResult_DirectionalChannelInfoDecodeErrorZ) { }
8275 impl Drop for CResult_DirectionalChannelInfoDecodeErrorZ {
8276         fn drop(&mut self) {
8277                 if self.result_ok {
8278                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
8279                                 let _ = unsafe { Box::from_raw(self.contents.result) };
8280                         }
8281                 } else {
8282                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
8283                                 let _ = unsafe { Box::from_raw(self.contents.err) };
8284                         }
8285                 }
8286         }
8287 }
8288 impl From<crate::c_types::CResultTempl<crate::lightning::routing::network_graph::DirectionalChannelInfo, crate::lightning::ln::msgs::DecodeError>> for CResult_DirectionalChannelInfoDecodeErrorZ {
8289         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::network_graph::DirectionalChannelInfo, crate::lightning::ln::msgs::DecodeError>) -> Self {
8290                 let contents = if o.result_ok {
8291                         let result = unsafe { o.contents.result };
8292                         unsafe { o.contents.result = std::ptr::null_mut() };
8293                         CResult_DirectionalChannelInfoDecodeErrorZPtr { result }
8294                 } else {
8295                         let err = unsafe { o.contents.err };
8296                         unsafe { o.contents.err = std::ptr::null_mut(); }
8297                         CResult_DirectionalChannelInfoDecodeErrorZPtr { err }
8298                 };
8299                 Self {
8300                         contents,
8301                         result_ok: o.result_ok,
8302                 }
8303         }
8304 }
8305 impl Clone for CResult_DirectionalChannelInfoDecodeErrorZ {
8306         fn clone(&self) -> Self {
8307                 if self.result_ok {
8308                         Self { result_ok: true, contents: CResult_DirectionalChannelInfoDecodeErrorZPtr {
8309                                 result: Box::into_raw(Box::new(<crate::lightning::routing::network_graph::DirectionalChannelInfo>::clone(unsafe { &*self.contents.result })))
8310                         } }
8311                 } else {
8312                         Self { result_ok: false, contents: CResult_DirectionalChannelInfoDecodeErrorZPtr {
8313                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
8314                         } }
8315                 }
8316         }
8317 }
8318 #[no_mangle]
8319 /// Creates a new CResult_DirectionalChannelInfoDecodeErrorZ which has the same data as `orig`
8320 /// but with all dynamically-allocated buffers duplicated in new buffers.
8321 pub extern "C" fn CResult_DirectionalChannelInfoDecodeErrorZ_clone(orig: &CResult_DirectionalChannelInfoDecodeErrorZ) -> CResult_DirectionalChannelInfoDecodeErrorZ { Clone::clone(&orig) }
8322 #[repr(C)]
8323 /// The contents of CResult_ChannelInfoDecodeErrorZ
8324 pub union CResult_ChannelInfoDecodeErrorZPtr {
8325         /// A pointer to the contents in the success state.
8326         /// Reading from this pointer when `result_ok` is not set is undefined.
8327         pub result: *mut crate::lightning::routing::network_graph::ChannelInfo,
8328         /// A pointer to the contents in the error state.
8329         /// Reading from this pointer when `result_ok` is set is undefined.
8330         pub err: *mut crate::lightning::ln::msgs::DecodeError,
8331 }
8332 #[repr(C)]
8333 /// A CResult_ChannelInfoDecodeErrorZ represents the result of a fallible operation,
8334 /// containing a crate::lightning::routing::network_graph::ChannelInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
8335 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8336 pub struct CResult_ChannelInfoDecodeErrorZ {
8337         /// The contents of this CResult_ChannelInfoDecodeErrorZ, accessible via either
8338         /// `err` or `result` depending on the state of `result_ok`.
8339         pub contents: CResult_ChannelInfoDecodeErrorZPtr,
8340         /// Whether this CResult_ChannelInfoDecodeErrorZ represents a success state.
8341         pub result_ok: bool,
8342 }
8343 #[no_mangle]
8344 /// Creates a new CResult_ChannelInfoDecodeErrorZ in the success state.
8345 pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_ok(o: crate::lightning::routing::network_graph::ChannelInfo) -> CResult_ChannelInfoDecodeErrorZ {
8346         CResult_ChannelInfoDecodeErrorZ {
8347                 contents: CResult_ChannelInfoDecodeErrorZPtr {
8348                         result: Box::into_raw(Box::new(o)),
8349                 },
8350                 result_ok: true,
8351         }
8352 }
8353 #[no_mangle]
8354 /// Creates a new CResult_ChannelInfoDecodeErrorZ in the error state.
8355 pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelInfoDecodeErrorZ {
8356         CResult_ChannelInfoDecodeErrorZ {
8357                 contents: CResult_ChannelInfoDecodeErrorZPtr {
8358                         err: Box::into_raw(Box::new(e)),
8359                 },
8360                 result_ok: false,
8361         }
8362 }
8363 #[no_mangle]
8364 /// Frees any resources used by the CResult_ChannelInfoDecodeErrorZ.
8365 pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_free(_res: CResult_ChannelInfoDecodeErrorZ) { }
8366 impl Drop for CResult_ChannelInfoDecodeErrorZ {
8367         fn drop(&mut self) {
8368                 if self.result_ok {
8369                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
8370                                 let _ = unsafe { Box::from_raw(self.contents.result) };
8371                         }
8372                 } else {
8373                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
8374                                 let _ = unsafe { Box::from_raw(self.contents.err) };
8375                         }
8376                 }
8377         }
8378 }
8379 impl From<crate::c_types::CResultTempl<crate::lightning::routing::network_graph::ChannelInfo, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelInfoDecodeErrorZ {
8380         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::network_graph::ChannelInfo, crate::lightning::ln::msgs::DecodeError>) -> Self {
8381                 let contents = if o.result_ok {
8382                         let result = unsafe { o.contents.result };
8383                         unsafe { o.contents.result = std::ptr::null_mut() };
8384                         CResult_ChannelInfoDecodeErrorZPtr { result }
8385                 } else {
8386                         let err = unsafe { o.contents.err };
8387                         unsafe { o.contents.err = std::ptr::null_mut(); }
8388                         CResult_ChannelInfoDecodeErrorZPtr { err }
8389                 };
8390                 Self {
8391                         contents,
8392                         result_ok: o.result_ok,
8393                 }
8394         }
8395 }
8396 impl Clone for CResult_ChannelInfoDecodeErrorZ {
8397         fn clone(&self) -> Self {
8398                 if self.result_ok {
8399                         Self { result_ok: true, contents: CResult_ChannelInfoDecodeErrorZPtr {
8400                                 result: Box::into_raw(Box::new(<crate::lightning::routing::network_graph::ChannelInfo>::clone(unsafe { &*self.contents.result })))
8401                         } }
8402                 } else {
8403                         Self { result_ok: false, contents: CResult_ChannelInfoDecodeErrorZPtr {
8404                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
8405                         } }
8406                 }
8407         }
8408 }
8409 #[no_mangle]
8410 /// Creates a new CResult_ChannelInfoDecodeErrorZ which has the same data as `orig`
8411 /// but with all dynamically-allocated buffers duplicated in new buffers.
8412 pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_clone(orig: &CResult_ChannelInfoDecodeErrorZ) -> CResult_ChannelInfoDecodeErrorZ { Clone::clone(&orig) }
8413 #[repr(C)]
8414 /// The contents of CResult_RoutingFeesDecodeErrorZ
8415 pub union CResult_RoutingFeesDecodeErrorZPtr {
8416         /// A pointer to the contents in the success state.
8417         /// Reading from this pointer when `result_ok` is not set is undefined.
8418         pub result: *mut crate::lightning::routing::network_graph::RoutingFees,
8419         /// A pointer to the contents in the error state.
8420         /// Reading from this pointer when `result_ok` is set is undefined.
8421         pub err: *mut crate::lightning::ln::msgs::DecodeError,
8422 }
8423 #[repr(C)]
8424 /// A CResult_RoutingFeesDecodeErrorZ represents the result of a fallible operation,
8425 /// containing a crate::lightning::routing::network_graph::RoutingFees on success and a crate::lightning::ln::msgs::DecodeError on failure.
8426 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8427 pub struct CResult_RoutingFeesDecodeErrorZ {
8428         /// The contents of this CResult_RoutingFeesDecodeErrorZ, accessible via either
8429         /// `err` or `result` depending on the state of `result_ok`.
8430         pub contents: CResult_RoutingFeesDecodeErrorZPtr,
8431         /// Whether this CResult_RoutingFeesDecodeErrorZ represents a success state.
8432         pub result_ok: bool,
8433 }
8434 #[no_mangle]
8435 /// Creates a new CResult_RoutingFeesDecodeErrorZ in the success state.
8436 pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_ok(o: crate::lightning::routing::network_graph::RoutingFees) -> CResult_RoutingFeesDecodeErrorZ {
8437         CResult_RoutingFeesDecodeErrorZ {
8438                 contents: CResult_RoutingFeesDecodeErrorZPtr {
8439                         result: Box::into_raw(Box::new(o)),
8440                 },
8441                 result_ok: true,
8442         }
8443 }
8444 #[no_mangle]
8445 /// Creates a new CResult_RoutingFeesDecodeErrorZ in the error state.
8446 pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RoutingFeesDecodeErrorZ {
8447         CResult_RoutingFeesDecodeErrorZ {
8448                 contents: CResult_RoutingFeesDecodeErrorZPtr {
8449                         err: Box::into_raw(Box::new(e)),
8450                 },
8451                 result_ok: false,
8452         }
8453 }
8454 #[no_mangle]
8455 /// Frees any resources used by the CResult_RoutingFeesDecodeErrorZ.
8456 pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_free(_res: CResult_RoutingFeesDecodeErrorZ) { }
8457 impl Drop for CResult_RoutingFeesDecodeErrorZ {
8458         fn drop(&mut self) {
8459                 if self.result_ok {
8460                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
8461                                 let _ = unsafe { Box::from_raw(self.contents.result) };
8462                         }
8463                 } else {
8464                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
8465                                 let _ = unsafe { Box::from_raw(self.contents.err) };
8466                         }
8467                 }
8468         }
8469 }
8470 impl From<crate::c_types::CResultTempl<crate::lightning::routing::network_graph::RoutingFees, crate::lightning::ln::msgs::DecodeError>> for CResult_RoutingFeesDecodeErrorZ {
8471         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::network_graph::RoutingFees, crate::lightning::ln::msgs::DecodeError>) -> Self {
8472                 let contents = if o.result_ok {
8473                         let result = unsafe { o.contents.result };
8474                         unsafe { o.contents.result = std::ptr::null_mut() };
8475                         CResult_RoutingFeesDecodeErrorZPtr { result }
8476                 } else {
8477                         let err = unsafe { o.contents.err };
8478                         unsafe { o.contents.err = std::ptr::null_mut(); }
8479                         CResult_RoutingFeesDecodeErrorZPtr { err }
8480                 };
8481                 Self {
8482                         contents,
8483                         result_ok: o.result_ok,
8484                 }
8485         }
8486 }
8487 impl Clone for CResult_RoutingFeesDecodeErrorZ {
8488         fn clone(&self) -> Self {
8489                 if self.result_ok {
8490                         Self { result_ok: true, contents: CResult_RoutingFeesDecodeErrorZPtr {
8491                                 result: Box::into_raw(Box::new(<crate::lightning::routing::network_graph::RoutingFees>::clone(unsafe { &*self.contents.result })))
8492                         } }
8493                 } else {
8494                         Self { result_ok: false, contents: CResult_RoutingFeesDecodeErrorZPtr {
8495                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
8496                         } }
8497                 }
8498         }
8499 }
8500 #[no_mangle]
8501 /// Creates a new CResult_RoutingFeesDecodeErrorZ which has the same data as `orig`
8502 /// but with all dynamically-allocated buffers duplicated in new buffers.
8503 pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_clone(orig: &CResult_RoutingFeesDecodeErrorZ) -> CResult_RoutingFeesDecodeErrorZ { Clone::clone(&orig) }
8504 #[repr(C)]
8505 /// The contents of CResult_NodeAnnouncementInfoDecodeErrorZ
8506 pub union CResult_NodeAnnouncementInfoDecodeErrorZPtr {
8507         /// A pointer to the contents in the success state.
8508         /// Reading from this pointer when `result_ok` is not set is undefined.
8509         pub result: *mut crate::lightning::routing::network_graph::NodeAnnouncementInfo,
8510         /// A pointer to the contents in the error state.
8511         /// Reading from this pointer when `result_ok` is set is undefined.
8512         pub err: *mut crate::lightning::ln::msgs::DecodeError,
8513 }
8514 #[repr(C)]
8515 /// A CResult_NodeAnnouncementInfoDecodeErrorZ represents the result of a fallible operation,
8516 /// containing a crate::lightning::routing::network_graph::NodeAnnouncementInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
8517 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8518 pub struct CResult_NodeAnnouncementInfoDecodeErrorZ {
8519         /// The contents of this CResult_NodeAnnouncementInfoDecodeErrorZ, accessible via either
8520         /// `err` or `result` depending on the state of `result_ok`.
8521         pub contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr,
8522         /// Whether this CResult_NodeAnnouncementInfoDecodeErrorZ represents a success state.
8523         pub result_ok: bool,
8524 }
8525 #[no_mangle]
8526 /// Creates a new CResult_NodeAnnouncementInfoDecodeErrorZ in the success state.
8527 pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_ok(o: crate::lightning::routing::network_graph::NodeAnnouncementInfo) -> CResult_NodeAnnouncementInfoDecodeErrorZ {
8528         CResult_NodeAnnouncementInfoDecodeErrorZ {
8529                 contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr {
8530                         result: Box::into_raw(Box::new(o)),
8531                 },
8532                 result_ok: true,
8533         }
8534 }
8535 #[no_mangle]
8536 /// Creates a new CResult_NodeAnnouncementInfoDecodeErrorZ in the error state.
8537 pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeAnnouncementInfoDecodeErrorZ {
8538         CResult_NodeAnnouncementInfoDecodeErrorZ {
8539                 contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr {
8540                         err: Box::into_raw(Box::new(e)),
8541                 },
8542                 result_ok: false,
8543         }
8544 }
8545 #[no_mangle]
8546 /// Frees any resources used by the CResult_NodeAnnouncementInfoDecodeErrorZ.
8547 pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_free(_res: CResult_NodeAnnouncementInfoDecodeErrorZ) { }
8548 impl Drop for CResult_NodeAnnouncementInfoDecodeErrorZ {
8549         fn drop(&mut self) {
8550                 if self.result_ok {
8551                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
8552                                 let _ = unsafe { Box::from_raw(self.contents.result) };
8553                         }
8554                 } else {
8555                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
8556                                 let _ = unsafe { Box::from_raw(self.contents.err) };
8557                         }
8558                 }
8559         }
8560 }
8561 impl From<crate::c_types::CResultTempl<crate::lightning::routing::network_graph::NodeAnnouncementInfo, crate::lightning::ln::msgs::DecodeError>> for CResult_NodeAnnouncementInfoDecodeErrorZ {
8562         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::network_graph::NodeAnnouncementInfo, crate::lightning::ln::msgs::DecodeError>) -> Self {
8563                 let contents = if o.result_ok {
8564                         let result = unsafe { o.contents.result };
8565                         unsafe { o.contents.result = std::ptr::null_mut() };
8566                         CResult_NodeAnnouncementInfoDecodeErrorZPtr { result }
8567                 } else {
8568                         let err = unsafe { o.contents.err };
8569                         unsafe { o.contents.err = std::ptr::null_mut(); }
8570                         CResult_NodeAnnouncementInfoDecodeErrorZPtr { err }
8571                 };
8572                 Self {
8573                         contents,
8574                         result_ok: o.result_ok,
8575                 }
8576         }
8577 }
8578 impl Clone for CResult_NodeAnnouncementInfoDecodeErrorZ {
8579         fn clone(&self) -> Self {
8580                 if self.result_ok {
8581                         Self { result_ok: true, contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr {
8582                                 result: Box::into_raw(Box::new(<crate::lightning::routing::network_graph::NodeAnnouncementInfo>::clone(unsafe { &*self.contents.result })))
8583                         } }
8584                 } else {
8585                         Self { result_ok: false, contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr {
8586                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
8587                         } }
8588                 }
8589         }
8590 }
8591 #[no_mangle]
8592 /// Creates a new CResult_NodeAnnouncementInfoDecodeErrorZ which has the same data as `orig`
8593 /// but with all dynamically-allocated buffers duplicated in new buffers.
8594 pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_clone(orig: &CResult_NodeAnnouncementInfoDecodeErrorZ) -> CResult_NodeAnnouncementInfoDecodeErrorZ { Clone::clone(&orig) }
8595 #[repr(C)]
8596 /// A dynamically-allocated array of u64s of arbitrary size.
8597 /// This corresponds to std::vector in C++
8598 pub struct CVec_u64Z {
8599         /// The elements in the array.
8600         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
8601         pub data: *mut u64,
8602         /// The number of elements pointed to by `data`.
8603         pub datalen: usize
8604 }
8605 impl CVec_u64Z {
8606         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<u64> {
8607                 if self.datalen == 0 { return Vec::new(); }
8608                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
8609                 self.data = std::ptr::null_mut();
8610                 self.datalen = 0;
8611                 ret
8612         }
8613         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[u64] {
8614                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
8615         }
8616 }
8617 impl From<Vec<u64>> for CVec_u64Z {
8618         fn from(v: Vec<u64>) -> Self {
8619                 let datalen = v.len();
8620                 let data = Box::into_raw(v.into_boxed_slice());
8621                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
8622         }
8623 }
8624 #[no_mangle]
8625 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
8626 pub extern "C" fn CVec_u64Z_free(_res: CVec_u64Z) { }
8627 impl Drop for CVec_u64Z {
8628         fn drop(&mut self) {
8629                 if self.datalen == 0 { return; }
8630                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
8631         }
8632 }
8633 impl Clone for CVec_u64Z {
8634         fn clone(&self) -> Self {
8635                 let mut res = Vec::new();
8636                 if self.datalen == 0 { return Self::from(res); }
8637                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
8638                 Self::from(res)
8639         }
8640 }
8641 #[repr(C)]
8642 /// The contents of CResult_NodeInfoDecodeErrorZ
8643 pub union CResult_NodeInfoDecodeErrorZPtr {
8644         /// A pointer to the contents in the success state.
8645         /// Reading from this pointer when `result_ok` is not set is undefined.
8646         pub result: *mut crate::lightning::routing::network_graph::NodeInfo,
8647         /// A pointer to the contents in the error state.
8648         /// Reading from this pointer when `result_ok` is set is undefined.
8649         pub err: *mut crate::lightning::ln::msgs::DecodeError,
8650 }
8651 #[repr(C)]
8652 /// A CResult_NodeInfoDecodeErrorZ represents the result of a fallible operation,
8653 /// containing a crate::lightning::routing::network_graph::NodeInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
8654 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8655 pub struct CResult_NodeInfoDecodeErrorZ {
8656         /// The contents of this CResult_NodeInfoDecodeErrorZ, accessible via either
8657         /// `err` or `result` depending on the state of `result_ok`.
8658         pub contents: CResult_NodeInfoDecodeErrorZPtr,
8659         /// Whether this CResult_NodeInfoDecodeErrorZ represents a success state.
8660         pub result_ok: bool,
8661 }
8662 #[no_mangle]
8663 /// Creates a new CResult_NodeInfoDecodeErrorZ in the success state.
8664 pub extern "C" fn CResult_NodeInfoDecodeErrorZ_ok(o: crate::lightning::routing::network_graph::NodeInfo) -> CResult_NodeInfoDecodeErrorZ {
8665         CResult_NodeInfoDecodeErrorZ {
8666                 contents: CResult_NodeInfoDecodeErrorZPtr {
8667                         result: Box::into_raw(Box::new(o)),
8668                 },
8669                 result_ok: true,
8670         }
8671 }
8672 #[no_mangle]
8673 /// Creates a new CResult_NodeInfoDecodeErrorZ in the error state.
8674 pub extern "C" fn CResult_NodeInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeInfoDecodeErrorZ {
8675         CResult_NodeInfoDecodeErrorZ {
8676                 contents: CResult_NodeInfoDecodeErrorZPtr {
8677                         err: Box::into_raw(Box::new(e)),
8678                 },
8679                 result_ok: false,
8680         }
8681 }
8682 #[no_mangle]
8683 /// Frees any resources used by the CResult_NodeInfoDecodeErrorZ.
8684 pub extern "C" fn CResult_NodeInfoDecodeErrorZ_free(_res: CResult_NodeInfoDecodeErrorZ) { }
8685 impl Drop for CResult_NodeInfoDecodeErrorZ {
8686         fn drop(&mut self) {
8687                 if self.result_ok {
8688                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
8689                                 let _ = unsafe { Box::from_raw(self.contents.result) };
8690                         }
8691                 } else {
8692                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
8693                                 let _ = unsafe { Box::from_raw(self.contents.err) };
8694                         }
8695                 }
8696         }
8697 }
8698 impl From<crate::c_types::CResultTempl<crate::lightning::routing::network_graph::NodeInfo, crate::lightning::ln::msgs::DecodeError>> for CResult_NodeInfoDecodeErrorZ {
8699         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::network_graph::NodeInfo, crate::lightning::ln::msgs::DecodeError>) -> Self {
8700                 let contents = if o.result_ok {
8701                         let result = unsafe { o.contents.result };
8702                         unsafe { o.contents.result = std::ptr::null_mut() };
8703                         CResult_NodeInfoDecodeErrorZPtr { result }
8704                 } else {
8705                         let err = unsafe { o.contents.err };
8706                         unsafe { o.contents.err = std::ptr::null_mut(); }
8707                         CResult_NodeInfoDecodeErrorZPtr { err }
8708                 };
8709                 Self {
8710                         contents,
8711                         result_ok: o.result_ok,
8712                 }
8713         }
8714 }
8715 impl Clone for CResult_NodeInfoDecodeErrorZ {
8716         fn clone(&self) -> Self {
8717                 if self.result_ok {
8718                         Self { result_ok: true, contents: CResult_NodeInfoDecodeErrorZPtr {
8719                                 result: Box::into_raw(Box::new(<crate::lightning::routing::network_graph::NodeInfo>::clone(unsafe { &*self.contents.result })))
8720                         } }
8721                 } else {
8722                         Self { result_ok: false, contents: CResult_NodeInfoDecodeErrorZPtr {
8723                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
8724                         } }
8725                 }
8726         }
8727 }
8728 #[no_mangle]
8729 /// Creates a new CResult_NodeInfoDecodeErrorZ which has the same data as `orig`
8730 /// but with all dynamically-allocated buffers duplicated in new buffers.
8731 pub extern "C" fn CResult_NodeInfoDecodeErrorZ_clone(orig: &CResult_NodeInfoDecodeErrorZ) -> CResult_NodeInfoDecodeErrorZ { Clone::clone(&orig) }
8732 #[repr(C)]
8733 /// The contents of CResult_NetworkGraphDecodeErrorZ
8734 pub union CResult_NetworkGraphDecodeErrorZPtr {
8735         /// A pointer to the contents in the success state.
8736         /// Reading from this pointer when `result_ok` is not set is undefined.
8737         pub result: *mut crate::lightning::routing::network_graph::NetworkGraph,
8738         /// A pointer to the contents in the error state.
8739         /// Reading from this pointer when `result_ok` is set is undefined.
8740         pub err: *mut crate::lightning::ln::msgs::DecodeError,
8741 }
8742 #[repr(C)]
8743 /// A CResult_NetworkGraphDecodeErrorZ represents the result of a fallible operation,
8744 /// containing a crate::lightning::routing::network_graph::NetworkGraph on success and a crate::lightning::ln::msgs::DecodeError on failure.
8745 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8746 pub struct CResult_NetworkGraphDecodeErrorZ {
8747         /// The contents of this CResult_NetworkGraphDecodeErrorZ, accessible via either
8748         /// `err` or `result` depending on the state of `result_ok`.
8749         pub contents: CResult_NetworkGraphDecodeErrorZPtr,
8750         /// Whether this CResult_NetworkGraphDecodeErrorZ represents a success state.
8751         pub result_ok: bool,
8752 }
8753 #[no_mangle]
8754 /// Creates a new CResult_NetworkGraphDecodeErrorZ in the success state.
8755 pub extern "C" fn CResult_NetworkGraphDecodeErrorZ_ok(o: crate::lightning::routing::network_graph::NetworkGraph) -> CResult_NetworkGraphDecodeErrorZ {
8756         CResult_NetworkGraphDecodeErrorZ {
8757                 contents: CResult_NetworkGraphDecodeErrorZPtr {
8758                         result: Box::into_raw(Box::new(o)),
8759                 },
8760                 result_ok: true,
8761         }
8762 }
8763 #[no_mangle]
8764 /// Creates a new CResult_NetworkGraphDecodeErrorZ in the error state.
8765 pub extern "C" fn CResult_NetworkGraphDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NetworkGraphDecodeErrorZ {
8766         CResult_NetworkGraphDecodeErrorZ {
8767                 contents: CResult_NetworkGraphDecodeErrorZPtr {
8768                         err: Box::into_raw(Box::new(e)),
8769                 },
8770                 result_ok: false,
8771         }
8772 }
8773 #[no_mangle]
8774 /// Frees any resources used by the CResult_NetworkGraphDecodeErrorZ.
8775 pub extern "C" fn CResult_NetworkGraphDecodeErrorZ_free(_res: CResult_NetworkGraphDecodeErrorZ) { }
8776 impl Drop for CResult_NetworkGraphDecodeErrorZ {
8777         fn drop(&mut self) {
8778                 if self.result_ok {
8779                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
8780                                 let _ = unsafe { Box::from_raw(self.contents.result) };
8781                         }
8782                 } else {
8783                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
8784                                 let _ = unsafe { Box::from_raw(self.contents.err) };
8785                         }
8786                 }
8787         }
8788 }
8789 impl From<crate::c_types::CResultTempl<crate::lightning::routing::network_graph::NetworkGraph, crate::lightning::ln::msgs::DecodeError>> for CResult_NetworkGraphDecodeErrorZ {
8790         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::network_graph::NetworkGraph, crate::lightning::ln::msgs::DecodeError>) -> Self {
8791                 let contents = if o.result_ok {
8792                         let result = unsafe { o.contents.result };
8793                         unsafe { o.contents.result = std::ptr::null_mut() };
8794                         CResult_NetworkGraphDecodeErrorZPtr { result }
8795                 } else {
8796                         let err = unsafe { o.contents.err };
8797                         unsafe { o.contents.err = std::ptr::null_mut(); }
8798                         CResult_NetworkGraphDecodeErrorZPtr { err }
8799                 };
8800                 Self {
8801                         contents,
8802                         result_ok: o.result_ok,
8803                 }
8804         }
8805 }
8806 impl Clone for CResult_NetworkGraphDecodeErrorZ {
8807         fn clone(&self) -> Self {
8808                 if self.result_ok {
8809                         Self { result_ok: true, contents: CResult_NetworkGraphDecodeErrorZPtr {
8810                                 result: Box::into_raw(Box::new(<crate::lightning::routing::network_graph::NetworkGraph>::clone(unsafe { &*self.contents.result })))
8811                         } }
8812                 } else {
8813                         Self { result_ok: false, contents: CResult_NetworkGraphDecodeErrorZPtr {
8814                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
8815                         } }
8816                 }
8817         }
8818 }
8819 #[no_mangle]
8820 /// Creates a new CResult_NetworkGraphDecodeErrorZ which has the same data as `orig`
8821 /// but with all dynamically-allocated buffers duplicated in new buffers.
8822 pub extern "C" fn CResult_NetworkGraphDecodeErrorZ_clone(orig: &CResult_NetworkGraphDecodeErrorZ) -> CResult_NetworkGraphDecodeErrorZ { Clone::clone(&orig) }
8823 #[repr(C)]
8824 #[derive(Clone)]
8825 /// An enum which can either contain a crate::c_types::derived::CVec_NetAddressZ or not
8826 pub enum COption_CVec_NetAddressZZ {
8827         /// When we're in this state, this COption_CVec_NetAddressZZ contains a crate::c_types::derived::CVec_NetAddressZ
8828         Some(crate::c_types::derived::CVec_NetAddressZ),
8829         /// When we're in this state, this COption_CVec_NetAddressZZ contains nothing
8830         None
8831 }
8832 impl COption_CVec_NetAddressZZ {
8833         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
8834                 if let Self::Some(_) = self { true } else { false }
8835         }
8836         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
8837                 !self.is_some()
8838         }
8839         #[allow(unused)] pub(crate) fn take(mut self) -> crate::c_types::derived::CVec_NetAddressZ {
8840                 if let Self::Some(v) = self { v } else { unreachable!() }
8841         }
8842 }
8843 #[no_mangle]
8844 /// Constructs a new COption_CVec_NetAddressZZ containing a crate::c_types::derived::CVec_NetAddressZ
8845 pub extern "C" fn COption_CVec_NetAddressZZ_some(o: crate::c_types::derived::CVec_NetAddressZ) -> COption_CVec_NetAddressZZ {
8846         COption_CVec_NetAddressZZ::Some(o)
8847 }
8848 #[no_mangle]
8849 /// Constructs a new COption_CVec_NetAddressZZ containing nothing
8850 pub extern "C" fn COption_CVec_NetAddressZZ_none() -> COption_CVec_NetAddressZZ {
8851         COption_CVec_NetAddressZZ::None
8852 }
8853 #[no_mangle]
8854 /// Frees any resources associated with the crate::c_types::derived::CVec_NetAddressZ, if we are in the Some state
8855 pub extern "C" fn COption_CVec_NetAddressZZ_free(_res: COption_CVec_NetAddressZZ) { }
8856 #[no_mangle]
8857 /// Creates a new COption_CVec_NetAddressZZ which has the same data as `orig`
8858 /// but with all dynamically-allocated buffers duplicated in new buffers.
8859 pub extern "C" fn COption_CVec_NetAddressZZ_clone(orig: &COption_CVec_NetAddressZZ) -> COption_CVec_NetAddressZZ { Clone::clone(&orig) }
8860 #[repr(C)]
8861 /// The contents of CResult_NetAddressu8Z
8862 pub union CResult_NetAddressu8ZPtr {
8863         /// A pointer to the contents in the success state.
8864         /// Reading from this pointer when `result_ok` is not set is undefined.
8865         pub result: *mut crate::lightning::ln::msgs::NetAddress,
8866         /// A pointer to the contents in the error state.
8867         /// Reading from this pointer when `result_ok` is set is undefined.
8868         pub err: *mut u8,
8869 }
8870 #[repr(C)]
8871 /// A CResult_NetAddressu8Z represents the result of a fallible operation,
8872 /// containing a crate::lightning::ln::msgs::NetAddress on success and a u8 on failure.
8873 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8874 pub struct CResult_NetAddressu8Z {
8875         /// The contents of this CResult_NetAddressu8Z, accessible via either
8876         /// `err` or `result` depending on the state of `result_ok`.
8877         pub contents: CResult_NetAddressu8ZPtr,
8878         /// Whether this CResult_NetAddressu8Z represents a success state.
8879         pub result_ok: bool,
8880 }
8881 #[no_mangle]
8882 /// Creates a new CResult_NetAddressu8Z in the success state.
8883 pub extern "C" fn CResult_NetAddressu8Z_ok(o: crate::lightning::ln::msgs::NetAddress) -> CResult_NetAddressu8Z {
8884         CResult_NetAddressu8Z {
8885                 contents: CResult_NetAddressu8ZPtr {
8886                         result: Box::into_raw(Box::new(o)),
8887                 },
8888                 result_ok: true,
8889         }
8890 }
8891 #[no_mangle]
8892 /// Creates a new CResult_NetAddressu8Z in the error state.
8893 pub extern "C" fn CResult_NetAddressu8Z_err(e: u8) -> CResult_NetAddressu8Z {
8894         CResult_NetAddressu8Z {
8895                 contents: CResult_NetAddressu8ZPtr {
8896                         err: Box::into_raw(Box::new(e)),
8897                 },
8898                 result_ok: false,
8899         }
8900 }
8901 #[no_mangle]
8902 /// Frees any resources used by the CResult_NetAddressu8Z.
8903 pub extern "C" fn CResult_NetAddressu8Z_free(_res: CResult_NetAddressu8Z) { }
8904 impl Drop for CResult_NetAddressu8Z {
8905         fn drop(&mut self) {
8906                 if self.result_ok {
8907                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
8908                                 let _ = unsafe { Box::from_raw(self.contents.result) };
8909                         }
8910                 } else {
8911                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
8912                                 let _ = unsafe { Box::from_raw(self.contents.err) };
8913                         }
8914                 }
8915         }
8916 }
8917 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::NetAddress, u8>> for CResult_NetAddressu8Z {
8918         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::NetAddress, u8>) -> Self {
8919                 let contents = if o.result_ok {
8920                         let result = unsafe { o.contents.result };
8921                         unsafe { o.contents.result = std::ptr::null_mut() };
8922                         CResult_NetAddressu8ZPtr { result }
8923                 } else {
8924                         let err = unsafe { o.contents.err };
8925                         unsafe { o.contents.err = std::ptr::null_mut(); }
8926                         CResult_NetAddressu8ZPtr { err }
8927                 };
8928                 Self {
8929                         contents,
8930                         result_ok: o.result_ok,
8931                 }
8932         }
8933 }
8934 impl Clone for CResult_NetAddressu8Z {
8935         fn clone(&self) -> Self {
8936                 if self.result_ok {
8937                         Self { result_ok: true, contents: CResult_NetAddressu8ZPtr {
8938                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::NetAddress>::clone(unsafe { &*self.contents.result })))
8939                         } }
8940                 } else {
8941                         Self { result_ok: false, contents: CResult_NetAddressu8ZPtr {
8942                                 err: Box::into_raw(Box::new(<u8>::clone(unsafe { &*self.contents.err })))
8943                         } }
8944                 }
8945         }
8946 }
8947 #[no_mangle]
8948 /// Creates a new CResult_NetAddressu8Z which has the same data as `orig`
8949 /// but with all dynamically-allocated buffers duplicated in new buffers.
8950 pub extern "C" fn CResult_NetAddressu8Z_clone(orig: &CResult_NetAddressu8Z) -> CResult_NetAddressu8Z { Clone::clone(&orig) }
8951 #[repr(C)]
8952 /// The contents of CResult_CResult_NetAddressu8ZDecodeErrorZ
8953 pub union CResult_CResult_NetAddressu8ZDecodeErrorZPtr {
8954         /// A pointer to the contents in the success state.
8955         /// Reading from this pointer when `result_ok` is not set is undefined.
8956         pub result: *mut crate::c_types::derived::CResult_NetAddressu8Z,
8957         /// A pointer to the contents in the error state.
8958         /// Reading from this pointer when `result_ok` is set is undefined.
8959         pub err: *mut crate::lightning::ln::msgs::DecodeError,
8960 }
8961 #[repr(C)]
8962 /// A CResult_CResult_NetAddressu8ZDecodeErrorZ represents the result of a fallible operation,
8963 /// containing a crate::c_types::derived::CResult_NetAddressu8Z on success and a crate::lightning::ln::msgs::DecodeError on failure.
8964 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8965 pub struct CResult_CResult_NetAddressu8ZDecodeErrorZ {
8966         /// The contents of this CResult_CResult_NetAddressu8ZDecodeErrorZ, accessible via either
8967         /// `err` or `result` depending on the state of `result_ok`.
8968         pub contents: CResult_CResult_NetAddressu8ZDecodeErrorZPtr,
8969         /// Whether this CResult_CResult_NetAddressu8ZDecodeErrorZ represents a success state.
8970         pub result_ok: bool,
8971 }
8972 #[no_mangle]
8973 /// Creates a new CResult_CResult_NetAddressu8ZDecodeErrorZ in the success state.
8974 pub extern "C" fn CResult_CResult_NetAddressu8ZDecodeErrorZ_ok(o: crate::c_types::derived::CResult_NetAddressu8Z) -> CResult_CResult_NetAddressu8ZDecodeErrorZ {
8975         CResult_CResult_NetAddressu8ZDecodeErrorZ {
8976                 contents: CResult_CResult_NetAddressu8ZDecodeErrorZPtr {
8977                         result: Box::into_raw(Box::new(o)),
8978                 },
8979                 result_ok: true,
8980         }
8981 }
8982 #[no_mangle]
8983 /// Creates a new CResult_CResult_NetAddressu8ZDecodeErrorZ in the error state.
8984 pub extern "C" fn CResult_CResult_NetAddressu8ZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_CResult_NetAddressu8ZDecodeErrorZ {
8985         CResult_CResult_NetAddressu8ZDecodeErrorZ {
8986                 contents: CResult_CResult_NetAddressu8ZDecodeErrorZPtr {
8987                         err: Box::into_raw(Box::new(e)),
8988                 },
8989                 result_ok: false,
8990         }
8991 }
8992 #[no_mangle]
8993 /// Frees any resources used by the CResult_CResult_NetAddressu8ZDecodeErrorZ.
8994 pub extern "C" fn CResult_CResult_NetAddressu8ZDecodeErrorZ_free(_res: CResult_CResult_NetAddressu8ZDecodeErrorZ) { }
8995 impl Drop for CResult_CResult_NetAddressu8ZDecodeErrorZ {
8996         fn drop(&mut self) {
8997                 if self.result_ok {
8998                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
8999                                 let _ = unsafe { Box::from_raw(self.contents.result) };
9000                         }
9001                 } else {
9002                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
9003                                 let _ = unsafe { Box::from_raw(self.contents.err) };
9004                         }
9005                 }
9006         }
9007 }
9008 impl From<crate::c_types::CResultTempl<crate::c_types::derived::CResult_NetAddressu8Z, crate::lightning::ln::msgs::DecodeError>> for CResult_CResult_NetAddressu8ZDecodeErrorZ {
9009         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CResult_NetAddressu8Z, crate::lightning::ln::msgs::DecodeError>) -> Self {
9010                 let contents = if o.result_ok {
9011                         let result = unsafe { o.contents.result };
9012                         unsafe { o.contents.result = std::ptr::null_mut() };
9013                         CResult_CResult_NetAddressu8ZDecodeErrorZPtr { result }
9014                 } else {
9015                         let err = unsafe { o.contents.err };
9016                         unsafe { o.contents.err = std::ptr::null_mut(); }
9017                         CResult_CResult_NetAddressu8ZDecodeErrorZPtr { err }
9018                 };
9019                 Self {
9020                         contents,
9021                         result_ok: o.result_ok,
9022                 }
9023         }
9024 }
9025 impl Clone for CResult_CResult_NetAddressu8ZDecodeErrorZ {
9026         fn clone(&self) -> Self {
9027                 if self.result_ok {
9028                         Self { result_ok: true, contents: CResult_CResult_NetAddressu8ZDecodeErrorZPtr {
9029                                 result: Box::into_raw(Box::new(<crate::c_types::derived::CResult_NetAddressu8Z>::clone(unsafe { &*self.contents.result })))
9030                         } }
9031                 } else {
9032                         Self { result_ok: false, contents: CResult_CResult_NetAddressu8ZDecodeErrorZPtr {
9033                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
9034                         } }
9035                 }
9036         }
9037 }
9038 #[no_mangle]
9039 /// Creates a new CResult_CResult_NetAddressu8ZDecodeErrorZ which has the same data as `orig`
9040 /// but with all dynamically-allocated buffers duplicated in new buffers.
9041 pub extern "C" fn CResult_CResult_NetAddressu8ZDecodeErrorZ_clone(orig: &CResult_CResult_NetAddressu8ZDecodeErrorZ) -> CResult_CResult_NetAddressu8ZDecodeErrorZ { Clone::clone(&orig) }
9042 #[repr(C)]
9043 /// The contents of CResult_NetAddressDecodeErrorZ
9044 pub union CResult_NetAddressDecodeErrorZPtr {
9045         /// A pointer to the contents in the success state.
9046         /// Reading from this pointer when `result_ok` is not set is undefined.
9047         pub result: *mut crate::lightning::ln::msgs::NetAddress,
9048         /// A pointer to the contents in the error state.
9049         /// Reading from this pointer when `result_ok` is set is undefined.
9050         pub err: *mut crate::lightning::ln::msgs::DecodeError,
9051 }
9052 #[repr(C)]
9053 /// A CResult_NetAddressDecodeErrorZ represents the result of a fallible operation,
9054 /// containing a crate::lightning::ln::msgs::NetAddress on success and a crate::lightning::ln::msgs::DecodeError on failure.
9055 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9056 pub struct CResult_NetAddressDecodeErrorZ {
9057         /// The contents of this CResult_NetAddressDecodeErrorZ, accessible via either
9058         /// `err` or `result` depending on the state of `result_ok`.
9059         pub contents: CResult_NetAddressDecodeErrorZPtr,
9060         /// Whether this CResult_NetAddressDecodeErrorZ represents a success state.
9061         pub result_ok: bool,
9062 }
9063 #[no_mangle]
9064 /// Creates a new CResult_NetAddressDecodeErrorZ in the success state.
9065 pub extern "C" fn CResult_NetAddressDecodeErrorZ_ok(o: crate::lightning::ln::msgs::NetAddress) -> CResult_NetAddressDecodeErrorZ {
9066         CResult_NetAddressDecodeErrorZ {
9067                 contents: CResult_NetAddressDecodeErrorZPtr {
9068                         result: Box::into_raw(Box::new(o)),
9069                 },
9070                 result_ok: true,
9071         }
9072 }
9073 #[no_mangle]
9074 /// Creates a new CResult_NetAddressDecodeErrorZ in the error state.
9075 pub extern "C" fn CResult_NetAddressDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NetAddressDecodeErrorZ {
9076         CResult_NetAddressDecodeErrorZ {
9077                 contents: CResult_NetAddressDecodeErrorZPtr {
9078                         err: Box::into_raw(Box::new(e)),
9079                 },
9080                 result_ok: false,
9081         }
9082 }
9083 #[no_mangle]
9084 /// Frees any resources used by the CResult_NetAddressDecodeErrorZ.
9085 pub extern "C" fn CResult_NetAddressDecodeErrorZ_free(_res: CResult_NetAddressDecodeErrorZ) { }
9086 impl Drop for CResult_NetAddressDecodeErrorZ {
9087         fn drop(&mut self) {
9088                 if self.result_ok {
9089                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
9090                                 let _ = unsafe { Box::from_raw(self.contents.result) };
9091                         }
9092                 } else {
9093                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
9094                                 let _ = unsafe { Box::from_raw(self.contents.err) };
9095                         }
9096                 }
9097         }
9098 }
9099 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::NetAddress, crate::lightning::ln::msgs::DecodeError>> for CResult_NetAddressDecodeErrorZ {
9100         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::NetAddress, crate::lightning::ln::msgs::DecodeError>) -> Self {
9101                 let contents = if o.result_ok {
9102                         let result = unsafe { o.contents.result };
9103                         unsafe { o.contents.result = std::ptr::null_mut() };
9104                         CResult_NetAddressDecodeErrorZPtr { result }
9105                 } else {
9106                         let err = unsafe { o.contents.err };
9107                         unsafe { o.contents.err = std::ptr::null_mut(); }
9108                         CResult_NetAddressDecodeErrorZPtr { err }
9109                 };
9110                 Self {
9111                         contents,
9112                         result_ok: o.result_ok,
9113                 }
9114         }
9115 }
9116 impl Clone for CResult_NetAddressDecodeErrorZ {
9117         fn clone(&self) -> Self {
9118                 if self.result_ok {
9119                         Self { result_ok: true, contents: CResult_NetAddressDecodeErrorZPtr {
9120                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::NetAddress>::clone(unsafe { &*self.contents.result })))
9121                         } }
9122                 } else {
9123                         Self { result_ok: false, contents: CResult_NetAddressDecodeErrorZPtr {
9124                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
9125                         } }
9126                 }
9127         }
9128 }
9129 #[no_mangle]
9130 /// Creates a new CResult_NetAddressDecodeErrorZ which has the same data as `orig`
9131 /// but with all dynamically-allocated buffers duplicated in new buffers.
9132 pub extern "C" fn CResult_NetAddressDecodeErrorZ_clone(orig: &CResult_NetAddressDecodeErrorZ) -> CResult_NetAddressDecodeErrorZ { Clone::clone(&orig) }
9133 #[repr(C)]
9134 /// A dynamically-allocated array of crate::lightning::ln::msgs::UpdateAddHTLCs of arbitrary size.
9135 /// This corresponds to std::vector in C++
9136 pub struct CVec_UpdateAddHTLCZ {
9137         /// The elements in the array.
9138         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
9139         pub data: *mut crate::lightning::ln::msgs::UpdateAddHTLC,
9140         /// The number of elements pointed to by `data`.
9141         pub datalen: usize
9142 }
9143 impl CVec_UpdateAddHTLCZ {
9144         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::UpdateAddHTLC> {
9145                 if self.datalen == 0 { return Vec::new(); }
9146                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
9147                 self.data = std::ptr::null_mut();
9148                 self.datalen = 0;
9149                 ret
9150         }
9151         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::UpdateAddHTLC] {
9152                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
9153         }
9154 }
9155 impl From<Vec<crate::lightning::ln::msgs::UpdateAddHTLC>> for CVec_UpdateAddHTLCZ {
9156         fn from(v: Vec<crate::lightning::ln::msgs::UpdateAddHTLC>) -> Self {
9157                 let datalen = v.len();
9158                 let data = Box::into_raw(v.into_boxed_slice());
9159                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
9160         }
9161 }
9162 #[no_mangle]
9163 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
9164 pub extern "C" fn CVec_UpdateAddHTLCZ_free(_res: CVec_UpdateAddHTLCZ) { }
9165 impl Drop for CVec_UpdateAddHTLCZ {
9166         fn drop(&mut self) {
9167                 if self.datalen == 0 { return; }
9168                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
9169         }
9170 }
9171 impl Clone for CVec_UpdateAddHTLCZ {
9172         fn clone(&self) -> Self {
9173                 let mut res = Vec::new();
9174                 if self.datalen == 0 { return Self::from(res); }
9175                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
9176                 Self::from(res)
9177         }
9178 }
9179 #[repr(C)]
9180 /// A dynamically-allocated array of crate::lightning::ln::msgs::UpdateFulfillHTLCs of arbitrary size.
9181 /// This corresponds to std::vector in C++
9182 pub struct CVec_UpdateFulfillHTLCZ {
9183         /// The elements in the array.
9184         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
9185         pub data: *mut crate::lightning::ln::msgs::UpdateFulfillHTLC,
9186         /// The number of elements pointed to by `data`.
9187         pub datalen: usize
9188 }
9189 impl CVec_UpdateFulfillHTLCZ {
9190         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::UpdateFulfillHTLC> {
9191                 if self.datalen == 0 { return Vec::new(); }
9192                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
9193                 self.data = std::ptr::null_mut();
9194                 self.datalen = 0;
9195                 ret
9196         }
9197         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::UpdateFulfillHTLC] {
9198                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
9199         }
9200 }
9201 impl From<Vec<crate::lightning::ln::msgs::UpdateFulfillHTLC>> for CVec_UpdateFulfillHTLCZ {
9202         fn from(v: Vec<crate::lightning::ln::msgs::UpdateFulfillHTLC>) -> Self {
9203                 let datalen = v.len();
9204                 let data = Box::into_raw(v.into_boxed_slice());
9205                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
9206         }
9207 }
9208 #[no_mangle]
9209 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
9210 pub extern "C" fn CVec_UpdateFulfillHTLCZ_free(_res: CVec_UpdateFulfillHTLCZ) { }
9211 impl Drop for CVec_UpdateFulfillHTLCZ {
9212         fn drop(&mut self) {
9213                 if self.datalen == 0 { return; }
9214                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
9215         }
9216 }
9217 impl Clone for CVec_UpdateFulfillHTLCZ {
9218         fn clone(&self) -> Self {
9219                 let mut res = Vec::new();
9220                 if self.datalen == 0 { return Self::from(res); }
9221                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
9222                 Self::from(res)
9223         }
9224 }
9225 #[repr(C)]
9226 /// A dynamically-allocated array of crate::lightning::ln::msgs::UpdateFailHTLCs of arbitrary size.
9227 /// This corresponds to std::vector in C++
9228 pub struct CVec_UpdateFailHTLCZ {
9229         /// The elements in the array.
9230         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
9231         pub data: *mut crate::lightning::ln::msgs::UpdateFailHTLC,
9232         /// The number of elements pointed to by `data`.
9233         pub datalen: usize
9234 }
9235 impl CVec_UpdateFailHTLCZ {
9236         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::UpdateFailHTLC> {
9237                 if self.datalen == 0 { return Vec::new(); }
9238                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
9239                 self.data = std::ptr::null_mut();
9240                 self.datalen = 0;
9241                 ret
9242         }
9243         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::UpdateFailHTLC] {
9244                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
9245         }
9246 }
9247 impl From<Vec<crate::lightning::ln::msgs::UpdateFailHTLC>> for CVec_UpdateFailHTLCZ {
9248         fn from(v: Vec<crate::lightning::ln::msgs::UpdateFailHTLC>) -> Self {
9249                 let datalen = v.len();
9250                 let data = Box::into_raw(v.into_boxed_slice());
9251                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
9252         }
9253 }
9254 #[no_mangle]
9255 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
9256 pub extern "C" fn CVec_UpdateFailHTLCZ_free(_res: CVec_UpdateFailHTLCZ) { }
9257 impl Drop for CVec_UpdateFailHTLCZ {
9258         fn drop(&mut self) {
9259                 if self.datalen == 0 { return; }
9260                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
9261         }
9262 }
9263 impl Clone for CVec_UpdateFailHTLCZ {
9264         fn clone(&self) -> Self {
9265                 let mut res = Vec::new();
9266                 if self.datalen == 0 { return Self::from(res); }
9267                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
9268                 Self::from(res)
9269         }
9270 }
9271 #[repr(C)]
9272 /// A dynamically-allocated array of crate::lightning::ln::msgs::UpdateFailMalformedHTLCs of arbitrary size.
9273 /// This corresponds to std::vector in C++
9274 pub struct CVec_UpdateFailMalformedHTLCZ {
9275         /// The elements in the array.
9276         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
9277         pub data: *mut crate::lightning::ln::msgs::UpdateFailMalformedHTLC,
9278         /// The number of elements pointed to by `data`.
9279         pub datalen: usize
9280 }
9281 impl CVec_UpdateFailMalformedHTLCZ {
9282         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::UpdateFailMalformedHTLC> {
9283                 if self.datalen == 0 { return Vec::new(); }
9284                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
9285                 self.data = std::ptr::null_mut();
9286                 self.datalen = 0;
9287                 ret
9288         }
9289         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::UpdateFailMalformedHTLC] {
9290                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
9291         }
9292 }
9293 impl From<Vec<crate::lightning::ln::msgs::UpdateFailMalformedHTLC>> for CVec_UpdateFailMalformedHTLCZ {
9294         fn from(v: Vec<crate::lightning::ln::msgs::UpdateFailMalformedHTLC>) -> Self {
9295                 let datalen = v.len();
9296                 let data = Box::into_raw(v.into_boxed_slice());
9297                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
9298         }
9299 }
9300 #[no_mangle]
9301 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
9302 pub extern "C" fn CVec_UpdateFailMalformedHTLCZ_free(_res: CVec_UpdateFailMalformedHTLCZ) { }
9303 impl Drop for CVec_UpdateFailMalformedHTLCZ {
9304         fn drop(&mut self) {
9305                 if self.datalen == 0 { return; }
9306                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
9307         }
9308 }
9309 impl Clone for CVec_UpdateFailMalformedHTLCZ {
9310         fn clone(&self) -> Self {
9311                 let mut res = Vec::new();
9312                 if self.datalen == 0 { return Self::from(res); }
9313                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
9314                 Self::from(res)
9315         }
9316 }
9317 #[repr(C)]
9318 /// The contents of CResult_AcceptChannelDecodeErrorZ
9319 pub union CResult_AcceptChannelDecodeErrorZPtr {
9320         /// A pointer to the contents in the success state.
9321         /// Reading from this pointer when `result_ok` is not set is undefined.
9322         pub result: *mut crate::lightning::ln::msgs::AcceptChannel,
9323         /// A pointer to the contents in the error state.
9324         /// Reading from this pointer when `result_ok` is set is undefined.
9325         pub err: *mut crate::lightning::ln::msgs::DecodeError,
9326 }
9327 #[repr(C)]
9328 /// A CResult_AcceptChannelDecodeErrorZ represents the result of a fallible operation,
9329 /// containing a crate::lightning::ln::msgs::AcceptChannel on success and a crate::lightning::ln::msgs::DecodeError on failure.
9330 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9331 pub struct CResult_AcceptChannelDecodeErrorZ {
9332         /// The contents of this CResult_AcceptChannelDecodeErrorZ, accessible via either
9333         /// `err` or `result` depending on the state of `result_ok`.
9334         pub contents: CResult_AcceptChannelDecodeErrorZPtr,
9335         /// Whether this CResult_AcceptChannelDecodeErrorZ represents a success state.
9336         pub result_ok: bool,
9337 }
9338 #[no_mangle]
9339 /// Creates a new CResult_AcceptChannelDecodeErrorZ in the success state.
9340 pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_ok(o: crate::lightning::ln::msgs::AcceptChannel) -> CResult_AcceptChannelDecodeErrorZ {
9341         CResult_AcceptChannelDecodeErrorZ {
9342                 contents: CResult_AcceptChannelDecodeErrorZPtr {
9343                         result: Box::into_raw(Box::new(o)),
9344                 },
9345                 result_ok: true,
9346         }
9347 }
9348 #[no_mangle]
9349 /// Creates a new CResult_AcceptChannelDecodeErrorZ in the error state.
9350 pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_AcceptChannelDecodeErrorZ {
9351         CResult_AcceptChannelDecodeErrorZ {
9352                 contents: CResult_AcceptChannelDecodeErrorZPtr {
9353                         err: Box::into_raw(Box::new(e)),
9354                 },
9355                 result_ok: false,
9356         }
9357 }
9358 #[no_mangle]
9359 /// Frees any resources used by the CResult_AcceptChannelDecodeErrorZ.
9360 pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_free(_res: CResult_AcceptChannelDecodeErrorZ) { }
9361 impl Drop for CResult_AcceptChannelDecodeErrorZ {
9362         fn drop(&mut self) {
9363                 if self.result_ok {
9364                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
9365                                 let _ = unsafe { Box::from_raw(self.contents.result) };
9366                         }
9367                 } else {
9368                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
9369                                 let _ = unsafe { Box::from_raw(self.contents.err) };
9370                         }
9371                 }
9372         }
9373 }
9374 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::AcceptChannel, crate::lightning::ln::msgs::DecodeError>> for CResult_AcceptChannelDecodeErrorZ {
9375         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::AcceptChannel, crate::lightning::ln::msgs::DecodeError>) -> Self {
9376                 let contents = if o.result_ok {
9377                         let result = unsafe { o.contents.result };
9378                         unsafe { o.contents.result = std::ptr::null_mut() };
9379                         CResult_AcceptChannelDecodeErrorZPtr { result }
9380                 } else {
9381                         let err = unsafe { o.contents.err };
9382                         unsafe { o.contents.err = std::ptr::null_mut(); }
9383                         CResult_AcceptChannelDecodeErrorZPtr { err }
9384                 };
9385                 Self {
9386                         contents,
9387                         result_ok: o.result_ok,
9388                 }
9389         }
9390 }
9391 impl Clone for CResult_AcceptChannelDecodeErrorZ {
9392         fn clone(&self) -> Self {
9393                 if self.result_ok {
9394                         Self { result_ok: true, contents: CResult_AcceptChannelDecodeErrorZPtr {
9395                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::AcceptChannel>::clone(unsafe { &*self.contents.result })))
9396                         } }
9397                 } else {
9398                         Self { result_ok: false, contents: CResult_AcceptChannelDecodeErrorZPtr {
9399                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
9400                         } }
9401                 }
9402         }
9403 }
9404 #[no_mangle]
9405 /// Creates a new CResult_AcceptChannelDecodeErrorZ which has the same data as `orig`
9406 /// but with all dynamically-allocated buffers duplicated in new buffers.
9407 pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_clone(orig: &CResult_AcceptChannelDecodeErrorZ) -> CResult_AcceptChannelDecodeErrorZ { Clone::clone(&orig) }
9408 #[repr(C)]
9409 /// The contents of CResult_AnnouncementSignaturesDecodeErrorZ
9410 pub union CResult_AnnouncementSignaturesDecodeErrorZPtr {
9411         /// A pointer to the contents in the success state.
9412         /// Reading from this pointer when `result_ok` is not set is undefined.
9413         pub result: *mut crate::lightning::ln::msgs::AnnouncementSignatures,
9414         /// A pointer to the contents in the error state.
9415         /// Reading from this pointer when `result_ok` is set is undefined.
9416         pub err: *mut crate::lightning::ln::msgs::DecodeError,
9417 }
9418 #[repr(C)]
9419 /// A CResult_AnnouncementSignaturesDecodeErrorZ represents the result of a fallible operation,
9420 /// containing a crate::lightning::ln::msgs::AnnouncementSignatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
9421 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9422 pub struct CResult_AnnouncementSignaturesDecodeErrorZ {
9423         /// The contents of this CResult_AnnouncementSignaturesDecodeErrorZ, accessible via either
9424         /// `err` or `result` depending on the state of `result_ok`.
9425         pub contents: CResult_AnnouncementSignaturesDecodeErrorZPtr,
9426         /// Whether this CResult_AnnouncementSignaturesDecodeErrorZ represents a success state.
9427         pub result_ok: bool,
9428 }
9429 #[no_mangle]
9430 /// Creates a new CResult_AnnouncementSignaturesDecodeErrorZ in the success state.
9431 pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_ok(o: crate::lightning::ln::msgs::AnnouncementSignatures) -> CResult_AnnouncementSignaturesDecodeErrorZ {
9432         CResult_AnnouncementSignaturesDecodeErrorZ {
9433                 contents: CResult_AnnouncementSignaturesDecodeErrorZPtr {
9434                         result: Box::into_raw(Box::new(o)),
9435                 },
9436                 result_ok: true,
9437         }
9438 }
9439 #[no_mangle]
9440 /// Creates a new CResult_AnnouncementSignaturesDecodeErrorZ in the error state.
9441 pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_AnnouncementSignaturesDecodeErrorZ {
9442         CResult_AnnouncementSignaturesDecodeErrorZ {
9443                 contents: CResult_AnnouncementSignaturesDecodeErrorZPtr {
9444                         err: Box::into_raw(Box::new(e)),
9445                 },
9446                 result_ok: false,
9447         }
9448 }
9449 #[no_mangle]
9450 /// Frees any resources used by the CResult_AnnouncementSignaturesDecodeErrorZ.
9451 pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_free(_res: CResult_AnnouncementSignaturesDecodeErrorZ) { }
9452 impl Drop for CResult_AnnouncementSignaturesDecodeErrorZ {
9453         fn drop(&mut self) {
9454                 if self.result_ok {
9455                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
9456                                 let _ = unsafe { Box::from_raw(self.contents.result) };
9457                         }
9458                 } else {
9459                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
9460                                 let _ = unsafe { Box::from_raw(self.contents.err) };
9461                         }
9462                 }
9463         }
9464 }
9465 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::AnnouncementSignatures, crate::lightning::ln::msgs::DecodeError>> for CResult_AnnouncementSignaturesDecodeErrorZ {
9466         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::AnnouncementSignatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
9467                 let contents = if o.result_ok {
9468                         let result = unsafe { o.contents.result };
9469                         unsafe { o.contents.result = std::ptr::null_mut() };
9470                         CResult_AnnouncementSignaturesDecodeErrorZPtr { result }
9471                 } else {
9472                         let err = unsafe { o.contents.err };
9473                         unsafe { o.contents.err = std::ptr::null_mut(); }
9474                         CResult_AnnouncementSignaturesDecodeErrorZPtr { err }
9475                 };
9476                 Self {
9477                         contents,
9478                         result_ok: o.result_ok,
9479                 }
9480         }
9481 }
9482 impl Clone for CResult_AnnouncementSignaturesDecodeErrorZ {
9483         fn clone(&self) -> Self {
9484                 if self.result_ok {
9485                         Self { result_ok: true, contents: CResult_AnnouncementSignaturesDecodeErrorZPtr {
9486                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::AnnouncementSignatures>::clone(unsafe { &*self.contents.result })))
9487                         } }
9488                 } else {
9489                         Self { result_ok: false, contents: CResult_AnnouncementSignaturesDecodeErrorZPtr {
9490                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
9491                         } }
9492                 }
9493         }
9494 }
9495 #[no_mangle]
9496 /// Creates a new CResult_AnnouncementSignaturesDecodeErrorZ which has the same data as `orig`
9497 /// but with all dynamically-allocated buffers duplicated in new buffers.
9498 pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_clone(orig: &CResult_AnnouncementSignaturesDecodeErrorZ) -> CResult_AnnouncementSignaturesDecodeErrorZ { Clone::clone(&orig) }
9499 #[repr(C)]
9500 /// The contents of CResult_ChannelReestablishDecodeErrorZ
9501 pub union CResult_ChannelReestablishDecodeErrorZPtr {
9502         /// A pointer to the contents in the success state.
9503         /// Reading from this pointer when `result_ok` is not set is undefined.
9504         pub result: *mut crate::lightning::ln::msgs::ChannelReestablish,
9505         /// A pointer to the contents in the error state.
9506         /// Reading from this pointer when `result_ok` is set is undefined.
9507         pub err: *mut crate::lightning::ln::msgs::DecodeError,
9508 }
9509 #[repr(C)]
9510 /// A CResult_ChannelReestablishDecodeErrorZ represents the result of a fallible operation,
9511 /// containing a crate::lightning::ln::msgs::ChannelReestablish on success and a crate::lightning::ln::msgs::DecodeError on failure.
9512 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9513 pub struct CResult_ChannelReestablishDecodeErrorZ {
9514         /// The contents of this CResult_ChannelReestablishDecodeErrorZ, accessible via either
9515         /// `err` or `result` depending on the state of `result_ok`.
9516         pub contents: CResult_ChannelReestablishDecodeErrorZPtr,
9517         /// Whether this CResult_ChannelReestablishDecodeErrorZ represents a success state.
9518         pub result_ok: bool,
9519 }
9520 #[no_mangle]
9521 /// Creates a new CResult_ChannelReestablishDecodeErrorZ in the success state.
9522 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ChannelReestablish) -> CResult_ChannelReestablishDecodeErrorZ {
9523         CResult_ChannelReestablishDecodeErrorZ {
9524                 contents: CResult_ChannelReestablishDecodeErrorZPtr {
9525                         result: Box::into_raw(Box::new(o)),
9526                 },
9527                 result_ok: true,
9528         }
9529 }
9530 #[no_mangle]
9531 /// Creates a new CResult_ChannelReestablishDecodeErrorZ in the error state.
9532 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelReestablishDecodeErrorZ {
9533         CResult_ChannelReestablishDecodeErrorZ {
9534                 contents: CResult_ChannelReestablishDecodeErrorZPtr {
9535                         err: Box::into_raw(Box::new(e)),
9536                 },
9537                 result_ok: false,
9538         }
9539 }
9540 #[no_mangle]
9541 /// Frees any resources used by the CResult_ChannelReestablishDecodeErrorZ.
9542 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_free(_res: CResult_ChannelReestablishDecodeErrorZ) { }
9543 impl Drop for CResult_ChannelReestablishDecodeErrorZ {
9544         fn drop(&mut self) {
9545                 if self.result_ok {
9546                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
9547                                 let _ = unsafe { Box::from_raw(self.contents.result) };
9548                         }
9549                 } else {
9550                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
9551                                 let _ = unsafe { Box::from_raw(self.contents.err) };
9552                         }
9553                 }
9554         }
9555 }
9556 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelReestablish, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelReestablishDecodeErrorZ {
9557         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelReestablish, crate::lightning::ln::msgs::DecodeError>) -> Self {
9558                 let contents = if o.result_ok {
9559                         let result = unsafe { o.contents.result };
9560                         unsafe { o.contents.result = std::ptr::null_mut() };
9561                         CResult_ChannelReestablishDecodeErrorZPtr { result }
9562                 } else {
9563                         let err = unsafe { o.contents.err };
9564                         unsafe { o.contents.err = std::ptr::null_mut(); }
9565                         CResult_ChannelReestablishDecodeErrorZPtr { err }
9566                 };
9567                 Self {
9568                         contents,
9569                         result_ok: o.result_ok,
9570                 }
9571         }
9572 }
9573 impl Clone for CResult_ChannelReestablishDecodeErrorZ {
9574         fn clone(&self) -> Self {
9575                 if self.result_ok {
9576                         Self { result_ok: true, contents: CResult_ChannelReestablishDecodeErrorZPtr {
9577                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ChannelReestablish>::clone(unsafe { &*self.contents.result })))
9578                         } }
9579                 } else {
9580                         Self { result_ok: false, contents: CResult_ChannelReestablishDecodeErrorZPtr {
9581                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
9582                         } }
9583                 }
9584         }
9585 }
9586 #[no_mangle]
9587 /// Creates a new CResult_ChannelReestablishDecodeErrorZ which has the same data as `orig`
9588 /// but with all dynamically-allocated buffers duplicated in new buffers.
9589 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_clone(orig: &CResult_ChannelReestablishDecodeErrorZ) -> CResult_ChannelReestablishDecodeErrorZ { Clone::clone(&orig) }
9590 #[repr(C)]
9591 /// The contents of CResult_ClosingSignedDecodeErrorZ
9592 pub union CResult_ClosingSignedDecodeErrorZPtr {
9593         /// A pointer to the contents in the success state.
9594         /// Reading from this pointer when `result_ok` is not set is undefined.
9595         pub result: *mut crate::lightning::ln::msgs::ClosingSigned,
9596         /// A pointer to the contents in the error state.
9597         /// Reading from this pointer when `result_ok` is set is undefined.
9598         pub err: *mut crate::lightning::ln::msgs::DecodeError,
9599 }
9600 #[repr(C)]
9601 /// A CResult_ClosingSignedDecodeErrorZ represents the result of a fallible operation,
9602 /// containing a crate::lightning::ln::msgs::ClosingSigned on success and a crate::lightning::ln::msgs::DecodeError on failure.
9603 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9604 pub struct CResult_ClosingSignedDecodeErrorZ {
9605         /// The contents of this CResult_ClosingSignedDecodeErrorZ, accessible via either
9606         /// `err` or `result` depending on the state of `result_ok`.
9607         pub contents: CResult_ClosingSignedDecodeErrorZPtr,
9608         /// Whether this CResult_ClosingSignedDecodeErrorZ represents a success state.
9609         pub result_ok: bool,
9610 }
9611 #[no_mangle]
9612 /// Creates a new CResult_ClosingSignedDecodeErrorZ in the success state.
9613 pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ClosingSigned) -> CResult_ClosingSignedDecodeErrorZ {
9614         CResult_ClosingSignedDecodeErrorZ {
9615                 contents: CResult_ClosingSignedDecodeErrorZPtr {
9616                         result: Box::into_raw(Box::new(o)),
9617                 },
9618                 result_ok: true,
9619         }
9620 }
9621 #[no_mangle]
9622 /// Creates a new CResult_ClosingSignedDecodeErrorZ in the error state.
9623 pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ClosingSignedDecodeErrorZ {
9624         CResult_ClosingSignedDecodeErrorZ {
9625                 contents: CResult_ClosingSignedDecodeErrorZPtr {
9626                         err: Box::into_raw(Box::new(e)),
9627                 },
9628                 result_ok: false,
9629         }
9630 }
9631 #[no_mangle]
9632 /// Frees any resources used by the CResult_ClosingSignedDecodeErrorZ.
9633 pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_free(_res: CResult_ClosingSignedDecodeErrorZ) { }
9634 impl Drop for CResult_ClosingSignedDecodeErrorZ {
9635         fn drop(&mut self) {
9636                 if self.result_ok {
9637                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
9638                                 let _ = unsafe { Box::from_raw(self.contents.result) };
9639                         }
9640                 } else {
9641                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
9642                                 let _ = unsafe { Box::from_raw(self.contents.err) };
9643                         }
9644                 }
9645         }
9646 }
9647 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ClosingSigned, crate::lightning::ln::msgs::DecodeError>> for CResult_ClosingSignedDecodeErrorZ {
9648         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ClosingSigned, crate::lightning::ln::msgs::DecodeError>) -> Self {
9649                 let contents = if o.result_ok {
9650                         let result = unsafe { o.contents.result };
9651                         unsafe { o.contents.result = std::ptr::null_mut() };
9652                         CResult_ClosingSignedDecodeErrorZPtr { result }
9653                 } else {
9654                         let err = unsafe { o.contents.err };
9655                         unsafe { o.contents.err = std::ptr::null_mut(); }
9656                         CResult_ClosingSignedDecodeErrorZPtr { err }
9657                 };
9658                 Self {
9659                         contents,
9660                         result_ok: o.result_ok,
9661                 }
9662         }
9663 }
9664 impl Clone for CResult_ClosingSignedDecodeErrorZ {
9665         fn clone(&self) -> Self {
9666                 if self.result_ok {
9667                         Self { result_ok: true, contents: CResult_ClosingSignedDecodeErrorZPtr {
9668                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ClosingSigned>::clone(unsafe { &*self.contents.result })))
9669                         } }
9670                 } else {
9671                         Self { result_ok: false, contents: CResult_ClosingSignedDecodeErrorZPtr {
9672                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
9673                         } }
9674                 }
9675         }
9676 }
9677 #[no_mangle]
9678 /// Creates a new CResult_ClosingSignedDecodeErrorZ which has the same data as `orig`
9679 /// but with all dynamically-allocated buffers duplicated in new buffers.
9680 pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_clone(orig: &CResult_ClosingSignedDecodeErrorZ) -> CResult_ClosingSignedDecodeErrorZ { Clone::clone(&orig) }
9681 #[repr(C)]
9682 /// The contents of CResult_ClosingSignedFeeRangeDecodeErrorZ
9683 pub union CResult_ClosingSignedFeeRangeDecodeErrorZPtr {
9684         /// A pointer to the contents in the success state.
9685         /// Reading from this pointer when `result_ok` is not set is undefined.
9686         pub result: *mut crate::lightning::ln::msgs::ClosingSignedFeeRange,
9687         /// A pointer to the contents in the error state.
9688         /// Reading from this pointer when `result_ok` is set is undefined.
9689         pub err: *mut crate::lightning::ln::msgs::DecodeError,
9690 }
9691 #[repr(C)]
9692 /// A CResult_ClosingSignedFeeRangeDecodeErrorZ represents the result of a fallible operation,
9693 /// containing a crate::lightning::ln::msgs::ClosingSignedFeeRange on success and a crate::lightning::ln::msgs::DecodeError on failure.
9694 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9695 pub struct CResult_ClosingSignedFeeRangeDecodeErrorZ {
9696         /// The contents of this CResult_ClosingSignedFeeRangeDecodeErrorZ, accessible via either
9697         /// `err` or `result` depending on the state of `result_ok`.
9698         pub contents: CResult_ClosingSignedFeeRangeDecodeErrorZPtr,
9699         /// Whether this CResult_ClosingSignedFeeRangeDecodeErrorZ represents a success state.
9700         pub result_ok: bool,
9701 }
9702 #[no_mangle]
9703 /// Creates a new CResult_ClosingSignedFeeRangeDecodeErrorZ in the success state.
9704 pub extern "C" fn CResult_ClosingSignedFeeRangeDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ClosingSignedFeeRange) -> CResult_ClosingSignedFeeRangeDecodeErrorZ {
9705         CResult_ClosingSignedFeeRangeDecodeErrorZ {
9706                 contents: CResult_ClosingSignedFeeRangeDecodeErrorZPtr {
9707                         result: Box::into_raw(Box::new(o)),
9708                 },
9709                 result_ok: true,
9710         }
9711 }
9712 #[no_mangle]
9713 /// Creates a new CResult_ClosingSignedFeeRangeDecodeErrorZ in the error state.
9714 pub extern "C" fn CResult_ClosingSignedFeeRangeDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ClosingSignedFeeRangeDecodeErrorZ {
9715         CResult_ClosingSignedFeeRangeDecodeErrorZ {
9716                 contents: CResult_ClosingSignedFeeRangeDecodeErrorZPtr {
9717                         err: Box::into_raw(Box::new(e)),
9718                 },
9719                 result_ok: false,
9720         }
9721 }
9722 #[no_mangle]
9723 /// Frees any resources used by the CResult_ClosingSignedFeeRangeDecodeErrorZ.
9724 pub extern "C" fn CResult_ClosingSignedFeeRangeDecodeErrorZ_free(_res: CResult_ClosingSignedFeeRangeDecodeErrorZ) { }
9725 impl Drop for CResult_ClosingSignedFeeRangeDecodeErrorZ {
9726         fn drop(&mut self) {
9727                 if self.result_ok {
9728                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
9729                                 let _ = unsafe { Box::from_raw(self.contents.result) };
9730                         }
9731                 } else {
9732                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
9733                                 let _ = unsafe { Box::from_raw(self.contents.err) };
9734                         }
9735                 }
9736         }
9737 }
9738 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ClosingSignedFeeRange, crate::lightning::ln::msgs::DecodeError>> for CResult_ClosingSignedFeeRangeDecodeErrorZ {
9739         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ClosingSignedFeeRange, crate::lightning::ln::msgs::DecodeError>) -> Self {
9740                 let contents = if o.result_ok {
9741                         let result = unsafe { o.contents.result };
9742                         unsafe { o.contents.result = std::ptr::null_mut() };
9743                         CResult_ClosingSignedFeeRangeDecodeErrorZPtr { result }
9744                 } else {
9745                         let err = unsafe { o.contents.err };
9746                         unsafe { o.contents.err = std::ptr::null_mut(); }
9747                         CResult_ClosingSignedFeeRangeDecodeErrorZPtr { err }
9748                 };
9749                 Self {
9750                         contents,
9751                         result_ok: o.result_ok,
9752                 }
9753         }
9754 }
9755 impl Clone for CResult_ClosingSignedFeeRangeDecodeErrorZ {
9756         fn clone(&self) -> Self {
9757                 if self.result_ok {
9758                         Self { result_ok: true, contents: CResult_ClosingSignedFeeRangeDecodeErrorZPtr {
9759                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ClosingSignedFeeRange>::clone(unsafe { &*self.contents.result })))
9760                         } }
9761                 } else {
9762                         Self { result_ok: false, contents: CResult_ClosingSignedFeeRangeDecodeErrorZPtr {
9763                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
9764                         } }
9765                 }
9766         }
9767 }
9768 #[no_mangle]
9769 /// Creates a new CResult_ClosingSignedFeeRangeDecodeErrorZ which has the same data as `orig`
9770 /// but with all dynamically-allocated buffers duplicated in new buffers.
9771 pub extern "C" fn CResult_ClosingSignedFeeRangeDecodeErrorZ_clone(orig: &CResult_ClosingSignedFeeRangeDecodeErrorZ) -> CResult_ClosingSignedFeeRangeDecodeErrorZ { Clone::clone(&orig) }
9772 #[repr(C)]
9773 /// The contents of CResult_CommitmentSignedDecodeErrorZ
9774 pub union CResult_CommitmentSignedDecodeErrorZPtr {
9775         /// A pointer to the contents in the success state.
9776         /// Reading from this pointer when `result_ok` is not set is undefined.
9777         pub result: *mut crate::lightning::ln::msgs::CommitmentSigned,
9778         /// A pointer to the contents in the error state.
9779         /// Reading from this pointer when `result_ok` is set is undefined.
9780         pub err: *mut crate::lightning::ln::msgs::DecodeError,
9781 }
9782 #[repr(C)]
9783 /// A CResult_CommitmentSignedDecodeErrorZ represents the result of a fallible operation,
9784 /// containing a crate::lightning::ln::msgs::CommitmentSigned on success and a crate::lightning::ln::msgs::DecodeError on failure.
9785 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9786 pub struct CResult_CommitmentSignedDecodeErrorZ {
9787         /// The contents of this CResult_CommitmentSignedDecodeErrorZ, accessible via either
9788         /// `err` or `result` depending on the state of `result_ok`.
9789         pub contents: CResult_CommitmentSignedDecodeErrorZPtr,
9790         /// Whether this CResult_CommitmentSignedDecodeErrorZ represents a success state.
9791         pub result_ok: bool,
9792 }
9793 #[no_mangle]
9794 /// Creates a new CResult_CommitmentSignedDecodeErrorZ in the success state.
9795 pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_ok(o: crate::lightning::ln::msgs::CommitmentSigned) -> CResult_CommitmentSignedDecodeErrorZ {
9796         CResult_CommitmentSignedDecodeErrorZ {
9797                 contents: CResult_CommitmentSignedDecodeErrorZPtr {
9798                         result: Box::into_raw(Box::new(o)),
9799                 },
9800                 result_ok: true,
9801         }
9802 }
9803 #[no_mangle]
9804 /// Creates a new CResult_CommitmentSignedDecodeErrorZ in the error state.
9805 pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_CommitmentSignedDecodeErrorZ {
9806         CResult_CommitmentSignedDecodeErrorZ {
9807                 contents: CResult_CommitmentSignedDecodeErrorZPtr {
9808                         err: Box::into_raw(Box::new(e)),
9809                 },
9810                 result_ok: false,
9811         }
9812 }
9813 #[no_mangle]
9814 /// Frees any resources used by the CResult_CommitmentSignedDecodeErrorZ.
9815 pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_free(_res: CResult_CommitmentSignedDecodeErrorZ) { }
9816 impl Drop for CResult_CommitmentSignedDecodeErrorZ {
9817         fn drop(&mut self) {
9818                 if self.result_ok {
9819                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
9820                                 let _ = unsafe { Box::from_raw(self.contents.result) };
9821                         }
9822                 } else {
9823                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
9824                                 let _ = unsafe { Box::from_raw(self.contents.err) };
9825                         }
9826                 }
9827         }
9828 }
9829 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::CommitmentSigned, crate::lightning::ln::msgs::DecodeError>> for CResult_CommitmentSignedDecodeErrorZ {
9830         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::CommitmentSigned, crate::lightning::ln::msgs::DecodeError>) -> Self {
9831                 let contents = if o.result_ok {
9832                         let result = unsafe { o.contents.result };
9833                         unsafe { o.contents.result = std::ptr::null_mut() };
9834                         CResult_CommitmentSignedDecodeErrorZPtr { result }
9835                 } else {
9836                         let err = unsafe { o.contents.err };
9837                         unsafe { o.contents.err = std::ptr::null_mut(); }
9838                         CResult_CommitmentSignedDecodeErrorZPtr { err }
9839                 };
9840                 Self {
9841                         contents,
9842                         result_ok: o.result_ok,
9843                 }
9844         }
9845 }
9846 impl Clone for CResult_CommitmentSignedDecodeErrorZ {
9847         fn clone(&self) -> Self {
9848                 if self.result_ok {
9849                         Self { result_ok: true, contents: CResult_CommitmentSignedDecodeErrorZPtr {
9850                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::CommitmentSigned>::clone(unsafe { &*self.contents.result })))
9851                         } }
9852                 } else {
9853                         Self { result_ok: false, contents: CResult_CommitmentSignedDecodeErrorZPtr {
9854                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
9855                         } }
9856                 }
9857         }
9858 }
9859 #[no_mangle]
9860 /// Creates a new CResult_CommitmentSignedDecodeErrorZ which has the same data as `orig`
9861 /// but with all dynamically-allocated buffers duplicated in new buffers.
9862 pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_clone(orig: &CResult_CommitmentSignedDecodeErrorZ) -> CResult_CommitmentSignedDecodeErrorZ { Clone::clone(&orig) }
9863 #[repr(C)]
9864 /// The contents of CResult_FundingCreatedDecodeErrorZ
9865 pub union CResult_FundingCreatedDecodeErrorZPtr {
9866         /// A pointer to the contents in the success state.
9867         /// Reading from this pointer when `result_ok` is not set is undefined.
9868         pub result: *mut crate::lightning::ln::msgs::FundingCreated,
9869         /// A pointer to the contents in the error state.
9870         /// Reading from this pointer when `result_ok` is set is undefined.
9871         pub err: *mut crate::lightning::ln::msgs::DecodeError,
9872 }
9873 #[repr(C)]
9874 /// A CResult_FundingCreatedDecodeErrorZ represents the result of a fallible operation,
9875 /// containing a crate::lightning::ln::msgs::FundingCreated on success and a crate::lightning::ln::msgs::DecodeError on failure.
9876 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9877 pub struct CResult_FundingCreatedDecodeErrorZ {
9878         /// The contents of this CResult_FundingCreatedDecodeErrorZ, accessible via either
9879         /// `err` or `result` depending on the state of `result_ok`.
9880         pub contents: CResult_FundingCreatedDecodeErrorZPtr,
9881         /// Whether this CResult_FundingCreatedDecodeErrorZ represents a success state.
9882         pub result_ok: bool,
9883 }
9884 #[no_mangle]
9885 /// Creates a new CResult_FundingCreatedDecodeErrorZ in the success state.
9886 pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_ok(o: crate::lightning::ln::msgs::FundingCreated) -> CResult_FundingCreatedDecodeErrorZ {
9887         CResult_FundingCreatedDecodeErrorZ {
9888                 contents: CResult_FundingCreatedDecodeErrorZPtr {
9889                         result: Box::into_raw(Box::new(o)),
9890                 },
9891                 result_ok: true,
9892         }
9893 }
9894 #[no_mangle]
9895 /// Creates a new CResult_FundingCreatedDecodeErrorZ in the error state.
9896 pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_FundingCreatedDecodeErrorZ {
9897         CResult_FundingCreatedDecodeErrorZ {
9898                 contents: CResult_FundingCreatedDecodeErrorZPtr {
9899                         err: Box::into_raw(Box::new(e)),
9900                 },
9901                 result_ok: false,
9902         }
9903 }
9904 #[no_mangle]
9905 /// Frees any resources used by the CResult_FundingCreatedDecodeErrorZ.
9906 pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_free(_res: CResult_FundingCreatedDecodeErrorZ) { }
9907 impl Drop for CResult_FundingCreatedDecodeErrorZ {
9908         fn drop(&mut self) {
9909                 if self.result_ok {
9910                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
9911                                 let _ = unsafe { Box::from_raw(self.contents.result) };
9912                         }
9913                 } else {
9914                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
9915                                 let _ = unsafe { Box::from_raw(self.contents.err) };
9916                         }
9917                 }
9918         }
9919 }
9920 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::FundingCreated, crate::lightning::ln::msgs::DecodeError>> for CResult_FundingCreatedDecodeErrorZ {
9921         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::FundingCreated, crate::lightning::ln::msgs::DecodeError>) -> Self {
9922                 let contents = if o.result_ok {
9923                         let result = unsafe { o.contents.result };
9924                         unsafe { o.contents.result = std::ptr::null_mut() };
9925                         CResult_FundingCreatedDecodeErrorZPtr { result }
9926                 } else {
9927                         let err = unsafe { o.contents.err };
9928                         unsafe { o.contents.err = std::ptr::null_mut(); }
9929                         CResult_FundingCreatedDecodeErrorZPtr { err }
9930                 };
9931                 Self {
9932                         contents,
9933                         result_ok: o.result_ok,
9934                 }
9935         }
9936 }
9937 impl Clone for CResult_FundingCreatedDecodeErrorZ {
9938         fn clone(&self) -> Self {
9939                 if self.result_ok {
9940                         Self { result_ok: true, contents: CResult_FundingCreatedDecodeErrorZPtr {
9941                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::FundingCreated>::clone(unsafe { &*self.contents.result })))
9942                         } }
9943                 } else {
9944                         Self { result_ok: false, contents: CResult_FundingCreatedDecodeErrorZPtr {
9945                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
9946                         } }
9947                 }
9948         }
9949 }
9950 #[no_mangle]
9951 /// Creates a new CResult_FundingCreatedDecodeErrorZ which has the same data as `orig`
9952 /// but with all dynamically-allocated buffers duplicated in new buffers.
9953 pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_clone(orig: &CResult_FundingCreatedDecodeErrorZ) -> CResult_FundingCreatedDecodeErrorZ { Clone::clone(&orig) }
9954 #[repr(C)]
9955 /// The contents of CResult_FundingSignedDecodeErrorZ
9956 pub union CResult_FundingSignedDecodeErrorZPtr {
9957         /// A pointer to the contents in the success state.
9958         /// Reading from this pointer when `result_ok` is not set is undefined.
9959         pub result: *mut crate::lightning::ln::msgs::FundingSigned,
9960         /// A pointer to the contents in the error state.
9961         /// Reading from this pointer when `result_ok` is set is undefined.
9962         pub err: *mut crate::lightning::ln::msgs::DecodeError,
9963 }
9964 #[repr(C)]
9965 /// A CResult_FundingSignedDecodeErrorZ represents the result of a fallible operation,
9966 /// containing a crate::lightning::ln::msgs::FundingSigned on success and a crate::lightning::ln::msgs::DecodeError on failure.
9967 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9968 pub struct CResult_FundingSignedDecodeErrorZ {
9969         /// The contents of this CResult_FundingSignedDecodeErrorZ, accessible via either
9970         /// `err` or `result` depending on the state of `result_ok`.
9971         pub contents: CResult_FundingSignedDecodeErrorZPtr,
9972         /// Whether this CResult_FundingSignedDecodeErrorZ represents a success state.
9973         pub result_ok: bool,
9974 }
9975 #[no_mangle]
9976 /// Creates a new CResult_FundingSignedDecodeErrorZ in the success state.
9977 pub extern "C" fn CResult_FundingSignedDecodeErrorZ_ok(o: crate::lightning::ln::msgs::FundingSigned) -> CResult_FundingSignedDecodeErrorZ {
9978         CResult_FundingSignedDecodeErrorZ {
9979                 contents: CResult_FundingSignedDecodeErrorZPtr {
9980                         result: Box::into_raw(Box::new(o)),
9981                 },
9982                 result_ok: true,
9983         }
9984 }
9985 #[no_mangle]
9986 /// Creates a new CResult_FundingSignedDecodeErrorZ in the error state.
9987 pub extern "C" fn CResult_FundingSignedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_FundingSignedDecodeErrorZ {
9988         CResult_FundingSignedDecodeErrorZ {
9989                 contents: CResult_FundingSignedDecodeErrorZPtr {
9990                         err: Box::into_raw(Box::new(e)),
9991                 },
9992                 result_ok: false,
9993         }
9994 }
9995 #[no_mangle]
9996 /// Frees any resources used by the CResult_FundingSignedDecodeErrorZ.
9997 pub extern "C" fn CResult_FundingSignedDecodeErrorZ_free(_res: CResult_FundingSignedDecodeErrorZ) { }
9998 impl Drop for CResult_FundingSignedDecodeErrorZ {
9999         fn drop(&mut self) {
10000                 if self.result_ok {
10001                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
10002                                 let _ = unsafe { Box::from_raw(self.contents.result) };
10003                         }
10004                 } else {
10005                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
10006                                 let _ = unsafe { Box::from_raw(self.contents.err) };
10007                         }
10008                 }
10009         }
10010 }
10011 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::FundingSigned, crate::lightning::ln::msgs::DecodeError>> for CResult_FundingSignedDecodeErrorZ {
10012         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::FundingSigned, crate::lightning::ln::msgs::DecodeError>) -> Self {
10013                 let contents = if o.result_ok {
10014                         let result = unsafe { o.contents.result };
10015                         unsafe { o.contents.result = std::ptr::null_mut() };
10016                         CResult_FundingSignedDecodeErrorZPtr { result }
10017                 } else {
10018                         let err = unsafe { o.contents.err };
10019                         unsafe { o.contents.err = std::ptr::null_mut(); }
10020                         CResult_FundingSignedDecodeErrorZPtr { err }
10021                 };
10022                 Self {
10023                         contents,
10024                         result_ok: o.result_ok,
10025                 }
10026         }
10027 }
10028 impl Clone for CResult_FundingSignedDecodeErrorZ {
10029         fn clone(&self) -> Self {
10030                 if self.result_ok {
10031                         Self { result_ok: true, contents: CResult_FundingSignedDecodeErrorZPtr {
10032                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::FundingSigned>::clone(unsafe { &*self.contents.result })))
10033                         } }
10034                 } else {
10035                         Self { result_ok: false, contents: CResult_FundingSignedDecodeErrorZPtr {
10036                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
10037                         } }
10038                 }
10039         }
10040 }
10041 #[no_mangle]
10042 /// Creates a new CResult_FundingSignedDecodeErrorZ which has the same data as `orig`
10043 /// but with all dynamically-allocated buffers duplicated in new buffers.
10044 pub extern "C" fn CResult_FundingSignedDecodeErrorZ_clone(orig: &CResult_FundingSignedDecodeErrorZ) -> CResult_FundingSignedDecodeErrorZ { Clone::clone(&orig) }
10045 #[repr(C)]
10046 /// The contents of CResult_FundingLockedDecodeErrorZ
10047 pub union CResult_FundingLockedDecodeErrorZPtr {
10048         /// A pointer to the contents in the success state.
10049         /// Reading from this pointer when `result_ok` is not set is undefined.
10050         pub result: *mut crate::lightning::ln::msgs::FundingLocked,
10051         /// A pointer to the contents in the error state.
10052         /// Reading from this pointer when `result_ok` is set is undefined.
10053         pub err: *mut crate::lightning::ln::msgs::DecodeError,
10054 }
10055 #[repr(C)]
10056 /// A CResult_FundingLockedDecodeErrorZ represents the result of a fallible operation,
10057 /// containing a crate::lightning::ln::msgs::FundingLocked on success and a crate::lightning::ln::msgs::DecodeError on failure.
10058 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10059 pub struct CResult_FundingLockedDecodeErrorZ {
10060         /// The contents of this CResult_FundingLockedDecodeErrorZ, accessible via either
10061         /// `err` or `result` depending on the state of `result_ok`.
10062         pub contents: CResult_FundingLockedDecodeErrorZPtr,
10063         /// Whether this CResult_FundingLockedDecodeErrorZ represents a success state.
10064         pub result_ok: bool,
10065 }
10066 #[no_mangle]
10067 /// Creates a new CResult_FundingLockedDecodeErrorZ in the success state.
10068 pub extern "C" fn CResult_FundingLockedDecodeErrorZ_ok(o: crate::lightning::ln::msgs::FundingLocked) -> CResult_FundingLockedDecodeErrorZ {
10069         CResult_FundingLockedDecodeErrorZ {
10070                 contents: CResult_FundingLockedDecodeErrorZPtr {
10071                         result: Box::into_raw(Box::new(o)),
10072                 },
10073                 result_ok: true,
10074         }
10075 }
10076 #[no_mangle]
10077 /// Creates a new CResult_FundingLockedDecodeErrorZ in the error state.
10078 pub extern "C" fn CResult_FundingLockedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_FundingLockedDecodeErrorZ {
10079         CResult_FundingLockedDecodeErrorZ {
10080                 contents: CResult_FundingLockedDecodeErrorZPtr {
10081                         err: Box::into_raw(Box::new(e)),
10082                 },
10083                 result_ok: false,
10084         }
10085 }
10086 #[no_mangle]
10087 /// Frees any resources used by the CResult_FundingLockedDecodeErrorZ.
10088 pub extern "C" fn CResult_FundingLockedDecodeErrorZ_free(_res: CResult_FundingLockedDecodeErrorZ) { }
10089 impl Drop for CResult_FundingLockedDecodeErrorZ {
10090         fn drop(&mut self) {
10091                 if self.result_ok {
10092                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
10093                                 let _ = unsafe { Box::from_raw(self.contents.result) };
10094                         }
10095                 } else {
10096                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
10097                                 let _ = unsafe { Box::from_raw(self.contents.err) };
10098                         }
10099                 }
10100         }
10101 }
10102 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::FundingLocked, crate::lightning::ln::msgs::DecodeError>> for CResult_FundingLockedDecodeErrorZ {
10103         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::FundingLocked, crate::lightning::ln::msgs::DecodeError>) -> Self {
10104                 let contents = if o.result_ok {
10105                         let result = unsafe { o.contents.result };
10106                         unsafe { o.contents.result = std::ptr::null_mut() };
10107                         CResult_FundingLockedDecodeErrorZPtr { result }
10108                 } else {
10109                         let err = unsafe { o.contents.err };
10110                         unsafe { o.contents.err = std::ptr::null_mut(); }
10111                         CResult_FundingLockedDecodeErrorZPtr { err }
10112                 };
10113                 Self {
10114                         contents,
10115                         result_ok: o.result_ok,
10116                 }
10117         }
10118 }
10119 impl Clone for CResult_FundingLockedDecodeErrorZ {
10120         fn clone(&self) -> Self {
10121                 if self.result_ok {
10122                         Self { result_ok: true, contents: CResult_FundingLockedDecodeErrorZPtr {
10123                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::FundingLocked>::clone(unsafe { &*self.contents.result })))
10124                         } }
10125                 } else {
10126                         Self { result_ok: false, contents: CResult_FundingLockedDecodeErrorZPtr {
10127                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
10128                         } }
10129                 }
10130         }
10131 }
10132 #[no_mangle]
10133 /// Creates a new CResult_FundingLockedDecodeErrorZ which has the same data as `orig`
10134 /// but with all dynamically-allocated buffers duplicated in new buffers.
10135 pub extern "C" fn CResult_FundingLockedDecodeErrorZ_clone(orig: &CResult_FundingLockedDecodeErrorZ) -> CResult_FundingLockedDecodeErrorZ { Clone::clone(&orig) }
10136 #[repr(C)]
10137 /// The contents of CResult_InitDecodeErrorZ
10138 pub union CResult_InitDecodeErrorZPtr {
10139         /// A pointer to the contents in the success state.
10140         /// Reading from this pointer when `result_ok` is not set is undefined.
10141         pub result: *mut crate::lightning::ln::msgs::Init,
10142         /// A pointer to the contents in the error state.
10143         /// Reading from this pointer when `result_ok` is set is undefined.
10144         pub err: *mut crate::lightning::ln::msgs::DecodeError,
10145 }
10146 #[repr(C)]
10147 /// A CResult_InitDecodeErrorZ represents the result of a fallible operation,
10148 /// containing a crate::lightning::ln::msgs::Init on success and a crate::lightning::ln::msgs::DecodeError on failure.
10149 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10150 pub struct CResult_InitDecodeErrorZ {
10151         /// The contents of this CResult_InitDecodeErrorZ, accessible via either
10152         /// `err` or `result` depending on the state of `result_ok`.
10153         pub contents: CResult_InitDecodeErrorZPtr,
10154         /// Whether this CResult_InitDecodeErrorZ represents a success state.
10155         pub result_ok: bool,
10156 }
10157 #[no_mangle]
10158 /// Creates a new CResult_InitDecodeErrorZ in the success state.
10159 pub extern "C" fn CResult_InitDecodeErrorZ_ok(o: crate::lightning::ln::msgs::Init) -> CResult_InitDecodeErrorZ {
10160         CResult_InitDecodeErrorZ {
10161                 contents: CResult_InitDecodeErrorZPtr {
10162                         result: Box::into_raw(Box::new(o)),
10163                 },
10164                 result_ok: true,
10165         }
10166 }
10167 #[no_mangle]
10168 /// Creates a new CResult_InitDecodeErrorZ in the error state.
10169 pub extern "C" fn CResult_InitDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_InitDecodeErrorZ {
10170         CResult_InitDecodeErrorZ {
10171                 contents: CResult_InitDecodeErrorZPtr {
10172                         err: Box::into_raw(Box::new(e)),
10173                 },
10174                 result_ok: false,
10175         }
10176 }
10177 #[no_mangle]
10178 /// Frees any resources used by the CResult_InitDecodeErrorZ.
10179 pub extern "C" fn CResult_InitDecodeErrorZ_free(_res: CResult_InitDecodeErrorZ) { }
10180 impl Drop for CResult_InitDecodeErrorZ {
10181         fn drop(&mut self) {
10182                 if self.result_ok {
10183                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
10184                                 let _ = unsafe { Box::from_raw(self.contents.result) };
10185                         }
10186                 } else {
10187                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
10188                                 let _ = unsafe { Box::from_raw(self.contents.err) };
10189                         }
10190                 }
10191         }
10192 }
10193 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::Init, crate::lightning::ln::msgs::DecodeError>> for CResult_InitDecodeErrorZ {
10194         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::Init, crate::lightning::ln::msgs::DecodeError>) -> Self {
10195                 let contents = if o.result_ok {
10196                         let result = unsafe { o.contents.result };
10197                         unsafe { o.contents.result = std::ptr::null_mut() };
10198                         CResult_InitDecodeErrorZPtr { result }
10199                 } else {
10200                         let err = unsafe { o.contents.err };
10201                         unsafe { o.contents.err = std::ptr::null_mut(); }
10202                         CResult_InitDecodeErrorZPtr { err }
10203                 };
10204                 Self {
10205                         contents,
10206                         result_ok: o.result_ok,
10207                 }
10208         }
10209 }
10210 impl Clone for CResult_InitDecodeErrorZ {
10211         fn clone(&self) -> Self {
10212                 if self.result_ok {
10213                         Self { result_ok: true, contents: CResult_InitDecodeErrorZPtr {
10214                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::Init>::clone(unsafe { &*self.contents.result })))
10215                         } }
10216                 } else {
10217                         Self { result_ok: false, contents: CResult_InitDecodeErrorZPtr {
10218                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
10219                         } }
10220                 }
10221         }
10222 }
10223 #[no_mangle]
10224 /// Creates a new CResult_InitDecodeErrorZ which has the same data as `orig`
10225 /// but with all dynamically-allocated buffers duplicated in new buffers.
10226 pub extern "C" fn CResult_InitDecodeErrorZ_clone(orig: &CResult_InitDecodeErrorZ) -> CResult_InitDecodeErrorZ { Clone::clone(&orig) }
10227 #[repr(C)]
10228 /// The contents of CResult_OpenChannelDecodeErrorZ
10229 pub union CResult_OpenChannelDecodeErrorZPtr {
10230         /// A pointer to the contents in the success state.
10231         /// Reading from this pointer when `result_ok` is not set is undefined.
10232         pub result: *mut crate::lightning::ln::msgs::OpenChannel,
10233         /// A pointer to the contents in the error state.
10234         /// Reading from this pointer when `result_ok` is set is undefined.
10235         pub err: *mut crate::lightning::ln::msgs::DecodeError,
10236 }
10237 #[repr(C)]
10238 /// A CResult_OpenChannelDecodeErrorZ represents the result of a fallible operation,
10239 /// containing a crate::lightning::ln::msgs::OpenChannel on success and a crate::lightning::ln::msgs::DecodeError on failure.
10240 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10241 pub struct CResult_OpenChannelDecodeErrorZ {
10242         /// The contents of this CResult_OpenChannelDecodeErrorZ, accessible via either
10243         /// `err` or `result` depending on the state of `result_ok`.
10244         pub contents: CResult_OpenChannelDecodeErrorZPtr,
10245         /// Whether this CResult_OpenChannelDecodeErrorZ represents a success state.
10246         pub result_ok: bool,
10247 }
10248 #[no_mangle]
10249 /// Creates a new CResult_OpenChannelDecodeErrorZ in the success state.
10250 pub extern "C" fn CResult_OpenChannelDecodeErrorZ_ok(o: crate::lightning::ln::msgs::OpenChannel) -> CResult_OpenChannelDecodeErrorZ {
10251         CResult_OpenChannelDecodeErrorZ {
10252                 contents: CResult_OpenChannelDecodeErrorZPtr {
10253                         result: Box::into_raw(Box::new(o)),
10254                 },
10255                 result_ok: true,
10256         }
10257 }
10258 #[no_mangle]
10259 /// Creates a new CResult_OpenChannelDecodeErrorZ in the error state.
10260 pub extern "C" fn CResult_OpenChannelDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_OpenChannelDecodeErrorZ {
10261         CResult_OpenChannelDecodeErrorZ {
10262                 contents: CResult_OpenChannelDecodeErrorZPtr {
10263                         err: Box::into_raw(Box::new(e)),
10264                 },
10265                 result_ok: false,
10266         }
10267 }
10268 #[no_mangle]
10269 /// Frees any resources used by the CResult_OpenChannelDecodeErrorZ.
10270 pub extern "C" fn CResult_OpenChannelDecodeErrorZ_free(_res: CResult_OpenChannelDecodeErrorZ) { }
10271 impl Drop for CResult_OpenChannelDecodeErrorZ {
10272         fn drop(&mut self) {
10273                 if self.result_ok {
10274                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
10275                                 let _ = unsafe { Box::from_raw(self.contents.result) };
10276                         }
10277                 } else {
10278                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
10279                                 let _ = unsafe { Box::from_raw(self.contents.err) };
10280                         }
10281                 }
10282         }
10283 }
10284 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::OpenChannel, crate::lightning::ln::msgs::DecodeError>> for CResult_OpenChannelDecodeErrorZ {
10285         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::OpenChannel, crate::lightning::ln::msgs::DecodeError>) -> Self {
10286                 let contents = if o.result_ok {
10287                         let result = unsafe { o.contents.result };
10288                         unsafe { o.contents.result = std::ptr::null_mut() };
10289                         CResult_OpenChannelDecodeErrorZPtr { result }
10290                 } else {
10291                         let err = unsafe { o.contents.err };
10292                         unsafe { o.contents.err = std::ptr::null_mut(); }
10293                         CResult_OpenChannelDecodeErrorZPtr { err }
10294                 };
10295                 Self {
10296                         contents,
10297                         result_ok: o.result_ok,
10298                 }
10299         }
10300 }
10301 impl Clone for CResult_OpenChannelDecodeErrorZ {
10302         fn clone(&self) -> Self {
10303                 if self.result_ok {
10304                         Self { result_ok: true, contents: CResult_OpenChannelDecodeErrorZPtr {
10305                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::OpenChannel>::clone(unsafe { &*self.contents.result })))
10306                         } }
10307                 } else {
10308                         Self { result_ok: false, contents: CResult_OpenChannelDecodeErrorZPtr {
10309                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
10310                         } }
10311                 }
10312         }
10313 }
10314 #[no_mangle]
10315 /// Creates a new CResult_OpenChannelDecodeErrorZ which has the same data as `orig`
10316 /// but with all dynamically-allocated buffers duplicated in new buffers.
10317 pub extern "C" fn CResult_OpenChannelDecodeErrorZ_clone(orig: &CResult_OpenChannelDecodeErrorZ) -> CResult_OpenChannelDecodeErrorZ { Clone::clone(&orig) }
10318 #[repr(C)]
10319 /// The contents of CResult_RevokeAndACKDecodeErrorZ
10320 pub union CResult_RevokeAndACKDecodeErrorZPtr {
10321         /// A pointer to the contents in the success state.
10322         /// Reading from this pointer when `result_ok` is not set is undefined.
10323         pub result: *mut crate::lightning::ln::msgs::RevokeAndACK,
10324         /// A pointer to the contents in the error state.
10325         /// Reading from this pointer when `result_ok` is set is undefined.
10326         pub err: *mut crate::lightning::ln::msgs::DecodeError,
10327 }
10328 #[repr(C)]
10329 /// A CResult_RevokeAndACKDecodeErrorZ represents the result of a fallible operation,
10330 /// containing a crate::lightning::ln::msgs::RevokeAndACK on success and a crate::lightning::ln::msgs::DecodeError on failure.
10331 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10332 pub struct CResult_RevokeAndACKDecodeErrorZ {
10333         /// The contents of this CResult_RevokeAndACKDecodeErrorZ, accessible via either
10334         /// `err` or `result` depending on the state of `result_ok`.
10335         pub contents: CResult_RevokeAndACKDecodeErrorZPtr,
10336         /// Whether this CResult_RevokeAndACKDecodeErrorZ represents a success state.
10337         pub result_ok: bool,
10338 }
10339 #[no_mangle]
10340 /// Creates a new CResult_RevokeAndACKDecodeErrorZ in the success state.
10341 pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_ok(o: crate::lightning::ln::msgs::RevokeAndACK) -> CResult_RevokeAndACKDecodeErrorZ {
10342         CResult_RevokeAndACKDecodeErrorZ {
10343                 contents: CResult_RevokeAndACKDecodeErrorZPtr {
10344                         result: Box::into_raw(Box::new(o)),
10345                 },
10346                 result_ok: true,
10347         }
10348 }
10349 #[no_mangle]
10350 /// Creates a new CResult_RevokeAndACKDecodeErrorZ in the error state.
10351 pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RevokeAndACKDecodeErrorZ {
10352         CResult_RevokeAndACKDecodeErrorZ {
10353                 contents: CResult_RevokeAndACKDecodeErrorZPtr {
10354                         err: Box::into_raw(Box::new(e)),
10355                 },
10356                 result_ok: false,
10357         }
10358 }
10359 #[no_mangle]
10360 /// Frees any resources used by the CResult_RevokeAndACKDecodeErrorZ.
10361 pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_free(_res: CResult_RevokeAndACKDecodeErrorZ) { }
10362 impl Drop for CResult_RevokeAndACKDecodeErrorZ {
10363         fn drop(&mut self) {
10364                 if self.result_ok {
10365                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
10366                                 let _ = unsafe { Box::from_raw(self.contents.result) };
10367                         }
10368                 } else {
10369                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
10370                                 let _ = unsafe { Box::from_raw(self.contents.err) };
10371                         }
10372                 }
10373         }
10374 }
10375 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::RevokeAndACK, crate::lightning::ln::msgs::DecodeError>> for CResult_RevokeAndACKDecodeErrorZ {
10376         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::RevokeAndACK, crate::lightning::ln::msgs::DecodeError>) -> Self {
10377                 let contents = if o.result_ok {
10378                         let result = unsafe { o.contents.result };
10379                         unsafe { o.contents.result = std::ptr::null_mut() };
10380                         CResult_RevokeAndACKDecodeErrorZPtr { result }
10381                 } else {
10382                         let err = unsafe { o.contents.err };
10383                         unsafe { o.contents.err = std::ptr::null_mut(); }
10384                         CResult_RevokeAndACKDecodeErrorZPtr { err }
10385                 };
10386                 Self {
10387                         contents,
10388                         result_ok: o.result_ok,
10389                 }
10390         }
10391 }
10392 impl Clone for CResult_RevokeAndACKDecodeErrorZ {
10393         fn clone(&self) -> Self {
10394                 if self.result_ok {
10395                         Self { result_ok: true, contents: CResult_RevokeAndACKDecodeErrorZPtr {
10396                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::RevokeAndACK>::clone(unsafe { &*self.contents.result })))
10397                         } }
10398                 } else {
10399                         Self { result_ok: false, contents: CResult_RevokeAndACKDecodeErrorZPtr {
10400                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
10401                         } }
10402                 }
10403         }
10404 }
10405 #[no_mangle]
10406 /// Creates a new CResult_RevokeAndACKDecodeErrorZ which has the same data as `orig`
10407 /// but with all dynamically-allocated buffers duplicated in new buffers.
10408 pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_clone(orig: &CResult_RevokeAndACKDecodeErrorZ) -> CResult_RevokeAndACKDecodeErrorZ { Clone::clone(&orig) }
10409 #[repr(C)]
10410 /// The contents of CResult_ShutdownDecodeErrorZ
10411 pub union CResult_ShutdownDecodeErrorZPtr {
10412         /// A pointer to the contents in the success state.
10413         /// Reading from this pointer when `result_ok` is not set is undefined.
10414         pub result: *mut crate::lightning::ln::msgs::Shutdown,
10415         /// A pointer to the contents in the error state.
10416         /// Reading from this pointer when `result_ok` is set is undefined.
10417         pub err: *mut crate::lightning::ln::msgs::DecodeError,
10418 }
10419 #[repr(C)]
10420 /// A CResult_ShutdownDecodeErrorZ represents the result of a fallible operation,
10421 /// containing a crate::lightning::ln::msgs::Shutdown on success and a crate::lightning::ln::msgs::DecodeError on failure.
10422 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10423 pub struct CResult_ShutdownDecodeErrorZ {
10424         /// The contents of this CResult_ShutdownDecodeErrorZ, accessible via either
10425         /// `err` or `result` depending on the state of `result_ok`.
10426         pub contents: CResult_ShutdownDecodeErrorZPtr,
10427         /// Whether this CResult_ShutdownDecodeErrorZ represents a success state.
10428         pub result_ok: bool,
10429 }
10430 #[no_mangle]
10431 /// Creates a new CResult_ShutdownDecodeErrorZ in the success state.
10432 pub extern "C" fn CResult_ShutdownDecodeErrorZ_ok(o: crate::lightning::ln::msgs::Shutdown) -> CResult_ShutdownDecodeErrorZ {
10433         CResult_ShutdownDecodeErrorZ {
10434                 contents: CResult_ShutdownDecodeErrorZPtr {
10435                         result: Box::into_raw(Box::new(o)),
10436                 },
10437                 result_ok: true,
10438         }
10439 }
10440 #[no_mangle]
10441 /// Creates a new CResult_ShutdownDecodeErrorZ in the error state.
10442 pub extern "C" fn CResult_ShutdownDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ShutdownDecodeErrorZ {
10443         CResult_ShutdownDecodeErrorZ {
10444                 contents: CResult_ShutdownDecodeErrorZPtr {
10445                         err: Box::into_raw(Box::new(e)),
10446                 },
10447                 result_ok: false,
10448         }
10449 }
10450 #[no_mangle]
10451 /// Frees any resources used by the CResult_ShutdownDecodeErrorZ.
10452 pub extern "C" fn CResult_ShutdownDecodeErrorZ_free(_res: CResult_ShutdownDecodeErrorZ) { }
10453 impl Drop for CResult_ShutdownDecodeErrorZ {
10454         fn drop(&mut self) {
10455                 if self.result_ok {
10456                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
10457                                 let _ = unsafe { Box::from_raw(self.contents.result) };
10458                         }
10459                 } else {
10460                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
10461                                 let _ = unsafe { Box::from_raw(self.contents.err) };
10462                         }
10463                 }
10464         }
10465 }
10466 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::Shutdown, crate::lightning::ln::msgs::DecodeError>> for CResult_ShutdownDecodeErrorZ {
10467         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::Shutdown, crate::lightning::ln::msgs::DecodeError>) -> Self {
10468                 let contents = if o.result_ok {
10469                         let result = unsafe { o.contents.result };
10470                         unsafe { o.contents.result = std::ptr::null_mut() };
10471                         CResult_ShutdownDecodeErrorZPtr { result }
10472                 } else {
10473                         let err = unsafe { o.contents.err };
10474                         unsafe { o.contents.err = std::ptr::null_mut(); }
10475                         CResult_ShutdownDecodeErrorZPtr { err }
10476                 };
10477                 Self {
10478                         contents,
10479                         result_ok: o.result_ok,
10480                 }
10481         }
10482 }
10483 impl Clone for CResult_ShutdownDecodeErrorZ {
10484         fn clone(&self) -> Self {
10485                 if self.result_ok {
10486                         Self { result_ok: true, contents: CResult_ShutdownDecodeErrorZPtr {
10487                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::Shutdown>::clone(unsafe { &*self.contents.result })))
10488                         } }
10489                 } else {
10490                         Self { result_ok: false, contents: CResult_ShutdownDecodeErrorZPtr {
10491                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
10492                         } }
10493                 }
10494         }
10495 }
10496 #[no_mangle]
10497 /// Creates a new CResult_ShutdownDecodeErrorZ which has the same data as `orig`
10498 /// but with all dynamically-allocated buffers duplicated in new buffers.
10499 pub extern "C" fn CResult_ShutdownDecodeErrorZ_clone(orig: &CResult_ShutdownDecodeErrorZ) -> CResult_ShutdownDecodeErrorZ { Clone::clone(&orig) }
10500 #[repr(C)]
10501 /// The contents of CResult_UpdateFailHTLCDecodeErrorZ
10502 pub union CResult_UpdateFailHTLCDecodeErrorZPtr {
10503         /// A pointer to the contents in the success state.
10504         /// Reading from this pointer when `result_ok` is not set is undefined.
10505         pub result: *mut crate::lightning::ln::msgs::UpdateFailHTLC,
10506         /// A pointer to the contents in the error state.
10507         /// Reading from this pointer when `result_ok` is set is undefined.
10508         pub err: *mut crate::lightning::ln::msgs::DecodeError,
10509 }
10510 #[repr(C)]
10511 /// A CResult_UpdateFailHTLCDecodeErrorZ represents the result of a fallible operation,
10512 /// containing a crate::lightning::ln::msgs::UpdateFailHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
10513 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10514 pub struct CResult_UpdateFailHTLCDecodeErrorZ {
10515         /// The contents of this CResult_UpdateFailHTLCDecodeErrorZ, accessible via either
10516         /// `err` or `result` depending on the state of `result_ok`.
10517         pub contents: CResult_UpdateFailHTLCDecodeErrorZPtr,
10518         /// Whether this CResult_UpdateFailHTLCDecodeErrorZ represents a success state.
10519         pub result_ok: bool,
10520 }
10521 #[no_mangle]
10522 /// Creates a new CResult_UpdateFailHTLCDecodeErrorZ in the success state.
10523 pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateFailHTLC) -> CResult_UpdateFailHTLCDecodeErrorZ {
10524         CResult_UpdateFailHTLCDecodeErrorZ {
10525                 contents: CResult_UpdateFailHTLCDecodeErrorZPtr {
10526                         result: Box::into_raw(Box::new(o)),
10527                 },
10528                 result_ok: true,
10529         }
10530 }
10531 #[no_mangle]
10532 /// Creates a new CResult_UpdateFailHTLCDecodeErrorZ in the error state.
10533 pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateFailHTLCDecodeErrorZ {
10534         CResult_UpdateFailHTLCDecodeErrorZ {
10535                 contents: CResult_UpdateFailHTLCDecodeErrorZPtr {
10536                         err: Box::into_raw(Box::new(e)),
10537                 },
10538                 result_ok: false,
10539         }
10540 }
10541 #[no_mangle]
10542 /// Frees any resources used by the CResult_UpdateFailHTLCDecodeErrorZ.
10543 pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_free(_res: CResult_UpdateFailHTLCDecodeErrorZ) { }
10544 impl Drop for CResult_UpdateFailHTLCDecodeErrorZ {
10545         fn drop(&mut self) {
10546                 if self.result_ok {
10547                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
10548                                 let _ = unsafe { Box::from_raw(self.contents.result) };
10549                         }
10550                 } else {
10551                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
10552                                 let _ = unsafe { Box::from_raw(self.contents.err) };
10553                         }
10554                 }
10555         }
10556 }
10557 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFailHTLC, crate::lightning::ln::msgs::DecodeError>> for CResult_UpdateFailHTLCDecodeErrorZ {
10558         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFailHTLC, crate::lightning::ln::msgs::DecodeError>) -> Self {
10559                 let contents = if o.result_ok {
10560                         let result = unsafe { o.contents.result };
10561                         unsafe { o.contents.result = std::ptr::null_mut() };
10562                         CResult_UpdateFailHTLCDecodeErrorZPtr { result }
10563                 } else {
10564                         let err = unsafe { o.contents.err };
10565                         unsafe { o.contents.err = std::ptr::null_mut(); }
10566                         CResult_UpdateFailHTLCDecodeErrorZPtr { err }
10567                 };
10568                 Self {
10569                         contents,
10570                         result_ok: o.result_ok,
10571                 }
10572         }
10573 }
10574 impl Clone for CResult_UpdateFailHTLCDecodeErrorZ {
10575         fn clone(&self) -> Self {
10576                 if self.result_ok {
10577                         Self { result_ok: true, contents: CResult_UpdateFailHTLCDecodeErrorZPtr {
10578                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UpdateFailHTLC>::clone(unsafe { &*self.contents.result })))
10579                         } }
10580                 } else {
10581                         Self { result_ok: false, contents: CResult_UpdateFailHTLCDecodeErrorZPtr {
10582                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
10583                         } }
10584                 }
10585         }
10586 }
10587 #[no_mangle]
10588 /// Creates a new CResult_UpdateFailHTLCDecodeErrorZ which has the same data as `orig`
10589 /// but with all dynamically-allocated buffers duplicated in new buffers.
10590 pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_clone(orig: &CResult_UpdateFailHTLCDecodeErrorZ) -> CResult_UpdateFailHTLCDecodeErrorZ { Clone::clone(&orig) }
10591 #[repr(C)]
10592 /// The contents of CResult_UpdateFailMalformedHTLCDecodeErrorZ
10593 pub union CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
10594         /// A pointer to the contents in the success state.
10595         /// Reading from this pointer when `result_ok` is not set is undefined.
10596         pub result: *mut crate::lightning::ln::msgs::UpdateFailMalformedHTLC,
10597         /// A pointer to the contents in the error state.
10598         /// Reading from this pointer when `result_ok` is set is undefined.
10599         pub err: *mut crate::lightning::ln::msgs::DecodeError,
10600 }
10601 #[repr(C)]
10602 /// A CResult_UpdateFailMalformedHTLCDecodeErrorZ represents the result of a fallible operation,
10603 /// containing a crate::lightning::ln::msgs::UpdateFailMalformedHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
10604 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10605 pub struct CResult_UpdateFailMalformedHTLCDecodeErrorZ {
10606         /// The contents of this CResult_UpdateFailMalformedHTLCDecodeErrorZ, accessible via either
10607         /// `err` or `result` depending on the state of `result_ok`.
10608         pub contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr,
10609         /// Whether this CResult_UpdateFailMalformedHTLCDecodeErrorZ represents a success state.
10610         pub result_ok: bool,
10611 }
10612 #[no_mangle]
10613 /// Creates a new CResult_UpdateFailMalformedHTLCDecodeErrorZ in the success state.
10614 pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateFailMalformedHTLC) -> CResult_UpdateFailMalformedHTLCDecodeErrorZ {
10615         CResult_UpdateFailMalformedHTLCDecodeErrorZ {
10616                 contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
10617                         result: Box::into_raw(Box::new(o)),
10618                 },
10619                 result_ok: true,
10620         }
10621 }
10622 #[no_mangle]
10623 /// Creates a new CResult_UpdateFailMalformedHTLCDecodeErrorZ in the error state.
10624 pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateFailMalformedHTLCDecodeErrorZ {
10625         CResult_UpdateFailMalformedHTLCDecodeErrorZ {
10626                 contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
10627                         err: Box::into_raw(Box::new(e)),
10628                 },
10629                 result_ok: false,
10630         }
10631 }
10632 #[no_mangle]
10633 /// Frees any resources used by the CResult_UpdateFailMalformedHTLCDecodeErrorZ.
10634 pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_free(_res: CResult_UpdateFailMalformedHTLCDecodeErrorZ) { }
10635 impl Drop for CResult_UpdateFailMalformedHTLCDecodeErrorZ {
10636         fn drop(&mut self) {
10637                 if self.result_ok {
10638                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
10639                                 let _ = unsafe { Box::from_raw(self.contents.result) };
10640                         }
10641                 } else {
10642                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
10643                                 let _ = unsafe { Box::from_raw(self.contents.err) };
10644                         }
10645                 }
10646         }
10647 }
10648 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFailMalformedHTLC, crate::lightning::ln::msgs::DecodeError>> for CResult_UpdateFailMalformedHTLCDecodeErrorZ {
10649         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFailMalformedHTLC, crate::lightning::ln::msgs::DecodeError>) -> Self {
10650                 let contents = if o.result_ok {
10651                         let result = unsafe { o.contents.result };
10652                         unsafe { o.contents.result = std::ptr::null_mut() };
10653                         CResult_UpdateFailMalformedHTLCDecodeErrorZPtr { result }
10654                 } else {
10655                         let err = unsafe { o.contents.err };
10656                         unsafe { o.contents.err = std::ptr::null_mut(); }
10657                         CResult_UpdateFailMalformedHTLCDecodeErrorZPtr { err }
10658                 };
10659                 Self {
10660                         contents,
10661                         result_ok: o.result_ok,
10662                 }
10663         }
10664 }
10665 impl Clone for CResult_UpdateFailMalformedHTLCDecodeErrorZ {
10666         fn clone(&self) -> Self {
10667                 if self.result_ok {
10668                         Self { result_ok: true, contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
10669                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UpdateFailMalformedHTLC>::clone(unsafe { &*self.contents.result })))
10670                         } }
10671                 } else {
10672                         Self { result_ok: false, contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
10673                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
10674                         } }
10675                 }
10676         }
10677 }
10678 #[no_mangle]
10679 /// Creates a new CResult_UpdateFailMalformedHTLCDecodeErrorZ which has the same data as `orig`
10680 /// but with all dynamically-allocated buffers duplicated in new buffers.
10681 pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone(orig: &CResult_UpdateFailMalformedHTLCDecodeErrorZ) -> CResult_UpdateFailMalformedHTLCDecodeErrorZ { Clone::clone(&orig) }
10682 #[repr(C)]
10683 /// The contents of CResult_UpdateFeeDecodeErrorZ
10684 pub union CResult_UpdateFeeDecodeErrorZPtr {
10685         /// A pointer to the contents in the success state.
10686         /// Reading from this pointer when `result_ok` is not set is undefined.
10687         pub result: *mut crate::lightning::ln::msgs::UpdateFee,
10688         /// A pointer to the contents in the error state.
10689         /// Reading from this pointer when `result_ok` is set is undefined.
10690         pub err: *mut crate::lightning::ln::msgs::DecodeError,
10691 }
10692 #[repr(C)]
10693 /// A CResult_UpdateFeeDecodeErrorZ represents the result of a fallible operation,
10694 /// containing a crate::lightning::ln::msgs::UpdateFee on success and a crate::lightning::ln::msgs::DecodeError on failure.
10695 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10696 pub struct CResult_UpdateFeeDecodeErrorZ {
10697         /// The contents of this CResult_UpdateFeeDecodeErrorZ, accessible via either
10698         /// `err` or `result` depending on the state of `result_ok`.
10699         pub contents: CResult_UpdateFeeDecodeErrorZPtr,
10700         /// Whether this CResult_UpdateFeeDecodeErrorZ represents a success state.
10701         pub result_ok: bool,
10702 }
10703 #[no_mangle]
10704 /// Creates a new CResult_UpdateFeeDecodeErrorZ in the success state.
10705 pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateFee) -> CResult_UpdateFeeDecodeErrorZ {
10706         CResult_UpdateFeeDecodeErrorZ {
10707                 contents: CResult_UpdateFeeDecodeErrorZPtr {
10708                         result: Box::into_raw(Box::new(o)),
10709                 },
10710                 result_ok: true,
10711         }
10712 }
10713 #[no_mangle]
10714 /// Creates a new CResult_UpdateFeeDecodeErrorZ in the error state.
10715 pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateFeeDecodeErrorZ {
10716         CResult_UpdateFeeDecodeErrorZ {
10717                 contents: CResult_UpdateFeeDecodeErrorZPtr {
10718                         err: Box::into_raw(Box::new(e)),
10719                 },
10720                 result_ok: false,
10721         }
10722 }
10723 #[no_mangle]
10724 /// Frees any resources used by the CResult_UpdateFeeDecodeErrorZ.
10725 pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_free(_res: CResult_UpdateFeeDecodeErrorZ) { }
10726 impl Drop for CResult_UpdateFeeDecodeErrorZ {
10727         fn drop(&mut self) {
10728                 if self.result_ok {
10729                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
10730                                 let _ = unsafe { Box::from_raw(self.contents.result) };
10731                         }
10732                 } else {
10733                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
10734                                 let _ = unsafe { Box::from_raw(self.contents.err) };
10735                         }
10736                 }
10737         }
10738 }
10739 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFee, crate::lightning::ln::msgs::DecodeError>> for CResult_UpdateFeeDecodeErrorZ {
10740         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFee, crate::lightning::ln::msgs::DecodeError>) -> Self {
10741                 let contents = if o.result_ok {
10742                         let result = unsafe { o.contents.result };
10743                         unsafe { o.contents.result = std::ptr::null_mut() };
10744                         CResult_UpdateFeeDecodeErrorZPtr { result }
10745                 } else {
10746                         let err = unsafe { o.contents.err };
10747                         unsafe { o.contents.err = std::ptr::null_mut(); }
10748                         CResult_UpdateFeeDecodeErrorZPtr { err }
10749                 };
10750                 Self {
10751                         contents,
10752                         result_ok: o.result_ok,
10753                 }
10754         }
10755 }
10756 impl Clone for CResult_UpdateFeeDecodeErrorZ {
10757         fn clone(&self) -> Self {
10758                 if self.result_ok {
10759                         Self { result_ok: true, contents: CResult_UpdateFeeDecodeErrorZPtr {
10760                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UpdateFee>::clone(unsafe { &*self.contents.result })))
10761                         } }
10762                 } else {
10763                         Self { result_ok: false, contents: CResult_UpdateFeeDecodeErrorZPtr {
10764                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
10765                         } }
10766                 }
10767         }
10768 }
10769 #[no_mangle]
10770 /// Creates a new CResult_UpdateFeeDecodeErrorZ which has the same data as `orig`
10771 /// but with all dynamically-allocated buffers duplicated in new buffers.
10772 pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_clone(orig: &CResult_UpdateFeeDecodeErrorZ) -> CResult_UpdateFeeDecodeErrorZ { Clone::clone(&orig) }
10773 #[repr(C)]
10774 /// The contents of CResult_UpdateFulfillHTLCDecodeErrorZ
10775 pub union CResult_UpdateFulfillHTLCDecodeErrorZPtr {
10776         /// A pointer to the contents in the success state.
10777         /// Reading from this pointer when `result_ok` is not set is undefined.
10778         pub result: *mut crate::lightning::ln::msgs::UpdateFulfillHTLC,
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::ln::msgs::DecodeError,
10782 }
10783 #[repr(C)]
10784 /// A CResult_UpdateFulfillHTLCDecodeErrorZ represents the result of a fallible operation,
10785 /// containing a crate::lightning::ln::msgs::UpdateFulfillHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
10786 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10787 pub struct CResult_UpdateFulfillHTLCDecodeErrorZ {
10788         /// The contents of this CResult_UpdateFulfillHTLCDecodeErrorZ, accessible via either
10789         /// `err` or `result` depending on the state of `result_ok`.
10790         pub contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr,
10791         /// Whether this CResult_UpdateFulfillHTLCDecodeErrorZ represents a success state.
10792         pub result_ok: bool,
10793 }
10794 #[no_mangle]
10795 /// Creates a new CResult_UpdateFulfillHTLCDecodeErrorZ in the success state.
10796 pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateFulfillHTLC) -> CResult_UpdateFulfillHTLCDecodeErrorZ {
10797         CResult_UpdateFulfillHTLCDecodeErrorZ {
10798                 contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr {
10799                         result: Box::into_raw(Box::new(o)),
10800                 },
10801                 result_ok: true,
10802         }
10803 }
10804 #[no_mangle]
10805 /// Creates a new CResult_UpdateFulfillHTLCDecodeErrorZ in the error state.
10806 pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateFulfillHTLCDecodeErrorZ {
10807         CResult_UpdateFulfillHTLCDecodeErrorZ {
10808                 contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr {
10809                         err: Box::into_raw(Box::new(e)),
10810                 },
10811                 result_ok: false,
10812         }
10813 }
10814 #[no_mangle]
10815 /// Frees any resources used by the CResult_UpdateFulfillHTLCDecodeErrorZ.
10816 pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_free(_res: CResult_UpdateFulfillHTLCDecodeErrorZ) { }
10817 impl Drop for CResult_UpdateFulfillHTLCDecodeErrorZ {
10818         fn drop(&mut self) {
10819                 if self.result_ok {
10820                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
10821                                 let _ = unsafe { Box::from_raw(self.contents.result) };
10822                         }
10823                 } else {
10824                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
10825                                 let _ = unsafe { Box::from_raw(self.contents.err) };
10826                         }
10827                 }
10828         }
10829 }
10830 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFulfillHTLC, crate::lightning::ln::msgs::DecodeError>> for CResult_UpdateFulfillHTLCDecodeErrorZ {
10831         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFulfillHTLC, crate::lightning::ln::msgs::DecodeError>) -> Self {
10832                 let contents = if o.result_ok {
10833                         let result = unsafe { o.contents.result };
10834                         unsafe { o.contents.result = std::ptr::null_mut() };
10835                         CResult_UpdateFulfillHTLCDecodeErrorZPtr { result }
10836                 } else {
10837                         let err = unsafe { o.contents.err };
10838                         unsafe { o.contents.err = std::ptr::null_mut(); }
10839                         CResult_UpdateFulfillHTLCDecodeErrorZPtr { err }
10840                 };
10841                 Self {
10842                         contents,
10843                         result_ok: o.result_ok,
10844                 }
10845         }
10846 }
10847 impl Clone for CResult_UpdateFulfillHTLCDecodeErrorZ {
10848         fn clone(&self) -> Self {
10849                 if self.result_ok {
10850                         Self { result_ok: true, contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr {
10851                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UpdateFulfillHTLC>::clone(unsafe { &*self.contents.result })))
10852                         } }
10853                 } else {
10854                         Self { result_ok: false, contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr {
10855                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
10856                         } }
10857                 }
10858         }
10859 }
10860 #[no_mangle]
10861 /// Creates a new CResult_UpdateFulfillHTLCDecodeErrorZ which has the same data as `orig`
10862 /// but with all dynamically-allocated buffers duplicated in new buffers.
10863 pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_clone(orig: &CResult_UpdateFulfillHTLCDecodeErrorZ) -> CResult_UpdateFulfillHTLCDecodeErrorZ { Clone::clone(&orig) }
10864 #[repr(C)]
10865 /// The contents of CResult_UpdateAddHTLCDecodeErrorZ
10866 pub union CResult_UpdateAddHTLCDecodeErrorZPtr {
10867         /// A pointer to the contents in the success state.
10868         /// Reading from this pointer when `result_ok` is not set is undefined.
10869         pub result: *mut crate::lightning::ln::msgs::UpdateAddHTLC,
10870         /// A pointer to the contents in the error state.
10871         /// Reading from this pointer when `result_ok` is set is undefined.
10872         pub err: *mut crate::lightning::ln::msgs::DecodeError,
10873 }
10874 #[repr(C)]
10875 /// A CResult_UpdateAddHTLCDecodeErrorZ represents the result of a fallible operation,
10876 /// containing a crate::lightning::ln::msgs::UpdateAddHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
10877 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10878 pub struct CResult_UpdateAddHTLCDecodeErrorZ {
10879         /// The contents of this CResult_UpdateAddHTLCDecodeErrorZ, accessible via either
10880         /// `err` or `result` depending on the state of `result_ok`.
10881         pub contents: CResult_UpdateAddHTLCDecodeErrorZPtr,
10882         /// Whether this CResult_UpdateAddHTLCDecodeErrorZ represents a success state.
10883         pub result_ok: bool,
10884 }
10885 #[no_mangle]
10886 /// Creates a new CResult_UpdateAddHTLCDecodeErrorZ in the success state.
10887 pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateAddHTLC) -> CResult_UpdateAddHTLCDecodeErrorZ {
10888         CResult_UpdateAddHTLCDecodeErrorZ {
10889                 contents: CResult_UpdateAddHTLCDecodeErrorZPtr {
10890                         result: Box::into_raw(Box::new(o)),
10891                 },
10892                 result_ok: true,
10893         }
10894 }
10895 #[no_mangle]
10896 /// Creates a new CResult_UpdateAddHTLCDecodeErrorZ in the error state.
10897 pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateAddHTLCDecodeErrorZ {
10898         CResult_UpdateAddHTLCDecodeErrorZ {
10899                 contents: CResult_UpdateAddHTLCDecodeErrorZPtr {
10900                         err: Box::into_raw(Box::new(e)),
10901                 },
10902                 result_ok: false,
10903         }
10904 }
10905 #[no_mangle]
10906 /// Frees any resources used by the CResult_UpdateAddHTLCDecodeErrorZ.
10907 pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_free(_res: CResult_UpdateAddHTLCDecodeErrorZ) { }
10908 impl Drop for CResult_UpdateAddHTLCDecodeErrorZ {
10909         fn drop(&mut self) {
10910                 if self.result_ok {
10911                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
10912                                 let _ = unsafe { Box::from_raw(self.contents.result) };
10913                         }
10914                 } else {
10915                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
10916                                 let _ = unsafe { Box::from_raw(self.contents.err) };
10917                         }
10918                 }
10919         }
10920 }
10921 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateAddHTLC, crate::lightning::ln::msgs::DecodeError>> for CResult_UpdateAddHTLCDecodeErrorZ {
10922         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateAddHTLC, crate::lightning::ln::msgs::DecodeError>) -> Self {
10923                 let contents = if o.result_ok {
10924                         let result = unsafe { o.contents.result };
10925                         unsafe { o.contents.result = std::ptr::null_mut() };
10926                         CResult_UpdateAddHTLCDecodeErrorZPtr { result }
10927                 } else {
10928                         let err = unsafe { o.contents.err };
10929                         unsafe { o.contents.err = std::ptr::null_mut(); }
10930                         CResult_UpdateAddHTLCDecodeErrorZPtr { err }
10931                 };
10932                 Self {
10933                         contents,
10934                         result_ok: o.result_ok,
10935                 }
10936         }
10937 }
10938 impl Clone for CResult_UpdateAddHTLCDecodeErrorZ {
10939         fn clone(&self) -> Self {
10940                 if self.result_ok {
10941                         Self { result_ok: true, contents: CResult_UpdateAddHTLCDecodeErrorZPtr {
10942                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UpdateAddHTLC>::clone(unsafe { &*self.contents.result })))
10943                         } }
10944                 } else {
10945                         Self { result_ok: false, contents: CResult_UpdateAddHTLCDecodeErrorZPtr {
10946                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
10947                         } }
10948                 }
10949         }
10950 }
10951 #[no_mangle]
10952 /// Creates a new CResult_UpdateAddHTLCDecodeErrorZ which has the same data as `orig`
10953 /// but with all dynamically-allocated buffers duplicated in new buffers.
10954 pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_clone(orig: &CResult_UpdateAddHTLCDecodeErrorZ) -> CResult_UpdateAddHTLCDecodeErrorZ { Clone::clone(&orig) }
10955 #[repr(C)]
10956 /// The contents of CResult_PingDecodeErrorZ
10957 pub union CResult_PingDecodeErrorZPtr {
10958         /// A pointer to the contents in the success state.
10959         /// Reading from this pointer when `result_ok` is not set is undefined.
10960         pub result: *mut crate::lightning::ln::msgs::Ping,
10961         /// A pointer to the contents in the error state.
10962         /// Reading from this pointer when `result_ok` is set is undefined.
10963         pub err: *mut crate::lightning::ln::msgs::DecodeError,
10964 }
10965 #[repr(C)]
10966 /// A CResult_PingDecodeErrorZ represents the result of a fallible operation,
10967 /// containing a crate::lightning::ln::msgs::Ping on success and a crate::lightning::ln::msgs::DecodeError on failure.
10968 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10969 pub struct CResult_PingDecodeErrorZ {
10970         /// The contents of this CResult_PingDecodeErrorZ, accessible via either
10971         /// `err` or `result` depending on the state of `result_ok`.
10972         pub contents: CResult_PingDecodeErrorZPtr,
10973         /// Whether this CResult_PingDecodeErrorZ represents a success state.
10974         pub result_ok: bool,
10975 }
10976 #[no_mangle]
10977 /// Creates a new CResult_PingDecodeErrorZ in the success state.
10978 pub extern "C" fn CResult_PingDecodeErrorZ_ok(o: crate::lightning::ln::msgs::Ping) -> CResult_PingDecodeErrorZ {
10979         CResult_PingDecodeErrorZ {
10980                 contents: CResult_PingDecodeErrorZPtr {
10981                         result: Box::into_raw(Box::new(o)),
10982                 },
10983                 result_ok: true,
10984         }
10985 }
10986 #[no_mangle]
10987 /// Creates a new CResult_PingDecodeErrorZ in the error state.
10988 pub extern "C" fn CResult_PingDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_PingDecodeErrorZ {
10989         CResult_PingDecodeErrorZ {
10990                 contents: CResult_PingDecodeErrorZPtr {
10991                         err: Box::into_raw(Box::new(e)),
10992                 },
10993                 result_ok: false,
10994         }
10995 }
10996 #[no_mangle]
10997 /// Frees any resources used by the CResult_PingDecodeErrorZ.
10998 pub extern "C" fn CResult_PingDecodeErrorZ_free(_res: CResult_PingDecodeErrorZ) { }
10999 impl Drop for CResult_PingDecodeErrorZ {
11000         fn drop(&mut self) {
11001                 if self.result_ok {
11002                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
11003                                 let _ = unsafe { Box::from_raw(self.contents.result) };
11004                         }
11005                 } else {
11006                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
11007                                 let _ = unsafe { Box::from_raw(self.contents.err) };
11008                         }
11009                 }
11010         }
11011 }
11012 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::Ping, crate::lightning::ln::msgs::DecodeError>> for CResult_PingDecodeErrorZ {
11013         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::Ping, crate::lightning::ln::msgs::DecodeError>) -> Self {
11014                 let contents = if o.result_ok {
11015                         let result = unsafe { o.contents.result };
11016                         unsafe { o.contents.result = std::ptr::null_mut() };
11017                         CResult_PingDecodeErrorZPtr { result }
11018                 } else {
11019                         let err = unsafe { o.contents.err };
11020                         unsafe { o.contents.err = std::ptr::null_mut(); }
11021                         CResult_PingDecodeErrorZPtr { err }
11022                 };
11023                 Self {
11024                         contents,
11025                         result_ok: o.result_ok,
11026                 }
11027         }
11028 }
11029 impl Clone for CResult_PingDecodeErrorZ {
11030         fn clone(&self) -> Self {
11031                 if self.result_ok {
11032                         Self { result_ok: true, contents: CResult_PingDecodeErrorZPtr {
11033                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::Ping>::clone(unsafe { &*self.contents.result })))
11034                         } }
11035                 } else {
11036                         Self { result_ok: false, contents: CResult_PingDecodeErrorZPtr {
11037                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
11038                         } }
11039                 }
11040         }
11041 }
11042 #[no_mangle]
11043 /// Creates a new CResult_PingDecodeErrorZ which has the same data as `orig`
11044 /// but with all dynamically-allocated buffers duplicated in new buffers.
11045 pub extern "C" fn CResult_PingDecodeErrorZ_clone(orig: &CResult_PingDecodeErrorZ) -> CResult_PingDecodeErrorZ { Clone::clone(&orig) }
11046 #[repr(C)]
11047 /// The contents of CResult_PongDecodeErrorZ
11048 pub union CResult_PongDecodeErrorZPtr {
11049         /// A pointer to the contents in the success state.
11050         /// Reading from this pointer when `result_ok` is not set is undefined.
11051         pub result: *mut crate::lightning::ln::msgs::Pong,
11052         /// A pointer to the contents in the error state.
11053         /// Reading from this pointer when `result_ok` is set is undefined.
11054         pub err: *mut crate::lightning::ln::msgs::DecodeError,
11055 }
11056 #[repr(C)]
11057 /// A CResult_PongDecodeErrorZ represents the result of a fallible operation,
11058 /// containing a crate::lightning::ln::msgs::Pong on success and a crate::lightning::ln::msgs::DecodeError on failure.
11059 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11060 pub struct CResult_PongDecodeErrorZ {
11061         /// The contents of this CResult_PongDecodeErrorZ, accessible via either
11062         /// `err` or `result` depending on the state of `result_ok`.
11063         pub contents: CResult_PongDecodeErrorZPtr,
11064         /// Whether this CResult_PongDecodeErrorZ represents a success state.
11065         pub result_ok: bool,
11066 }
11067 #[no_mangle]
11068 /// Creates a new CResult_PongDecodeErrorZ in the success state.
11069 pub extern "C" fn CResult_PongDecodeErrorZ_ok(o: crate::lightning::ln::msgs::Pong) -> CResult_PongDecodeErrorZ {
11070         CResult_PongDecodeErrorZ {
11071                 contents: CResult_PongDecodeErrorZPtr {
11072                         result: Box::into_raw(Box::new(o)),
11073                 },
11074                 result_ok: true,
11075         }
11076 }
11077 #[no_mangle]
11078 /// Creates a new CResult_PongDecodeErrorZ in the error state.
11079 pub extern "C" fn CResult_PongDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_PongDecodeErrorZ {
11080         CResult_PongDecodeErrorZ {
11081                 contents: CResult_PongDecodeErrorZPtr {
11082                         err: Box::into_raw(Box::new(e)),
11083                 },
11084                 result_ok: false,
11085         }
11086 }
11087 #[no_mangle]
11088 /// Frees any resources used by the CResult_PongDecodeErrorZ.
11089 pub extern "C" fn CResult_PongDecodeErrorZ_free(_res: CResult_PongDecodeErrorZ) { }
11090 impl Drop for CResult_PongDecodeErrorZ {
11091         fn drop(&mut self) {
11092                 if self.result_ok {
11093                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
11094                                 let _ = unsafe { Box::from_raw(self.contents.result) };
11095                         }
11096                 } else {
11097                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
11098                                 let _ = unsafe { Box::from_raw(self.contents.err) };
11099                         }
11100                 }
11101         }
11102 }
11103 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::Pong, crate::lightning::ln::msgs::DecodeError>> for CResult_PongDecodeErrorZ {
11104         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::Pong, crate::lightning::ln::msgs::DecodeError>) -> Self {
11105                 let contents = if o.result_ok {
11106                         let result = unsafe { o.contents.result };
11107                         unsafe { o.contents.result = std::ptr::null_mut() };
11108                         CResult_PongDecodeErrorZPtr { result }
11109                 } else {
11110                         let err = unsafe { o.contents.err };
11111                         unsafe { o.contents.err = std::ptr::null_mut(); }
11112                         CResult_PongDecodeErrorZPtr { err }
11113                 };
11114                 Self {
11115                         contents,
11116                         result_ok: o.result_ok,
11117                 }
11118         }
11119 }
11120 impl Clone for CResult_PongDecodeErrorZ {
11121         fn clone(&self) -> Self {
11122                 if self.result_ok {
11123                         Self { result_ok: true, contents: CResult_PongDecodeErrorZPtr {
11124                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::Pong>::clone(unsafe { &*self.contents.result })))
11125                         } }
11126                 } else {
11127                         Self { result_ok: false, contents: CResult_PongDecodeErrorZPtr {
11128                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
11129                         } }
11130                 }
11131         }
11132 }
11133 #[no_mangle]
11134 /// Creates a new CResult_PongDecodeErrorZ which has the same data as `orig`
11135 /// but with all dynamically-allocated buffers duplicated in new buffers.
11136 pub extern "C" fn CResult_PongDecodeErrorZ_clone(orig: &CResult_PongDecodeErrorZ) -> CResult_PongDecodeErrorZ { Clone::clone(&orig) }
11137 #[repr(C)]
11138 /// The contents of CResult_UnsignedChannelAnnouncementDecodeErrorZ
11139 pub union CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
11140         /// A pointer to the contents in the success state.
11141         /// Reading from this pointer when `result_ok` is not set is undefined.
11142         pub result: *mut crate::lightning::ln::msgs::UnsignedChannelAnnouncement,
11143         /// A pointer to the contents in the error state.
11144         /// Reading from this pointer when `result_ok` is set is undefined.
11145         pub err: *mut crate::lightning::ln::msgs::DecodeError,
11146 }
11147 #[repr(C)]
11148 /// A CResult_UnsignedChannelAnnouncementDecodeErrorZ represents the result of a fallible operation,
11149 /// containing a crate::lightning::ln::msgs::UnsignedChannelAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
11150 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11151 pub struct CResult_UnsignedChannelAnnouncementDecodeErrorZ {
11152         /// The contents of this CResult_UnsignedChannelAnnouncementDecodeErrorZ, accessible via either
11153         /// `err` or `result` depending on the state of `result_ok`.
11154         pub contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr,
11155         /// Whether this CResult_UnsignedChannelAnnouncementDecodeErrorZ represents a success state.
11156         pub result_ok: bool,
11157 }
11158 #[no_mangle]
11159 /// Creates a new CResult_UnsignedChannelAnnouncementDecodeErrorZ in the success state.
11160 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UnsignedChannelAnnouncement) -> CResult_UnsignedChannelAnnouncementDecodeErrorZ {
11161         CResult_UnsignedChannelAnnouncementDecodeErrorZ {
11162                 contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
11163                         result: Box::into_raw(Box::new(o)),
11164                 },
11165                 result_ok: true,
11166         }
11167 }
11168 #[no_mangle]
11169 /// Creates a new CResult_UnsignedChannelAnnouncementDecodeErrorZ in the error state.
11170 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UnsignedChannelAnnouncementDecodeErrorZ {
11171         CResult_UnsignedChannelAnnouncementDecodeErrorZ {
11172                 contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
11173                         err: Box::into_raw(Box::new(e)),
11174                 },
11175                 result_ok: false,
11176         }
11177 }
11178 #[no_mangle]
11179 /// Frees any resources used by the CResult_UnsignedChannelAnnouncementDecodeErrorZ.
11180 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_free(_res: CResult_UnsignedChannelAnnouncementDecodeErrorZ) { }
11181 impl Drop for CResult_UnsignedChannelAnnouncementDecodeErrorZ {
11182         fn drop(&mut self) {
11183                 if self.result_ok {
11184                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
11185                                 let _ = unsafe { Box::from_raw(self.contents.result) };
11186                         }
11187                 } else {
11188                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
11189                                 let _ = unsafe { Box::from_raw(self.contents.err) };
11190                         }
11191                 }
11192         }
11193 }
11194 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedChannelAnnouncement, crate::lightning::ln::msgs::DecodeError>> for CResult_UnsignedChannelAnnouncementDecodeErrorZ {
11195         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedChannelAnnouncement, crate::lightning::ln::msgs::DecodeError>) -> Self {
11196                 let contents = if o.result_ok {
11197                         let result = unsafe { o.contents.result };
11198                         unsafe { o.contents.result = std::ptr::null_mut() };
11199                         CResult_UnsignedChannelAnnouncementDecodeErrorZPtr { result }
11200                 } else {
11201                         let err = unsafe { o.contents.err };
11202                         unsafe { o.contents.err = std::ptr::null_mut(); }
11203                         CResult_UnsignedChannelAnnouncementDecodeErrorZPtr { err }
11204                 };
11205                 Self {
11206                         contents,
11207                         result_ok: o.result_ok,
11208                 }
11209         }
11210 }
11211 impl Clone for CResult_UnsignedChannelAnnouncementDecodeErrorZ {
11212         fn clone(&self) -> Self {
11213                 if self.result_ok {
11214                         Self { result_ok: true, contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
11215                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UnsignedChannelAnnouncement>::clone(unsafe { &*self.contents.result })))
11216                         } }
11217                 } else {
11218                         Self { result_ok: false, contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
11219                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
11220                         } }
11221                 }
11222         }
11223 }
11224 #[no_mangle]
11225 /// Creates a new CResult_UnsignedChannelAnnouncementDecodeErrorZ which has the same data as `orig`
11226 /// but with all dynamically-allocated buffers duplicated in new buffers.
11227 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone(orig: &CResult_UnsignedChannelAnnouncementDecodeErrorZ) -> CResult_UnsignedChannelAnnouncementDecodeErrorZ { Clone::clone(&orig) }
11228 #[repr(C)]
11229 /// The contents of CResult_ChannelAnnouncementDecodeErrorZ
11230 pub union CResult_ChannelAnnouncementDecodeErrorZPtr {
11231         /// A pointer to the contents in the success state.
11232         /// Reading from this pointer when `result_ok` is not set is undefined.
11233         pub result: *mut crate::lightning::ln::msgs::ChannelAnnouncement,
11234         /// A pointer to the contents in the error state.
11235         /// Reading from this pointer when `result_ok` is set is undefined.
11236         pub err: *mut crate::lightning::ln::msgs::DecodeError,
11237 }
11238 #[repr(C)]
11239 /// A CResult_ChannelAnnouncementDecodeErrorZ represents the result of a fallible operation,
11240 /// containing a crate::lightning::ln::msgs::ChannelAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
11241 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11242 pub struct CResult_ChannelAnnouncementDecodeErrorZ {
11243         /// The contents of this CResult_ChannelAnnouncementDecodeErrorZ, accessible via either
11244         /// `err` or `result` depending on the state of `result_ok`.
11245         pub contents: CResult_ChannelAnnouncementDecodeErrorZPtr,
11246         /// Whether this CResult_ChannelAnnouncementDecodeErrorZ represents a success state.
11247         pub result_ok: bool,
11248 }
11249 #[no_mangle]
11250 /// Creates a new CResult_ChannelAnnouncementDecodeErrorZ in the success state.
11251 pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ChannelAnnouncement) -> CResult_ChannelAnnouncementDecodeErrorZ {
11252         CResult_ChannelAnnouncementDecodeErrorZ {
11253                 contents: CResult_ChannelAnnouncementDecodeErrorZPtr {
11254                         result: Box::into_raw(Box::new(o)),
11255                 },
11256                 result_ok: true,
11257         }
11258 }
11259 #[no_mangle]
11260 /// Creates a new CResult_ChannelAnnouncementDecodeErrorZ in the error state.
11261 pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelAnnouncementDecodeErrorZ {
11262         CResult_ChannelAnnouncementDecodeErrorZ {
11263                 contents: CResult_ChannelAnnouncementDecodeErrorZPtr {
11264                         err: Box::into_raw(Box::new(e)),
11265                 },
11266                 result_ok: false,
11267         }
11268 }
11269 #[no_mangle]
11270 /// Frees any resources used by the CResult_ChannelAnnouncementDecodeErrorZ.
11271 pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_free(_res: CResult_ChannelAnnouncementDecodeErrorZ) { }
11272 impl Drop for CResult_ChannelAnnouncementDecodeErrorZ {
11273         fn drop(&mut self) {
11274                 if self.result_ok {
11275                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
11276                                 let _ = unsafe { Box::from_raw(self.contents.result) };
11277                         }
11278                 } else {
11279                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
11280                                 let _ = unsafe { Box::from_raw(self.contents.err) };
11281                         }
11282                 }
11283         }
11284 }
11285 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelAnnouncement, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelAnnouncementDecodeErrorZ {
11286         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelAnnouncement, crate::lightning::ln::msgs::DecodeError>) -> Self {
11287                 let contents = if o.result_ok {
11288                         let result = unsafe { o.contents.result };
11289                         unsafe { o.contents.result = std::ptr::null_mut() };
11290                         CResult_ChannelAnnouncementDecodeErrorZPtr { result }
11291                 } else {
11292                         let err = unsafe { o.contents.err };
11293                         unsafe { o.contents.err = std::ptr::null_mut(); }
11294                         CResult_ChannelAnnouncementDecodeErrorZPtr { err }
11295                 };
11296                 Self {
11297                         contents,
11298                         result_ok: o.result_ok,
11299                 }
11300         }
11301 }
11302 impl Clone for CResult_ChannelAnnouncementDecodeErrorZ {
11303         fn clone(&self) -> Self {
11304                 if self.result_ok {
11305                         Self { result_ok: true, contents: CResult_ChannelAnnouncementDecodeErrorZPtr {
11306                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ChannelAnnouncement>::clone(unsafe { &*self.contents.result })))
11307                         } }
11308                 } else {
11309                         Self { result_ok: false, contents: CResult_ChannelAnnouncementDecodeErrorZPtr {
11310                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
11311                         } }
11312                 }
11313         }
11314 }
11315 #[no_mangle]
11316 /// Creates a new CResult_ChannelAnnouncementDecodeErrorZ which has the same data as `orig`
11317 /// but with all dynamically-allocated buffers duplicated in new buffers.
11318 pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_clone(orig: &CResult_ChannelAnnouncementDecodeErrorZ) -> CResult_ChannelAnnouncementDecodeErrorZ { Clone::clone(&orig) }
11319 #[repr(C)]
11320 /// The contents of CResult_UnsignedChannelUpdateDecodeErrorZ
11321 pub union CResult_UnsignedChannelUpdateDecodeErrorZPtr {
11322         /// A pointer to the contents in the success state.
11323         /// Reading from this pointer when `result_ok` is not set is undefined.
11324         pub result: *mut crate::lightning::ln::msgs::UnsignedChannelUpdate,
11325         /// A pointer to the contents in the error state.
11326         /// Reading from this pointer when `result_ok` is set is undefined.
11327         pub err: *mut crate::lightning::ln::msgs::DecodeError,
11328 }
11329 #[repr(C)]
11330 /// A CResult_UnsignedChannelUpdateDecodeErrorZ represents the result of a fallible operation,
11331 /// containing a crate::lightning::ln::msgs::UnsignedChannelUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
11332 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11333 pub struct CResult_UnsignedChannelUpdateDecodeErrorZ {
11334         /// The contents of this CResult_UnsignedChannelUpdateDecodeErrorZ, accessible via either
11335         /// `err` or `result` depending on the state of `result_ok`.
11336         pub contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr,
11337         /// Whether this CResult_UnsignedChannelUpdateDecodeErrorZ represents a success state.
11338         pub result_ok: bool,
11339 }
11340 #[no_mangle]
11341 /// Creates a new CResult_UnsignedChannelUpdateDecodeErrorZ in the success state.
11342 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UnsignedChannelUpdate) -> CResult_UnsignedChannelUpdateDecodeErrorZ {
11343         CResult_UnsignedChannelUpdateDecodeErrorZ {
11344                 contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr {
11345                         result: Box::into_raw(Box::new(o)),
11346                 },
11347                 result_ok: true,
11348         }
11349 }
11350 #[no_mangle]
11351 /// Creates a new CResult_UnsignedChannelUpdateDecodeErrorZ in the error state.
11352 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UnsignedChannelUpdateDecodeErrorZ {
11353         CResult_UnsignedChannelUpdateDecodeErrorZ {
11354                 contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr {
11355                         err: Box::into_raw(Box::new(e)),
11356                 },
11357                 result_ok: false,
11358         }
11359 }
11360 #[no_mangle]
11361 /// Frees any resources used by the CResult_UnsignedChannelUpdateDecodeErrorZ.
11362 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_free(_res: CResult_UnsignedChannelUpdateDecodeErrorZ) { }
11363 impl Drop for CResult_UnsignedChannelUpdateDecodeErrorZ {
11364         fn drop(&mut self) {
11365                 if self.result_ok {
11366                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
11367                                 let _ = unsafe { Box::from_raw(self.contents.result) };
11368                         }
11369                 } else {
11370                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
11371                                 let _ = unsafe { Box::from_raw(self.contents.err) };
11372                         }
11373                 }
11374         }
11375 }
11376 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedChannelUpdate, crate::lightning::ln::msgs::DecodeError>> for CResult_UnsignedChannelUpdateDecodeErrorZ {
11377         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedChannelUpdate, crate::lightning::ln::msgs::DecodeError>) -> Self {
11378                 let contents = if o.result_ok {
11379                         let result = unsafe { o.contents.result };
11380                         unsafe { o.contents.result = std::ptr::null_mut() };
11381                         CResult_UnsignedChannelUpdateDecodeErrorZPtr { result }
11382                 } else {
11383                         let err = unsafe { o.contents.err };
11384                         unsafe { o.contents.err = std::ptr::null_mut(); }
11385                         CResult_UnsignedChannelUpdateDecodeErrorZPtr { err }
11386                 };
11387                 Self {
11388                         contents,
11389                         result_ok: o.result_ok,
11390                 }
11391         }
11392 }
11393 impl Clone for CResult_UnsignedChannelUpdateDecodeErrorZ {
11394         fn clone(&self) -> Self {
11395                 if self.result_ok {
11396                         Self { result_ok: true, contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr {
11397                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UnsignedChannelUpdate>::clone(unsafe { &*self.contents.result })))
11398                         } }
11399                 } else {
11400                         Self { result_ok: false, contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr {
11401                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
11402                         } }
11403                 }
11404         }
11405 }
11406 #[no_mangle]
11407 /// Creates a new CResult_UnsignedChannelUpdateDecodeErrorZ which has the same data as `orig`
11408 /// but with all dynamically-allocated buffers duplicated in new buffers.
11409 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_clone(orig: &CResult_UnsignedChannelUpdateDecodeErrorZ) -> CResult_UnsignedChannelUpdateDecodeErrorZ { Clone::clone(&orig) }
11410 #[repr(C)]
11411 /// The contents of CResult_ChannelUpdateDecodeErrorZ
11412 pub union CResult_ChannelUpdateDecodeErrorZPtr {
11413         /// A pointer to the contents in the success state.
11414         /// Reading from this pointer when `result_ok` is not set is undefined.
11415         pub result: *mut crate::lightning::ln::msgs::ChannelUpdate,
11416         /// A pointer to the contents in the error state.
11417         /// Reading from this pointer when `result_ok` is set is undefined.
11418         pub err: *mut crate::lightning::ln::msgs::DecodeError,
11419 }
11420 #[repr(C)]
11421 /// A CResult_ChannelUpdateDecodeErrorZ represents the result of a fallible operation,
11422 /// containing a crate::lightning::ln::msgs::ChannelUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
11423 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11424 pub struct CResult_ChannelUpdateDecodeErrorZ {
11425         /// The contents of this CResult_ChannelUpdateDecodeErrorZ, accessible via either
11426         /// `err` or `result` depending on the state of `result_ok`.
11427         pub contents: CResult_ChannelUpdateDecodeErrorZPtr,
11428         /// Whether this CResult_ChannelUpdateDecodeErrorZ represents a success state.
11429         pub result_ok: bool,
11430 }
11431 #[no_mangle]
11432 /// Creates a new CResult_ChannelUpdateDecodeErrorZ in the success state.
11433 pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ChannelUpdate) -> CResult_ChannelUpdateDecodeErrorZ {
11434         CResult_ChannelUpdateDecodeErrorZ {
11435                 contents: CResult_ChannelUpdateDecodeErrorZPtr {
11436                         result: Box::into_raw(Box::new(o)),
11437                 },
11438                 result_ok: true,
11439         }
11440 }
11441 #[no_mangle]
11442 /// Creates a new CResult_ChannelUpdateDecodeErrorZ in the error state.
11443 pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelUpdateDecodeErrorZ {
11444         CResult_ChannelUpdateDecodeErrorZ {
11445                 contents: CResult_ChannelUpdateDecodeErrorZPtr {
11446                         err: Box::into_raw(Box::new(e)),
11447                 },
11448                 result_ok: false,
11449         }
11450 }
11451 #[no_mangle]
11452 /// Frees any resources used by the CResult_ChannelUpdateDecodeErrorZ.
11453 pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_free(_res: CResult_ChannelUpdateDecodeErrorZ) { }
11454 impl Drop for CResult_ChannelUpdateDecodeErrorZ {
11455         fn drop(&mut self) {
11456                 if self.result_ok {
11457                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
11458                                 let _ = unsafe { Box::from_raw(self.contents.result) };
11459                         }
11460                 } else {
11461                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
11462                                 let _ = unsafe { Box::from_raw(self.contents.err) };
11463                         }
11464                 }
11465         }
11466 }
11467 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelUpdate, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelUpdateDecodeErrorZ {
11468         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelUpdate, crate::lightning::ln::msgs::DecodeError>) -> Self {
11469                 let contents = if o.result_ok {
11470                         let result = unsafe { o.contents.result };
11471                         unsafe { o.contents.result = std::ptr::null_mut() };
11472                         CResult_ChannelUpdateDecodeErrorZPtr { result }
11473                 } else {
11474                         let err = unsafe { o.contents.err };
11475                         unsafe { o.contents.err = std::ptr::null_mut(); }
11476                         CResult_ChannelUpdateDecodeErrorZPtr { err }
11477                 };
11478                 Self {
11479                         contents,
11480                         result_ok: o.result_ok,
11481                 }
11482         }
11483 }
11484 impl Clone for CResult_ChannelUpdateDecodeErrorZ {
11485         fn clone(&self) -> Self {
11486                 if self.result_ok {
11487                         Self { result_ok: true, contents: CResult_ChannelUpdateDecodeErrorZPtr {
11488                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ChannelUpdate>::clone(unsafe { &*self.contents.result })))
11489                         } }
11490                 } else {
11491                         Self { result_ok: false, contents: CResult_ChannelUpdateDecodeErrorZPtr {
11492                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
11493                         } }
11494                 }
11495         }
11496 }
11497 #[no_mangle]
11498 /// Creates a new CResult_ChannelUpdateDecodeErrorZ which has the same data as `orig`
11499 /// but with all dynamically-allocated buffers duplicated in new buffers.
11500 pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_clone(orig: &CResult_ChannelUpdateDecodeErrorZ) -> CResult_ChannelUpdateDecodeErrorZ { Clone::clone(&orig) }
11501 #[repr(C)]
11502 /// The contents of CResult_ErrorMessageDecodeErrorZ
11503 pub union CResult_ErrorMessageDecodeErrorZPtr {
11504         /// A pointer to the contents in the success state.
11505         /// Reading from this pointer when `result_ok` is not set is undefined.
11506         pub result: *mut crate::lightning::ln::msgs::ErrorMessage,
11507         /// A pointer to the contents in the error state.
11508         /// Reading from this pointer when `result_ok` is set is undefined.
11509         pub err: *mut crate::lightning::ln::msgs::DecodeError,
11510 }
11511 #[repr(C)]
11512 /// A CResult_ErrorMessageDecodeErrorZ represents the result of a fallible operation,
11513 /// containing a crate::lightning::ln::msgs::ErrorMessage on success and a crate::lightning::ln::msgs::DecodeError on failure.
11514 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11515 pub struct CResult_ErrorMessageDecodeErrorZ {
11516         /// The contents of this CResult_ErrorMessageDecodeErrorZ, accessible via either
11517         /// `err` or `result` depending on the state of `result_ok`.
11518         pub contents: CResult_ErrorMessageDecodeErrorZPtr,
11519         /// Whether this CResult_ErrorMessageDecodeErrorZ represents a success state.
11520         pub result_ok: bool,
11521 }
11522 #[no_mangle]
11523 /// Creates a new CResult_ErrorMessageDecodeErrorZ in the success state.
11524 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ErrorMessage) -> CResult_ErrorMessageDecodeErrorZ {
11525         CResult_ErrorMessageDecodeErrorZ {
11526                 contents: CResult_ErrorMessageDecodeErrorZPtr {
11527                         result: Box::into_raw(Box::new(o)),
11528                 },
11529                 result_ok: true,
11530         }
11531 }
11532 #[no_mangle]
11533 /// Creates a new CResult_ErrorMessageDecodeErrorZ in the error state.
11534 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ErrorMessageDecodeErrorZ {
11535         CResult_ErrorMessageDecodeErrorZ {
11536                 contents: CResult_ErrorMessageDecodeErrorZPtr {
11537                         err: Box::into_raw(Box::new(e)),
11538                 },
11539                 result_ok: false,
11540         }
11541 }
11542 #[no_mangle]
11543 /// Frees any resources used by the CResult_ErrorMessageDecodeErrorZ.
11544 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_free(_res: CResult_ErrorMessageDecodeErrorZ) { }
11545 impl Drop for CResult_ErrorMessageDecodeErrorZ {
11546         fn drop(&mut self) {
11547                 if self.result_ok {
11548                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
11549                                 let _ = unsafe { Box::from_raw(self.contents.result) };
11550                         }
11551                 } else {
11552                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
11553                                 let _ = unsafe { Box::from_raw(self.contents.err) };
11554                         }
11555                 }
11556         }
11557 }
11558 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ErrorMessage, crate::lightning::ln::msgs::DecodeError>> for CResult_ErrorMessageDecodeErrorZ {
11559         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ErrorMessage, crate::lightning::ln::msgs::DecodeError>) -> Self {
11560                 let contents = if o.result_ok {
11561                         let result = unsafe { o.contents.result };
11562                         unsafe { o.contents.result = std::ptr::null_mut() };
11563                         CResult_ErrorMessageDecodeErrorZPtr { result }
11564                 } else {
11565                         let err = unsafe { o.contents.err };
11566                         unsafe { o.contents.err = std::ptr::null_mut(); }
11567                         CResult_ErrorMessageDecodeErrorZPtr { err }
11568                 };
11569                 Self {
11570                         contents,
11571                         result_ok: o.result_ok,
11572                 }
11573         }
11574 }
11575 impl Clone for CResult_ErrorMessageDecodeErrorZ {
11576         fn clone(&self) -> Self {
11577                 if self.result_ok {
11578                         Self { result_ok: true, contents: CResult_ErrorMessageDecodeErrorZPtr {
11579                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ErrorMessage>::clone(unsafe { &*self.contents.result })))
11580                         } }
11581                 } else {
11582                         Self { result_ok: false, contents: CResult_ErrorMessageDecodeErrorZPtr {
11583                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
11584                         } }
11585                 }
11586         }
11587 }
11588 #[no_mangle]
11589 /// Creates a new CResult_ErrorMessageDecodeErrorZ which has the same data as `orig`
11590 /// but with all dynamically-allocated buffers duplicated in new buffers.
11591 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_clone(orig: &CResult_ErrorMessageDecodeErrorZ) -> CResult_ErrorMessageDecodeErrorZ { Clone::clone(&orig) }
11592 #[repr(C)]
11593 /// The contents of CResult_UnsignedNodeAnnouncementDecodeErrorZ
11594 pub union CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
11595         /// A pointer to the contents in the success state.
11596         /// Reading from this pointer when `result_ok` is not set is undefined.
11597         pub result: *mut crate::lightning::ln::msgs::UnsignedNodeAnnouncement,
11598         /// A pointer to the contents in the error state.
11599         /// Reading from this pointer when `result_ok` is set is undefined.
11600         pub err: *mut crate::lightning::ln::msgs::DecodeError,
11601 }
11602 #[repr(C)]
11603 /// A CResult_UnsignedNodeAnnouncementDecodeErrorZ represents the result of a fallible operation,
11604 /// containing a crate::lightning::ln::msgs::UnsignedNodeAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
11605 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11606 pub struct CResult_UnsignedNodeAnnouncementDecodeErrorZ {
11607         /// The contents of this CResult_UnsignedNodeAnnouncementDecodeErrorZ, accessible via either
11608         /// `err` or `result` depending on the state of `result_ok`.
11609         pub contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr,
11610         /// Whether this CResult_UnsignedNodeAnnouncementDecodeErrorZ represents a success state.
11611         pub result_ok: bool,
11612 }
11613 #[no_mangle]
11614 /// Creates a new CResult_UnsignedNodeAnnouncementDecodeErrorZ in the success state.
11615 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UnsignedNodeAnnouncement) -> CResult_UnsignedNodeAnnouncementDecodeErrorZ {
11616         CResult_UnsignedNodeAnnouncementDecodeErrorZ {
11617                 contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
11618                         result: Box::into_raw(Box::new(o)),
11619                 },
11620                 result_ok: true,
11621         }
11622 }
11623 #[no_mangle]
11624 /// Creates a new CResult_UnsignedNodeAnnouncementDecodeErrorZ in the error state.
11625 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UnsignedNodeAnnouncementDecodeErrorZ {
11626         CResult_UnsignedNodeAnnouncementDecodeErrorZ {
11627                 contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
11628                         err: Box::into_raw(Box::new(e)),
11629                 },
11630                 result_ok: false,
11631         }
11632 }
11633 #[no_mangle]
11634 /// Frees any resources used by the CResult_UnsignedNodeAnnouncementDecodeErrorZ.
11635 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_free(_res: CResult_UnsignedNodeAnnouncementDecodeErrorZ) { }
11636 impl Drop for CResult_UnsignedNodeAnnouncementDecodeErrorZ {
11637         fn drop(&mut self) {
11638                 if self.result_ok {
11639                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
11640                                 let _ = unsafe { Box::from_raw(self.contents.result) };
11641                         }
11642                 } else {
11643                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
11644                                 let _ = unsafe { Box::from_raw(self.contents.err) };
11645                         }
11646                 }
11647         }
11648 }
11649 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedNodeAnnouncement, crate::lightning::ln::msgs::DecodeError>> for CResult_UnsignedNodeAnnouncementDecodeErrorZ {
11650         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedNodeAnnouncement, crate::lightning::ln::msgs::DecodeError>) -> Self {
11651                 let contents = if o.result_ok {
11652                         let result = unsafe { o.contents.result };
11653                         unsafe { o.contents.result = std::ptr::null_mut() };
11654                         CResult_UnsignedNodeAnnouncementDecodeErrorZPtr { result }
11655                 } else {
11656                         let err = unsafe { o.contents.err };
11657                         unsafe { o.contents.err = std::ptr::null_mut(); }
11658                         CResult_UnsignedNodeAnnouncementDecodeErrorZPtr { err }
11659                 };
11660                 Self {
11661                         contents,
11662                         result_ok: o.result_ok,
11663                 }
11664         }
11665 }
11666 impl Clone for CResult_UnsignedNodeAnnouncementDecodeErrorZ {
11667         fn clone(&self) -> Self {
11668                 if self.result_ok {
11669                         Self { result_ok: true, contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
11670                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UnsignedNodeAnnouncement>::clone(unsafe { &*self.contents.result })))
11671                         } }
11672                 } else {
11673                         Self { result_ok: false, contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
11674                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
11675                         } }
11676                 }
11677         }
11678 }
11679 #[no_mangle]
11680 /// Creates a new CResult_UnsignedNodeAnnouncementDecodeErrorZ which has the same data as `orig`
11681 /// but with all dynamically-allocated buffers duplicated in new buffers.
11682 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone(orig: &CResult_UnsignedNodeAnnouncementDecodeErrorZ) -> CResult_UnsignedNodeAnnouncementDecodeErrorZ { Clone::clone(&orig) }
11683 #[repr(C)]
11684 /// The contents of CResult_NodeAnnouncementDecodeErrorZ
11685 pub union CResult_NodeAnnouncementDecodeErrorZPtr {
11686         /// A pointer to the contents in the success state.
11687         /// Reading from this pointer when `result_ok` is not set is undefined.
11688         pub result: *mut crate::lightning::ln::msgs::NodeAnnouncement,
11689         /// A pointer to the contents in the error state.
11690         /// Reading from this pointer when `result_ok` is set is undefined.
11691         pub err: *mut crate::lightning::ln::msgs::DecodeError,
11692 }
11693 #[repr(C)]
11694 /// A CResult_NodeAnnouncementDecodeErrorZ represents the result of a fallible operation,
11695 /// containing a crate::lightning::ln::msgs::NodeAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
11696 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11697 pub struct CResult_NodeAnnouncementDecodeErrorZ {
11698         /// The contents of this CResult_NodeAnnouncementDecodeErrorZ, accessible via either
11699         /// `err` or `result` depending on the state of `result_ok`.
11700         pub contents: CResult_NodeAnnouncementDecodeErrorZPtr,
11701         /// Whether this CResult_NodeAnnouncementDecodeErrorZ represents a success state.
11702         pub result_ok: bool,
11703 }
11704 #[no_mangle]
11705 /// Creates a new CResult_NodeAnnouncementDecodeErrorZ in the success state.
11706 pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_ok(o: crate::lightning::ln::msgs::NodeAnnouncement) -> CResult_NodeAnnouncementDecodeErrorZ {
11707         CResult_NodeAnnouncementDecodeErrorZ {
11708                 contents: CResult_NodeAnnouncementDecodeErrorZPtr {
11709                         result: Box::into_raw(Box::new(o)),
11710                 },
11711                 result_ok: true,
11712         }
11713 }
11714 #[no_mangle]
11715 /// Creates a new CResult_NodeAnnouncementDecodeErrorZ in the error state.
11716 pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeAnnouncementDecodeErrorZ {
11717         CResult_NodeAnnouncementDecodeErrorZ {
11718                 contents: CResult_NodeAnnouncementDecodeErrorZPtr {
11719                         err: Box::into_raw(Box::new(e)),
11720                 },
11721                 result_ok: false,
11722         }
11723 }
11724 #[no_mangle]
11725 /// Frees any resources used by the CResult_NodeAnnouncementDecodeErrorZ.
11726 pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_free(_res: CResult_NodeAnnouncementDecodeErrorZ) { }
11727 impl Drop for CResult_NodeAnnouncementDecodeErrorZ {
11728         fn drop(&mut self) {
11729                 if self.result_ok {
11730                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
11731                                 let _ = unsafe { Box::from_raw(self.contents.result) };
11732                         }
11733                 } else {
11734                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
11735                                 let _ = unsafe { Box::from_raw(self.contents.err) };
11736                         }
11737                 }
11738         }
11739 }
11740 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::NodeAnnouncement, crate::lightning::ln::msgs::DecodeError>> for CResult_NodeAnnouncementDecodeErrorZ {
11741         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::NodeAnnouncement, crate::lightning::ln::msgs::DecodeError>) -> Self {
11742                 let contents = if o.result_ok {
11743                         let result = unsafe { o.contents.result };
11744                         unsafe { o.contents.result = std::ptr::null_mut() };
11745                         CResult_NodeAnnouncementDecodeErrorZPtr { result }
11746                 } else {
11747                         let err = unsafe { o.contents.err };
11748                         unsafe { o.contents.err = std::ptr::null_mut(); }
11749                         CResult_NodeAnnouncementDecodeErrorZPtr { err }
11750                 };
11751                 Self {
11752                         contents,
11753                         result_ok: o.result_ok,
11754                 }
11755         }
11756 }
11757 impl Clone for CResult_NodeAnnouncementDecodeErrorZ {
11758         fn clone(&self) -> Self {
11759                 if self.result_ok {
11760                         Self { result_ok: true, contents: CResult_NodeAnnouncementDecodeErrorZPtr {
11761                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::NodeAnnouncement>::clone(unsafe { &*self.contents.result })))
11762                         } }
11763                 } else {
11764                         Self { result_ok: false, contents: CResult_NodeAnnouncementDecodeErrorZPtr {
11765                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
11766                         } }
11767                 }
11768         }
11769 }
11770 #[no_mangle]
11771 /// Creates a new CResult_NodeAnnouncementDecodeErrorZ which has the same data as `orig`
11772 /// but with all dynamically-allocated buffers duplicated in new buffers.
11773 pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_clone(orig: &CResult_NodeAnnouncementDecodeErrorZ) -> CResult_NodeAnnouncementDecodeErrorZ { Clone::clone(&orig) }
11774 #[repr(C)]
11775 /// The contents of CResult_QueryShortChannelIdsDecodeErrorZ
11776 pub union CResult_QueryShortChannelIdsDecodeErrorZPtr {
11777         /// A pointer to the contents in the success state.
11778         /// Reading from this pointer when `result_ok` is not set is undefined.
11779         pub result: *mut crate::lightning::ln::msgs::QueryShortChannelIds,
11780         /// A pointer to the contents in the error state.
11781         /// Reading from this pointer when `result_ok` is set is undefined.
11782         pub err: *mut crate::lightning::ln::msgs::DecodeError,
11783 }
11784 #[repr(C)]
11785 /// A CResult_QueryShortChannelIdsDecodeErrorZ represents the result of a fallible operation,
11786 /// containing a crate::lightning::ln::msgs::QueryShortChannelIds on success and a crate::lightning::ln::msgs::DecodeError on failure.
11787 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11788 pub struct CResult_QueryShortChannelIdsDecodeErrorZ {
11789         /// The contents of this CResult_QueryShortChannelIdsDecodeErrorZ, accessible via either
11790         /// `err` or `result` depending on the state of `result_ok`.
11791         pub contents: CResult_QueryShortChannelIdsDecodeErrorZPtr,
11792         /// Whether this CResult_QueryShortChannelIdsDecodeErrorZ represents a success state.
11793         pub result_ok: bool,
11794 }
11795 #[no_mangle]
11796 /// Creates a new CResult_QueryShortChannelIdsDecodeErrorZ in the success state.
11797 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_ok(o: crate::lightning::ln::msgs::QueryShortChannelIds) -> CResult_QueryShortChannelIdsDecodeErrorZ {
11798         CResult_QueryShortChannelIdsDecodeErrorZ {
11799                 contents: CResult_QueryShortChannelIdsDecodeErrorZPtr {
11800                         result: Box::into_raw(Box::new(o)),
11801                 },
11802                 result_ok: true,
11803         }
11804 }
11805 #[no_mangle]
11806 /// Creates a new CResult_QueryShortChannelIdsDecodeErrorZ in the error state.
11807 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_QueryShortChannelIdsDecodeErrorZ {
11808         CResult_QueryShortChannelIdsDecodeErrorZ {
11809                 contents: CResult_QueryShortChannelIdsDecodeErrorZPtr {
11810                         err: Box::into_raw(Box::new(e)),
11811                 },
11812                 result_ok: false,
11813         }
11814 }
11815 #[no_mangle]
11816 /// Frees any resources used by the CResult_QueryShortChannelIdsDecodeErrorZ.
11817 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_free(_res: CResult_QueryShortChannelIdsDecodeErrorZ) { }
11818 impl Drop for CResult_QueryShortChannelIdsDecodeErrorZ {
11819         fn drop(&mut self) {
11820                 if self.result_ok {
11821                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
11822                                 let _ = unsafe { Box::from_raw(self.contents.result) };
11823                         }
11824                 } else {
11825                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
11826                                 let _ = unsafe { Box::from_raw(self.contents.err) };
11827                         }
11828                 }
11829         }
11830 }
11831 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::QueryShortChannelIds, crate::lightning::ln::msgs::DecodeError>> for CResult_QueryShortChannelIdsDecodeErrorZ {
11832         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::QueryShortChannelIds, crate::lightning::ln::msgs::DecodeError>) -> Self {
11833                 let contents = if o.result_ok {
11834                         let result = unsafe { o.contents.result };
11835                         unsafe { o.contents.result = std::ptr::null_mut() };
11836                         CResult_QueryShortChannelIdsDecodeErrorZPtr { result }
11837                 } else {
11838                         let err = unsafe { o.contents.err };
11839                         unsafe { o.contents.err = std::ptr::null_mut(); }
11840                         CResult_QueryShortChannelIdsDecodeErrorZPtr { err }
11841                 };
11842                 Self {
11843                         contents,
11844                         result_ok: o.result_ok,
11845                 }
11846         }
11847 }
11848 impl Clone for CResult_QueryShortChannelIdsDecodeErrorZ {
11849         fn clone(&self) -> Self {
11850                 if self.result_ok {
11851                         Self { result_ok: true, contents: CResult_QueryShortChannelIdsDecodeErrorZPtr {
11852                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::QueryShortChannelIds>::clone(unsafe { &*self.contents.result })))
11853                         } }
11854                 } else {
11855                         Self { result_ok: false, contents: CResult_QueryShortChannelIdsDecodeErrorZPtr {
11856                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
11857                         } }
11858                 }
11859         }
11860 }
11861 #[no_mangle]
11862 /// Creates a new CResult_QueryShortChannelIdsDecodeErrorZ which has the same data as `orig`
11863 /// but with all dynamically-allocated buffers duplicated in new buffers.
11864 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_clone(orig: &CResult_QueryShortChannelIdsDecodeErrorZ) -> CResult_QueryShortChannelIdsDecodeErrorZ { Clone::clone(&orig) }
11865 #[repr(C)]
11866 /// The contents of CResult_ReplyShortChannelIdsEndDecodeErrorZ
11867 pub union CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
11868         /// A pointer to the contents in the success state.
11869         /// Reading from this pointer when `result_ok` is not set is undefined.
11870         pub result: *mut crate::lightning::ln::msgs::ReplyShortChannelIdsEnd,
11871         /// A pointer to the contents in the error state.
11872         /// Reading from this pointer when `result_ok` is set is undefined.
11873         pub err: *mut crate::lightning::ln::msgs::DecodeError,
11874 }
11875 #[repr(C)]
11876 /// A CResult_ReplyShortChannelIdsEndDecodeErrorZ represents the result of a fallible operation,
11877 /// containing a crate::lightning::ln::msgs::ReplyShortChannelIdsEnd on success and a crate::lightning::ln::msgs::DecodeError on failure.
11878 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11879 pub struct CResult_ReplyShortChannelIdsEndDecodeErrorZ {
11880         /// The contents of this CResult_ReplyShortChannelIdsEndDecodeErrorZ, accessible via either
11881         /// `err` or `result` depending on the state of `result_ok`.
11882         pub contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr,
11883         /// Whether this CResult_ReplyShortChannelIdsEndDecodeErrorZ represents a success state.
11884         pub result_ok: bool,
11885 }
11886 #[no_mangle]
11887 /// Creates a new CResult_ReplyShortChannelIdsEndDecodeErrorZ in the success state.
11888 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ReplyShortChannelIdsEnd) -> CResult_ReplyShortChannelIdsEndDecodeErrorZ {
11889         CResult_ReplyShortChannelIdsEndDecodeErrorZ {
11890                 contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
11891                         result: Box::into_raw(Box::new(o)),
11892                 },
11893                 result_ok: true,
11894         }
11895 }
11896 #[no_mangle]
11897 /// Creates a new CResult_ReplyShortChannelIdsEndDecodeErrorZ in the error state.
11898 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ReplyShortChannelIdsEndDecodeErrorZ {
11899         CResult_ReplyShortChannelIdsEndDecodeErrorZ {
11900                 contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
11901                         err: Box::into_raw(Box::new(e)),
11902                 },
11903                 result_ok: false,
11904         }
11905 }
11906 #[no_mangle]
11907 /// Frees any resources used by the CResult_ReplyShortChannelIdsEndDecodeErrorZ.
11908 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_free(_res: CResult_ReplyShortChannelIdsEndDecodeErrorZ) { }
11909 impl Drop for CResult_ReplyShortChannelIdsEndDecodeErrorZ {
11910         fn drop(&mut self) {
11911                 if self.result_ok {
11912                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
11913                                 let _ = unsafe { Box::from_raw(self.contents.result) };
11914                         }
11915                 } else {
11916                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
11917                                 let _ = unsafe { Box::from_raw(self.contents.err) };
11918                         }
11919                 }
11920         }
11921 }
11922 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ReplyShortChannelIdsEnd, crate::lightning::ln::msgs::DecodeError>> for CResult_ReplyShortChannelIdsEndDecodeErrorZ {
11923         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ReplyShortChannelIdsEnd, crate::lightning::ln::msgs::DecodeError>) -> Self {
11924                 let contents = if o.result_ok {
11925                         let result = unsafe { o.contents.result };
11926                         unsafe { o.contents.result = std::ptr::null_mut() };
11927                         CResult_ReplyShortChannelIdsEndDecodeErrorZPtr { result }
11928                 } else {
11929                         let err = unsafe { o.contents.err };
11930                         unsafe { o.contents.err = std::ptr::null_mut(); }
11931                         CResult_ReplyShortChannelIdsEndDecodeErrorZPtr { err }
11932                 };
11933                 Self {
11934                         contents,
11935                         result_ok: o.result_ok,
11936                 }
11937         }
11938 }
11939 impl Clone for CResult_ReplyShortChannelIdsEndDecodeErrorZ {
11940         fn clone(&self) -> Self {
11941                 if self.result_ok {
11942                         Self { result_ok: true, contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
11943                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ReplyShortChannelIdsEnd>::clone(unsafe { &*self.contents.result })))
11944                         } }
11945                 } else {
11946                         Self { result_ok: false, contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
11947                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
11948                         } }
11949                 }
11950         }
11951 }
11952 #[no_mangle]
11953 /// Creates a new CResult_ReplyShortChannelIdsEndDecodeErrorZ which has the same data as `orig`
11954 /// but with all dynamically-allocated buffers duplicated in new buffers.
11955 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone(orig: &CResult_ReplyShortChannelIdsEndDecodeErrorZ) -> CResult_ReplyShortChannelIdsEndDecodeErrorZ { Clone::clone(&orig) }
11956 #[repr(C)]
11957 /// The contents of CResult_QueryChannelRangeDecodeErrorZ
11958 pub union CResult_QueryChannelRangeDecodeErrorZPtr {
11959         /// A pointer to the contents in the success state.
11960         /// Reading from this pointer when `result_ok` is not set is undefined.
11961         pub result: *mut crate::lightning::ln::msgs::QueryChannelRange,
11962         /// A pointer to the contents in the error state.
11963         /// Reading from this pointer when `result_ok` is set is undefined.
11964         pub err: *mut crate::lightning::ln::msgs::DecodeError,
11965 }
11966 #[repr(C)]
11967 /// A CResult_QueryChannelRangeDecodeErrorZ represents the result of a fallible operation,
11968 /// containing a crate::lightning::ln::msgs::QueryChannelRange on success and a crate::lightning::ln::msgs::DecodeError on failure.
11969 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11970 pub struct CResult_QueryChannelRangeDecodeErrorZ {
11971         /// The contents of this CResult_QueryChannelRangeDecodeErrorZ, accessible via either
11972         /// `err` or `result` depending on the state of `result_ok`.
11973         pub contents: CResult_QueryChannelRangeDecodeErrorZPtr,
11974         /// Whether this CResult_QueryChannelRangeDecodeErrorZ represents a success state.
11975         pub result_ok: bool,
11976 }
11977 #[no_mangle]
11978 /// Creates a new CResult_QueryChannelRangeDecodeErrorZ in the success state.
11979 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_ok(o: crate::lightning::ln::msgs::QueryChannelRange) -> CResult_QueryChannelRangeDecodeErrorZ {
11980         CResult_QueryChannelRangeDecodeErrorZ {
11981                 contents: CResult_QueryChannelRangeDecodeErrorZPtr {
11982                         result: Box::into_raw(Box::new(o)),
11983                 },
11984                 result_ok: true,
11985         }
11986 }
11987 #[no_mangle]
11988 /// Creates a new CResult_QueryChannelRangeDecodeErrorZ in the error state.
11989 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_QueryChannelRangeDecodeErrorZ {
11990         CResult_QueryChannelRangeDecodeErrorZ {
11991                 contents: CResult_QueryChannelRangeDecodeErrorZPtr {
11992                         err: Box::into_raw(Box::new(e)),
11993                 },
11994                 result_ok: false,
11995         }
11996 }
11997 #[no_mangle]
11998 /// Frees any resources used by the CResult_QueryChannelRangeDecodeErrorZ.
11999 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_free(_res: CResult_QueryChannelRangeDecodeErrorZ) { }
12000 impl Drop for CResult_QueryChannelRangeDecodeErrorZ {
12001         fn drop(&mut self) {
12002                 if self.result_ok {
12003                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
12004                                 let _ = unsafe { Box::from_raw(self.contents.result) };
12005                         }
12006                 } else {
12007                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
12008                                 let _ = unsafe { Box::from_raw(self.contents.err) };
12009                         }
12010                 }
12011         }
12012 }
12013 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::QueryChannelRange, crate::lightning::ln::msgs::DecodeError>> for CResult_QueryChannelRangeDecodeErrorZ {
12014         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::QueryChannelRange, crate::lightning::ln::msgs::DecodeError>) -> Self {
12015                 let contents = if o.result_ok {
12016                         let result = unsafe { o.contents.result };
12017                         unsafe { o.contents.result = std::ptr::null_mut() };
12018                         CResult_QueryChannelRangeDecodeErrorZPtr { result }
12019                 } else {
12020                         let err = unsafe { o.contents.err };
12021                         unsafe { o.contents.err = std::ptr::null_mut(); }
12022                         CResult_QueryChannelRangeDecodeErrorZPtr { err }
12023                 };
12024                 Self {
12025                         contents,
12026                         result_ok: o.result_ok,
12027                 }
12028         }
12029 }
12030 impl Clone for CResult_QueryChannelRangeDecodeErrorZ {
12031         fn clone(&self) -> Self {
12032                 if self.result_ok {
12033                         Self { result_ok: true, contents: CResult_QueryChannelRangeDecodeErrorZPtr {
12034                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::QueryChannelRange>::clone(unsafe { &*self.contents.result })))
12035                         } }
12036                 } else {
12037                         Self { result_ok: false, contents: CResult_QueryChannelRangeDecodeErrorZPtr {
12038                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
12039                         } }
12040                 }
12041         }
12042 }
12043 #[no_mangle]
12044 /// Creates a new CResult_QueryChannelRangeDecodeErrorZ which has the same data as `orig`
12045 /// but with all dynamically-allocated buffers duplicated in new buffers.
12046 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_clone(orig: &CResult_QueryChannelRangeDecodeErrorZ) -> CResult_QueryChannelRangeDecodeErrorZ { Clone::clone(&orig) }
12047 #[repr(C)]
12048 /// The contents of CResult_ReplyChannelRangeDecodeErrorZ
12049 pub union CResult_ReplyChannelRangeDecodeErrorZPtr {
12050         /// A pointer to the contents in the success state.
12051         /// Reading from this pointer when `result_ok` is not set is undefined.
12052         pub result: *mut crate::lightning::ln::msgs::ReplyChannelRange,
12053         /// A pointer to the contents in the error state.
12054         /// Reading from this pointer when `result_ok` is set is undefined.
12055         pub err: *mut crate::lightning::ln::msgs::DecodeError,
12056 }
12057 #[repr(C)]
12058 /// A CResult_ReplyChannelRangeDecodeErrorZ represents the result of a fallible operation,
12059 /// containing a crate::lightning::ln::msgs::ReplyChannelRange on success and a crate::lightning::ln::msgs::DecodeError on failure.
12060 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12061 pub struct CResult_ReplyChannelRangeDecodeErrorZ {
12062         /// The contents of this CResult_ReplyChannelRangeDecodeErrorZ, accessible via either
12063         /// `err` or `result` depending on the state of `result_ok`.
12064         pub contents: CResult_ReplyChannelRangeDecodeErrorZPtr,
12065         /// Whether this CResult_ReplyChannelRangeDecodeErrorZ represents a success state.
12066         pub result_ok: bool,
12067 }
12068 #[no_mangle]
12069 /// Creates a new CResult_ReplyChannelRangeDecodeErrorZ in the success state.
12070 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ReplyChannelRange) -> CResult_ReplyChannelRangeDecodeErrorZ {
12071         CResult_ReplyChannelRangeDecodeErrorZ {
12072                 contents: CResult_ReplyChannelRangeDecodeErrorZPtr {
12073                         result: Box::into_raw(Box::new(o)),
12074                 },
12075                 result_ok: true,
12076         }
12077 }
12078 #[no_mangle]
12079 /// Creates a new CResult_ReplyChannelRangeDecodeErrorZ in the error state.
12080 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ReplyChannelRangeDecodeErrorZ {
12081         CResult_ReplyChannelRangeDecodeErrorZ {
12082                 contents: CResult_ReplyChannelRangeDecodeErrorZPtr {
12083                         err: Box::into_raw(Box::new(e)),
12084                 },
12085                 result_ok: false,
12086         }
12087 }
12088 #[no_mangle]
12089 /// Frees any resources used by the CResult_ReplyChannelRangeDecodeErrorZ.
12090 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_free(_res: CResult_ReplyChannelRangeDecodeErrorZ) { }
12091 impl Drop for CResult_ReplyChannelRangeDecodeErrorZ {
12092         fn drop(&mut self) {
12093                 if self.result_ok {
12094                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
12095                                 let _ = unsafe { Box::from_raw(self.contents.result) };
12096                         }
12097                 } else {
12098                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
12099                                 let _ = unsafe { Box::from_raw(self.contents.err) };
12100                         }
12101                 }
12102         }
12103 }
12104 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ReplyChannelRange, crate::lightning::ln::msgs::DecodeError>> for CResult_ReplyChannelRangeDecodeErrorZ {
12105         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ReplyChannelRange, crate::lightning::ln::msgs::DecodeError>) -> Self {
12106                 let contents = if o.result_ok {
12107                         let result = unsafe { o.contents.result };
12108                         unsafe { o.contents.result = std::ptr::null_mut() };
12109                         CResult_ReplyChannelRangeDecodeErrorZPtr { result }
12110                 } else {
12111                         let err = unsafe { o.contents.err };
12112                         unsafe { o.contents.err = std::ptr::null_mut(); }
12113                         CResult_ReplyChannelRangeDecodeErrorZPtr { err }
12114                 };
12115                 Self {
12116                         contents,
12117                         result_ok: o.result_ok,
12118                 }
12119         }
12120 }
12121 impl Clone for CResult_ReplyChannelRangeDecodeErrorZ {
12122         fn clone(&self) -> Self {
12123                 if self.result_ok {
12124                         Self { result_ok: true, contents: CResult_ReplyChannelRangeDecodeErrorZPtr {
12125                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ReplyChannelRange>::clone(unsafe { &*self.contents.result })))
12126                         } }
12127                 } else {
12128                         Self { result_ok: false, contents: CResult_ReplyChannelRangeDecodeErrorZPtr {
12129                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
12130                         } }
12131                 }
12132         }
12133 }
12134 #[no_mangle]
12135 /// Creates a new CResult_ReplyChannelRangeDecodeErrorZ which has the same data as `orig`
12136 /// but with all dynamically-allocated buffers duplicated in new buffers.
12137 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_clone(orig: &CResult_ReplyChannelRangeDecodeErrorZ) -> CResult_ReplyChannelRangeDecodeErrorZ { Clone::clone(&orig) }
12138 #[repr(C)]
12139 /// The contents of CResult_GossipTimestampFilterDecodeErrorZ
12140 pub union CResult_GossipTimestampFilterDecodeErrorZPtr {
12141         /// A pointer to the contents in the success state.
12142         /// Reading from this pointer when `result_ok` is not set is undefined.
12143         pub result: *mut crate::lightning::ln::msgs::GossipTimestampFilter,
12144         /// A pointer to the contents in the error state.
12145         /// Reading from this pointer when `result_ok` is set is undefined.
12146         pub err: *mut crate::lightning::ln::msgs::DecodeError,
12147 }
12148 #[repr(C)]
12149 /// A CResult_GossipTimestampFilterDecodeErrorZ represents the result of a fallible operation,
12150 /// containing a crate::lightning::ln::msgs::GossipTimestampFilter on success and a crate::lightning::ln::msgs::DecodeError on failure.
12151 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12152 pub struct CResult_GossipTimestampFilterDecodeErrorZ {
12153         /// The contents of this CResult_GossipTimestampFilterDecodeErrorZ, accessible via either
12154         /// `err` or `result` depending on the state of `result_ok`.
12155         pub contents: CResult_GossipTimestampFilterDecodeErrorZPtr,
12156         /// Whether this CResult_GossipTimestampFilterDecodeErrorZ represents a success state.
12157         pub result_ok: bool,
12158 }
12159 #[no_mangle]
12160 /// Creates a new CResult_GossipTimestampFilterDecodeErrorZ in the success state.
12161 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_ok(o: crate::lightning::ln::msgs::GossipTimestampFilter) -> CResult_GossipTimestampFilterDecodeErrorZ {
12162         CResult_GossipTimestampFilterDecodeErrorZ {
12163                 contents: CResult_GossipTimestampFilterDecodeErrorZPtr {
12164                         result: Box::into_raw(Box::new(o)),
12165                 },
12166                 result_ok: true,
12167         }
12168 }
12169 #[no_mangle]
12170 /// Creates a new CResult_GossipTimestampFilterDecodeErrorZ in the error state.
12171 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_GossipTimestampFilterDecodeErrorZ {
12172         CResult_GossipTimestampFilterDecodeErrorZ {
12173                 contents: CResult_GossipTimestampFilterDecodeErrorZPtr {
12174                         err: Box::into_raw(Box::new(e)),
12175                 },
12176                 result_ok: false,
12177         }
12178 }
12179 #[no_mangle]
12180 /// Frees any resources used by the CResult_GossipTimestampFilterDecodeErrorZ.
12181 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_free(_res: CResult_GossipTimestampFilterDecodeErrorZ) { }
12182 impl Drop for CResult_GossipTimestampFilterDecodeErrorZ {
12183         fn drop(&mut self) {
12184                 if self.result_ok {
12185                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
12186                                 let _ = unsafe { Box::from_raw(self.contents.result) };
12187                         }
12188                 } else {
12189                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
12190                                 let _ = unsafe { Box::from_raw(self.contents.err) };
12191                         }
12192                 }
12193         }
12194 }
12195 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::GossipTimestampFilter, crate::lightning::ln::msgs::DecodeError>> for CResult_GossipTimestampFilterDecodeErrorZ {
12196         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::GossipTimestampFilter, crate::lightning::ln::msgs::DecodeError>) -> Self {
12197                 let contents = if o.result_ok {
12198                         let result = unsafe { o.contents.result };
12199                         unsafe { o.contents.result = std::ptr::null_mut() };
12200                         CResult_GossipTimestampFilterDecodeErrorZPtr { result }
12201                 } else {
12202                         let err = unsafe { o.contents.err };
12203                         unsafe { o.contents.err = std::ptr::null_mut(); }
12204                         CResult_GossipTimestampFilterDecodeErrorZPtr { err }
12205                 };
12206                 Self {
12207                         contents,
12208                         result_ok: o.result_ok,
12209                 }
12210         }
12211 }
12212 impl Clone for CResult_GossipTimestampFilterDecodeErrorZ {
12213         fn clone(&self) -> Self {
12214                 if self.result_ok {
12215                         Self { result_ok: true, contents: CResult_GossipTimestampFilterDecodeErrorZPtr {
12216                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::GossipTimestampFilter>::clone(unsafe { &*self.contents.result })))
12217                         } }
12218                 } else {
12219                         Self { result_ok: false, contents: CResult_GossipTimestampFilterDecodeErrorZPtr {
12220                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
12221                         } }
12222                 }
12223         }
12224 }
12225 #[no_mangle]
12226 /// Creates a new CResult_GossipTimestampFilterDecodeErrorZ which has the same data as `orig`
12227 /// but with all dynamically-allocated buffers duplicated in new buffers.
12228 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_clone(orig: &CResult_GossipTimestampFilterDecodeErrorZ) -> CResult_GossipTimestampFilterDecodeErrorZ { Clone::clone(&orig) }
12229 #[repr(C)]
12230 /// The contents of CResult_InvoiceSignOrCreationErrorZ
12231 pub union CResult_InvoiceSignOrCreationErrorZPtr {
12232         /// A pointer to the contents in the success state.
12233         /// Reading from this pointer when `result_ok` is not set is undefined.
12234         pub result: *mut crate::lightning_invoice::Invoice,
12235         /// A pointer to the contents in the error state.
12236         /// Reading from this pointer when `result_ok` is set is undefined.
12237         pub err: *mut crate::lightning_invoice::SignOrCreationError,
12238 }
12239 #[repr(C)]
12240 /// A CResult_InvoiceSignOrCreationErrorZ represents the result of a fallible operation,
12241 /// containing a crate::lightning_invoice::Invoice on success and a crate::lightning_invoice::SignOrCreationError on failure.
12242 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12243 pub struct CResult_InvoiceSignOrCreationErrorZ {
12244         /// The contents of this CResult_InvoiceSignOrCreationErrorZ, accessible via either
12245         /// `err` or `result` depending on the state of `result_ok`.
12246         pub contents: CResult_InvoiceSignOrCreationErrorZPtr,
12247         /// Whether this CResult_InvoiceSignOrCreationErrorZ represents a success state.
12248         pub result_ok: bool,
12249 }
12250 #[no_mangle]
12251 /// Creates a new CResult_InvoiceSignOrCreationErrorZ in the success state.
12252 pub extern "C" fn CResult_InvoiceSignOrCreationErrorZ_ok(o: crate::lightning_invoice::Invoice) -> CResult_InvoiceSignOrCreationErrorZ {
12253         CResult_InvoiceSignOrCreationErrorZ {
12254                 contents: CResult_InvoiceSignOrCreationErrorZPtr {
12255                         result: Box::into_raw(Box::new(o)),
12256                 },
12257                 result_ok: true,
12258         }
12259 }
12260 #[no_mangle]
12261 /// Creates a new CResult_InvoiceSignOrCreationErrorZ in the error state.
12262 pub extern "C" fn CResult_InvoiceSignOrCreationErrorZ_err(e: crate::lightning_invoice::SignOrCreationError) -> CResult_InvoiceSignOrCreationErrorZ {
12263         CResult_InvoiceSignOrCreationErrorZ {
12264                 contents: CResult_InvoiceSignOrCreationErrorZPtr {
12265                         err: Box::into_raw(Box::new(e)),
12266                 },
12267                 result_ok: false,
12268         }
12269 }
12270 #[no_mangle]
12271 /// Frees any resources used by the CResult_InvoiceSignOrCreationErrorZ.
12272 pub extern "C" fn CResult_InvoiceSignOrCreationErrorZ_free(_res: CResult_InvoiceSignOrCreationErrorZ) { }
12273 impl Drop for CResult_InvoiceSignOrCreationErrorZ {
12274         fn drop(&mut self) {
12275                 if self.result_ok {
12276                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
12277                                 let _ = unsafe { Box::from_raw(self.contents.result) };
12278                         }
12279                 } else {
12280                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
12281                                 let _ = unsafe { Box::from_raw(self.contents.err) };
12282                         }
12283                 }
12284         }
12285 }
12286 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::Invoice, crate::lightning_invoice::SignOrCreationError>> for CResult_InvoiceSignOrCreationErrorZ {
12287         fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::Invoice, crate::lightning_invoice::SignOrCreationError>) -> Self {
12288                 let contents = if o.result_ok {
12289                         let result = unsafe { o.contents.result };
12290                         unsafe { o.contents.result = std::ptr::null_mut() };
12291                         CResult_InvoiceSignOrCreationErrorZPtr { result }
12292                 } else {
12293                         let err = unsafe { o.contents.err };
12294                         unsafe { o.contents.err = std::ptr::null_mut(); }
12295                         CResult_InvoiceSignOrCreationErrorZPtr { err }
12296                 };
12297                 Self {
12298                         contents,
12299                         result_ok: o.result_ok,
12300                 }
12301         }
12302 }
12303 impl Clone for CResult_InvoiceSignOrCreationErrorZ {
12304         fn clone(&self) -> Self {
12305                 if self.result_ok {
12306                         Self { result_ok: true, contents: CResult_InvoiceSignOrCreationErrorZPtr {
12307                                 result: Box::into_raw(Box::new(<crate::lightning_invoice::Invoice>::clone(unsafe { &*self.contents.result })))
12308                         } }
12309                 } else {
12310                         Self { result_ok: false, contents: CResult_InvoiceSignOrCreationErrorZPtr {
12311                                 err: Box::into_raw(Box::new(<crate::lightning_invoice::SignOrCreationError>::clone(unsafe { &*self.contents.err })))
12312                         } }
12313                 }
12314         }
12315 }
12316 #[no_mangle]
12317 /// Creates a new CResult_InvoiceSignOrCreationErrorZ which has the same data as `orig`
12318 /// but with all dynamically-allocated buffers duplicated in new buffers.
12319 pub extern "C" fn CResult_InvoiceSignOrCreationErrorZ_clone(orig: &CResult_InvoiceSignOrCreationErrorZ) -> CResult_InvoiceSignOrCreationErrorZ { Clone::clone(&orig) }
12320 #[repr(C)]
12321 /// An enum which can either contain a crate::lightning::chain::Filter or not
12322 pub enum COption_FilterZ {
12323         /// When we're in this state, this COption_FilterZ contains a crate::lightning::chain::Filter
12324         Some(crate::lightning::chain::Filter),
12325         /// When we're in this state, this COption_FilterZ contains nothing
12326         None
12327 }
12328 impl COption_FilterZ {
12329         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
12330                 if let Self::Some(_) = self { true } else { false }
12331         }
12332         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
12333                 !self.is_some()
12334         }
12335         #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::chain::Filter {
12336                 if let Self::Some(v) = self { v } else { unreachable!() }
12337         }
12338 }
12339 #[no_mangle]
12340 /// Constructs a new COption_FilterZ containing a crate::lightning::chain::Filter
12341 pub extern "C" fn COption_FilterZ_some(o: crate::lightning::chain::Filter) -> COption_FilterZ {
12342         COption_FilterZ::Some(o)
12343 }
12344 #[no_mangle]
12345 /// Constructs a new COption_FilterZ containing nothing
12346 pub extern "C" fn COption_FilterZ_none() -> COption_FilterZ {
12347         COption_FilterZ::None
12348 }
12349 #[no_mangle]
12350 /// Frees any resources associated with the crate::lightning::chain::Filter, if we are in the Some state
12351 pub extern "C" fn COption_FilterZ_free(_res: COption_FilterZ) { }
12352 #[repr(C)]
12353 /// The contents of CResult_LockedChannelMonitorNoneZ
12354 pub union CResult_LockedChannelMonitorNoneZPtr {
12355         /// A pointer to the contents in the success state.
12356         /// Reading from this pointer when `result_ok` is not set is undefined.
12357         pub result: *mut crate::lightning::chain::chainmonitor::LockedChannelMonitor,
12358         /// Note that this value is always NULL, as there are no contents in the Err variant
12359         pub err: *mut std::ffi::c_void,
12360 }
12361 #[repr(C)]
12362 /// A CResult_LockedChannelMonitorNoneZ represents the result of a fallible operation,
12363 /// containing a crate::lightning::chain::chainmonitor::LockedChannelMonitor on success and a () on failure.
12364 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12365 pub struct CResult_LockedChannelMonitorNoneZ {
12366         /// The contents of this CResult_LockedChannelMonitorNoneZ, accessible via either
12367         /// `err` or `result` depending on the state of `result_ok`.
12368         pub contents: CResult_LockedChannelMonitorNoneZPtr,
12369         /// Whether this CResult_LockedChannelMonitorNoneZ represents a success state.
12370         pub result_ok: bool,
12371 }
12372 #[no_mangle]
12373 /// Creates a new CResult_LockedChannelMonitorNoneZ in the success state.
12374 pub extern "C" fn CResult_LockedChannelMonitorNoneZ_ok(o: crate::lightning::chain::chainmonitor::LockedChannelMonitor) -> CResult_LockedChannelMonitorNoneZ {
12375         CResult_LockedChannelMonitorNoneZ {
12376                 contents: CResult_LockedChannelMonitorNoneZPtr {
12377                         result: Box::into_raw(Box::new(o)),
12378                 },
12379                 result_ok: true,
12380         }
12381 }
12382 #[no_mangle]
12383 /// Creates a new CResult_LockedChannelMonitorNoneZ in the error state.
12384 pub extern "C" fn CResult_LockedChannelMonitorNoneZ_err() -> CResult_LockedChannelMonitorNoneZ {
12385         CResult_LockedChannelMonitorNoneZ {
12386                 contents: CResult_LockedChannelMonitorNoneZPtr {
12387                         err: std::ptr::null_mut(),
12388                 },
12389                 result_ok: false,
12390         }
12391 }
12392 #[no_mangle]
12393 /// Frees any resources used by the CResult_LockedChannelMonitorNoneZ.
12394 pub extern "C" fn CResult_LockedChannelMonitorNoneZ_free(_res: CResult_LockedChannelMonitorNoneZ) { }
12395 impl Drop for CResult_LockedChannelMonitorNoneZ {
12396         fn drop(&mut self) {
12397                 if self.result_ok {
12398                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
12399                                 let _ = unsafe { Box::from_raw(self.contents.result) };
12400                         }
12401                 } else {
12402                 }
12403         }
12404 }
12405 impl From<crate::c_types::CResultTempl<crate::lightning::chain::chainmonitor::LockedChannelMonitor, ()>> for CResult_LockedChannelMonitorNoneZ {
12406         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::chainmonitor::LockedChannelMonitor, ()>) -> Self {
12407                 let contents = if o.result_ok {
12408                         let result = unsafe { o.contents.result };
12409                         unsafe { o.contents.result = std::ptr::null_mut() };
12410                         CResult_LockedChannelMonitorNoneZPtr { result }
12411                 } else {
12412                         let _ = unsafe { Box::from_raw(o.contents.err) };
12413                         o.contents.err = std::ptr::null_mut();
12414                         CResult_LockedChannelMonitorNoneZPtr { err: std::ptr::null_mut() }
12415                 };
12416                 Self {
12417                         contents,
12418                         result_ok: o.result_ok,
12419                 }
12420         }
12421 }
12422 #[repr(C)]
12423 /// A dynamically-allocated array of crate::lightning::chain::transaction::OutPoints of arbitrary size.
12424 /// This corresponds to std::vector in C++
12425 pub struct CVec_OutPointZ {
12426         /// The elements in the array.
12427         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
12428         pub data: *mut crate::lightning::chain::transaction::OutPoint,
12429         /// The number of elements pointed to by `data`.
12430         pub datalen: usize
12431 }
12432 impl CVec_OutPointZ {
12433         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::chain::transaction::OutPoint> {
12434                 if self.datalen == 0 { return Vec::new(); }
12435                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
12436                 self.data = std::ptr::null_mut();
12437                 self.datalen = 0;
12438                 ret
12439         }
12440         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::chain::transaction::OutPoint] {
12441                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
12442         }
12443 }
12444 impl From<Vec<crate::lightning::chain::transaction::OutPoint>> for CVec_OutPointZ {
12445         fn from(v: Vec<crate::lightning::chain::transaction::OutPoint>) -> Self {
12446                 let datalen = v.len();
12447                 let data = Box::into_raw(v.into_boxed_slice());
12448                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
12449         }
12450 }
12451 #[no_mangle]
12452 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
12453 pub extern "C" fn CVec_OutPointZ_free(_res: CVec_OutPointZ) { }
12454 impl Drop for CVec_OutPointZ {
12455         fn drop(&mut self) {
12456                 if self.datalen == 0 { return; }
12457                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
12458         }
12459 }
12460 impl Clone for CVec_OutPointZ {
12461         fn clone(&self) -> Self {
12462                 let mut res = Vec::new();
12463                 if self.datalen == 0 { return Self::from(res); }
12464                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
12465                 Self::from(res)
12466         }
12467 }