Update auto-generated bindings to latest upstream
[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::channelmonitor::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::channelmonitor::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::channelmonitor::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::channelmonitor::ChannelMonitorUpdateErr>> for CResult_NoneChannelMonitorUpdateErrZ {
2320         fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::chain::channelmonitor::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::channelmonitor::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 #[derive(Clone)]
4158 /// An enum which can either contain a u16 or not
4159 pub enum COption_u16Z {
4160         /// When we're in this state, this COption_u16Z contains a u16
4161         Some(u16),
4162         /// When we're in this state, this COption_u16Z contains nothing
4163         None
4164 }
4165 impl COption_u16Z {
4166         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
4167                 if let Self::Some(_) = self { true } else { false }
4168         }
4169         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
4170                 !self.is_some()
4171         }
4172         #[allow(unused)] pub(crate) fn take(mut self) -> u16 {
4173                 if let Self::Some(v) = self { v } else { unreachable!() }
4174         }
4175 }
4176 #[no_mangle]
4177 /// Constructs a new COption_u16Z containing a u16
4178 pub extern "C" fn COption_u16Z_some(o: u16) -> COption_u16Z {
4179         COption_u16Z::Some(o)
4180 }
4181 #[no_mangle]
4182 /// Constructs a new COption_u16Z containing nothing
4183 pub extern "C" fn COption_u16Z_none() -> COption_u16Z {
4184         COption_u16Z::None
4185 }
4186 #[no_mangle]
4187 /// Frees any resources associated with the u16, if we are in the Some state
4188 pub extern "C" fn COption_u16Z_free(_res: COption_u16Z) { }
4189 #[no_mangle]
4190 /// Creates a new COption_u16Z which has the same data as `orig`
4191 /// but with all dynamically-allocated buffers duplicated in new buffers.
4192 pub extern "C" fn COption_u16Z_clone(orig: &COption_u16Z) -> COption_u16Z { Clone::clone(&orig) }
4193 #[repr(C)]
4194 /// The contents of CResult_NoneAPIErrorZ
4195 pub union CResult_NoneAPIErrorZPtr {
4196         /// Note that this value is always NULL, as there are no contents in the OK variant
4197         pub result: *mut std::ffi::c_void,
4198         /// A pointer to the contents in the error state.
4199         /// Reading from this pointer when `result_ok` is set is undefined.
4200         pub err: *mut crate::lightning::util::errors::APIError,
4201 }
4202 #[repr(C)]
4203 /// A CResult_NoneAPIErrorZ represents the result of a fallible operation,
4204 /// containing a () on success and a crate::lightning::util::errors::APIError on failure.
4205 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4206 pub struct CResult_NoneAPIErrorZ {
4207         /// The contents of this CResult_NoneAPIErrorZ, accessible via either
4208         /// `err` or `result` depending on the state of `result_ok`.
4209         pub contents: CResult_NoneAPIErrorZPtr,
4210         /// Whether this CResult_NoneAPIErrorZ represents a success state.
4211         pub result_ok: bool,
4212 }
4213 #[no_mangle]
4214 /// Creates a new CResult_NoneAPIErrorZ in the success state.
4215 pub extern "C" fn CResult_NoneAPIErrorZ_ok() -> CResult_NoneAPIErrorZ {
4216         CResult_NoneAPIErrorZ {
4217                 contents: CResult_NoneAPIErrorZPtr {
4218                         result: std::ptr::null_mut(),
4219                 },
4220                 result_ok: true,
4221         }
4222 }
4223 #[no_mangle]
4224 /// Creates a new CResult_NoneAPIErrorZ in the error state.
4225 pub extern "C" fn CResult_NoneAPIErrorZ_err(e: crate::lightning::util::errors::APIError) -> CResult_NoneAPIErrorZ {
4226         CResult_NoneAPIErrorZ {
4227                 contents: CResult_NoneAPIErrorZPtr {
4228                         err: Box::into_raw(Box::new(e)),
4229                 },
4230                 result_ok: false,
4231         }
4232 }
4233 #[no_mangle]
4234 /// Frees any resources used by the CResult_NoneAPIErrorZ.
4235 pub extern "C" fn CResult_NoneAPIErrorZ_free(_res: CResult_NoneAPIErrorZ) { }
4236 impl Drop for CResult_NoneAPIErrorZ {
4237         fn drop(&mut self) {
4238                 if self.result_ok {
4239                 } else {
4240                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
4241                                 let _ = unsafe { Box::from_raw(self.contents.err) };
4242                         }
4243                 }
4244         }
4245 }
4246 impl From<crate::c_types::CResultTempl<(), crate::lightning::util::errors::APIError>> for CResult_NoneAPIErrorZ {
4247         fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::util::errors::APIError>) -> Self {
4248                 let contents = if o.result_ok {
4249                         let _ = unsafe { Box::from_raw(o.contents.result) };
4250                         o.contents.result = std::ptr::null_mut();
4251                         CResult_NoneAPIErrorZPtr { result: std::ptr::null_mut() }
4252                 } else {
4253                         let err = unsafe { o.contents.err };
4254                         unsafe { o.contents.err = std::ptr::null_mut(); }
4255                         CResult_NoneAPIErrorZPtr { err }
4256                 };
4257                 Self {
4258                         contents,
4259                         result_ok: o.result_ok,
4260                 }
4261         }
4262 }
4263 impl Clone for CResult_NoneAPIErrorZ {
4264         fn clone(&self) -> Self {
4265                 if self.result_ok {
4266                         Self { result_ok: true, contents: CResult_NoneAPIErrorZPtr {
4267                                 result: std::ptr::null_mut()
4268                         } }
4269                 } else {
4270                         Self { result_ok: false, contents: CResult_NoneAPIErrorZPtr {
4271                                 err: Box::into_raw(Box::new(<crate::lightning::util::errors::APIError>::clone(unsafe { &*self.contents.err })))
4272                         } }
4273                 }
4274         }
4275 }
4276 #[no_mangle]
4277 /// Creates a new CResult_NoneAPIErrorZ which has the same data as `orig`
4278 /// but with all dynamically-allocated buffers duplicated in new buffers.
4279 pub extern "C" fn CResult_NoneAPIErrorZ_clone(orig: &CResult_NoneAPIErrorZ) -> CResult_NoneAPIErrorZ { Clone::clone(&orig) }
4280 #[repr(C)]
4281 /// A dynamically-allocated array of crate::c_types::derived::CResult_NoneAPIErrorZs of arbitrary size.
4282 /// This corresponds to std::vector in C++
4283 pub struct CVec_CResult_NoneAPIErrorZZ {
4284         /// The elements in the array.
4285         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4286         pub data: *mut crate::c_types::derived::CResult_NoneAPIErrorZ,
4287         /// The number of elements pointed to by `data`.
4288         pub datalen: usize
4289 }
4290 impl CVec_CResult_NoneAPIErrorZZ {
4291         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::CResult_NoneAPIErrorZ> {
4292                 if self.datalen == 0 { return Vec::new(); }
4293                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
4294                 self.data = std::ptr::null_mut();
4295                 self.datalen = 0;
4296                 ret
4297         }
4298         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::CResult_NoneAPIErrorZ] {
4299                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
4300         }
4301 }
4302 impl From<Vec<crate::c_types::derived::CResult_NoneAPIErrorZ>> for CVec_CResult_NoneAPIErrorZZ {
4303         fn from(v: Vec<crate::c_types::derived::CResult_NoneAPIErrorZ>) -> Self {
4304                 let datalen = v.len();
4305                 let data = Box::into_raw(v.into_boxed_slice());
4306                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
4307         }
4308 }
4309 #[no_mangle]
4310 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
4311 pub extern "C" fn CVec_CResult_NoneAPIErrorZZ_free(_res: CVec_CResult_NoneAPIErrorZZ) { }
4312 impl Drop for CVec_CResult_NoneAPIErrorZZ {
4313         fn drop(&mut self) {
4314                 if self.datalen == 0 { return; }
4315                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
4316         }
4317 }
4318 impl Clone for CVec_CResult_NoneAPIErrorZZ {
4319         fn clone(&self) -> Self {
4320                 let mut res = Vec::new();
4321                 if self.datalen == 0 { return Self::from(res); }
4322                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
4323                 Self::from(res)
4324         }
4325 }
4326 #[repr(C)]
4327 /// A dynamically-allocated array of crate::lightning::util::errors::APIErrors of arbitrary size.
4328 /// This corresponds to std::vector in C++
4329 pub struct CVec_APIErrorZ {
4330         /// The elements in the array.
4331         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4332         pub data: *mut crate::lightning::util::errors::APIError,
4333         /// The number of elements pointed to by `data`.
4334         pub datalen: usize
4335 }
4336 impl CVec_APIErrorZ {
4337         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::util::errors::APIError> {
4338                 if self.datalen == 0 { return Vec::new(); }
4339                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
4340                 self.data = std::ptr::null_mut();
4341                 self.datalen = 0;
4342                 ret
4343         }
4344         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::util::errors::APIError] {
4345                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
4346         }
4347 }
4348 impl From<Vec<crate::lightning::util::errors::APIError>> for CVec_APIErrorZ {
4349         fn from(v: Vec<crate::lightning::util::errors::APIError>) -> Self {
4350                 let datalen = v.len();
4351                 let data = Box::into_raw(v.into_boxed_slice());
4352                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
4353         }
4354 }
4355 #[no_mangle]
4356 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
4357 pub extern "C" fn CVec_APIErrorZ_free(_res: CVec_APIErrorZ) { }
4358 impl Drop for CVec_APIErrorZ {
4359         fn drop(&mut self) {
4360                 if self.datalen == 0 { return; }
4361                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
4362         }
4363 }
4364 impl Clone for CVec_APIErrorZ {
4365         fn clone(&self) -> Self {
4366                 let mut res = Vec::new();
4367                 if self.datalen == 0 { return Self::from(res); }
4368                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
4369                 Self::from(res)
4370         }
4371 }
4372 #[repr(C)]
4373 /// The contents of CResult_NonePaymentSendFailureZ
4374 pub union CResult_NonePaymentSendFailureZPtr {
4375         /// Note that this value is always NULL, as there are no contents in the OK variant
4376         pub result: *mut std::ffi::c_void,
4377         /// A pointer to the contents in the error state.
4378         /// Reading from this pointer when `result_ok` is set is undefined.
4379         pub err: *mut crate::lightning::ln::channelmanager::PaymentSendFailure,
4380 }
4381 #[repr(C)]
4382 /// A CResult_NonePaymentSendFailureZ represents the result of a fallible operation,
4383 /// containing a () on success and a crate::lightning::ln::channelmanager::PaymentSendFailure on failure.
4384 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4385 pub struct CResult_NonePaymentSendFailureZ {
4386         /// The contents of this CResult_NonePaymentSendFailureZ, accessible via either
4387         /// `err` or `result` depending on the state of `result_ok`.
4388         pub contents: CResult_NonePaymentSendFailureZPtr,
4389         /// Whether this CResult_NonePaymentSendFailureZ represents a success state.
4390         pub result_ok: bool,
4391 }
4392 #[no_mangle]
4393 /// Creates a new CResult_NonePaymentSendFailureZ in the success state.
4394 pub extern "C" fn CResult_NonePaymentSendFailureZ_ok() -> CResult_NonePaymentSendFailureZ {
4395         CResult_NonePaymentSendFailureZ {
4396                 contents: CResult_NonePaymentSendFailureZPtr {
4397                         result: std::ptr::null_mut(),
4398                 },
4399                 result_ok: true,
4400         }
4401 }
4402 #[no_mangle]
4403 /// Creates a new CResult_NonePaymentSendFailureZ in the error state.
4404 pub extern "C" fn CResult_NonePaymentSendFailureZ_err(e: crate::lightning::ln::channelmanager::PaymentSendFailure) -> CResult_NonePaymentSendFailureZ {
4405         CResult_NonePaymentSendFailureZ {
4406                 contents: CResult_NonePaymentSendFailureZPtr {
4407                         err: Box::into_raw(Box::new(e)),
4408                 },
4409                 result_ok: false,
4410         }
4411 }
4412 #[no_mangle]
4413 /// Frees any resources used by the CResult_NonePaymentSendFailureZ.
4414 pub extern "C" fn CResult_NonePaymentSendFailureZ_free(_res: CResult_NonePaymentSendFailureZ) { }
4415 impl Drop for CResult_NonePaymentSendFailureZ {
4416         fn drop(&mut self) {
4417                 if self.result_ok {
4418                 } else {
4419                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
4420                                 let _ = unsafe { Box::from_raw(self.contents.err) };
4421                         }
4422                 }
4423         }
4424 }
4425 impl From<crate::c_types::CResultTempl<(), crate::lightning::ln::channelmanager::PaymentSendFailure>> for CResult_NonePaymentSendFailureZ {
4426         fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::ln::channelmanager::PaymentSendFailure>) -> Self {
4427                 let contents = if o.result_ok {
4428                         let _ = unsafe { Box::from_raw(o.contents.result) };
4429                         o.contents.result = std::ptr::null_mut();
4430                         CResult_NonePaymentSendFailureZPtr { result: std::ptr::null_mut() }
4431                 } else {
4432                         let err = unsafe { o.contents.err };
4433                         unsafe { o.contents.err = std::ptr::null_mut(); }
4434                         CResult_NonePaymentSendFailureZPtr { err }
4435                 };
4436                 Self {
4437                         contents,
4438                         result_ok: o.result_ok,
4439                 }
4440         }
4441 }
4442 impl Clone for CResult_NonePaymentSendFailureZ {
4443         fn clone(&self) -> Self {
4444                 if self.result_ok {
4445                         Self { result_ok: true, contents: CResult_NonePaymentSendFailureZPtr {
4446                                 result: std::ptr::null_mut()
4447                         } }
4448                 } else {
4449                         Self { result_ok: false, contents: CResult_NonePaymentSendFailureZPtr {
4450                                 err: Box::into_raw(Box::new(<crate::lightning::ln::channelmanager::PaymentSendFailure>::clone(unsafe { &*self.contents.err })))
4451                         } }
4452                 }
4453         }
4454 }
4455 #[no_mangle]
4456 /// Creates a new CResult_NonePaymentSendFailureZ which has the same data as `orig`
4457 /// but with all dynamically-allocated buffers duplicated in new buffers.
4458 pub extern "C" fn CResult_NonePaymentSendFailureZ_clone(orig: &CResult_NonePaymentSendFailureZ) -> CResult_NonePaymentSendFailureZ { Clone::clone(&orig) }
4459 #[repr(C)]
4460 /// The contents of CResult_PaymentHashPaymentSendFailureZ
4461 pub union CResult_PaymentHashPaymentSendFailureZPtr {
4462         /// A pointer to the contents in the success state.
4463         /// Reading from this pointer when `result_ok` is not set is undefined.
4464         pub result: *mut crate::c_types::ThirtyTwoBytes,
4465         /// A pointer to the contents in the error state.
4466         /// Reading from this pointer when `result_ok` is set is undefined.
4467         pub err: *mut crate::lightning::ln::channelmanager::PaymentSendFailure,
4468 }
4469 #[repr(C)]
4470 /// A CResult_PaymentHashPaymentSendFailureZ represents the result of a fallible operation,
4471 /// containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning::ln::channelmanager::PaymentSendFailure on failure.
4472 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4473 pub struct CResult_PaymentHashPaymentSendFailureZ {
4474         /// The contents of this CResult_PaymentHashPaymentSendFailureZ, accessible via either
4475         /// `err` or `result` depending on the state of `result_ok`.
4476         pub contents: CResult_PaymentHashPaymentSendFailureZPtr,
4477         /// Whether this CResult_PaymentHashPaymentSendFailureZ represents a success state.
4478         pub result_ok: bool,
4479 }
4480 #[no_mangle]
4481 /// Creates a new CResult_PaymentHashPaymentSendFailureZ in the success state.
4482 pub extern "C" fn CResult_PaymentHashPaymentSendFailureZ_ok(o: crate::c_types::ThirtyTwoBytes) -> CResult_PaymentHashPaymentSendFailureZ {
4483         CResult_PaymentHashPaymentSendFailureZ {
4484                 contents: CResult_PaymentHashPaymentSendFailureZPtr {
4485                         result: Box::into_raw(Box::new(o)),
4486                 },
4487                 result_ok: true,
4488         }
4489 }
4490 #[no_mangle]
4491 /// Creates a new CResult_PaymentHashPaymentSendFailureZ in the error state.
4492 pub extern "C" fn CResult_PaymentHashPaymentSendFailureZ_err(e: crate::lightning::ln::channelmanager::PaymentSendFailure) -> CResult_PaymentHashPaymentSendFailureZ {
4493         CResult_PaymentHashPaymentSendFailureZ {
4494                 contents: CResult_PaymentHashPaymentSendFailureZPtr {
4495                         err: Box::into_raw(Box::new(e)),
4496                 },
4497                 result_ok: false,
4498         }
4499 }
4500 #[no_mangle]
4501 /// Frees any resources used by the CResult_PaymentHashPaymentSendFailureZ.
4502 pub extern "C" fn CResult_PaymentHashPaymentSendFailureZ_free(_res: CResult_PaymentHashPaymentSendFailureZ) { }
4503 impl Drop for CResult_PaymentHashPaymentSendFailureZ {
4504         fn drop(&mut self) {
4505                 if self.result_ok {
4506                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
4507                                 let _ = unsafe { Box::from_raw(self.contents.result) };
4508                         }
4509                 } else {
4510                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
4511                                 let _ = unsafe { Box::from_raw(self.contents.err) };
4512                         }
4513                 }
4514         }
4515 }
4516 impl From<crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::ln::channelmanager::PaymentSendFailure>> for CResult_PaymentHashPaymentSendFailureZ {
4517         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::ln::channelmanager::PaymentSendFailure>) -> Self {
4518                 let contents = if o.result_ok {
4519                         let result = unsafe { o.contents.result };
4520                         unsafe { o.contents.result = std::ptr::null_mut() };
4521                         CResult_PaymentHashPaymentSendFailureZPtr { result }
4522                 } else {
4523                         let err = unsafe { o.contents.err };
4524                         unsafe { o.contents.err = std::ptr::null_mut(); }
4525                         CResult_PaymentHashPaymentSendFailureZPtr { err }
4526                 };
4527                 Self {
4528                         contents,
4529                         result_ok: o.result_ok,
4530                 }
4531         }
4532 }
4533 impl Clone for CResult_PaymentHashPaymentSendFailureZ {
4534         fn clone(&self) -> Self {
4535                 if self.result_ok {
4536                         Self { result_ok: true, contents: CResult_PaymentHashPaymentSendFailureZPtr {
4537                                 result: Box::into_raw(Box::new(<crate::c_types::ThirtyTwoBytes>::clone(unsafe { &*self.contents.result })))
4538                         } }
4539                 } else {
4540                         Self { result_ok: false, contents: CResult_PaymentHashPaymentSendFailureZPtr {
4541                                 err: Box::into_raw(Box::new(<crate::lightning::ln::channelmanager::PaymentSendFailure>::clone(unsafe { &*self.contents.err })))
4542                         } }
4543                 }
4544         }
4545 }
4546 #[no_mangle]
4547 /// Creates a new CResult_PaymentHashPaymentSendFailureZ which has the same data as `orig`
4548 /// but with all dynamically-allocated buffers duplicated in new buffers.
4549 pub extern "C" fn CResult_PaymentHashPaymentSendFailureZ_clone(orig: &CResult_PaymentHashPaymentSendFailureZ) -> CResult_PaymentHashPaymentSendFailureZ { Clone::clone(&orig) }
4550 #[repr(C)]
4551 /// A dynamically-allocated array of crate::lightning::ln::msgs::NetAddresss of arbitrary size.
4552 /// This corresponds to std::vector in C++
4553 pub struct CVec_NetAddressZ {
4554         /// The elements in the array.
4555         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4556         pub data: *mut crate::lightning::ln::msgs::NetAddress,
4557         /// The number of elements pointed to by `data`.
4558         pub datalen: usize
4559 }
4560 impl CVec_NetAddressZ {
4561         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::NetAddress> {
4562                 if self.datalen == 0 { return Vec::new(); }
4563                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
4564                 self.data = std::ptr::null_mut();
4565                 self.datalen = 0;
4566                 ret
4567         }
4568         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::NetAddress] {
4569                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
4570         }
4571 }
4572 impl From<Vec<crate::lightning::ln::msgs::NetAddress>> for CVec_NetAddressZ {
4573         fn from(v: Vec<crate::lightning::ln::msgs::NetAddress>) -> Self {
4574                 let datalen = v.len();
4575                 let data = Box::into_raw(v.into_boxed_slice());
4576                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
4577         }
4578 }
4579 #[no_mangle]
4580 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
4581 pub extern "C" fn CVec_NetAddressZ_free(_res: CVec_NetAddressZ) { }
4582 impl Drop for CVec_NetAddressZ {
4583         fn drop(&mut self) {
4584                 if self.datalen == 0 { return; }
4585                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
4586         }
4587 }
4588 impl Clone for CVec_NetAddressZ {
4589         fn clone(&self) -> Self {
4590                 let mut res = Vec::new();
4591                 if self.datalen == 0 { return Self::from(res); }
4592                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
4593                 Self::from(res)
4594         }
4595 }
4596 #[repr(C)]
4597 /// A tuple of 2 elements. See the individual fields for the types contained.
4598 pub struct C2Tuple_PaymentHashPaymentSecretZ {
4599         /// The element at position 0
4600         pub a: crate::c_types::ThirtyTwoBytes,
4601         /// The element at position 1
4602         pub b: crate::c_types::ThirtyTwoBytes,
4603 }
4604 impl From<(crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes)> for C2Tuple_PaymentHashPaymentSecretZ {
4605         fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes)) -> Self {
4606                 Self {
4607                         a: tup.0,
4608                         b: tup.1,
4609                 }
4610         }
4611 }
4612 impl C2Tuple_PaymentHashPaymentSecretZ {
4613         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes) {
4614                 (self.a, self.b)
4615         }
4616 }
4617 impl Clone for C2Tuple_PaymentHashPaymentSecretZ {
4618         fn clone(&self) -> Self {
4619                 Self {
4620                         a: Clone::clone(&self.a),
4621                         b: Clone::clone(&self.b),
4622                 }
4623         }
4624 }
4625 #[no_mangle]
4626 /// Creates a new tuple which has the same data as `orig`
4627 /// but with all dynamically-allocated buffers duplicated in new buffers.
4628 pub extern "C" fn C2Tuple_PaymentHashPaymentSecretZ_clone(orig: &C2Tuple_PaymentHashPaymentSecretZ) -> C2Tuple_PaymentHashPaymentSecretZ { Clone::clone(&orig) }
4629 /// Creates a new C2Tuple_PaymentHashPaymentSecretZ from the contained elements.
4630 #[no_mangle]
4631 pub extern "C" fn C2Tuple_PaymentHashPaymentSecretZ_new(a: crate::c_types::ThirtyTwoBytes, b: crate::c_types::ThirtyTwoBytes) -> C2Tuple_PaymentHashPaymentSecretZ {
4632         C2Tuple_PaymentHashPaymentSecretZ { a, b, }
4633 }
4634
4635 #[no_mangle]
4636 /// Frees any resources used by the C2Tuple_PaymentHashPaymentSecretZ.
4637 pub extern "C" fn C2Tuple_PaymentHashPaymentSecretZ_free(_res: C2Tuple_PaymentHashPaymentSecretZ) { }
4638 #[repr(C)]
4639 /// The contents of CResult_PaymentSecretAPIErrorZ
4640 pub union CResult_PaymentSecretAPIErrorZPtr {
4641         /// A pointer to the contents in the success state.
4642         /// Reading from this pointer when `result_ok` is not set is undefined.
4643         pub result: *mut crate::c_types::ThirtyTwoBytes,
4644         /// A pointer to the contents in the error state.
4645         /// Reading from this pointer when `result_ok` is set is undefined.
4646         pub err: *mut crate::lightning::util::errors::APIError,
4647 }
4648 #[repr(C)]
4649 /// A CResult_PaymentSecretAPIErrorZ represents the result of a fallible operation,
4650 /// containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning::util::errors::APIError on failure.
4651 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4652 pub struct CResult_PaymentSecretAPIErrorZ {
4653         /// The contents of this CResult_PaymentSecretAPIErrorZ, accessible via either
4654         /// `err` or `result` depending on the state of `result_ok`.
4655         pub contents: CResult_PaymentSecretAPIErrorZPtr,
4656         /// Whether this CResult_PaymentSecretAPIErrorZ represents a success state.
4657         pub result_ok: bool,
4658 }
4659 #[no_mangle]
4660 /// Creates a new CResult_PaymentSecretAPIErrorZ in the success state.
4661 pub extern "C" fn CResult_PaymentSecretAPIErrorZ_ok(o: crate::c_types::ThirtyTwoBytes) -> CResult_PaymentSecretAPIErrorZ {
4662         CResult_PaymentSecretAPIErrorZ {
4663                 contents: CResult_PaymentSecretAPIErrorZPtr {
4664                         result: Box::into_raw(Box::new(o)),
4665                 },
4666                 result_ok: true,
4667         }
4668 }
4669 #[no_mangle]
4670 /// Creates a new CResult_PaymentSecretAPIErrorZ in the error state.
4671 pub extern "C" fn CResult_PaymentSecretAPIErrorZ_err(e: crate::lightning::util::errors::APIError) -> CResult_PaymentSecretAPIErrorZ {
4672         CResult_PaymentSecretAPIErrorZ {
4673                 contents: CResult_PaymentSecretAPIErrorZPtr {
4674                         err: Box::into_raw(Box::new(e)),
4675                 },
4676                 result_ok: false,
4677         }
4678 }
4679 #[no_mangle]
4680 /// Frees any resources used by the CResult_PaymentSecretAPIErrorZ.
4681 pub extern "C" fn CResult_PaymentSecretAPIErrorZ_free(_res: CResult_PaymentSecretAPIErrorZ) { }
4682 impl Drop for CResult_PaymentSecretAPIErrorZ {
4683         fn drop(&mut self) {
4684                 if self.result_ok {
4685                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
4686                                 let _ = unsafe { Box::from_raw(self.contents.result) };
4687                         }
4688                 } else {
4689                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
4690                                 let _ = unsafe { Box::from_raw(self.contents.err) };
4691                         }
4692                 }
4693         }
4694 }
4695 impl From<crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::util::errors::APIError>> for CResult_PaymentSecretAPIErrorZ {
4696         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::util::errors::APIError>) -> Self {
4697                 let contents = if o.result_ok {
4698                         let result = unsafe { o.contents.result };
4699                         unsafe { o.contents.result = std::ptr::null_mut() };
4700                         CResult_PaymentSecretAPIErrorZPtr { result }
4701                 } else {
4702                         let err = unsafe { o.contents.err };
4703                         unsafe { o.contents.err = std::ptr::null_mut(); }
4704                         CResult_PaymentSecretAPIErrorZPtr { err }
4705                 };
4706                 Self {
4707                         contents,
4708                         result_ok: o.result_ok,
4709                 }
4710         }
4711 }
4712 impl Clone for CResult_PaymentSecretAPIErrorZ {
4713         fn clone(&self) -> Self {
4714                 if self.result_ok {
4715                         Self { result_ok: true, contents: CResult_PaymentSecretAPIErrorZPtr {
4716                                 result: Box::into_raw(Box::new(<crate::c_types::ThirtyTwoBytes>::clone(unsafe { &*self.contents.result })))
4717                         } }
4718                 } else {
4719                         Self { result_ok: false, contents: CResult_PaymentSecretAPIErrorZPtr {
4720                                 err: Box::into_raw(Box::new(<crate::lightning::util::errors::APIError>::clone(unsafe { &*self.contents.err })))
4721                         } }
4722                 }
4723         }
4724 }
4725 #[no_mangle]
4726 /// Creates a new CResult_PaymentSecretAPIErrorZ which has the same data as `orig`
4727 /// but with all dynamically-allocated buffers duplicated in new buffers.
4728 pub extern "C" fn CResult_PaymentSecretAPIErrorZ_clone(orig: &CResult_PaymentSecretAPIErrorZ) -> CResult_PaymentSecretAPIErrorZ { Clone::clone(&orig) }
4729 #[repr(C)]
4730 /// A dynamically-allocated array of crate::lightning::chain::channelmonitor::ChannelMonitors of arbitrary size.
4731 /// This corresponds to std::vector in C++
4732 pub struct CVec_ChannelMonitorZ {
4733         /// The elements in the array.
4734         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4735         pub data: *mut crate::lightning::chain::channelmonitor::ChannelMonitor,
4736         /// The number of elements pointed to by `data`.
4737         pub datalen: usize
4738 }
4739 impl CVec_ChannelMonitorZ {
4740         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::chain::channelmonitor::ChannelMonitor> {
4741                 if self.datalen == 0 { return Vec::new(); }
4742                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
4743                 self.data = std::ptr::null_mut();
4744                 self.datalen = 0;
4745                 ret
4746         }
4747         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::chain::channelmonitor::ChannelMonitor] {
4748                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
4749         }
4750 }
4751 impl From<Vec<crate::lightning::chain::channelmonitor::ChannelMonitor>> for CVec_ChannelMonitorZ {
4752         fn from(v: Vec<crate::lightning::chain::channelmonitor::ChannelMonitor>) -> Self {
4753                 let datalen = v.len();
4754                 let data = Box::into_raw(v.into_boxed_slice());
4755                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
4756         }
4757 }
4758 #[no_mangle]
4759 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
4760 pub extern "C" fn CVec_ChannelMonitorZ_free(_res: CVec_ChannelMonitorZ) { }
4761 impl Drop for CVec_ChannelMonitorZ {
4762         fn drop(&mut self) {
4763                 if self.datalen == 0 { return; }
4764                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
4765         }
4766 }
4767 #[repr(C)]
4768 /// A tuple of 2 elements. See the individual fields for the types contained.
4769 pub struct C2Tuple_BlockHashChannelManagerZ {
4770         /// The element at position 0
4771         pub a: crate::c_types::ThirtyTwoBytes,
4772         /// The element at position 1
4773         pub b: crate::lightning::ln::channelmanager::ChannelManager,
4774 }
4775 impl From<(crate::c_types::ThirtyTwoBytes, crate::lightning::ln::channelmanager::ChannelManager)> for C2Tuple_BlockHashChannelManagerZ {
4776         fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::lightning::ln::channelmanager::ChannelManager)) -> Self {
4777                 Self {
4778                         a: tup.0,
4779                         b: tup.1,
4780                 }
4781         }
4782 }
4783 impl C2Tuple_BlockHashChannelManagerZ {
4784         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::lightning::ln::channelmanager::ChannelManager) {
4785                 (self.a, self.b)
4786         }
4787 }
4788 /// Creates a new C2Tuple_BlockHashChannelManagerZ from the contained elements.
4789 #[no_mangle]
4790 pub extern "C" fn C2Tuple_BlockHashChannelManagerZ_new(a: crate::c_types::ThirtyTwoBytes, b: crate::lightning::ln::channelmanager::ChannelManager) -> C2Tuple_BlockHashChannelManagerZ {
4791         C2Tuple_BlockHashChannelManagerZ { a, b, }
4792 }
4793
4794 #[no_mangle]
4795 /// Frees any resources used by the C2Tuple_BlockHashChannelManagerZ.
4796 pub extern "C" fn C2Tuple_BlockHashChannelManagerZ_free(_res: C2Tuple_BlockHashChannelManagerZ) { }
4797 #[repr(C)]
4798 /// The contents of CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ
4799 pub union CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr {
4800         /// A pointer to the contents in the success state.
4801         /// Reading from this pointer when `result_ok` is not set is undefined.
4802         pub result: *mut crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ,
4803         /// A pointer to the contents in the error state.
4804         /// Reading from this pointer when `result_ok` is set is undefined.
4805         pub err: *mut crate::lightning::ln::msgs::DecodeError,
4806 }
4807 #[repr(C)]
4808 /// A CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ represents the result of a fallible operation,
4809 /// containing a crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
4810 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4811 pub struct CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
4812         /// The contents of this CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ, accessible via either
4813         /// `err` or `result` depending on the state of `result_ok`.
4814         pub contents: CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr,
4815         /// Whether this CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ represents a success state.
4816         pub result_ok: bool,
4817 }
4818 #[no_mangle]
4819 /// Creates a new CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ in the success state.
4820 pub extern "C" fn CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_ok(o: crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ) -> CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
4821         CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
4822                 contents: CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr {
4823                         result: Box::into_raw(Box::new(o)),
4824                 },
4825                 result_ok: true,
4826         }
4827 }
4828 #[no_mangle]
4829 /// Creates a new CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ in the error state.
4830 pub extern "C" fn CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
4831         CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
4832                 contents: CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr {
4833                         err: Box::into_raw(Box::new(e)),
4834                 },
4835                 result_ok: false,
4836         }
4837 }
4838 #[no_mangle]
4839 /// Frees any resources used by the CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ.
4840 pub extern "C" fn CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_free(_res: CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ) { }
4841 impl Drop for CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
4842         fn drop(&mut self) {
4843                 if self.result_ok {
4844                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
4845                                 let _ = unsafe { Box::from_raw(self.contents.result) };
4846                         }
4847                 } else {
4848                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
4849                                 let _ = unsafe { Box::from_raw(self.contents.err) };
4850                         }
4851                 }
4852         }
4853 }
4854 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ, crate::lightning::ln::msgs::DecodeError>> for CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
4855         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
4856                 let contents = if o.result_ok {
4857                         let result = unsafe { o.contents.result };
4858                         unsafe { o.contents.result = std::ptr::null_mut() };
4859                         CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr { result }
4860                 } else {
4861                         let err = unsafe { o.contents.err };
4862                         unsafe { o.contents.err = std::ptr::null_mut(); }
4863                         CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr { err }
4864                 };
4865                 Self {
4866                         contents,
4867                         result_ok: o.result_ok,
4868                 }
4869         }
4870 }
4871 #[repr(C)]
4872 /// The contents of CResult_ChannelConfigDecodeErrorZ
4873 pub union CResult_ChannelConfigDecodeErrorZPtr {
4874         /// A pointer to the contents in the success state.
4875         /// Reading from this pointer when `result_ok` is not set is undefined.
4876         pub result: *mut crate::lightning::util::config::ChannelConfig,
4877         /// A pointer to the contents in the error state.
4878         /// Reading from this pointer when `result_ok` is set is undefined.
4879         pub err: *mut crate::lightning::ln::msgs::DecodeError,
4880 }
4881 #[repr(C)]
4882 /// A CResult_ChannelConfigDecodeErrorZ represents the result of a fallible operation,
4883 /// containing a crate::lightning::util::config::ChannelConfig on success and a crate::lightning::ln::msgs::DecodeError on failure.
4884 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4885 pub struct CResult_ChannelConfigDecodeErrorZ {
4886         /// The contents of this CResult_ChannelConfigDecodeErrorZ, accessible via either
4887         /// `err` or `result` depending on the state of `result_ok`.
4888         pub contents: CResult_ChannelConfigDecodeErrorZPtr,
4889         /// Whether this CResult_ChannelConfigDecodeErrorZ represents a success state.
4890         pub result_ok: bool,
4891 }
4892 #[no_mangle]
4893 /// Creates a new CResult_ChannelConfigDecodeErrorZ in the success state.
4894 pub extern "C" fn CResult_ChannelConfigDecodeErrorZ_ok(o: crate::lightning::util::config::ChannelConfig) -> CResult_ChannelConfigDecodeErrorZ {
4895         CResult_ChannelConfigDecodeErrorZ {
4896                 contents: CResult_ChannelConfigDecodeErrorZPtr {
4897                         result: Box::into_raw(Box::new(o)),
4898                 },
4899                 result_ok: true,
4900         }
4901 }
4902 #[no_mangle]
4903 /// Creates a new CResult_ChannelConfigDecodeErrorZ in the error state.
4904 pub extern "C" fn CResult_ChannelConfigDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelConfigDecodeErrorZ {
4905         CResult_ChannelConfigDecodeErrorZ {
4906                 contents: CResult_ChannelConfigDecodeErrorZPtr {
4907                         err: Box::into_raw(Box::new(e)),
4908                 },
4909                 result_ok: false,
4910         }
4911 }
4912 #[no_mangle]
4913 /// Frees any resources used by the CResult_ChannelConfigDecodeErrorZ.
4914 pub extern "C" fn CResult_ChannelConfigDecodeErrorZ_free(_res: CResult_ChannelConfigDecodeErrorZ) { }
4915 impl Drop for CResult_ChannelConfigDecodeErrorZ {
4916         fn drop(&mut self) {
4917                 if self.result_ok {
4918                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
4919                                 let _ = unsafe { Box::from_raw(self.contents.result) };
4920                         }
4921                 } else {
4922                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
4923                                 let _ = unsafe { Box::from_raw(self.contents.err) };
4924                         }
4925                 }
4926         }
4927 }
4928 impl From<crate::c_types::CResultTempl<crate::lightning::util::config::ChannelConfig, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelConfigDecodeErrorZ {
4929         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::util::config::ChannelConfig, crate::lightning::ln::msgs::DecodeError>) -> Self {
4930                 let contents = if o.result_ok {
4931                         let result = unsafe { o.contents.result };
4932                         unsafe { o.contents.result = std::ptr::null_mut() };
4933                         CResult_ChannelConfigDecodeErrorZPtr { result }
4934                 } else {
4935                         let err = unsafe { o.contents.err };
4936                         unsafe { o.contents.err = std::ptr::null_mut(); }
4937                         CResult_ChannelConfigDecodeErrorZPtr { err }
4938                 };
4939                 Self {
4940                         contents,
4941                         result_ok: o.result_ok,
4942                 }
4943         }
4944 }
4945 impl Clone for CResult_ChannelConfigDecodeErrorZ {
4946         fn clone(&self) -> Self {
4947                 if self.result_ok {
4948                         Self { result_ok: true, contents: CResult_ChannelConfigDecodeErrorZPtr {
4949                                 result: Box::into_raw(Box::new(<crate::lightning::util::config::ChannelConfig>::clone(unsafe { &*self.contents.result })))
4950                         } }
4951                 } else {
4952                         Self { result_ok: false, contents: CResult_ChannelConfigDecodeErrorZPtr {
4953                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
4954                         } }
4955                 }
4956         }
4957 }
4958 #[no_mangle]
4959 /// Creates a new CResult_ChannelConfigDecodeErrorZ which has the same data as `orig`
4960 /// but with all dynamically-allocated buffers duplicated in new buffers.
4961 pub extern "C" fn CResult_ChannelConfigDecodeErrorZ_clone(orig: &CResult_ChannelConfigDecodeErrorZ) -> CResult_ChannelConfigDecodeErrorZ { Clone::clone(&orig) }
4962 #[repr(C)]
4963 /// The contents of CResult_OutPointDecodeErrorZ
4964 pub union CResult_OutPointDecodeErrorZPtr {
4965         /// A pointer to the contents in the success state.
4966         /// Reading from this pointer when `result_ok` is not set is undefined.
4967         pub result: *mut crate::lightning::chain::transaction::OutPoint,
4968         /// A pointer to the contents in the error state.
4969         /// Reading from this pointer when `result_ok` is set is undefined.
4970         pub err: *mut crate::lightning::ln::msgs::DecodeError,
4971 }
4972 #[repr(C)]
4973 /// A CResult_OutPointDecodeErrorZ represents the result of a fallible operation,
4974 /// containing a crate::lightning::chain::transaction::OutPoint on success and a crate::lightning::ln::msgs::DecodeError on failure.
4975 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4976 pub struct CResult_OutPointDecodeErrorZ {
4977         /// The contents of this CResult_OutPointDecodeErrorZ, accessible via either
4978         /// `err` or `result` depending on the state of `result_ok`.
4979         pub contents: CResult_OutPointDecodeErrorZPtr,
4980         /// Whether this CResult_OutPointDecodeErrorZ represents a success state.
4981         pub result_ok: bool,
4982 }
4983 #[no_mangle]
4984 /// Creates a new CResult_OutPointDecodeErrorZ in the success state.
4985 pub extern "C" fn CResult_OutPointDecodeErrorZ_ok(o: crate::lightning::chain::transaction::OutPoint) -> CResult_OutPointDecodeErrorZ {
4986         CResult_OutPointDecodeErrorZ {
4987                 contents: CResult_OutPointDecodeErrorZPtr {
4988                         result: Box::into_raw(Box::new(o)),
4989                 },
4990                 result_ok: true,
4991         }
4992 }
4993 #[no_mangle]
4994 /// Creates a new CResult_OutPointDecodeErrorZ in the error state.
4995 pub extern "C" fn CResult_OutPointDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_OutPointDecodeErrorZ {
4996         CResult_OutPointDecodeErrorZ {
4997                 contents: CResult_OutPointDecodeErrorZPtr {
4998                         err: Box::into_raw(Box::new(e)),
4999                 },
5000                 result_ok: false,
5001         }
5002 }
5003 #[no_mangle]
5004 /// Frees any resources used by the CResult_OutPointDecodeErrorZ.
5005 pub extern "C" fn CResult_OutPointDecodeErrorZ_free(_res: CResult_OutPointDecodeErrorZ) { }
5006 impl Drop for CResult_OutPointDecodeErrorZ {
5007         fn drop(&mut self) {
5008                 if self.result_ok {
5009                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
5010                                 let _ = unsafe { Box::from_raw(self.contents.result) };
5011                         }
5012                 } else {
5013                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
5014                                 let _ = unsafe { Box::from_raw(self.contents.err) };
5015                         }
5016                 }
5017         }
5018 }
5019 impl From<crate::c_types::CResultTempl<crate::lightning::chain::transaction::OutPoint, crate::lightning::ln::msgs::DecodeError>> for CResult_OutPointDecodeErrorZ {
5020         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::transaction::OutPoint, crate::lightning::ln::msgs::DecodeError>) -> Self {
5021                 let contents = if o.result_ok {
5022                         let result = unsafe { o.contents.result };
5023                         unsafe { o.contents.result = std::ptr::null_mut() };
5024                         CResult_OutPointDecodeErrorZPtr { result }
5025                 } else {
5026                         let err = unsafe { o.contents.err };
5027                         unsafe { o.contents.err = std::ptr::null_mut(); }
5028                         CResult_OutPointDecodeErrorZPtr { err }
5029                 };
5030                 Self {
5031                         contents,
5032                         result_ok: o.result_ok,
5033                 }
5034         }
5035 }
5036 impl Clone for CResult_OutPointDecodeErrorZ {
5037         fn clone(&self) -> Self {
5038                 if self.result_ok {
5039                         Self { result_ok: true, contents: CResult_OutPointDecodeErrorZPtr {
5040                                 result: Box::into_raw(Box::new(<crate::lightning::chain::transaction::OutPoint>::clone(unsafe { &*self.contents.result })))
5041                         } }
5042                 } else {
5043                         Self { result_ok: false, contents: CResult_OutPointDecodeErrorZPtr {
5044                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
5045                         } }
5046                 }
5047         }
5048 }
5049 #[no_mangle]
5050 /// Creates a new CResult_OutPointDecodeErrorZ which has the same data as `orig`
5051 /// but with all dynamically-allocated buffers duplicated in new buffers.
5052 pub extern "C" fn CResult_OutPointDecodeErrorZ_clone(orig: &CResult_OutPointDecodeErrorZ) -> CResult_OutPointDecodeErrorZ { Clone::clone(&orig) }
5053 #[repr(C)]
5054 /// An enum which can either contain a crate::lightning::ln::wire::Type or not
5055 pub enum COption_TypeZ {
5056         /// When we're in this state, this COption_TypeZ contains a crate::lightning::ln::wire::Type
5057         Some(crate::lightning::ln::wire::Type),
5058         /// When we're in this state, this COption_TypeZ contains nothing
5059         None
5060 }
5061 impl COption_TypeZ {
5062         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
5063                 if let Self::Some(_) = self { true } else { false }
5064         }
5065         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
5066                 !self.is_some()
5067         }
5068         #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::ln::wire::Type {
5069                 if let Self::Some(v) = self { v } else { unreachable!() }
5070         }
5071 }
5072 #[no_mangle]
5073 /// Constructs a new COption_TypeZ containing a crate::lightning::ln::wire::Type
5074 pub extern "C" fn COption_TypeZ_some(o: crate::lightning::ln::wire::Type) -> COption_TypeZ {
5075         COption_TypeZ::Some(o)
5076 }
5077 #[no_mangle]
5078 /// Constructs a new COption_TypeZ containing nothing
5079 pub extern "C" fn COption_TypeZ_none() -> COption_TypeZ {
5080         COption_TypeZ::None
5081 }
5082 #[no_mangle]
5083 /// Frees any resources associated with the crate::lightning::ln::wire::Type, if we are in the Some state
5084 pub extern "C" fn COption_TypeZ_free(_res: COption_TypeZ) { }
5085 #[repr(C)]
5086 /// The contents of CResult_COption_TypeZDecodeErrorZ
5087 pub union CResult_COption_TypeZDecodeErrorZPtr {
5088         /// A pointer to the contents in the success state.
5089         /// Reading from this pointer when `result_ok` is not set is undefined.
5090         pub result: *mut crate::c_types::derived::COption_TypeZ,
5091         /// A pointer to the contents in the error state.
5092         /// Reading from this pointer when `result_ok` is set is undefined.
5093         pub err: *mut crate::lightning::ln::msgs::DecodeError,
5094 }
5095 #[repr(C)]
5096 /// A CResult_COption_TypeZDecodeErrorZ represents the result of a fallible operation,
5097 /// containing a crate::c_types::derived::COption_TypeZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
5098 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5099 pub struct CResult_COption_TypeZDecodeErrorZ {
5100         /// The contents of this CResult_COption_TypeZDecodeErrorZ, accessible via either
5101         /// `err` or `result` depending on the state of `result_ok`.
5102         pub contents: CResult_COption_TypeZDecodeErrorZPtr,
5103         /// Whether this CResult_COption_TypeZDecodeErrorZ represents a success state.
5104         pub result_ok: bool,
5105 }
5106 #[no_mangle]
5107 /// Creates a new CResult_COption_TypeZDecodeErrorZ in the success state.
5108 pub extern "C" fn CResult_COption_TypeZDecodeErrorZ_ok(o: crate::c_types::derived::COption_TypeZ) -> CResult_COption_TypeZDecodeErrorZ {
5109         CResult_COption_TypeZDecodeErrorZ {
5110                 contents: CResult_COption_TypeZDecodeErrorZPtr {
5111                         result: Box::into_raw(Box::new(o)),
5112                 },
5113                 result_ok: true,
5114         }
5115 }
5116 #[no_mangle]
5117 /// Creates a new CResult_COption_TypeZDecodeErrorZ in the error state.
5118 pub extern "C" fn CResult_COption_TypeZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_TypeZDecodeErrorZ {
5119         CResult_COption_TypeZDecodeErrorZ {
5120                 contents: CResult_COption_TypeZDecodeErrorZPtr {
5121                         err: Box::into_raw(Box::new(e)),
5122                 },
5123                 result_ok: false,
5124         }
5125 }
5126 #[no_mangle]
5127 /// Frees any resources used by the CResult_COption_TypeZDecodeErrorZ.
5128 pub extern "C" fn CResult_COption_TypeZDecodeErrorZ_free(_res: CResult_COption_TypeZDecodeErrorZ) { }
5129 impl Drop for CResult_COption_TypeZDecodeErrorZ {
5130         fn drop(&mut self) {
5131                 if self.result_ok {
5132                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
5133                                 let _ = unsafe { Box::from_raw(self.contents.result) };
5134                         }
5135                 } else {
5136                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
5137                                 let _ = unsafe { Box::from_raw(self.contents.err) };
5138                         }
5139                 }
5140         }
5141 }
5142 impl From<crate::c_types::CResultTempl<crate::c_types::derived::COption_TypeZ, crate::lightning::ln::msgs::DecodeError>> for CResult_COption_TypeZDecodeErrorZ {
5143         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::COption_TypeZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
5144                 let contents = if o.result_ok {
5145                         let result = unsafe { o.contents.result };
5146                         unsafe { o.contents.result = std::ptr::null_mut() };
5147                         CResult_COption_TypeZDecodeErrorZPtr { result }
5148                 } else {
5149                         let err = unsafe { o.contents.err };
5150                         unsafe { o.contents.err = std::ptr::null_mut(); }
5151                         CResult_COption_TypeZDecodeErrorZPtr { err }
5152                 };
5153                 Self {
5154                         contents,
5155                         result_ok: o.result_ok,
5156                 }
5157         }
5158 }
5159 #[repr(C)]
5160 /// The contents of CResult_SiPrefixNoneZ
5161 pub union CResult_SiPrefixNoneZPtr {
5162         /// A pointer to the contents in the success state.
5163         /// Reading from this pointer when `result_ok` is not set is undefined.
5164         pub result: *mut crate::lightning_invoice::SiPrefix,
5165         /// Note that this value is always NULL, as there are no contents in the Err variant
5166         pub err: *mut std::ffi::c_void,
5167 }
5168 #[repr(C)]
5169 /// A CResult_SiPrefixNoneZ represents the result of a fallible operation,
5170 /// containing a crate::lightning_invoice::SiPrefix on success and a () on failure.
5171 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5172 pub struct CResult_SiPrefixNoneZ {
5173         /// The contents of this CResult_SiPrefixNoneZ, accessible via either
5174         /// `err` or `result` depending on the state of `result_ok`.
5175         pub contents: CResult_SiPrefixNoneZPtr,
5176         /// Whether this CResult_SiPrefixNoneZ represents a success state.
5177         pub result_ok: bool,
5178 }
5179 #[no_mangle]
5180 /// Creates a new CResult_SiPrefixNoneZ in the success state.
5181 pub extern "C" fn CResult_SiPrefixNoneZ_ok(o: crate::lightning_invoice::SiPrefix) -> CResult_SiPrefixNoneZ {
5182         CResult_SiPrefixNoneZ {
5183                 contents: CResult_SiPrefixNoneZPtr {
5184                         result: Box::into_raw(Box::new(o)),
5185                 },
5186                 result_ok: true,
5187         }
5188 }
5189 #[no_mangle]
5190 /// Creates a new CResult_SiPrefixNoneZ in the error state.
5191 pub extern "C" fn CResult_SiPrefixNoneZ_err() -> CResult_SiPrefixNoneZ {
5192         CResult_SiPrefixNoneZ {
5193                 contents: CResult_SiPrefixNoneZPtr {
5194                         err: std::ptr::null_mut(),
5195                 },
5196                 result_ok: false,
5197         }
5198 }
5199 #[no_mangle]
5200 /// Frees any resources used by the CResult_SiPrefixNoneZ.
5201 pub extern "C" fn CResult_SiPrefixNoneZ_free(_res: CResult_SiPrefixNoneZ) { }
5202 impl Drop for CResult_SiPrefixNoneZ {
5203         fn drop(&mut self) {
5204                 if self.result_ok {
5205                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
5206                                 let _ = unsafe { Box::from_raw(self.contents.result) };
5207                         }
5208                 } else {
5209                 }
5210         }
5211 }
5212 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::SiPrefix, ()>> for CResult_SiPrefixNoneZ {
5213         fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::SiPrefix, ()>) -> Self {
5214                 let contents = if o.result_ok {
5215                         let result = unsafe { o.contents.result };
5216                         unsafe { o.contents.result = std::ptr::null_mut() };
5217                         CResult_SiPrefixNoneZPtr { result }
5218                 } else {
5219                         let _ = unsafe { Box::from_raw(o.contents.err) };
5220                         o.contents.err = std::ptr::null_mut();
5221                         CResult_SiPrefixNoneZPtr { err: std::ptr::null_mut() }
5222                 };
5223                 Self {
5224                         contents,
5225                         result_ok: o.result_ok,
5226                 }
5227         }
5228 }
5229 impl Clone for CResult_SiPrefixNoneZ {
5230         fn clone(&self) -> Self {
5231                 if self.result_ok {
5232                         Self { result_ok: true, contents: CResult_SiPrefixNoneZPtr {
5233                                 result: Box::into_raw(Box::new(<crate::lightning_invoice::SiPrefix>::clone(unsafe { &*self.contents.result })))
5234                         } }
5235                 } else {
5236                         Self { result_ok: false, contents: CResult_SiPrefixNoneZPtr {
5237                                 err: std::ptr::null_mut()
5238                         } }
5239                 }
5240         }
5241 }
5242 #[no_mangle]
5243 /// Creates a new CResult_SiPrefixNoneZ which has the same data as `orig`
5244 /// but with all dynamically-allocated buffers duplicated in new buffers.
5245 pub extern "C" fn CResult_SiPrefixNoneZ_clone(orig: &CResult_SiPrefixNoneZ) -> CResult_SiPrefixNoneZ { Clone::clone(&orig) }
5246 #[repr(C)]
5247 /// The contents of CResult_InvoiceNoneZ
5248 pub union CResult_InvoiceNoneZPtr {
5249         /// A pointer to the contents in the success state.
5250         /// Reading from this pointer when `result_ok` is not set is undefined.
5251         pub result: *mut crate::lightning_invoice::Invoice,
5252         /// Note that this value is always NULL, as there are no contents in the Err variant
5253         pub err: *mut std::ffi::c_void,
5254 }
5255 #[repr(C)]
5256 /// A CResult_InvoiceNoneZ represents the result of a fallible operation,
5257 /// containing a crate::lightning_invoice::Invoice on success and a () on failure.
5258 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5259 pub struct CResult_InvoiceNoneZ {
5260         /// The contents of this CResult_InvoiceNoneZ, accessible via either
5261         /// `err` or `result` depending on the state of `result_ok`.
5262         pub contents: CResult_InvoiceNoneZPtr,
5263         /// Whether this CResult_InvoiceNoneZ represents a success state.
5264         pub result_ok: bool,
5265 }
5266 #[no_mangle]
5267 /// Creates a new CResult_InvoiceNoneZ in the success state.
5268 pub extern "C" fn CResult_InvoiceNoneZ_ok(o: crate::lightning_invoice::Invoice) -> CResult_InvoiceNoneZ {
5269         CResult_InvoiceNoneZ {
5270                 contents: CResult_InvoiceNoneZPtr {
5271                         result: Box::into_raw(Box::new(o)),
5272                 },
5273                 result_ok: true,
5274         }
5275 }
5276 #[no_mangle]
5277 /// Creates a new CResult_InvoiceNoneZ in the error state.
5278 pub extern "C" fn CResult_InvoiceNoneZ_err() -> CResult_InvoiceNoneZ {
5279         CResult_InvoiceNoneZ {
5280                 contents: CResult_InvoiceNoneZPtr {
5281                         err: std::ptr::null_mut(),
5282                 },
5283                 result_ok: false,
5284         }
5285 }
5286 #[no_mangle]
5287 /// Frees any resources used by the CResult_InvoiceNoneZ.
5288 pub extern "C" fn CResult_InvoiceNoneZ_free(_res: CResult_InvoiceNoneZ) { }
5289 impl Drop for CResult_InvoiceNoneZ {
5290         fn drop(&mut self) {
5291                 if self.result_ok {
5292                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
5293                                 let _ = unsafe { Box::from_raw(self.contents.result) };
5294                         }
5295                 } else {
5296                 }
5297         }
5298 }
5299 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::Invoice, ()>> for CResult_InvoiceNoneZ {
5300         fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::Invoice, ()>) -> Self {
5301                 let contents = if o.result_ok {
5302                         let result = unsafe { o.contents.result };
5303                         unsafe { o.contents.result = std::ptr::null_mut() };
5304                         CResult_InvoiceNoneZPtr { result }
5305                 } else {
5306                         let _ = unsafe { Box::from_raw(o.contents.err) };
5307                         o.contents.err = std::ptr::null_mut();
5308                         CResult_InvoiceNoneZPtr { err: std::ptr::null_mut() }
5309                 };
5310                 Self {
5311                         contents,
5312                         result_ok: o.result_ok,
5313                 }
5314         }
5315 }
5316 impl Clone for CResult_InvoiceNoneZ {
5317         fn clone(&self) -> Self {
5318                 if self.result_ok {
5319                         Self { result_ok: true, contents: CResult_InvoiceNoneZPtr {
5320                                 result: Box::into_raw(Box::new(<crate::lightning_invoice::Invoice>::clone(unsafe { &*self.contents.result })))
5321                         } }
5322                 } else {
5323                         Self { result_ok: false, contents: CResult_InvoiceNoneZPtr {
5324                                 err: std::ptr::null_mut()
5325                         } }
5326                 }
5327         }
5328 }
5329 #[no_mangle]
5330 /// Creates a new CResult_InvoiceNoneZ which has the same data as `orig`
5331 /// but with all dynamically-allocated buffers duplicated in new buffers.
5332 pub extern "C" fn CResult_InvoiceNoneZ_clone(orig: &CResult_InvoiceNoneZ) -> CResult_InvoiceNoneZ { Clone::clone(&orig) }
5333 #[repr(C)]
5334 /// The contents of CResult_SignedRawInvoiceNoneZ
5335 pub union CResult_SignedRawInvoiceNoneZPtr {
5336         /// A pointer to the contents in the success state.
5337         /// Reading from this pointer when `result_ok` is not set is undefined.
5338         pub result: *mut crate::lightning_invoice::SignedRawInvoice,
5339         /// Note that this value is always NULL, as there are no contents in the Err variant
5340         pub err: *mut std::ffi::c_void,
5341 }
5342 #[repr(C)]
5343 /// A CResult_SignedRawInvoiceNoneZ represents the result of a fallible operation,
5344 /// containing a crate::lightning_invoice::SignedRawInvoice on success and a () on failure.
5345 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5346 pub struct CResult_SignedRawInvoiceNoneZ {
5347         /// The contents of this CResult_SignedRawInvoiceNoneZ, accessible via either
5348         /// `err` or `result` depending on the state of `result_ok`.
5349         pub contents: CResult_SignedRawInvoiceNoneZPtr,
5350         /// Whether this CResult_SignedRawInvoiceNoneZ represents a success state.
5351         pub result_ok: bool,
5352 }
5353 #[no_mangle]
5354 /// Creates a new CResult_SignedRawInvoiceNoneZ in the success state.
5355 pub extern "C" fn CResult_SignedRawInvoiceNoneZ_ok(o: crate::lightning_invoice::SignedRawInvoice) -> CResult_SignedRawInvoiceNoneZ {
5356         CResult_SignedRawInvoiceNoneZ {
5357                 contents: CResult_SignedRawInvoiceNoneZPtr {
5358                         result: Box::into_raw(Box::new(o)),
5359                 },
5360                 result_ok: true,
5361         }
5362 }
5363 #[no_mangle]
5364 /// Creates a new CResult_SignedRawInvoiceNoneZ in the error state.
5365 pub extern "C" fn CResult_SignedRawInvoiceNoneZ_err() -> CResult_SignedRawInvoiceNoneZ {
5366         CResult_SignedRawInvoiceNoneZ {
5367                 contents: CResult_SignedRawInvoiceNoneZPtr {
5368                         err: std::ptr::null_mut(),
5369                 },
5370                 result_ok: false,
5371         }
5372 }
5373 #[no_mangle]
5374 /// Frees any resources used by the CResult_SignedRawInvoiceNoneZ.
5375 pub extern "C" fn CResult_SignedRawInvoiceNoneZ_free(_res: CResult_SignedRawInvoiceNoneZ) { }
5376 impl Drop for CResult_SignedRawInvoiceNoneZ {
5377         fn drop(&mut self) {
5378                 if self.result_ok {
5379                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
5380                                 let _ = unsafe { Box::from_raw(self.contents.result) };
5381                         }
5382                 } else {
5383                 }
5384         }
5385 }
5386 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::SignedRawInvoice, ()>> for CResult_SignedRawInvoiceNoneZ {
5387         fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::SignedRawInvoice, ()>) -> Self {
5388                 let contents = if o.result_ok {
5389                         let result = unsafe { o.contents.result };
5390                         unsafe { o.contents.result = std::ptr::null_mut() };
5391                         CResult_SignedRawInvoiceNoneZPtr { result }
5392                 } else {
5393                         let _ = unsafe { Box::from_raw(o.contents.err) };
5394                         o.contents.err = std::ptr::null_mut();
5395                         CResult_SignedRawInvoiceNoneZPtr { err: std::ptr::null_mut() }
5396                 };
5397                 Self {
5398                         contents,
5399                         result_ok: o.result_ok,
5400                 }
5401         }
5402 }
5403 impl Clone for CResult_SignedRawInvoiceNoneZ {
5404         fn clone(&self) -> Self {
5405                 if self.result_ok {
5406                         Self { result_ok: true, contents: CResult_SignedRawInvoiceNoneZPtr {
5407                                 result: Box::into_raw(Box::new(<crate::lightning_invoice::SignedRawInvoice>::clone(unsafe { &*self.contents.result })))
5408                         } }
5409                 } else {
5410                         Self { result_ok: false, contents: CResult_SignedRawInvoiceNoneZPtr {
5411                                 err: std::ptr::null_mut()
5412                         } }
5413                 }
5414         }
5415 }
5416 #[no_mangle]
5417 /// Creates a new CResult_SignedRawInvoiceNoneZ which has the same data as `orig`
5418 /// but with all dynamically-allocated buffers duplicated in new buffers.
5419 pub extern "C" fn CResult_SignedRawInvoiceNoneZ_clone(orig: &CResult_SignedRawInvoiceNoneZ) -> CResult_SignedRawInvoiceNoneZ { Clone::clone(&orig) }
5420 #[repr(C)]
5421 /// A tuple of 3 elements. See the individual fields for the types contained.
5422 pub struct C3Tuple_RawInvoice_u832InvoiceSignatureZ {
5423         /// The element at position 0
5424         pub a: crate::lightning_invoice::RawInvoice,
5425         /// The element at position 1
5426         pub b: crate::c_types::ThirtyTwoBytes,
5427         /// The element at position 2
5428         pub c: crate::lightning_invoice::InvoiceSignature,
5429 }
5430 impl From<(crate::lightning_invoice::RawInvoice, crate::c_types::ThirtyTwoBytes, crate::lightning_invoice::InvoiceSignature)> for C3Tuple_RawInvoice_u832InvoiceSignatureZ {
5431         fn from (tup: (crate::lightning_invoice::RawInvoice, crate::c_types::ThirtyTwoBytes, crate::lightning_invoice::InvoiceSignature)) -> Self {
5432                 Self {
5433                         a: tup.0,
5434                         b: tup.1,
5435                         c: tup.2,
5436                 }
5437         }
5438 }
5439 impl C3Tuple_RawInvoice_u832InvoiceSignatureZ {
5440         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::lightning_invoice::RawInvoice, crate::c_types::ThirtyTwoBytes, crate::lightning_invoice::InvoiceSignature) {
5441                 (self.a, self.b, self.c)
5442         }
5443 }
5444 impl Clone for C3Tuple_RawInvoice_u832InvoiceSignatureZ {
5445         fn clone(&self) -> Self {
5446                 Self {
5447                         a: Clone::clone(&self.a),
5448                         b: Clone::clone(&self.b),
5449                         c: Clone::clone(&self.c),
5450                 }
5451         }
5452 }
5453 #[no_mangle]
5454 /// Creates a new tuple which has the same data as `orig`
5455 /// but with all dynamically-allocated buffers duplicated in new buffers.
5456 pub extern "C" fn C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone(orig: &C3Tuple_RawInvoice_u832InvoiceSignatureZ) -> C3Tuple_RawInvoice_u832InvoiceSignatureZ { Clone::clone(&orig) }
5457 /// Creates a new C3Tuple_RawInvoice_u832InvoiceSignatureZ from the contained elements.
5458 #[no_mangle]
5459 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 {
5460         C3Tuple_RawInvoice_u832InvoiceSignatureZ { a, b, c, }
5461 }
5462
5463 #[no_mangle]
5464 /// Frees any resources used by the C3Tuple_RawInvoice_u832InvoiceSignatureZ.
5465 pub extern "C" fn C3Tuple_RawInvoice_u832InvoiceSignatureZ_free(_res: C3Tuple_RawInvoice_u832InvoiceSignatureZ) { }
5466 #[repr(C)]
5467 /// The contents of CResult_PayeePubKeyErrorZ
5468 pub union CResult_PayeePubKeyErrorZPtr {
5469         /// A pointer to the contents in the success state.
5470         /// Reading from this pointer when `result_ok` is not set is undefined.
5471         pub result: *mut crate::lightning_invoice::PayeePubKey,
5472         /// A pointer to the contents in the error state.
5473         /// Reading from this pointer when `result_ok` is set is undefined.
5474         pub err: *mut crate::c_types::Secp256k1Error,
5475 }
5476 #[repr(C)]
5477 /// A CResult_PayeePubKeyErrorZ represents the result of a fallible operation,
5478 /// containing a crate::lightning_invoice::PayeePubKey on success and a crate::c_types::Secp256k1Error on failure.
5479 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5480 pub struct CResult_PayeePubKeyErrorZ {
5481         /// The contents of this CResult_PayeePubKeyErrorZ, accessible via either
5482         /// `err` or `result` depending on the state of `result_ok`.
5483         pub contents: CResult_PayeePubKeyErrorZPtr,
5484         /// Whether this CResult_PayeePubKeyErrorZ represents a success state.
5485         pub result_ok: bool,
5486 }
5487 #[no_mangle]
5488 /// Creates a new CResult_PayeePubKeyErrorZ in the success state.
5489 pub extern "C" fn CResult_PayeePubKeyErrorZ_ok(o: crate::lightning_invoice::PayeePubKey) -> CResult_PayeePubKeyErrorZ {
5490         CResult_PayeePubKeyErrorZ {
5491                 contents: CResult_PayeePubKeyErrorZPtr {
5492                         result: Box::into_raw(Box::new(o)),
5493                 },
5494                 result_ok: true,
5495         }
5496 }
5497 #[no_mangle]
5498 /// Creates a new CResult_PayeePubKeyErrorZ in the error state.
5499 pub extern "C" fn CResult_PayeePubKeyErrorZ_err(e: crate::c_types::Secp256k1Error) -> CResult_PayeePubKeyErrorZ {
5500         CResult_PayeePubKeyErrorZ {
5501                 contents: CResult_PayeePubKeyErrorZPtr {
5502                         err: Box::into_raw(Box::new(e)),
5503                 },
5504                 result_ok: false,
5505         }
5506 }
5507 #[no_mangle]
5508 /// Frees any resources used by the CResult_PayeePubKeyErrorZ.
5509 pub extern "C" fn CResult_PayeePubKeyErrorZ_free(_res: CResult_PayeePubKeyErrorZ) { }
5510 impl Drop for CResult_PayeePubKeyErrorZ {
5511         fn drop(&mut self) {
5512                 if self.result_ok {
5513                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
5514                                 let _ = unsafe { Box::from_raw(self.contents.result) };
5515                         }
5516                 } else {
5517                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
5518                                 let _ = unsafe { Box::from_raw(self.contents.err) };
5519                         }
5520                 }
5521         }
5522 }
5523 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::PayeePubKey, crate::c_types::Secp256k1Error>> for CResult_PayeePubKeyErrorZ {
5524         fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::PayeePubKey, crate::c_types::Secp256k1Error>) -> Self {
5525                 let contents = if o.result_ok {
5526                         let result = unsafe { o.contents.result };
5527                         unsafe { o.contents.result = std::ptr::null_mut() };
5528                         CResult_PayeePubKeyErrorZPtr { result }
5529                 } else {
5530                         let err = unsafe { o.contents.err };
5531                         unsafe { o.contents.err = std::ptr::null_mut(); }
5532                         CResult_PayeePubKeyErrorZPtr { err }
5533                 };
5534                 Self {
5535                         contents,
5536                         result_ok: o.result_ok,
5537                 }
5538         }
5539 }
5540 impl Clone for CResult_PayeePubKeyErrorZ {
5541         fn clone(&self) -> Self {
5542                 if self.result_ok {
5543                         Self { result_ok: true, contents: CResult_PayeePubKeyErrorZPtr {
5544                                 result: Box::into_raw(Box::new(<crate::lightning_invoice::PayeePubKey>::clone(unsafe { &*self.contents.result })))
5545                         } }
5546                 } else {
5547                         Self { result_ok: false, contents: CResult_PayeePubKeyErrorZPtr {
5548                                 err: Box::into_raw(Box::new(<crate::c_types::Secp256k1Error>::clone(unsafe { &*self.contents.err })))
5549                         } }
5550                 }
5551         }
5552 }
5553 #[no_mangle]
5554 /// Creates a new CResult_PayeePubKeyErrorZ which has the same data as `orig`
5555 /// but with all dynamically-allocated buffers duplicated in new buffers.
5556 pub extern "C" fn CResult_PayeePubKeyErrorZ_clone(orig: &CResult_PayeePubKeyErrorZ) -> CResult_PayeePubKeyErrorZ { Clone::clone(&orig) }
5557 #[repr(C)]
5558 /// A dynamically-allocated array of crate::lightning_invoice::PrivateRoutes of arbitrary size.
5559 /// This corresponds to std::vector in C++
5560 pub struct CVec_PrivateRouteZ {
5561         /// The elements in the array.
5562         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
5563         pub data: *mut crate::lightning_invoice::PrivateRoute,
5564         /// The number of elements pointed to by `data`.
5565         pub datalen: usize
5566 }
5567 impl CVec_PrivateRouteZ {
5568         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning_invoice::PrivateRoute> {
5569                 if self.datalen == 0 { return Vec::new(); }
5570                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
5571                 self.data = std::ptr::null_mut();
5572                 self.datalen = 0;
5573                 ret
5574         }
5575         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning_invoice::PrivateRoute] {
5576                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
5577         }
5578 }
5579 impl From<Vec<crate::lightning_invoice::PrivateRoute>> for CVec_PrivateRouteZ {
5580         fn from(v: Vec<crate::lightning_invoice::PrivateRoute>) -> Self {
5581                 let datalen = v.len();
5582                 let data = Box::into_raw(v.into_boxed_slice());
5583                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
5584         }
5585 }
5586 #[no_mangle]
5587 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
5588 pub extern "C" fn CVec_PrivateRouteZ_free(_res: CVec_PrivateRouteZ) { }
5589 impl Drop for CVec_PrivateRouteZ {
5590         fn drop(&mut self) {
5591                 if self.datalen == 0 { return; }
5592                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
5593         }
5594 }
5595 impl Clone for CVec_PrivateRouteZ {
5596         fn clone(&self) -> Self {
5597                 let mut res = Vec::new();
5598                 if self.datalen == 0 { return Self::from(res); }
5599                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
5600                 Self::from(res)
5601         }
5602 }
5603 #[repr(C)]
5604 /// The contents of CResult_PositiveTimestampCreationErrorZ
5605 pub union CResult_PositiveTimestampCreationErrorZPtr {
5606         /// A pointer to the contents in the success state.
5607         /// Reading from this pointer when `result_ok` is not set is undefined.
5608         pub result: *mut crate::lightning_invoice::PositiveTimestamp,
5609         /// A pointer to the contents in the error state.
5610         /// Reading from this pointer when `result_ok` is set is undefined.
5611         pub err: *mut crate::lightning_invoice::CreationError,
5612 }
5613 #[repr(C)]
5614 /// A CResult_PositiveTimestampCreationErrorZ represents the result of a fallible operation,
5615 /// containing a crate::lightning_invoice::PositiveTimestamp on success and a crate::lightning_invoice::CreationError on failure.
5616 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5617 pub struct CResult_PositiveTimestampCreationErrorZ {
5618         /// The contents of this CResult_PositiveTimestampCreationErrorZ, accessible via either
5619         /// `err` or `result` depending on the state of `result_ok`.
5620         pub contents: CResult_PositiveTimestampCreationErrorZPtr,
5621         /// Whether this CResult_PositiveTimestampCreationErrorZ represents a success state.
5622         pub result_ok: bool,
5623 }
5624 #[no_mangle]
5625 /// Creates a new CResult_PositiveTimestampCreationErrorZ in the success state.
5626 pub extern "C" fn CResult_PositiveTimestampCreationErrorZ_ok(o: crate::lightning_invoice::PositiveTimestamp) -> CResult_PositiveTimestampCreationErrorZ {
5627         CResult_PositiveTimestampCreationErrorZ {
5628                 contents: CResult_PositiveTimestampCreationErrorZPtr {
5629                         result: Box::into_raw(Box::new(o)),
5630                 },
5631                 result_ok: true,
5632         }
5633 }
5634 #[no_mangle]
5635 /// Creates a new CResult_PositiveTimestampCreationErrorZ in the error state.
5636 pub extern "C" fn CResult_PositiveTimestampCreationErrorZ_err(e: crate::lightning_invoice::CreationError) -> CResult_PositiveTimestampCreationErrorZ {
5637         CResult_PositiveTimestampCreationErrorZ {
5638                 contents: CResult_PositiveTimestampCreationErrorZPtr {
5639                         err: Box::into_raw(Box::new(e)),
5640                 },
5641                 result_ok: false,
5642         }
5643 }
5644 #[no_mangle]
5645 /// Frees any resources used by the CResult_PositiveTimestampCreationErrorZ.
5646 pub extern "C" fn CResult_PositiveTimestampCreationErrorZ_free(_res: CResult_PositiveTimestampCreationErrorZ) { }
5647 impl Drop for CResult_PositiveTimestampCreationErrorZ {
5648         fn drop(&mut self) {
5649                 if self.result_ok {
5650                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
5651                                 let _ = unsafe { Box::from_raw(self.contents.result) };
5652                         }
5653                 } else {
5654                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
5655                                 let _ = unsafe { Box::from_raw(self.contents.err) };
5656                         }
5657                 }
5658         }
5659 }
5660 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::PositiveTimestamp, crate::lightning_invoice::CreationError>> for CResult_PositiveTimestampCreationErrorZ {
5661         fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::PositiveTimestamp, crate::lightning_invoice::CreationError>) -> Self {
5662                 let contents = if o.result_ok {
5663                         let result = unsafe { o.contents.result };
5664                         unsafe { o.contents.result = std::ptr::null_mut() };
5665                         CResult_PositiveTimestampCreationErrorZPtr { result }
5666                 } else {
5667                         let err = unsafe { o.contents.err };
5668                         unsafe { o.contents.err = std::ptr::null_mut(); }
5669                         CResult_PositiveTimestampCreationErrorZPtr { err }
5670                 };
5671                 Self {
5672                         contents,
5673                         result_ok: o.result_ok,
5674                 }
5675         }
5676 }
5677 impl Clone for CResult_PositiveTimestampCreationErrorZ {
5678         fn clone(&self) -> Self {
5679                 if self.result_ok {
5680                         Self { result_ok: true, contents: CResult_PositiveTimestampCreationErrorZPtr {
5681                                 result: Box::into_raw(Box::new(<crate::lightning_invoice::PositiveTimestamp>::clone(unsafe { &*self.contents.result })))
5682                         } }
5683                 } else {
5684                         Self { result_ok: false, contents: CResult_PositiveTimestampCreationErrorZPtr {
5685                                 err: Box::into_raw(Box::new(<crate::lightning_invoice::CreationError>::clone(unsafe { &*self.contents.err })))
5686                         } }
5687                 }
5688         }
5689 }
5690 #[no_mangle]
5691 /// Creates a new CResult_PositiveTimestampCreationErrorZ which has the same data as `orig`
5692 /// but with all dynamically-allocated buffers duplicated in new buffers.
5693 pub extern "C" fn CResult_PositiveTimestampCreationErrorZ_clone(orig: &CResult_PositiveTimestampCreationErrorZ) -> CResult_PositiveTimestampCreationErrorZ { Clone::clone(&orig) }
5694 #[repr(C)]
5695 /// The contents of CResult_NoneSemanticErrorZ
5696 pub union CResult_NoneSemanticErrorZPtr {
5697         /// Note that this value is always NULL, as there are no contents in the OK variant
5698         pub result: *mut std::ffi::c_void,
5699         /// A pointer to the contents in the error state.
5700         /// Reading from this pointer when `result_ok` is set is undefined.
5701         pub err: *mut crate::lightning_invoice::SemanticError,
5702 }
5703 #[repr(C)]
5704 /// A CResult_NoneSemanticErrorZ represents the result of a fallible operation,
5705 /// containing a () on success and a crate::lightning_invoice::SemanticError on failure.
5706 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5707 pub struct CResult_NoneSemanticErrorZ {
5708         /// The contents of this CResult_NoneSemanticErrorZ, accessible via either
5709         /// `err` or `result` depending on the state of `result_ok`.
5710         pub contents: CResult_NoneSemanticErrorZPtr,
5711         /// Whether this CResult_NoneSemanticErrorZ represents a success state.
5712         pub result_ok: bool,
5713 }
5714 #[no_mangle]
5715 /// Creates a new CResult_NoneSemanticErrorZ in the success state.
5716 pub extern "C" fn CResult_NoneSemanticErrorZ_ok() -> CResult_NoneSemanticErrorZ {
5717         CResult_NoneSemanticErrorZ {
5718                 contents: CResult_NoneSemanticErrorZPtr {
5719                         result: std::ptr::null_mut(),
5720                 },
5721                 result_ok: true,
5722         }
5723 }
5724 #[no_mangle]
5725 /// Creates a new CResult_NoneSemanticErrorZ in the error state.
5726 pub extern "C" fn CResult_NoneSemanticErrorZ_err(e: crate::lightning_invoice::SemanticError) -> CResult_NoneSemanticErrorZ {
5727         CResult_NoneSemanticErrorZ {
5728                 contents: CResult_NoneSemanticErrorZPtr {
5729                         err: Box::into_raw(Box::new(e)),
5730                 },
5731                 result_ok: false,
5732         }
5733 }
5734 #[no_mangle]
5735 /// Frees any resources used by the CResult_NoneSemanticErrorZ.
5736 pub extern "C" fn CResult_NoneSemanticErrorZ_free(_res: CResult_NoneSemanticErrorZ) { }
5737 impl Drop for CResult_NoneSemanticErrorZ {
5738         fn drop(&mut self) {
5739                 if self.result_ok {
5740                 } else {
5741                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
5742                                 let _ = unsafe { Box::from_raw(self.contents.err) };
5743                         }
5744                 }
5745         }
5746 }
5747 impl From<crate::c_types::CResultTempl<(), crate::lightning_invoice::SemanticError>> for CResult_NoneSemanticErrorZ {
5748         fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning_invoice::SemanticError>) -> Self {
5749                 let contents = if o.result_ok {
5750                         let _ = unsafe { Box::from_raw(o.contents.result) };
5751                         o.contents.result = std::ptr::null_mut();
5752                         CResult_NoneSemanticErrorZPtr { result: std::ptr::null_mut() }
5753                 } else {
5754                         let err = unsafe { o.contents.err };
5755                         unsafe { o.contents.err = std::ptr::null_mut(); }
5756                         CResult_NoneSemanticErrorZPtr { err }
5757                 };
5758                 Self {
5759                         contents,
5760                         result_ok: o.result_ok,
5761                 }
5762         }
5763 }
5764 impl Clone for CResult_NoneSemanticErrorZ {
5765         fn clone(&self) -> Self {
5766                 if self.result_ok {
5767                         Self { result_ok: true, contents: CResult_NoneSemanticErrorZPtr {
5768                                 result: std::ptr::null_mut()
5769                         } }
5770                 } else {
5771                         Self { result_ok: false, contents: CResult_NoneSemanticErrorZPtr {
5772                                 err: Box::into_raw(Box::new(<crate::lightning_invoice::SemanticError>::clone(unsafe { &*self.contents.err })))
5773                         } }
5774                 }
5775         }
5776 }
5777 #[no_mangle]
5778 /// Creates a new CResult_NoneSemanticErrorZ which has the same data as `orig`
5779 /// but with all dynamically-allocated buffers duplicated in new buffers.
5780 pub extern "C" fn CResult_NoneSemanticErrorZ_clone(orig: &CResult_NoneSemanticErrorZ) -> CResult_NoneSemanticErrorZ { Clone::clone(&orig) }
5781 #[repr(C)]
5782 /// The contents of CResult_InvoiceSemanticErrorZ
5783 pub union CResult_InvoiceSemanticErrorZPtr {
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::Invoice,
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::lightning_invoice::SemanticError,
5790 }
5791 #[repr(C)]
5792 /// A CResult_InvoiceSemanticErrorZ represents the result of a fallible operation,
5793 /// containing a crate::lightning_invoice::Invoice on success and a crate::lightning_invoice::SemanticError on failure.
5794 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5795 pub struct CResult_InvoiceSemanticErrorZ {
5796         /// The contents of this CResult_InvoiceSemanticErrorZ, accessible via either
5797         /// `err` or `result` depending on the state of `result_ok`.
5798         pub contents: CResult_InvoiceSemanticErrorZPtr,
5799         /// Whether this CResult_InvoiceSemanticErrorZ represents a success state.
5800         pub result_ok: bool,
5801 }
5802 #[no_mangle]
5803 /// Creates a new CResult_InvoiceSemanticErrorZ in the success state.
5804 pub extern "C" fn CResult_InvoiceSemanticErrorZ_ok(o: crate::lightning_invoice::Invoice) -> CResult_InvoiceSemanticErrorZ {
5805         CResult_InvoiceSemanticErrorZ {
5806                 contents: CResult_InvoiceSemanticErrorZPtr {
5807                         result: Box::into_raw(Box::new(o)),
5808                 },
5809                 result_ok: true,
5810         }
5811 }
5812 #[no_mangle]
5813 /// Creates a new CResult_InvoiceSemanticErrorZ in the error state.
5814 pub extern "C" fn CResult_InvoiceSemanticErrorZ_err(e: crate::lightning_invoice::SemanticError) -> CResult_InvoiceSemanticErrorZ {
5815         CResult_InvoiceSemanticErrorZ {
5816                 contents: CResult_InvoiceSemanticErrorZPtr {
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_InvoiceSemanticErrorZ.
5824 pub extern "C" fn CResult_InvoiceSemanticErrorZ_free(_res: CResult_InvoiceSemanticErrorZ) { }
5825 impl Drop for CResult_InvoiceSemanticErrorZ {
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::Invoice, crate::lightning_invoice::SemanticError>> for CResult_InvoiceSemanticErrorZ {
5839         fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::Invoice, crate::lightning_invoice::SemanticError>) -> 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_InvoiceSemanticErrorZPtr { result }
5844                 } else {
5845                         let err = unsafe { o.contents.err };
5846                         unsafe { o.contents.err = std::ptr::null_mut(); }
5847                         CResult_InvoiceSemanticErrorZPtr { err }
5848                 };
5849                 Self {
5850                         contents,
5851                         result_ok: o.result_ok,
5852                 }
5853         }
5854 }
5855 impl Clone for CResult_InvoiceSemanticErrorZ {
5856         fn clone(&self) -> Self {
5857                 if self.result_ok {
5858                         Self { result_ok: true, contents: CResult_InvoiceSemanticErrorZPtr {
5859                                 result: Box::into_raw(Box::new(<crate::lightning_invoice::Invoice>::clone(unsafe { &*self.contents.result })))
5860                         } }
5861                 } else {
5862                         Self { result_ok: false, contents: CResult_InvoiceSemanticErrorZPtr {
5863                                 err: Box::into_raw(Box::new(<crate::lightning_invoice::SemanticError>::clone(unsafe { &*self.contents.err })))
5864                         } }
5865                 }
5866         }
5867 }
5868 #[no_mangle]
5869 /// Creates a new CResult_InvoiceSemanticErrorZ which has the same data as `orig`
5870 /// but with all dynamically-allocated buffers duplicated in new buffers.
5871 pub extern "C" fn CResult_InvoiceSemanticErrorZ_clone(orig: &CResult_InvoiceSemanticErrorZ) -> CResult_InvoiceSemanticErrorZ { Clone::clone(&orig) }
5872 #[repr(C)]
5873 /// The contents of CResult_DescriptionCreationErrorZ
5874 pub union CResult_DescriptionCreationErrorZPtr {
5875         /// A pointer to the contents in the success state.
5876         /// Reading from this pointer when `result_ok` is not set is undefined.
5877         pub result: *mut crate::lightning_invoice::Description,
5878         /// A pointer to the contents in the error state.
5879         /// Reading from this pointer when `result_ok` is set is undefined.
5880         pub err: *mut crate::lightning_invoice::CreationError,
5881 }
5882 #[repr(C)]
5883 /// A CResult_DescriptionCreationErrorZ represents the result of a fallible operation,
5884 /// containing a crate::lightning_invoice::Description on success and a crate::lightning_invoice::CreationError on failure.
5885 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5886 pub struct CResult_DescriptionCreationErrorZ {
5887         /// The contents of this CResult_DescriptionCreationErrorZ, accessible via either
5888         /// `err` or `result` depending on the state of `result_ok`.
5889         pub contents: CResult_DescriptionCreationErrorZPtr,
5890         /// Whether this CResult_DescriptionCreationErrorZ represents a success state.
5891         pub result_ok: bool,
5892 }
5893 #[no_mangle]
5894 /// Creates a new CResult_DescriptionCreationErrorZ in the success state.
5895 pub extern "C" fn CResult_DescriptionCreationErrorZ_ok(o: crate::lightning_invoice::Description) -> CResult_DescriptionCreationErrorZ {
5896         CResult_DescriptionCreationErrorZ {
5897                 contents: CResult_DescriptionCreationErrorZPtr {
5898                         result: Box::into_raw(Box::new(o)),
5899                 },
5900                 result_ok: true,
5901         }
5902 }
5903 #[no_mangle]
5904 /// Creates a new CResult_DescriptionCreationErrorZ in the error state.
5905 pub extern "C" fn CResult_DescriptionCreationErrorZ_err(e: crate::lightning_invoice::CreationError) -> CResult_DescriptionCreationErrorZ {
5906         CResult_DescriptionCreationErrorZ {
5907                 contents: CResult_DescriptionCreationErrorZPtr {
5908                         err: Box::into_raw(Box::new(e)),
5909                 },
5910                 result_ok: false,
5911         }
5912 }
5913 #[no_mangle]
5914 /// Frees any resources used by the CResult_DescriptionCreationErrorZ.
5915 pub extern "C" fn CResult_DescriptionCreationErrorZ_free(_res: CResult_DescriptionCreationErrorZ) { }
5916 impl Drop for CResult_DescriptionCreationErrorZ {
5917         fn drop(&mut self) {
5918                 if self.result_ok {
5919                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
5920                                 let _ = unsafe { Box::from_raw(self.contents.result) };
5921                         }
5922                 } else {
5923                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
5924                                 let _ = unsafe { Box::from_raw(self.contents.err) };
5925                         }
5926                 }
5927         }
5928 }
5929 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::Description, crate::lightning_invoice::CreationError>> for CResult_DescriptionCreationErrorZ {
5930         fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::Description, crate::lightning_invoice::CreationError>) -> Self {
5931                 let contents = if o.result_ok {
5932                         let result = unsafe { o.contents.result };
5933                         unsafe { o.contents.result = std::ptr::null_mut() };
5934                         CResult_DescriptionCreationErrorZPtr { result }
5935                 } else {
5936                         let err = unsafe { o.contents.err };
5937                         unsafe { o.contents.err = std::ptr::null_mut(); }
5938                         CResult_DescriptionCreationErrorZPtr { err }
5939                 };
5940                 Self {
5941                         contents,
5942                         result_ok: o.result_ok,
5943                 }
5944         }
5945 }
5946 impl Clone for CResult_DescriptionCreationErrorZ {
5947         fn clone(&self) -> Self {
5948                 if self.result_ok {
5949                         Self { result_ok: true, contents: CResult_DescriptionCreationErrorZPtr {
5950                                 result: Box::into_raw(Box::new(<crate::lightning_invoice::Description>::clone(unsafe { &*self.contents.result })))
5951                         } }
5952                 } else {
5953                         Self { result_ok: false, contents: CResult_DescriptionCreationErrorZPtr {
5954                                 err: Box::into_raw(Box::new(<crate::lightning_invoice::CreationError>::clone(unsafe { &*self.contents.err })))
5955                         } }
5956                 }
5957         }
5958 }
5959 #[no_mangle]
5960 /// Creates a new CResult_DescriptionCreationErrorZ which has the same data as `orig`
5961 /// but with all dynamically-allocated buffers duplicated in new buffers.
5962 pub extern "C" fn CResult_DescriptionCreationErrorZ_clone(orig: &CResult_DescriptionCreationErrorZ) -> CResult_DescriptionCreationErrorZ { Clone::clone(&orig) }
5963 #[repr(C)]
5964 /// The contents of CResult_ExpiryTimeCreationErrorZ
5965 pub union CResult_ExpiryTimeCreationErrorZPtr {
5966         /// A pointer to the contents in the success state.
5967         /// Reading from this pointer when `result_ok` is not set is undefined.
5968         pub result: *mut crate::lightning_invoice::ExpiryTime,
5969         /// A pointer to the contents in the error state.
5970         /// Reading from this pointer when `result_ok` is set is undefined.
5971         pub err: *mut crate::lightning_invoice::CreationError,
5972 }
5973 #[repr(C)]
5974 /// A CResult_ExpiryTimeCreationErrorZ represents the result of a fallible operation,
5975 /// containing a crate::lightning_invoice::ExpiryTime on success and a crate::lightning_invoice::CreationError on failure.
5976 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5977 pub struct CResult_ExpiryTimeCreationErrorZ {
5978         /// The contents of this CResult_ExpiryTimeCreationErrorZ, accessible via either
5979         /// `err` or `result` depending on the state of `result_ok`.
5980         pub contents: CResult_ExpiryTimeCreationErrorZPtr,
5981         /// Whether this CResult_ExpiryTimeCreationErrorZ represents a success state.
5982         pub result_ok: bool,
5983 }
5984 #[no_mangle]
5985 /// Creates a new CResult_ExpiryTimeCreationErrorZ in the success state.
5986 pub extern "C" fn CResult_ExpiryTimeCreationErrorZ_ok(o: crate::lightning_invoice::ExpiryTime) -> CResult_ExpiryTimeCreationErrorZ {
5987         CResult_ExpiryTimeCreationErrorZ {
5988                 contents: CResult_ExpiryTimeCreationErrorZPtr {
5989                         result: Box::into_raw(Box::new(o)),
5990                 },
5991                 result_ok: true,
5992         }
5993 }
5994 #[no_mangle]
5995 /// Creates a new CResult_ExpiryTimeCreationErrorZ in the error state.
5996 pub extern "C" fn CResult_ExpiryTimeCreationErrorZ_err(e: crate::lightning_invoice::CreationError) -> CResult_ExpiryTimeCreationErrorZ {
5997         CResult_ExpiryTimeCreationErrorZ {
5998                 contents: CResult_ExpiryTimeCreationErrorZPtr {
5999                         err: Box::into_raw(Box::new(e)),
6000                 },
6001                 result_ok: false,
6002         }
6003 }
6004 #[no_mangle]
6005 /// Frees any resources used by the CResult_ExpiryTimeCreationErrorZ.
6006 pub extern "C" fn CResult_ExpiryTimeCreationErrorZ_free(_res: CResult_ExpiryTimeCreationErrorZ) { }
6007 impl Drop for CResult_ExpiryTimeCreationErrorZ {
6008         fn drop(&mut self) {
6009                 if self.result_ok {
6010                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
6011                                 let _ = unsafe { Box::from_raw(self.contents.result) };
6012                         }
6013                 } else {
6014                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
6015                                 let _ = unsafe { Box::from_raw(self.contents.err) };
6016                         }
6017                 }
6018         }
6019 }
6020 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::ExpiryTime, crate::lightning_invoice::CreationError>> for CResult_ExpiryTimeCreationErrorZ {
6021         fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::ExpiryTime, crate::lightning_invoice::CreationError>) -> Self {
6022                 let contents = if o.result_ok {
6023                         let result = unsafe { o.contents.result };
6024                         unsafe { o.contents.result = std::ptr::null_mut() };
6025                         CResult_ExpiryTimeCreationErrorZPtr { result }
6026                 } else {
6027                         let err = unsafe { o.contents.err };
6028                         unsafe { o.contents.err = std::ptr::null_mut(); }
6029                         CResult_ExpiryTimeCreationErrorZPtr { err }
6030                 };
6031                 Self {
6032                         contents,
6033                         result_ok: o.result_ok,
6034                 }
6035         }
6036 }
6037 impl Clone for CResult_ExpiryTimeCreationErrorZ {
6038         fn clone(&self) -> Self {
6039                 if self.result_ok {
6040                         Self { result_ok: true, contents: CResult_ExpiryTimeCreationErrorZPtr {
6041                                 result: Box::into_raw(Box::new(<crate::lightning_invoice::ExpiryTime>::clone(unsafe { &*self.contents.result })))
6042                         } }
6043                 } else {
6044                         Self { result_ok: false, contents: CResult_ExpiryTimeCreationErrorZPtr {
6045                                 err: Box::into_raw(Box::new(<crate::lightning_invoice::CreationError>::clone(unsafe { &*self.contents.err })))
6046                         } }
6047                 }
6048         }
6049 }
6050 #[no_mangle]
6051 /// Creates a new CResult_ExpiryTimeCreationErrorZ which has the same data as `orig`
6052 /// but with all dynamically-allocated buffers duplicated in new buffers.
6053 pub extern "C" fn CResult_ExpiryTimeCreationErrorZ_clone(orig: &CResult_ExpiryTimeCreationErrorZ) -> CResult_ExpiryTimeCreationErrorZ { Clone::clone(&orig) }
6054 #[repr(C)]
6055 /// The contents of CResult_PrivateRouteCreationErrorZ
6056 pub union CResult_PrivateRouteCreationErrorZPtr {
6057         /// A pointer to the contents in the success state.
6058         /// Reading from this pointer when `result_ok` is not set is undefined.
6059         pub result: *mut crate::lightning_invoice::PrivateRoute,
6060         /// A pointer to the contents in the error state.
6061         /// Reading from this pointer when `result_ok` is set is undefined.
6062         pub err: *mut crate::lightning_invoice::CreationError,
6063 }
6064 #[repr(C)]
6065 /// A CResult_PrivateRouteCreationErrorZ represents the result of a fallible operation,
6066 /// containing a crate::lightning_invoice::PrivateRoute on success and a crate::lightning_invoice::CreationError on failure.
6067 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6068 pub struct CResult_PrivateRouteCreationErrorZ {
6069         /// The contents of this CResult_PrivateRouteCreationErrorZ, accessible via either
6070         /// `err` or `result` depending on the state of `result_ok`.
6071         pub contents: CResult_PrivateRouteCreationErrorZPtr,
6072         /// Whether this CResult_PrivateRouteCreationErrorZ represents a success state.
6073         pub result_ok: bool,
6074 }
6075 #[no_mangle]
6076 /// Creates a new CResult_PrivateRouteCreationErrorZ in the success state.
6077 pub extern "C" fn CResult_PrivateRouteCreationErrorZ_ok(o: crate::lightning_invoice::PrivateRoute) -> CResult_PrivateRouteCreationErrorZ {
6078         CResult_PrivateRouteCreationErrorZ {
6079                 contents: CResult_PrivateRouteCreationErrorZPtr {
6080                         result: Box::into_raw(Box::new(o)),
6081                 },
6082                 result_ok: true,
6083         }
6084 }
6085 #[no_mangle]
6086 /// Creates a new CResult_PrivateRouteCreationErrorZ in the error state.
6087 pub extern "C" fn CResult_PrivateRouteCreationErrorZ_err(e: crate::lightning_invoice::CreationError) -> CResult_PrivateRouteCreationErrorZ {
6088         CResult_PrivateRouteCreationErrorZ {
6089                 contents: CResult_PrivateRouteCreationErrorZPtr {
6090                         err: Box::into_raw(Box::new(e)),
6091                 },
6092                 result_ok: false,
6093         }
6094 }
6095 #[no_mangle]
6096 /// Frees any resources used by the CResult_PrivateRouteCreationErrorZ.
6097 pub extern "C" fn CResult_PrivateRouteCreationErrorZ_free(_res: CResult_PrivateRouteCreationErrorZ) { }
6098 impl Drop for CResult_PrivateRouteCreationErrorZ {
6099         fn drop(&mut self) {
6100                 if self.result_ok {
6101                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
6102                                 let _ = unsafe { Box::from_raw(self.contents.result) };
6103                         }
6104                 } else {
6105                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
6106                                 let _ = unsafe { Box::from_raw(self.contents.err) };
6107                         }
6108                 }
6109         }
6110 }
6111 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::PrivateRoute, crate::lightning_invoice::CreationError>> for CResult_PrivateRouteCreationErrorZ {
6112         fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::PrivateRoute, crate::lightning_invoice::CreationError>) -> Self {
6113                 let contents = if o.result_ok {
6114                         let result = unsafe { o.contents.result };
6115                         unsafe { o.contents.result = std::ptr::null_mut() };
6116                         CResult_PrivateRouteCreationErrorZPtr { result }
6117                 } else {
6118                         let err = unsafe { o.contents.err };
6119                         unsafe { o.contents.err = std::ptr::null_mut(); }
6120                         CResult_PrivateRouteCreationErrorZPtr { err }
6121                 };
6122                 Self {
6123                         contents,
6124                         result_ok: o.result_ok,
6125                 }
6126         }
6127 }
6128 impl Clone for CResult_PrivateRouteCreationErrorZ {
6129         fn clone(&self) -> Self {
6130                 if self.result_ok {
6131                         Self { result_ok: true, contents: CResult_PrivateRouteCreationErrorZPtr {
6132                                 result: Box::into_raw(Box::new(<crate::lightning_invoice::PrivateRoute>::clone(unsafe { &*self.contents.result })))
6133                         } }
6134                 } else {
6135                         Self { result_ok: false, contents: CResult_PrivateRouteCreationErrorZPtr {
6136                                 err: Box::into_raw(Box::new(<crate::lightning_invoice::CreationError>::clone(unsafe { &*self.contents.err })))
6137                         } }
6138                 }
6139         }
6140 }
6141 #[no_mangle]
6142 /// Creates a new CResult_PrivateRouteCreationErrorZ which has the same data as `orig`
6143 /// but with all dynamically-allocated buffers duplicated in new buffers.
6144 pub extern "C" fn CResult_PrivateRouteCreationErrorZ_clone(orig: &CResult_PrivateRouteCreationErrorZ) -> CResult_PrivateRouteCreationErrorZ { Clone::clone(&orig) }
6145 #[repr(C)]
6146 /// The contents of CResult_StringErrorZ
6147 pub union CResult_StringErrorZPtr {
6148         /// A pointer to the contents in the success state.
6149         /// Reading from this pointer when `result_ok` is not set is undefined.
6150         pub result: *mut crate::c_types::Str,
6151         /// A pointer to the contents in the error state.
6152         /// Reading from this pointer when `result_ok` is set is undefined.
6153         pub err: *mut crate::c_types::Secp256k1Error,
6154 }
6155 #[repr(C)]
6156 /// A CResult_StringErrorZ represents the result of a fallible operation,
6157 /// containing a crate::c_types::Str on success and a crate::c_types::Secp256k1Error on failure.
6158 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6159 pub struct CResult_StringErrorZ {
6160         /// The contents of this CResult_StringErrorZ, accessible via either
6161         /// `err` or `result` depending on the state of `result_ok`.
6162         pub contents: CResult_StringErrorZPtr,
6163         /// Whether this CResult_StringErrorZ represents a success state.
6164         pub result_ok: bool,
6165 }
6166 #[no_mangle]
6167 /// Creates a new CResult_StringErrorZ in the success state.
6168 pub extern "C" fn CResult_StringErrorZ_ok(o: crate::c_types::Str) -> CResult_StringErrorZ {
6169         CResult_StringErrorZ {
6170                 contents: CResult_StringErrorZPtr {
6171                         result: Box::into_raw(Box::new(o)),
6172                 },
6173                 result_ok: true,
6174         }
6175 }
6176 #[no_mangle]
6177 /// Creates a new CResult_StringErrorZ in the error state.
6178 pub extern "C" fn CResult_StringErrorZ_err(e: crate::c_types::Secp256k1Error) -> CResult_StringErrorZ {
6179         CResult_StringErrorZ {
6180                 contents: CResult_StringErrorZPtr {
6181                         err: Box::into_raw(Box::new(e)),
6182                 },
6183                 result_ok: false,
6184         }
6185 }
6186 #[no_mangle]
6187 /// Frees any resources used by the CResult_StringErrorZ.
6188 pub extern "C" fn CResult_StringErrorZ_free(_res: CResult_StringErrorZ) { }
6189 impl Drop for CResult_StringErrorZ {
6190         fn drop(&mut self) {
6191                 if self.result_ok {
6192                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
6193                                 let _ = unsafe { Box::from_raw(self.contents.result) };
6194                         }
6195                 } else {
6196                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
6197                                 let _ = unsafe { Box::from_raw(self.contents.err) };
6198                         }
6199                 }
6200         }
6201 }
6202 impl From<crate::c_types::CResultTempl<crate::c_types::Str, crate::c_types::Secp256k1Error>> for CResult_StringErrorZ {
6203         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::Str, crate::c_types::Secp256k1Error>) -> Self {
6204                 let contents = if o.result_ok {
6205                         let result = unsafe { o.contents.result };
6206                         unsafe { o.contents.result = std::ptr::null_mut() };
6207                         CResult_StringErrorZPtr { result }
6208                 } else {
6209                         let err = unsafe { o.contents.err };
6210                         unsafe { o.contents.err = std::ptr::null_mut(); }
6211                         CResult_StringErrorZPtr { err }
6212                 };
6213                 Self {
6214                         contents,
6215                         result_ok: o.result_ok,
6216                 }
6217         }
6218 }
6219 #[repr(C)]
6220 /// The contents of CResult_ChannelMonitorUpdateDecodeErrorZ
6221 pub union CResult_ChannelMonitorUpdateDecodeErrorZPtr {
6222         /// A pointer to the contents in the success state.
6223         /// Reading from this pointer when `result_ok` is not set is undefined.
6224         pub result: *mut crate::lightning::chain::channelmonitor::ChannelMonitorUpdate,
6225         /// A pointer to the contents in the error state.
6226         /// Reading from this pointer when `result_ok` is set is undefined.
6227         pub err: *mut crate::lightning::ln::msgs::DecodeError,
6228 }
6229 #[repr(C)]
6230 /// A CResult_ChannelMonitorUpdateDecodeErrorZ represents the result of a fallible operation,
6231 /// containing a crate::lightning::chain::channelmonitor::ChannelMonitorUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
6232 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6233 pub struct CResult_ChannelMonitorUpdateDecodeErrorZ {
6234         /// The contents of this CResult_ChannelMonitorUpdateDecodeErrorZ, accessible via either
6235         /// `err` or `result` depending on the state of `result_ok`.
6236         pub contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr,
6237         /// Whether this CResult_ChannelMonitorUpdateDecodeErrorZ represents a success state.
6238         pub result_ok: bool,
6239 }
6240 #[no_mangle]
6241 /// Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ in the success state.
6242 pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_ok(o: crate::lightning::chain::channelmonitor::ChannelMonitorUpdate) -> CResult_ChannelMonitorUpdateDecodeErrorZ {
6243         CResult_ChannelMonitorUpdateDecodeErrorZ {
6244                 contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr {
6245                         result: Box::into_raw(Box::new(o)),
6246                 },
6247                 result_ok: true,
6248         }
6249 }
6250 #[no_mangle]
6251 /// Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ in the error state.
6252 pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelMonitorUpdateDecodeErrorZ {
6253         CResult_ChannelMonitorUpdateDecodeErrorZ {
6254                 contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr {
6255                         err: Box::into_raw(Box::new(e)),
6256                 },
6257                 result_ok: false,
6258         }
6259 }
6260 #[no_mangle]
6261 /// Frees any resources used by the CResult_ChannelMonitorUpdateDecodeErrorZ.
6262 pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_free(_res: CResult_ChannelMonitorUpdateDecodeErrorZ) { }
6263 impl Drop for CResult_ChannelMonitorUpdateDecodeErrorZ {
6264         fn drop(&mut self) {
6265                 if self.result_ok {
6266                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
6267                                 let _ = unsafe { Box::from_raw(self.contents.result) };
6268                         }
6269                 } else {
6270                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
6271                                 let _ = unsafe { Box::from_raw(self.contents.err) };
6272                         }
6273                 }
6274         }
6275 }
6276 impl From<crate::c_types::CResultTempl<crate::lightning::chain::channelmonitor::ChannelMonitorUpdate, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelMonitorUpdateDecodeErrorZ {
6277         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::channelmonitor::ChannelMonitorUpdate, crate::lightning::ln::msgs::DecodeError>) -> Self {
6278                 let contents = if o.result_ok {
6279                         let result = unsafe { o.contents.result };
6280                         unsafe { o.contents.result = std::ptr::null_mut() };
6281                         CResult_ChannelMonitorUpdateDecodeErrorZPtr { result }
6282                 } else {
6283                         let err = unsafe { o.contents.err };
6284                         unsafe { o.contents.err = std::ptr::null_mut(); }
6285                         CResult_ChannelMonitorUpdateDecodeErrorZPtr { err }
6286                 };
6287                 Self {
6288                         contents,
6289                         result_ok: o.result_ok,
6290                 }
6291         }
6292 }
6293 impl Clone for CResult_ChannelMonitorUpdateDecodeErrorZ {
6294         fn clone(&self) -> Self {
6295                 if self.result_ok {
6296                         Self { result_ok: true, contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr {
6297                                 result: Box::into_raw(Box::new(<crate::lightning::chain::channelmonitor::ChannelMonitorUpdate>::clone(unsafe { &*self.contents.result })))
6298                         } }
6299                 } else {
6300                         Self { result_ok: false, contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr {
6301                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
6302                         } }
6303                 }
6304         }
6305 }
6306 #[no_mangle]
6307 /// Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ which has the same data as `orig`
6308 /// but with all dynamically-allocated buffers duplicated in new buffers.
6309 pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_clone(orig: &CResult_ChannelMonitorUpdateDecodeErrorZ) -> CResult_ChannelMonitorUpdateDecodeErrorZ { Clone::clone(&orig) }
6310 #[repr(C)]
6311 /// The contents of CResult_HTLCUpdateDecodeErrorZ
6312 pub union CResult_HTLCUpdateDecodeErrorZPtr {
6313         /// A pointer to the contents in the success state.
6314         /// Reading from this pointer when `result_ok` is not set is undefined.
6315         pub result: *mut crate::lightning::chain::channelmonitor::HTLCUpdate,
6316         /// A pointer to the contents in the error state.
6317         /// Reading from this pointer when `result_ok` is set is undefined.
6318         pub err: *mut crate::lightning::ln::msgs::DecodeError,
6319 }
6320 #[repr(C)]
6321 /// A CResult_HTLCUpdateDecodeErrorZ represents the result of a fallible operation,
6322 /// containing a crate::lightning::chain::channelmonitor::HTLCUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
6323 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6324 pub struct CResult_HTLCUpdateDecodeErrorZ {
6325         /// The contents of this CResult_HTLCUpdateDecodeErrorZ, accessible via either
6326         /// `err` or `result` depending on the state of `result_ok`.
6327         pub contents: CResult_HTLCUpdateDecodeErrorZPtr,
6328         /// Whether this CResult_HTLCUpdateDecodeErrorZ represents a success state.
6329         pub result_ok: bool,
6330 }
6331 #[no_mangle]
6332 /// Creates a new CResult_HTLCUpdateDecodeErrorZ in the success state.
6333 pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_ok(o: crate::lightning::chain::channelmonitor::HTLCUpdate) -> CResult_HTLCUpdateDecodeErrorZ {
6334         CResult_HTLCUpdateDecodeErrorZ {
6335                 contents: CResult_HTLCUpdateDecodeErrorZPtr {
6336                         result: Box::into_raw(Box::new(o)),
6337                 },
6338                 result_ok: true,
6339         }
6340 }
6341 #[no_mangle]
6342 /// Creates a new CResult_HTLCUpdateDecodeErrorZ in the error state.
6343 pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_HTLCUpdateDecodeErrorZ {
6344         CResult_HTLCUpdateDecodeErrorZ {
6345                 contents: CResult_HTLCUpdateDecodeErrorZPtr {
6346                         err: Box::into_raw(Box::new(e)),
6347                 },
6348                 result_ok: false,
6349         }
6350 }
6351 #[no_mangle]
6352 /// Frees any resources used by the CResult_HTLCUpdateDecodeErrorZ.
6353 pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_free(_res: CResult_HTLCUpdateDecodeErrorZ) { }
6354 impl Drop for CResult_HTLCUpdateDecodeErrorZ {
6355         fn drop(&mut self) {
6356                 if self.result_ok {
6357                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
6358                                 let _ = unsafe { Box::from_raw(self.contents.result) };
6359                         }
6360                 } else {
6361                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
6362                                 let _ = unsafe { Box::from_raw(self.contents.err) };
6363                         }
6364                 }
6365         }
6366 }
6367 impl From<crate::c_types::CResultTempl<crate::lightning::chain::channelmonitor::HTLCUpdate, crate::lightning::ln::msgs::DecodeError>> for CResult_HTLCUpdateDecodeErrorZ {
6368         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::channelmonitor::HTLCUpdate, crate::lightning::ln::msgs::DecodeError>) -> Self {
6369                 let contents = if o.result_ok {
6370                         let result = unsafe { o.contents.result };
6371                         unsafe { o.contents.result = std::ptr::null_mut() };
6372                         CResult_HTLCUpdateDecodeErrorZPtr { result }
6373                 } else {
6374                         let err = unsafe { o.contents.err };
6375                         unsafe { o.contents.err = std::ptr::null_mut(); }
6376                         CResult_HTLCUpdateDecodeErrorZPtr { err }
6377                 };
6378                 Self {
6379                         contents,
6380                         result_ok: o.result_ok,
6381                 }
6382         }
6383 }
6384 impl Clone for CResult_HTLCUpdateDecodeErrorZ {
6385         fn clone(&self) -> Self {
6386                 if self.result_ok {
6387                         Self { result_ok: true, contents: CResult_HTLCUpdateDecodeErrorZPtr {
6388                                 result: Box::into_raw(Box::new(<crate::lightning::chain::channelmonitor::HTLCUpdate>::clone(unsafe { &*self.contents.result })))
6389                         } }
6390                 } else {
6391                         Self { result_ok: false, contents: CResult_HTLCUpdateDecodeErrorZPtr {
6392                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
6393                         } }
6394                 }
6395         }
6396 }
6397 #[no_mangle]
6398 /// Creates a new CResult_HTLCUpdateDecodeErrorZ which has the same data as `orig`
6399 /// but with all dynamically-allocated buffers duplicated in new buffers.
6400 pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_clone(orig: &CResult_HTLCUpdateDecodeErrorZ) -> CResult_HTLCUpdateDecodeErrorZ { Clone::clone(&orig) }
6401 #[repr(C)]
6402 /// The contents of CResult_NoneMonitorUpdateErrorZ
6403 pub union CResult_NoneMonitorUpdateErrorZPtr {
6404         /// Note that this value is always NULL, as there are no contents in the OK variant
6405         pub result: *mut std::ffi::c_void,
6406         /// A pointer to the contents in the error state.
6407         /// Reading from this pointer when `result_ok` is set is undefined.
6408         pub err: *mut crate::lightning::chain::channelmonitor::MonitorUpdateError,
6409 }
6410 #[repr(C)]
6411 /// A CResult_NoneMonitorUpdateErrorZ represents the result of a fallible operation,
6412 /// containing a () on success and a crate::lightning::chain::channelmonitor::MonitorUpdateError on failure.
6413 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6414 pub struct CResult_NoneMonitorUpdateErrorZ {
6415         /// The contents of this CResult_NoneMonitorUpdateErrorZ, accessible via either
6416         /// `err` or `result` depending on the state of `result_ok`.
6417         pub contents: CResult_NoneMonitorUpdateErrorZPtr,
6418         /// Whether this CResult_NoneMonitorUpdateErrorZ represents a success state.
6419         pub result_ok: bool,
6420 }
6421 #[no_mangle]
6422 /// Creates a new CResult_NoneMonitorUpdateErrorZ in the success state.
6423 pub extern "C" fn CResult_NoneMonitorUpdateErrorZ_ok() -> CResult_NoneMonitorUpdateErrorZ {
6424         CResult_NoneMonitorUpdateErrorZ {
6425                 contents: CResult_NoneMonitorUpdateErrorZPtr {
6426                         result: std::ptr::null_mut(),
6427                 },
6428                 result_ok: true,
6429         }
6430 }
6431 #[no_mangle]
6432 /// Creates a new CResult_NoneMonitorUpdateErrorZ in the error state.
6433 pub extern "C" fn CResult_NoneMonitorUpdateErrorZ_err(e: crate::lightning::chain::channelmonitor::MonitorUpdateError) -> CResult_NoneMonitorUpdateErrorZ {
6434         CResult_NoneMonitorUpdateErrorZ {
6435                 contents: CResult_NoneMonitorUpdateErrorZPtr {
6436                         err: Box::into_raw(Box::new(e)),
6437                 },
6438                 result_ok: false,
6439         }
6440 }
6441 #[no_mangle]
6442 /// Frees any resources used by the CResult_NoneMonitorUpdateErrorZ.
6443 pub extern "C" fn CResult_NoneMonitorUpdateErrorZ_free(_res: CResult_NoneMonitorUpdateErrorZ) { }
6444 impl Drop for CResult_NoneMonitorUpdateErrorZ {
6445         fn drop(&mut self) {
6446                 if self.result_ok {
6447                 } else {
6448                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
6449                                 let _ = unsafe { Box::from_raw(self.contents.err) };
6450                         }
6451                 }
6452         }
6453 }
6454 impl From<crate::c_types::CResultTempl<(), crate::lightning::chain::channelmonitor::MonitorUpdateError>> for CResult_NoneMonitorUpdateErrorZ {
6455         fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::chain::channelmonitor::MonitorUpdateError>) -> Self {
6456                 let contents = if o.result_ok {
6457                         let _ = unsafe { Box::from_raw(o.contents.result) };
6458                         o.contents.result = std::ptr::null_mut();
6459                         CResult_NoneMonitorUpdateErrorZPtr { result: std::ptr::null_mut() }
6460                 } else {
6461                         let err = unsafe { o.contents.err };
6462                         unsafe { o.contents.err = std::ptr::null_mut(); }
6463                         CResult_NoneMonitorUpdateErrorZPtr { err }
6464                 };
6465                 Self {
6466                         contents,
6467                         result_ok: o.result_ok,
6468                 }
6469         }
6470 }
6471 impl Clone for CResult_NoneMonitorUpdateErrorZ {
6472         fn clone(&self) -> Self {
6473                 if self.result_ok {
6474                         Self { result_ok: true, contents: CResult_NoneMonitorUpdateErrorZPtr {
6475                                 result: std::ptr::null_mut()
6476                         } }
6477                 } else {
6478                         Self { result_ok: false, contents: CResult_NoneMonitorUpdateErrorZPtr {
6479                                 err: Box::into_raw(Box::new(<crate::lightning::chain::channelmonitor::MonitorUpdateError>::clone(unsafe { &*self.contents.err })))
6480                         } }
6481                 }
6482         }
6483 }
6484 #[no_mangle]
6485 /// Creates a new CResult_NoneMonitorUpdateErrorZ which has the same data as `orig`
6486 /// but with all dynamically-allocated buffers duplicated in new buffers.
6487 pub extern "C" fn CResult_NoneMonitorUpdateErrorZ_clone(orig: &CResult_NoneMonitorUpdateErrorZ) -> CResult_NoneMonitorUpdateErrorZ { Clone::clone(&orig) }
6488 #[repr(C)]
6489 /// A tuple of 2 elements. See the individual fields for the types contained.
6490 pub struct C2Tuple_OutPointScriptZ {
6491         /// The element at position 0
6492         pub a: crate::lightning::chain::transaction::OutPoint,
6493         /// The element at position 1
6494         pub b: crate::c_types::derived::CVec_u8Z,
6495 }
6496 impl From<(crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_u8Z)> for C2Tuple_OutPointScriptZ {
6497         fn from (tup: (crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_u8Z)) -> Self {
6498                 Self {
6499                         a: tup.0,
6500                         b: tup.1,
6501                 }
6502         }
6503 }
6504 impl C2Tuple_OutPointScriptZ {
6505         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_u8Z) {
6506                 (self.a, self.b)
6507         }
6508 }
6509 impl Clone for C2Tuple_OutPointScriptZ {
6510         fn clone(&self) -> Self {
6511                 Self {
6512                         a: Clone::clone(&self.a),
6513                         b: Clone::clone(&self.b),
6514                 }
6515         }
6516 }
6517 #[no_mangle]
6518 /// Creates a new tuple which has the same data as `orig`
6519 /// but with all dynamically-allocated buffers duplicated in new buffers.
6520 pub extern "C" fn C2Tuple_OutPointScriptZ_clone(orig: &C2Tuple_OutPointScriptZ) -> C2Tuple_OutPointScriptZ { Clone::clone(&orig) }
6521 /// Creates a new C2Tuple_OutPointScriptZ from the contained elements.
6522 #[no_mangle]
6523 pub extern "C" fn C2Tuple_OutPointScriptZ_new(a: crate::lightning::chain::transaction::OutPoint, b: crate::c_types::derived::CVec_u8Z) -> C2Tuple_OutPointScriptZ {
6524         C2Tuple_OutPointScriptZ { a, b, }
6525 }
6526
6527 #[no_mangle]
6528 /// Frees any resources used by the C2Tuple_OutPointScriptZ.
6529 pub extern "C" fn C2Tuple_OutPointScriptZ_free(_res: C2Tuple_OutPointScriptZ) { }
6530 #[repr(C)]
6531 /// A tuple of 2 elements. See the individual fields for the types contained.
6532 pub struct C2Tuple_u32ScriptZ {
6533         /// The element at position 0
6534         pub a: u32,
6535         /// The element at position 1
6536         pub b: crate::c_types::derived::CVec_u8Z,
6537 }
6538 impl From<(u32, crate::c_types::derived::CVec_u8Z)> for C2Tuple_u32ScriptZ {
6539         fn from (tup: (u32, crate::c_types::derived::CVec_u8Z)) -> Self {
6540                 Self {
6541                         a: tup.0,
6542                         b: tup.1,
6543                 }
6544         }
6545 }
6546 impl C2Tuple_u32ScriptZ {
6547         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (u32, crate::c_types::derived::CVec_u8Z) {
6548                 (self.a, self.b)
6549         }
6550 }
6551 impl Clone for C2Tuple_u32ScriptZ {
6552         fn clone(&self) -> Self {
6553                 Self {
6554                         a: Clone::clone(&self.a),
6555                         b: Clone::clone(&self.b),
6556                 }
6557         }
6558 }
6559 #[no_mangle]
6560 /// Creates a new tuple which has the same data as `orig`
6561 /// but with all dynamically-allocated buffers duplicated in new buffers.
6562 pub extern "C" fn C2Tuple_u32ScriptZ_clone(orig: &C2Tuple_u32ScriptZ) -> C2Tuple_u32ScriptZ { Clone::clone(&orig) }
6563 /// Creates a new C2Tuple_u32ScriptZ from the contained elements.
6564 #[no_mangle]
6565 pub extern "C" fn C2Tuple_u32ScriptZ_new(a: u32, b: crate::c_types::derived::CVec_u8Z) -> C2Tuple_u32ScriptZ {
6566         C2Tuple_u32ScriptZ { a, b, }
6567 }
6568
6569 #[no_mangle]
6570 /// Frees any resources used by the C2Tuple_u32ScriptZ.
6571 pub extern "C" fn C2Tuple_u32ScriptZ_free(_res: C2Tuple_u32ScriptZ) { }
6572 #[repr(C)]
6573 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_u32ScriptZs of arbitrary size.
6574 /// This corresponds to std::vector in C++
6575 pub struct CVec_C2Tuple_u32ScriptZZ {
6576         /// The elements in the array.
6577         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
6578         pub data: *mut crate::c_types::derived::C2Tuple_u32ScriptZ,
6579         /// The number of elements pointed to by `data`.
6580         pub datalen: usize
6581 }
6582 impl CVec_C2Tuple_u32ScriptZZ {
6583         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_u32ScriptZ> {
6584                 if self.datalen == 0 { return Vec::new(); }
6585                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
6586                 self.data = std::ptr::null_mut();
6587                 self.datalen = 0;
6588                 ret
6589         }
6590         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_u32ScriptZ] {
6591                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
6592         }
6593 }
6594 impl From<Vec<crate::c_types::derived::C2Tuple_u32ScriptZ>> for CVec_C2Tuple_u32ScriptZZ {
6595         fn from(v: Vec<crate::c_types::derived::C2Tuple_u32ScriptZ>) -> Self {
6596                 let datalen = v.len();
6597                 let data = Box::into_raw(v.into_boxed_slice());
6598                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
6599         }
6600 }
6601 #[no_mangle]
6602 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
6603 pub extern "C" fn CVec_C2Tuple_u32ScriptZZ_free(_res: CVec_C2Tuple_u32ScriptZZ) { }
6604 impl Drop for CVec_C2Tuple_u32ScriptZZ {
6605         fn drop(&mut self) {
6606                 if self.datalen == 0 { return; }
6607                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
6608         }
6609 }
6610 impl Clone for CVec_C2Tuple_u32ScriptZZ {
6611         fn clone(&self) -> Self {
6612                 let mut res = Vec::new();
6613                 if self.datalen == 0 { return Self::from(res); }
6614                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
6615                 Self::from(res)
6616         }
6617 }
6618 #[repr(C)]
6619 /// A tuple of 2 elements. See the individual fields for the types contained.
6620 pub struct C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ {
6621         /// The element at position 0
6622         pub a: crate::c_types::ThirtyTwoBytes,
6623         /// The element at position 1
6624         pub b: crate::c_types::derived::CVec_C2Tuple_u32ScriptZZ,
6625 }
6626 impl From<(crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32ScriptZZ)> for C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ {
6627         fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32ScriptZZ)) -> Self {
6628                 Self {
6629                         a: tup.0,
6630                         b: tup.1,
6631                 }
6632         }
6633 }
6634 impl C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ {
6635         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32ScriptZZ) {
6636                 (self.a, self.b)
6637         }
6638 }
6639 impl Clone for C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ {
6640         fn clone(&self) -> Self {
6641                 Self {
6642                         a: Clone::clone(&self.a),
6643                         b: Clone::clone(&self.b),
6644                 }
6645         }
6646 }
6647 #[no_mangle]
6648 /// Creates a new tuple which has the same data as `orig`
6649 /// but with all dynamically-allocated buffers duplicated in new buffers.
6650 pub extern "C" fn C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone(orig: &C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ) -> C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ { Clone::clone(&orig) }
6651 /// Creates a new C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ from the contained elements.
6652 #[no_mangle]
6653 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 {
6654         C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ { a, b, }
6655 }
6656
6657 #[no_mangle]
6658 /// Frees any resources used by the C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ.
6659 pub extern "C" fn C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_free(_res: C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ) { }
6660 #[repr(C)]
6661 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZs of arbitrary size.
6662 /// This corresponds to std::vector in C++
6663 pub struct CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ {
6664         /// The elements in the array.
6665         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
6666         pub data: *mut crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ,
6667         /// The number of elements pointed to by `data`.
6668         pub datalen: usize
6669 }
6670 impl CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ {
6671         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ> {
6672                 if self.datalen == 0 { return Vec::new(); }
6673                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
6674                 self.data = std::ptr::null_mut();
6675                 self.datalen = 0;
6676                 ret
6677         }
6678         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ] {
6679                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
6680         }
6681 }
6682 impl From<Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ>> for CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ {
6683         fn from(v: Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ>) -> Self {
6684                 let datalen = v.len();
6685                 let data = Box::into_raw(v.into_boxed_slice());
6686                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
6687         }
6688 }
6689 #[no_mangle]
6690 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
6691 pub extern "C" fn CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ_free(_res: CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ) { }
6692 impl Drop for CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ {
6693         fn drop(&mut self) {
6694                 if self.datalen == 0 { return; }
6695                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
6696         }
6697 }
6698 impl Clone for CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ {
6699         fn clone(&self) -> Self {
6700                 let mut res = Vec::new();
6701                 if self.datalen == 0 { return Self::from(res); }
6702                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
6703                 Self::from(res)
6704         }
6705 }
6706 #[repr(C)]
6707 /// A dynamically-allocated array of crate::lightning::util::events::Events of arbitrary size.
6708 /// This corresponds to std::vector in C++
6709 pub struct CVec_EventZ {
6710         /// The elements in the array.
6711         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
6712         pub data: *mut crate::lightning::util::events::Event,
6713         /// The number of elements pointed to by `data`.
6714         pub datalen: usize
6715 }
6716 impl CVec_EventZ {
6717         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::util::events::Event> {
6718                 if self.datalen == 0 { return Vec::new(); }
6719                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
6720                 self.data = std::ptr::null_mut();
6721                 self.datalen = 0;
6722                 ret
6723         }
6724         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::util::events::Event] {
6725                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
6726         }
6727 }
6728 impl From<Vec<crate::lightning::util::events::Event>> for CVec_EventZ {
6729         fn from(v: Vec<crate::lightning::util::events::Event>) -> Self {
6730                 let datalen = v.len();
6731                 let data = Box::into_raw(v.into_boxed_slice());
6732                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
6733         }
6734 }
6735 #[no_mangle]
6736 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
6737 pub extern "C" fn CVec_EventZ_free(_res: CVec_EventZ) { }
6738 impl Drop for CVec_EventZ {
6739         fn drop(&mut self) {
6740                 if self.datalen == 0 { return; }
6741                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
6742         }
6743 }
6744 impl Clone for CVec_EventZ {
6745         fn clone(&self) -> Self {
6746                 let mut res = Vec::new();
6747                 if self.datalen == 0 { return Self::from(res); }
6748                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
6749                 Self::from(res)
6750         }
6751 }
6752 #[repr(C)]
6753 /// A dynamically-allocated array of crate::c_types::Transactions of arbitrary size.
6754 /// This corresponds to std::vector in C++
6755 pub struct CVec_TransactionZ {
6756         /// The elements in the array.
6757         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
6758         pub data: *mut crate::c_types::Transaction,
6759         /// The number of elements pointed to by `data`.
6760         pub datalen: usize
6761 }
6762 impl CVec_TransactionZ {
6763         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::Transaction> {
6764                 if self.datalen == 0 { return Vec::new(); }
6765                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
6766                 self.data = std::ptr::null_mut();
6767                 self.datalen = 0;
6768                 ret
6769         }
6770         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::Transaction] {
6771                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
6772         }
6773 }
6774 impl From<Vec<crate::c_types::Transaction>> for CVec_TransactionZ {
6775         fn from(v: Vec<crate::c_types::Transaction>) -> Self {
6776                 let datalen = v.len();
6777                 let data = Box::into_raw(v.into_boxed_slice());
6778                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
6779         }
6780 }
6781 #[no_mangle]
6782 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
6783 pub extern "C" fn CVec_TransactionZ_free(_res: CVec_TransactionZ) { }
6784 impl Drop for CVec_TransactionZ {
6785         fn drop(&mut self) {
6786                 if self.datalen == 0 { return; }
6787                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
6788         }
6789 }
6790 impl Clone for CVec_TransactionZ {
6791         fn clone(&self) -> Self {
6792                 let mut res = Vec::new();
6793                 if self.datalen == 0 { return Self::from(res); }
6794                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
6795                 Self::from(res)
6796         }
6797 }
6798 #[repr(C)]
6799 /// A tuple of 2 elements. See the individual fields for the types contained.
6800 pub struct C2Tuple_u32TxOutZ {
6801         /// The element at position 0
6802         pub a: u32,
6803         /// The element at position 1
6804         pub b: crate::c_types::TxOut,
6805 }
6806 impl From<(u32, crate::c_types::TxOut)> for C2Tuple_u32TxOutZ {
6807         fn from (tup: (u32, crate::c_types::TxOut)) -> Self {
6808                 Self {
6809                         a: tup.0,
6810                         b: tup.1,
6811                 }
6812         }
6813 }
6814 impl C2Tuple_u32TxOutZ {
6815         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (u32, crate::c_types::TxOut) {
6816                 (self.a, self.b)
6817         }
6818 }
6819 impl Clone for C2Tuple_u32TxOutZ {
6820         fn clone(&self) -> Self {
6821                 Self {
6822                         a: Clone::clone(&self.a),
6823                         b: Clone::clone(&self.b),
6824                 }
6825         }
6826 }
6827 #[no_mangle]
6828 /// Creates a new tuple which has the same data as `orig`
6829 /// but with all dynamically-allocated buffers duplicated in new buffers.
6830 pub extern "C" fn C2Tuple_u32TxOutZ_clone(orig: &C2Tuple_u32TxOutZ) -> C2Tuple_u32TxOutZ { Clone::clone(&orig) }
6831 /// Creates a new C2Tuple_u32TxOutZ from the contained elements.
6832 #[no_mangle]
6833 pub extern "C" fn C2Tuple_u32TxOutZ_new(a: u32, b: crate::c_types::TxOut) -> C2Tuple_u32TxOutZ {
6834         C2Tuple_u32TxOutZ { a, b, }
6835 }
6836
6837 #[no_mangle]
6838 /// Frees any resources used by the C2Tuple_u32TxOutZ.
6839 pub extern "C" fn C2Tuple_u32TxOutZ_free(_res: C2Tuple_u32TxOutZ) { }
6840 #[repr(C)]
6841 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_u32TxOutZs of arbitrary size.
6842 /// This corresponds to std::vector in C++
6843 pub struct CVec_C2Tuple_u32TxOutZZ {
6844         /// The elements in the array.
6845         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
6846         pub data: *mut crate::c_types::derived::C2Tuple_u32TxOutZ,
6847         /// The number of elements pointed to by `data`.
6848         pub datalen: usize
6849 }
6850 impl CVec_C2Tuple_u32TxOutZZ {
6851         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_u32TxOutZ> {
6852                 if self.datalen == 0 { return Vec::new(); }
6853                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
6854                 self.data = std::ptr::null_mut();
6855                 self.datalen = 0;
6856                 ret
6857         }
6858         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_u32TxOutZ] {
6859                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
6860         }
6861 }
6862 impl From<Vec<crate::c_types::derived::C2Tuple_u32TxOutZ>> for CVec_C2Tuple_u32TxOutZZ {
6863         fn from(v: Vec<crate::c_types::derived::C2Tuple_u32TxOutZ>) -> Self {
6864                 let datalen = v.len();
6865                 let data = Box::into_raw(v.into_boxed_slice());
6866                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
6867         }
6868 }
6869 #[no_mangle]
6870 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
6871 pub extern "C" fn CVec_C2Tuple_u32TxOutZZ_free(_res: CVec_C2Tuple_u32TxOutZZ) { }
6872 impl Drop for CVec_C2Tuple_u32TxOutZZ {
6873         fn drop(&mut self) {
6874                 if self.datalen == 0 { return; }
6875                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
6876         }
6877 }
6878 impl Clone for CVec_C2Tuple_u32TxOutZZ {
6879         fn clone(&self) -> Self {
6880                 let mut res = Vec::new();
6881                 if self.datalen == 0 { return Self::from(res); }
6882                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
6883                 Self::from(res)
6884         }
6885 }
6886 #[repr(C)]
6887 /// A tuple of 2 elements. See the individual fields for the types contained.
6888 pub struct C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ {
6889         /// The element at position 0
6890         pub a: crate::c_types::ThirtyTwoBytes,
6891         /// The element at position 1
6892         pub b: crate::c_types::derived::CVec_C2Tuple_u32TxOutZZ,
6893 }
6894 impl From<(crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32TxOutZZ)> for C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ {
6895         fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32TxOutZZ)) -> Self {
6896                 Self {
6897                         a: tup.0,
6898                         b: tup.1,
6899                 }
6900         }
6901 }
6902 impl C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ {
6903         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32TxOutZZ) {
6904                 (self.a, self.b)
6905         }
6906 }
6907 impl Clone for C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ {
6908         fn clone(&self) -> Self {
6909                 Self {
6910                         a: Clone::clone(&self.a),
6911                         b: Clone::clone(&self.b),
6912                 }
6913         }
6914 }
6915 #[no_mangle]
6916 /// Creates a new tuple which has the same data as `orig`
6917 /// but with all dynamically-allocated buffers duplicated in new buffers.
6918 pub extern "C" fn C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone(orig: &C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ) -> C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ { Clone::clone(&orig) }
6919 /// Creates a new C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ from the contained elements.
6920 #[no_mangle]
6921 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 {
6922         C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ { a, b, }
6923 }
6924
6925 #[no_mangle]
6926 /// Frees any resources used by the C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ.
6927 pub extern "C" fn C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_free(_res: C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ) { }
6928 #[repr(C)]
6929 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZs of arbitrary size.
6930 /// This corresponds to std::vector in C++
6931 pub struct CVec_TransactionOutputsZ {
6932         /// The elements in the array.
6933         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
6934         pub data: *mut crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ,
6935         /// The number of elements pointed to by `data`.
6936         pub datalen: usize
6937 }
6938 impl CVec_TransactionOutputsZ {
6939         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ> {
6940                 if self.datalen == 0 { return Vec::new(); }
6941                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
6942                 self.data = std::ptr::null_mut();
6943                 self.datalen = 0;
6944                 ret
6945         }
6946         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ] {
6947                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
6948         }
6949 }
6950 impl From<Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ>> for CVec_TransactionOutputsZ {
6951         fn from(v: Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ>) -> Self {
6952                 let datalen = v.len();
6953                 let data = Box::into_raw(v.into_boxed_slice());
6954                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
6955         }
6956 }
6957 #[no_mangle]
6958 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
6959 pub extern "C" fn CVec_TransactionOutputsZ_free(_res: CVec_TransactionOutputsZ) { }
6960 impl Drop for CVec_TransactionOutputsZ {
6961         fn drop(&mut self) {
6962                 if self.datalen == 0 { return; }
6963                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
6964         }
6965 }
6966 impl Clone for CVec_TransactionOutputsZ {
6967         fn clone(&self) -> Self {
6968                 let mut res = Vec::new();
6969                 if self.datalen == 0 { return Self::from(res); }
6970                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
6971                 Self::from(res)
6972         }
6973 }
6974 #[repr(C)]
6975 /// A dynamically-allocated array of crate::lightning::chain::channelmonitor::Balances of arbitrary size.
6976 /// This corresponds to std::vector in C++
6977 pub struct CVec_BalanceZ {
6978         /// The elements in the array.
6979         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
6980         pub data: *mut crate::lightning::chain::channelmonitor::Balance,
6981         /// The number of elements pointed to by `data`.
6982         pub datalen: usize
6983 }
6984 impl CVec_BalanceZ {
6985         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::chain::channelmonitor::Balance> {
6986                 if self.datalen == 0 { return Vec::new(); }
6987                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
6988                 self.data = std::ptr::null_mut();
6989                 self.datalen = 0;
6990                 ret
6991         }
6992         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::chain::channelmonitor::Balance] {
6993                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
6994         }
6995 }
6996 impl From<Vec<crate::lightning::chain::channelmonitor::Balance>> for CVec_BalanceZ {
6997         fn from(v: Vec<crate::lightning::chain::channelmonitor::Balance>) -> Self {
6998                 let datalen = v.len();
6999                 let data = Box::into_raw(v.into_boxed_slice());
7000                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
7001         }
7002 }
7003 #[no_mangle]
7004 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
7005 pub extern "C" fn CVec_BalanceZ_free(_res: CVec_BalanceZ) { }
7006 impl Drop for CVec_BalanceZ {
7007         fn drop(&mut self) {
7008                 if self.datalen == 0 { return; }
7009                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
7010         }
7011 }
7012 impl Clone for CVec_BalanceZ {
7013         fn clone(&self) -> Self {
7014                 let mut res = Vec::new();
7015                 if self.datalen == 0 { return Self::from(res); }
7016                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
7017                 Self::from(res)
7018         }
7019 }
7020 #[repr(C)]
7021 /// The contents of CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ
7022 pub union CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr {
7023         /// A pointer to the contents in the success state.
7024         /// Reading from this pointer when `result_ok` is not set is undefined.
7025         pub result: *mut crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ,
7026         /// A pointer to the contents in the error state.
7027         /// Reading from this pointer when `result_ok` is set is undefined.
7028         pub err: *mut crate::lightning::ln::msgs::DecodeError,
7029 }
7030 #[repr(C)]
7031 /// A CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ represents the result of a fallible operation,
7032 /// containing a crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
7033 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7034 pub struct CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
7035         /// The contents of this CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ, accessible via either
7036         /// `err` or `result` depending on the state of `result_ok`.
7037         pub contents: CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr,
7038         /// Whether this CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ represents a success state.
7039         pub result_ok: bool,
7040 }
7041 #[no_mangle]
7042 /// Creates a new CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ in the success state.
7043 pub extern "C" fn CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_ok(o: crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ) -> CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
7044         CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
7045                 contents: CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr {
7046                         result: Box::into_raw(Box::new(o)),
7047                 },
7048                 result_ok: true,
7049         }
7050 }
7051 #[no_mangle]
7052 /// Creates a new CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ in the error state.
7053 pub extern "C" fn CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
7054         CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
7055                 contents: CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr {
7056                         err: Box::into_raw(Box::new(e)),
7057                 },
7058                 result_ok: false,
7059         }
7060 }
7061 #[no_mangle]
7062 /// Frees any resources used by the CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ.
7063 pub extern "C" fn CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_free(_res: CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ) { }
7064 impl Drop for CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
7065         fn drop(&mut self) {
7066                 if self.result_ok {
7067                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
7068                                 let _ = unsafe { Box::from_raw(self.contents.result) };
7069                         }
7070                 } else {
7071                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
7072                                 let _ = unsafe { Box::from_raw(self.contents.err) };
7073                         }
7074                 }
7075         }
7076 }
7077 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ, crate::lightning::ln::msgs::DecodeError>> for CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
7078         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
7079                 let contents = if o.result_ok {
7080                         let result = unsafe { o.contents.result };
7081                         unsafe { o.contents.result = std::ptr::null_mut() };
7082                         CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr { result }
7083                 } else {
7084                         let err = unsafe { o.contents.err };
7085                         unsafe { o.contents.err = std::ptr::null_mut(); }
7086                         CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr { err }
7087                 };
7088                 Self {
7089                         contents,
7090                         result_ok: o.result_ok,
7091                 }
7092         }
7093 }
7094 #[repr(C)]
7095 /// The contents of CResult_NoneLightningErrorZ
7096 pub union CResult_NoneLightningErrorZPtr {
7097         /// Note that this value is always NULL, as there are no contents in the OK variant
7098         pub result: *mut std::ffi::c_void,
7099         /// A pointer to the contents in the error state.
7100         /// Reading from this pointer when `result_ok` is set is undefined.
7101         pub err: *mut crate::lightning::ln::msgs::LightningError,
7102 }
7103 #[repr(C)]
7104 /// A CResult_NoneLightningErrorZ represents the result of a fallible operation,
7105 /// containing a () on success and a crate::lightning::ln::msgs::LightningError on failure.
7106 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7107 pub struct CResult_NoneLightningErrorZ {
7108         /// The contents of this CResult_NoneLightningErrorZ, accessible via either
7109         /// `err` or `result` depending on the state of `result_ok`.
7110         pub contents: CResult_NoneLightningErrorZPtr,
7111         /// Whether this CResult_NoneLightningErrorZ represents a success state.
7112         pub result_ok: bool,
7113 }
7114 #[no_mangle]
7115 /// Creates a new CResult_NoneLightningErrorZ in the success state.
7116 pub extern "C" fn CResult_NoneLightningErrorZ_ok() -> CResult_NoneLightningErrorZ {
7117         CResult_NoneLightningErrorZ {
7118                 contents: CResult_NoneLightningErrorZPtr {
7119                         result: std::ptr::null_mut(),
7120                 },
7121                 result_ok: true,
7122         }
7123 }
7124 #[no_mangle]
7125 /// Creates a new CResult_NoneLightningErrorZ in the error state.
7126 pub extern "C" fn CResult_NoneLightningErrorZ_err(e: crate::lightning::ln::msgs::LightningError) -> CResult_NoneLightningErrorZ {
7127         CResult_NoneLightningErrorZ {
7128                 contents: CResult_NoneLightningErrorZPtr {
7129                         err: Box::into_raw(Box::new(e)),
7130                 },
7131                 result_ok: false,
7132         }
7133 }
7134 #[no_mangle]
7135 /// Frees any resources used by the CResult_NoneLightningErrorZ.
7136 pub extern "C" fn CResult_NoneLightningErrorZ_free(_res: CResult_NoneLightningErrorZ) { }
7137 impl Drop for CResult_NoneLightningErrorZ {
7138         fn drop(&mut self) {
7139                 if self.result_ok {
7140                 } else {
7141                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
7142                                 let _ = unsafe { Box::from_raw(self.contents.err) };
7143                         }
7144                 }
7145         }
7146 }
7147 impl From<crate::c_types::CResultTempl<(), crate::lightning::ln::msgs::LightningError>> for CResult_NoneLightningErrorZ {
7148         fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::ln::msgs::LightningError>) -> Self {
7149                 let contents = if o.result_ok {
7150                         let _ = unsafe { Box::from_raw(o.contents.result) };
7151                         o.contents.result = std::ptr::null_mut();
7152                         CResult_NoneLightningErrorZPtr { result: std::ptr::null_mut() }
7153                 } else {
7154                         let err = unsafe { o.contents.err };
7155                         unsafe { o.contents.err = std::ptr::null_mut(); }
7156                         CResult_NoneLightningErrorZPtr { err }
7157                 };
7158                 Self {
7159                         contents,
7160                         result_ok: o.result_ok,
7161                 }
7162         }
7163 }
7164 impl Clone for CResult_NoneLightningErrorZ {
7165         fn clone(&self) -> Self {
7166                 if self.result_ok {
7167                         Self { result_ok: true, contents: CResult_NoneLightningErrorZPtr {
7168                                 result: std::ptr::null_mut()
7169                         } }
7170                 } else {
7171                         Self { result_ok: false, contents: CResult_NoneLightningErrorZPtr {
7172                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::LightningError>::clone(unsafe { &*self.contents.err })))
7173                         } }
7174                 }
7175         }
7176 }
7177 #[no_mangle]
7178 /// Creates a new CResult_NoneLightningErrorZ which has the same data as `orig`
7179 /// but with all dynamically-allocated buffers duplicated in new buffers.
7180 pub extern "C" fn CResult_NoneLightningErrorZ_clone(orig: &CResult_NoneLightningErrorZ) -> CResult_NoneLightningErrorZ { Clone::clone(&orig) }
7181 #[repr(C)]
7182 /// A tuple of 2 elements. See the individual fields for the types contained.
7183 pub struct C2Tuple_PublicKeyTypeZ {
7184         /// The element at position 0
7185         pub a: crate::c_types::PublicKey,
7186         /// The element at position 1
7187         pub b: crate::lightning::ln::wire::Type,
7188 }
7189 impl From<(crate::c_types::PublicKey, crate::lightning::ln::wire::Type)> for C2Tuple_PublicKeyTypeZ {
7190         fn from (tup: (crate::c_types::PublicKey, crate::lightning::ln::wire::Type)) -> Self {
7191                 Self {
7192                         a: tup.0,
7193                         b: tup.1,
7194                 }
7195         }
7196 }
7197 impl C2Tuple_PublicKeyTypeZ {
7198         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::PublicKey, crate::lightning::ln::wire::Type) {
7199                 (self.a, self.b)
7200         }
7201 }
7202 /// Creates a new C2Tuple_PublicKeyTypeZ from the contained elements.
7203 #[no_mangle]
7204 pub extern "C" fn C2Tuple_PublicKeyTypeZ_new(a: crate::c_types::PublicKey, b: crate::lightning::ln::wire::Type) -> C2Tuple_PublicKeyTypeZ {
7205         C2Tuple_PublicKeyTypeZ { a, b, }
7206 }
7207
7208 #[no_mangle]
7209 /// Frees any resources used by the C2Tuple_PublicKeyTypeZ.
7210 pub extern "C" fn C2Tuple_PublicKeyTypeZ_free(_res: C2Tuple_PublicKeyTypeZ) { }
7211 #[repr(C)]
7212 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_PublicKeyTypeZs of arbitrary size.
7213 /// This corresponds to std::vector in C++
7214 pub struct CVec_C2Tuple_PublicKeyTypeZZ {
7215         /// The elements in the array.
7216         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
7217         pub data: *mut crate::c_types::derived::C2Tuple_PublicKeyTypeZ,
7218         /// The number of elements pointed to by `data`.
7219         pub datalen: usize
7220 }
7221 impl CVec_C2Tuple_PublicKeyTypeZZ {
7222         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_PublicKeyTypeZ> {
7223                 if self.datalen == 0 { return Vec::new(); }
7224                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
7225                 self.data = std::ptr::null_mut();
7226                 self.datalen = 0;
7227                 ret
7228         }
7229         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_PublicKeyTypeZ] {
7230                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
7231         }
7232 }
7233 impl From<Vec<crate::c_types::derived::C2Tuple_PublicKeyTypeZ>> for CVec_C2Tuple_PublicKeyTypeZZ {
7234         fn from(v: Vec<crate::c_types::derived::C2Tuple_PublicKeyTypeZ>) -> Self {
7235                 let datalen = v.len();
7236                 let data = Box::into_raw(v.into_boxed_slice());
7237                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
7238         }
7239 }
7240 #[no_mangle]
7241 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
7242 pub extern "C" fn CVec_C2Tuple_PublicKeyTypeZZ_free(_res: CVec_C2Tuple_PublicKeyTypeZZ) { }
7243 impl Drop for CVec_C2Tuple_PublicKeyTypeZZ {
7244         fn drop(&mut self) {
7245                 if self.datalen == 0 { return; }
7246                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
7247         }
7248 }
7249 #[repr(C)]
7250 /// The contents of CResult_boolLightningErrorZ
7251 pub union CResult_boolLightningErrorZPtr {
7252         /// A pointer to the contents in the success state.
7253         /// Reading from this pointer when `result_ok` is not set is undefined.
7254         pub result: *mut bool,
7255         /// A pointer to the contents in the error state.
7256         /// Reading from this pointer when `result_ok` is set is undefined.
7257         pub err: *mut crate::lightning::ln::msgs::LightningError,
7258 }
7259 #[repr(C)]
7260 /// A CResult_boolLightningErrorZ represents the result of a fallible operation,
7261 /// containing a bool on success and a crate::lightning::ln::msgs::LightningError on failure.
7262 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7263 pub struct CResult_boolLightningErrorZ {
7264         /// The contents of this CResult_boolLightningErrorZ, accessible via either
7265         /// `err` or `result` depending on the state of `result_ok`.
7266         pub contents: CResult_boolLightningErrorZPtr,
7267         /// Whether this CResult_boolLightningErrorZ represents a success state.
7268         pub result_ok: bool,
7269 }
7270 #[no_mangle]
7271 /// Creates a new CResult_boolLightningErrorZ in the success state.
7272 pub extern "C" fn CResult_boolLightningErrorZ_ok(o: bool) -> CResult_boolLightningErrorZ {
7273         CResult_boolLightningErrorZ {
7274                 contents: CResult_boolLightningErrorZPtr {
7275                         result: Box::into_raw(Box::new(o)),
7276                 },
7277                 result_ok: true,
7278         }
7279 }
7280 #[no_mangle]
7281 /// Creates a new CResult_boolLightningErrorZ in the error state.
7282 pub extern "C" fn CResult_boolLightningErrorZ_err(e: crate::lightning::ln::msgs::LightningError) -> CResult_boolLightningErrorZ {
7283         CResult_boolLightningErrorZ {
7284                 contents: CResult_boolLightningErrorZPtr {
7285                         err: Box::into_raw(Box::new(e)),
7286                 },
7287                 result_ok: false,
7288         }
7289 }
7290 #[no_mangle]
7291 /// Frees any resources used by the CResult_boolLightningErrorZ.
7292 pub extern "C" fn CResult_boolLightningErrorZ_free(_res: CResult_boolLightningErrorZ) { }
7293 impl Drop for CResult_boolLightningErrorZ {
7294         fn drop(&mut self) {
7295                 if self.result_ok {
7296                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
7297                                 let _ = unsafe { Box::from_raw(self.contents.result) };
7298                         }
7299                 } else {
7300                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
7301                                 let _ = unsafe { Box::from_raw(self.contents.err) };
7302                         }
7303                 }
7304         }
7305 }
7306 impl From<crate::c_types::CResultTempl<bool, crate::lightning::ln::msgs::LightningError>> for CResult_boolLightningErrorZ {
7307         fn from(mut o: crate::c_types::CResultTempl<bool, crate::lightning::ln::msgs::LightningError>) -> Self {
7308                 let contents = if o.result_ok {
7309                         let result = unsafe { o.contents.result };
7310                         unsafe { o.contents.result = std::ptr::null_mut() };
7311                         CResult_boolLightningErrorZPtr { result }
7312                 } else {
7313                         let err = unsafe { o.contents.err };
7314                         unsafe { o.contents.err = std::ptr::null_mut(); }
7315                         CResult_boolLightningErrorZPtr { err }
7316                 };
7317                 Self {
7318                         contents,
7319                         result_ok: o.result_ok,
7320                 }
7321         }
7322 }
7323 impl Clone for CResult_boolLightningErrorZ {
7324         fn clone(&self) -> Self {
7325                 if self.result_ok {
7326                         Self { result_ok: true, contents: CResult_boolLightningErrorZPtr {
7327                                 result: Box::into_raw(Box::new(<bool>::clone(unsafe { &*self.contents.result })))
7328                         } }
7329                 } else {
7330                         Self { result_ok: false, contents: CResult_boolLightningErrorZPtr {
7331                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::LightningError>::clone(unsafe { &*self.contents.err })))
7332                         } }
7333                 }
7334         }
7335 }
7336 #[no_mangle]
7337 /// Creates a new CResult_boolLightningErrorZ which has the same data as `orig`
7338 /// but with all dynamically-allocated buffers duplicated in new buffers.
7339 pub extern "C" fn CResult_boolLightningErrorZ_clone(orig: &CResult_boolLightningErrorZ) -> CResult_boolLightningErrorZ { Clone::clone(&orig) }
7340 #[repr(C)]
7341 /// A tuple of 3 elements. See the individual fields for the types contained.
7342 pub struct C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
7343         /// The element at position 0
7344         pub a: crate::lightning::ln::msgs::ChannelAnnouncement,
7345         /// The element at position 1
7346         pub b: crate::lightning::ln::msgs::ChannelUpdate,
7347         /// The element at position 2
7348         pub c: crate::lightning::ln::msgs::ChannelUpdate,
7349 }
7350 impl From<(crate::lightning::ln::msgs::ChannelAnnouncement, crate::lightning::ln::msgs::ChannelUpdate, crate::lightning::ln::msgs::ChannelUpdate)> for C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
7351         fn from (tup: (crate::lightning::ln::msgs::ChannelAnnouncement, crate::lightning::ln::msgs::ChannelUpdate, crate::lightning::ln::msgs::ChannelUpdate)) -> Self {
7352                 Self {
7353                         a: tup.0,
7354                         b: tup.1,
7355                         c: tup.2,
7356                 }
7357         }
7358 }
7359 impl C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
7360         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::lightning::ln::msgs::ChannelAnnouncement, crate::lightning::ln::msgs::ChannelUpdate, crate::lightning::ln::msgs::ChannelUpdate) {
7361                 (self.a, self.b, self.c)
7362         }
7363 }
7364 impl Clone for C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
7365         fn clone(&self) -> Self {
7366                 Self {
7367                         a: Clone::clone(&self.a),
7368                         b: Clone::clone(&self.b),
7369                         c: Clone::clone(&self.c),
7370                 }
7371         }
7372 }
7373 #[no_mangle]
7374 /// Creates a new tuple which has the same data as `orig`
7375 /// but with all dynamically-allocated buffers duplicated in new buffers.
7376 pub extern "C" fn C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(orig: &C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ) -> C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ { Clone::clone(&orig) }
7377 /// Creates a new C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ from the contained elements.
7378 #[no_mangle]
7379 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 {
7380         C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ { a, b, c, }
7381 }
7382
7383 #[no_mangle]
7384 /// Frees any resources used by the C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ.
7385 pub extern "C" fn C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free(_res: C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ) { }
7386 #[repr(C)]
7387 /// A dynamically-allocated array of crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZs of arbitrary size.
7388 /// This corresponds to std::vector in C++
7389 pub struct CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
7390         /// The elements in the array.
7391         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
7392         pub data: *mut crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ,
7393         /// The number of elements pointed to by `data`.
7394         pub datalen: usize
7395 }
7396 impl CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
7397         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ> {
7398                 if self.datalen == 0 { return Vec::new(); }
7399                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
7400                 self.data = std::ptr::null_mut();
7401                 self.datalen = 0;
7402                 ret
7403         }
7404         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ] {
7405                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
7406         }
7407 }
7408 impl From<Vec<crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ>> for CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
7409         fn from(v: Vec<crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ>) -> Self {
7410                 let datalen = v.len();
7411                 let data = Box::into_raw(v.into_boxed_slice());
7412                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
7413         }
7414 }
7415 #[no_mangle]
7416 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
7417 pub extern "C" fn CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free(_res: CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ) { }
7418 impl Drop for CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
7419         fn drop(&mut self) {
7420                 if self.datalen == 0 { return; }
7421                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
7422         }
7423 }
7424 impl Clone for CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
7425         fn clone(&self) -> Self {
7426                 let mut res = Vec::new();
7427                 if self.datalen == 0 { return Self::from(res); }
7428                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
7429                 Self::from(res)
7430         }
7431 }
7432 #[repr(C)]
7433 /// A dynamically-allocated array of crate::lightning::ln::msgs::NodeAnnouncements of arbitrary size.
7434 /// This corresponds to std::vector in C++
7435 pub struct CVec_NodeAnnouncementZ {
7436         /// The elements in the array.
7437         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
7438         pub data: *mut crate::lightning::ln::msgs::NodeAnnouncement,
7439         /// The number of elements pointed to by `data`.
7440         pub datalen: usize
7441 }
7442 impl CVec_NodeAnnouncementZ {
7443         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::NodeAnnouncement> {
7444                 if self.datalen == 0 { return Vec::new(); }
7445                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
7446                 self.data = std::ptr::null_mut();
7447                 self.datalen = 0;
7448                 ret
7449         }
7450         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::NodeAnnouncement] {
7451                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
7452         }
7453 }
7454 impl From<Vec<crate::lightning::ln::msgs::NodeAnnouncement>> for CVec_NodeAnnouncementZ {
7455         fn from(v: Vec<crate::lightning::ln::msgs::NodeAnnouncement>) -> Self {
7456                 let datalen = v.len();
7457                 let data = Box::into_raw(v.into_boxed_slice());
7458                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
7459         }
7460 }
7461 #[no_mangle]
7462 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
7463 pub extern "C" fn CVec_NodeAnnouncementZ_free(_res: CVec_NodeAnnouncementZ) { }
7464 impl Drop for CVec_NodeAnnouncementZ {
7465         fn drop(&mut self) {
7466                 if self.datalen == 0 { return; }
7467                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
7468         }
7469 }
7470 impl Clone for CVec_NodeAnnouncementZ {
7471         fn clone(&self) -> Self {
7472                 let mut res = Vec::new();
7473                 if self.datalen == 0 { return Self::from(res); }
7474                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
7475                 Self::from(res)
7476         }
7477 }
7478 #[repr(C)]
7479 /// A dynamically-allocated array of crate::c_types::PublicKeys of arbitrary size.
7480 /// This corresponds to std::vector in C++
7481 pub struct CVec_PublicKeyZ {
7482         /// The elements in the array.
7483         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
7484         pub data: *mut crate::c_types::PublicKey,
7485         /// The number of elements pointed to by `data`.
7486         pub datalen: usize
7487 }
7488 impl CVec_PublicKeyZ {
7489         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::PublicKey> {
7490                 if self.datalen == 0 { return Vec::new(); }
7491                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
7492                 self.data = std::ptr::null_mut();
7493                 self.datalen = 0;
7494                 ret
7495         }
7496         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::PublicKey] {
7497                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
7498         }
7499 }
7500 impl From<Vec<crate::c_types::PublicKey>> for CVec_PublicKeyZ {
7501         fn from(v: Vec<crate::c_types::PublicKey>) -> Self {
7502                 let datalen = v.len();
7503                 let data = Box::into_raw(v.into_boxed_slice());
7504                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
7505         }
7506 }
7507 #[no_mangle]
7508 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
7509 pub extern "C" fn CVec_PublicKeyZ_free(_res: CVec_PublicKeyZ) { }
7510 impl Drop for CVec_PublicKeyZ {
7511         fn drop(&mut self) {
7512                 if self.datalen == 0 { return; }
7513                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
7514         }
7515 }
7516 impl Clone for CVec_PublicKeyZ {
7517         fn clone(&self) -> Self {
7518                 let mut res = Vec::new();
7519                 if self.datalen == 0 { return Self::from(res); }
7520                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
7521                 Self::from(res)
7522         }
7523 }
7524 #[repr(C)]
7525 /// The contents of CResult_CVec_u8ZPeerHandleErrorZ
7526 pub union CResult_CVec_u8ZPeerHandleErrorZPtr {
7527         /// A pointer to the contents in the success state.
7528         /// Reading from this pointer when `result_ok` is not set is undefined.
7529         pub result: *mut crate::c_types::derived::CVec_u8Z,
7530         /// A pointer to the contents in the error state.
7531         /// Reading from this pointer when `result_ok` is set is undefined.
7532         pub err: *mut crate::lightning::ln::peer_handler::PeerHandleError,
7533 }
7534 #[repr(C)]
7535 /// A CResult_CVec_u8ZPeerHandleErrorZ represents the result of a fallible operation,
7536 /// containing a crate::c_types::derived::CVec_u8Z on success and a crate::lightning::ln::peer_handler::PeerHandleError on failure.
7537 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7538 pub struct CResult_CVec_u8ZPeerHandleErrorZ {
7539         /// The contents of this CResult_CVec_u8ZPeerHandleErrorZ, accessible via either
7540         /// `err` or `result` depending on the state of `result_ok`.
7541         pub contents: CResult_CVec_u8ZPeerHandleErrorZPtr,
7542         /// Whether this CResult_CVec_u8ZPeerHandleErrorZ represents a success state.
7543         pub result_ok: bool,
7544 }
7545 #[no_mangle]
7546 /// Creates a new CResult_CVec_u8ZPeerHandleErrorZ in the success state.
7547 pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_ok(o: crate::c_types::derived::CVec_u8Z) -> CResult_CVec_u8ZPeerHandleErrorZ {
7548         CResult_CVec_u8ZPeerHandleErrorZ {
7549                 contents: CResult_CVec_u8ZPeerHandleErrorZPtr {
7550                         result: Box::into_raw(Box::new(o)),
7551                 },
7552                 result_ok: true,
7553         }
7554 }
7555 #[no_mangle]
7556 /// Creates a new CResult_CVec_u8ZPeerHandleErrorZ in the error state.
7557 pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_err(e: crate::lightning::ln::peer_handler::PeerHandleError) -> CResult_CVec_u8ZPeerHandleErrorZ {
7558         CResult_CVec_u8ZPeerHandleErrorZ {
7559                 contents: CResult_CVec_u8ZPeerHandleErrorZPtr {
7560                         err: Box::into_raw(Box::new(e)),
7561                 },
7562                 result_ok: false,
7563         }
7564 }
7565 #[no_mangle]
7566 /// Frees any resources used by the CResult_CVec_u8ZPeerHandleErrorZ.
7567 pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_free(_res: CResult_CVec_u8ZPeerHandleErrorZ) { }
7568 impl Drop for CResult_CVec_u8ZPeerHandleErrorZ {
7569         fn drop(&mut self) {
7570                 if self.result_ok {
7571                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
7572                                 let _ = unsafe { Box::from_raw(self.contents.result) };
7573                         }
7574                 } else {
7575                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
7576                                 let _ = unsafe { Box::from_raw(self.contents.err) };
7577                         }
7578                 }
7579         }
7580 }
7581 impl From<crate::c_types::CResultTempl<crate::c_types::derived::CVec_u8Z, crate::lightning::ln::peer_handler::PeerHandleError>> for CResult_CVec_u8ZPeerHandleErrorZ {
7582         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CVec_u8Z, crate::lightning::ln::peer_handler::PeerHandleError>) -> Self {
7583                 let contents = if o.result_ok {
7584                         let result = unsafe { o.contents.result };
7585                         unsafe { o.contents.result = std::ptr::null_mut() };
7586                         CResult_CVec_u8ZPeerHandleErrorZPtr { result }
7587                 } else {
7588                         let err = unsafe { o.contents.err };
7589                         unsafe { o.contents.err = std::ptr::null_mut(); }
7590                         CResult_CVec_u8ZPeerHandleErrorZPtr { err }
7591                 };
7592                 Self {
7593                         contents,
7594                         result_ok: o.result_ok,
7595                 }
7596         }
7597 }
7598 impl Clone for CResult_CVec_u8ZPeerHandleErrorZ {
7599         fn clone(&self) -> Self {
7600                 if self.result_ok {
7601                         Self { result_ok: true, contents: CResult_CVec_u8ZPeerHandleErrorZPtr {
7602                                 result: Box::into_raw(Box::new(<crate::c_types::derived::CVec_u8Z>::clone(unsafe { &*self.contents.result })))
7603                         } }
7604                 } else {
7605                         Self { result_ok: false, contents: CResult_CVec_u8ZPeerHandleErrorZPtr {
7606                                 err: Box::into_raw(Box::new(<crate::lightning::ln::peer_handler::PeerHandleError>::clone(unsafe { &*self.contents.err })))
7607                         } }
7608                 }
7609         }
7610 }
7611 #[no_mangle]
7612 /// Creates a new CResult_CVec_u8ZPeerHandleErrorZ which has the same data as `orig`
7613 /// but with all dynamically-allocated buffers duplicated in new buffers.
7614 pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_clone(orig: &CResult_CVec_u8ZPeerHandleErrorZ) -> CResult_CVec_u8ZPeerHandleErrorZ { Clone::clone(&orig) }
7615 #[repr(C)]
7616 /// The contents of CResult_NonePeerHandleErrorZ
7617 pub union CResult_NonePeerHandleErrorZPtr {
7618         /// Note that this value is always NULL, as there are no contents in the OK variant
7619         pub result: *mut std::ffi::c_void,
7620         /// A pointer to the contents in the error state.
7621         /// Reading from this pointer when `result_ok` is set is undefined.
7622         pub err: *mut crate::lightning::ln::peer_handler::PeerHandleError,
7623 }
7624 #[repr(C)]
7625 /// A CResult_NonePeerHandleErrorZ represents the result of a fallible operation,
7626 /// containing a () on success and a crate::lightning::ln::peer_handler::PeerHandleError on failure.
7627 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7628 pub struct CResult_NonePeerHandleErrorZ {
7629         /// The contents of this CResult_NonePeerHandleErrorZ, accessible via either
7630         /// `err` or `result` depending on the state of `result_ok`.
7631         pub contents: CResult_NonePeerHandleErrorZPtr,
7632         /// Whether this CResult_NonePeerHandleErrorZ represents a success state.
7633         pub result_ok: bool,
7634 }
7635 #[no_mangle]
7636 /// Creates a new CResult_NonePeerHandleErrorZ in the success state.
7637 pub extern "C" fn CResult_NonePeerHandleErrorZ_ok() -> CResult_NonePeerHandleErrorZ {
7638         CResult_NonePeerHandleErrorZ {
7639                 contents: CResult_NonePeerHandleErrorZPtr {
7640                         result: std::ptr::null_mut(),
7641                 },
7642                 result_ok: true,
7643         }
7644 }
7645 #[no_mangle]
7646 /// Creates a new CResult_NonePeerHandleErrorZ in the error state.
7647 pub extern "C" fn CResult_NonePeerHandleErrorZ_err(e: crate::lightning::ln::peer_handler::PeerHandleError) -> CResult_NonePeerHandleErrorZ {
7648         CResult_NonePeerHandleErrorZ {
7649                 contents: CResult_NonePeerHandleErrorZPtr {
7650                         err: Box::into_raw(Box::new(e)),
7651                 },
7652                 result_ok: false,
7653         }
7654 }
7655 #[no_mangle]
7656 /// Frees any resources used by the CResult_NonePeerHandleErrorZ.
7657 pub extern "C" fn CResult_NonePeerHandleErrorZ_free(_res: CResult_NonePeerHandleErrorZ) { }
7658 impl Drop for CResult_NonePeerHandleErrorZ {
7659         fn drop(&mut self) {
7660                 if self.result_ok {
7661                 } else {
7662                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
7663                                 let _ = unsafe { Box::from_raw(self.contents.err) };
7664                         }
7665                 }
7666         }
7667 }
7668 impl From<crate::c_types::CResultTempl<(), crate::lightning::ln::peer_handler::PeerHandleError>> for CResult_NonePeerHandleErrorZ {
7669         fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::ln::peer_handler::PeerHandleError>) -> Self {
7670                 let contents = if o.result_ok {
7671                         let _ = unsafe { Box::from_raw(o.contents.result) };
7672                         o.contents.result = std::ptr::null_mut();
7673                         CResult_NonePeerHandleErrorZPtr { result: std::ptr::null_mut() }
7674                 } else {
7675                         let err = unsafe { o.contents.err };
7676                         unsafe { o.contents.err = std::ptr::null_mut(); }
7677                         CResult_NonePeerHandleErrorZPtr { err }
7678                 };
7679                 Self {
7680                         contents,
7681                         result_ok: o.result_ok,
7682                 }
7683         }
7684 }
7685 impl Clone for CResult_NonePeerHandleErrorZ {
7686         fn clone(&self) -> Self {
7687                 if self.result_ok {
7688                         Self { result_ok: true, contents: CResult_NonePeerHandleErrorZPtr {
7689                                 result: std::ptr::null_mut()
7690                         } }
7691                 } else {
7692                         Self { result_ok: false, contents: CResult_NonePeerHandleErrorZPtr {
7693                                 err: Box::into_raw(Box::new(<crate::lightning::ln::peer_handler::PeerHandleError>::clone(unsafe { &*self.contents.err })))
7694                         } }
7695                 }
7696         }
7697 }
7698 #[no_mangle]
7699 /// Creates a new CResult_NonePeerHandleErrorZ which has the same data as `orig`
7700 /// but with all dynamically-allocated buffers duplicated in new buffers.
7701 pub extern "C" fn CResult_NonePeerHandleErrorZ_clone(orig: &CResult_NonePeerHandleErrorZ) -> CResult_NonePeerHandleErrorZ { Clone::clone(&orig) }
7702 #[repr(C)]
7703 /// The contents of CResult_boolPeerHandleErrorZ
7704 pub union CResult_boolPeerHandleErrorZPtr {
7705         /// A pointer to the contents in the success state.
7706         /// Reading from this pointer when `result_ok` is not set is undefined.
7707         pub result: *mut bool,
7708         /// A pointer to the contents in the error state.
7709         /// Reading from this pointer when `result_ok` is set is undefined.
7710         pub err: *mut crate::lightning::ln::peer_handler::PeerHandleError,
7711 }
7712 #[repr(C)]
7713 /// A CResult_boolPeerHandleErrorZ represents the result of a fallible operation,
7714 /// containing a bool on success and a crate::lightning::ln::peer_handler::PeerHandleError on failure.
7715 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7716 pub struct CResult_boolPeerHandleErrorZ {
7717         /// The contents of this CResult_boolPeerHandleErrorZ, accessible via either
7718         /// `err` or `result` depending on the state of `result_ok`.
7719         pub contents: CResult_boolPeerHandleErrorZPtr,
7720         /// Whether this CResult_boolPeerHandleErrorZ represents a success state.
7721         pub result_ok: bool,
7722 }
7723 #[no_mangle]
7724 /// Creates a new CResult_boolPeerHandleErrorZ in the success state.
7725 pub extern "C" fn CResult_boolPeerHandleErrorZ_ok(o: bool) -> CResult_boolPeerHandleErrorZ {
7726         CResult_boolPeerHandleErrorZ {
7727                 contents: CResult_boolPeerHandleErrorZPtr {
7728                         result: Box::into_raw(Box::new(o)),
7729                 },
7730                 result_ok: true,
7731         }
7732 }
7733 #[no_mangle]
7734 /// Creates a new CResult_boolPeerHandleErrorZ in the error state.
7735 pub extern "C" fn CResult_boolPeerHandleErrorZ_err(e: crate::lightning::ln::peer_handler::PeerHandleError) -> CResult_boolPeerHandleErrorZ {
7736         CResult_boolPeerHandleErrorZ {
7737                 contents: CResult_boolPeerHandleErrorZPtr {
7738                         err: Box::into_raw(Box::new(e)),
7739                 },
7740                 result_ok: false,
7741         }
7742 }
7743 #[no_mangle]
7744 /// Frees any resources used by the CResult_boolPeerHandleErrorZ.
7745 pub extern "C" fn CResult_boolPeerHandleErrorZ_free(_res: CResult_boolPeerHandleErrorZ) { }
7746 impl Drop for CResult_boolPeerHandleErrorZ {
7747         fn drop(&mut self) {
7748                 if self.result_ok {
7749                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
7750                                 let _ = unsafe { Box::from_raw(self.contents.result) };
7751                         }
7752                 } else {
7753                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
7754                                 let _ = unsafe { Box::from_raw(self.contents.err) };
7755                         }
7756                 }
7757         }
7758 }
7759 impl From<crate::c_types::CResultTempl<bool, crate::lightning::ln::peer_handler::PeerHandleError>> for CResult_boolPeerHandleErrorZ {
7760         fn from(mut o: crate::c_types::CResultTempl<bool, crate::lightning::ln::peer_handler::PeerHandleError>) -> Self {
7761                 let contents = if o.result_ok {
7762                         let result = unsafe { o.contents.result };
7763                         unsafe { o.contents.result = std::ptr::null_mut() };
7764                         CResult_boolPeerHandleErrorZPtr { result }
7765                 } else {
7766                         let err = unsafe { o.contents.err };
7767                         unsafe { o.contents.err = std::ptr::null_mut(); }
7768                         CResult_boolPeerHandleErrorZPtr { err }
7769                 };
7770                 Self {
7771                         contents,
7772                         result_ok: o.result_ok,
7773                 }
7774         }
7775 }
7776 impl Clone for CResult_boolPeerHandleErrorZ {
7777         fn clone(&self) -> Self {
7778                 if self.result_ok {
7779                         Self { result_ok: true, contents: CResult_boolPeerHandleErrorZPtr {
7780                                 result: Box::into_raw(Box::new(<bool>::clone(unsafe { &*self.contents.result })))
7781                         } }
7782                 } else {
7783                         Self { result_ok: false, contents: CResult_boolPeerHandleErrorZPtr {
7784                                 err: Box::into_raw(Box::new(<crate::lightning::ln::peer_handler::PeerHandleError>::clone(unsafe { &*self.contents.err })))
7785                         } }
7786                 }
7787         }
7788 }
7789 #[no_mangle]
7790 /// Creates a new CResult_boolPeerHandleErrorZ which has the same data as `orig`
7791 /// but with all dynamically-allocated buffers duplicated in new buffers.
7792 pub extern "C" fn CResult_boolPeerHandleErrorZ_clone(orig: &CResult_boolPeerHandleErrorZ) -> CResult_boolPeerHandleErrorZ { Clone::clone(&orig) }
7793 #[repr(C)]
7794 /// An enum which can either contain a crate::lightning::chain::Access or not
7795 pub enum COption_AccessZ {
7796         /// When we're in this state, this COption_AccessZ contains a crate::lightning::chain::Access
7797         Some(crate::lightning::chain::Access),
7798         /// When we're in this state, this COption_AccessZ contains nothing
7799         None
7800 }
7801 impl COption_AccessZ {
7802         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
7803                 if let Self::Some(_) = self { true } else { false }
7804         }
7805         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
7806                 !self.is_some()
7807         }
7808         #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::chain::Access {
7809                 if let Self::Some(v) = self { v } else { unreachable!() }
7810         }
7811 }
7812 #[no_mangle]
7813 /// Constructs a new COption_AccessZ containing a crate::lightning::chain::Access
7814 pub extern "C" fn COption_AccessZ_some(o: crate::lightning::chain::Access) -> COption_AccessZ {
7815         COption_AccessZ::Some(o)
7816 }
7817 #[no_mangle]
7818 /// Constructs a new COption_AccessZ containing nothing
7819 pub extern "C" fn COption_AccessZ_none() -> COption_AccessZ {
7820         COption_AccessZ::None
7821 }
7822 #[no_mangle]
7823 /// Frees any resources associated with the crate::lightning::chain::Access, if we are in the Some state
7824 pub extern "C" fn COption_AccessZ_free(_res: COption_AccessZ) { }
7825 #[repr(C)]
7826 /// The contents of CResult_DirectionalChannelInfoDecodeErrorZ
7827 pub union CResult_DirectionalChannelInfoDecodeErrorZPtr {
7828         /// A pointer to the contents in the success state.
7829         /// Reading from this pointer when `result_ok` is not set is undefined.
7830         pub result: *mut crate::lightning::routing::network_graph::DirectionalChannelInfo,
7831         /// A pointer to the contents in the error state.
7832         /// Reading from this pointer when `result_ok` is set is undefined.
7833         pub err: *mut crate::lightning::ln::msgs::DecodeError,
7834 }
7835 #[repr(C)]
7836 /// A CResult_DirectionalChannelInfoDecodeErrorZ represents the result of a fallible operation,
7837 /// containing a crate::lightning::routing::network_graph::DirectionalChannelInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
7838 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7839 pub struct CResult_DirectionalChannelInfoDecodeErrorZ {
7840         /// The contents of this CResult_DirectionalChannelInfoDecodeErrorZ, accessible via either
7841         /// `err` or `result` depending on the state of `result_ok`.
7842         pub contents: CResult_DirectionalChannelInfoDecodeErrorZPtr,
7843         /// Whether this CResult_DirectionalChannelInfoDecodeErrorZ represents a success state.
7844         pub result_ok: bool,
7845 }
7846 #[no_mangle]
7847 /// Creates a new CResult_DirectionalChannelInfoDecodeErrorZ in the success state.
7848 pub extern "C" fn CResult_DirectionalChannelInfoDecodeErrorZ_ok(o: crate::lightning::routing::network_graph::DirectionalChannelInfo) -> CResult_DirectionalChannelInfoDecodeErrorZ {
7849         CResult_DirectionalChannelInfoDecodeErrorZ {
7850                 contents: CResult_DirectionalChannelInfoDecodeErrorZPtr {
7851                         result: Box::into_raw(Box::new(o)),
7852                 },
7853                 result_ok: true,
7854         }
7855 }
7856 #[no_mangle]
7857 /// Creates a new CResult_DirectionalChannelInfoDecodeErrorZ in the error state.
7858 pub extern "C" fn CResult_DirectionalChannelInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_DirectionalChannelInfoDecodeErrorZ {
7859         CResult_DirectionalChannelInfoDecodeErrorZ {
7860                 contents: CResult_DirectionalChannelInfoDecodeErrorZPtr {
7861                         err: Box::into_raw(Box::new(e)),
7862                 },
7863                 result_ok: false,
7864         }
7865 }
7866 #[no_mangle]
7867 /// Frees any resources used by the CResult_DirectionalChannelInfoDecodeErrorZ.
7868 pub extern "C" fn CResult_DirectionalChannelInfoDecodeErrorZ_free(_res: CResult_DirectionalChannelInfoDecodeErrorZ) { }
7869 impl Drop for CResult_DirectionalChannelInfoDecodeErrorZ {
7870         fn drop(&mut self) {
7871                 if self.result_ok {
7872                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
7873                                 let _ = unsafe { Box::from_raw(self.contents.result) };
7874                         }
7875                 } else {
7876                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
7877                                 let _ = unsafe { Box::from_raw(self.contents.err) };
7878                         }
7879                 }
7880         }
7881 }
7882 impl From<crate::c_types::CResultTempl<crate::lightning::routing::network_graph::DirectionalChannelInfo, crate::lightning::ln::msgs::DecodeError>> for CResult_DirectionalChannelInfoDecodeErrorZ {
7883         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::network_graph::DirectionalChannelInfo, crate::lightning::ln::msgs::DecodeError>) -> Self {
7884                 let contents = if o.result_ok {
7885                         let result = unsafe { o.contents.result };
7886                         unsafe { o.contents.result = std::ptr::null_mut() };
7887                         CResult_DirectionalChannelInfoDecodeErrorZPtr { result }
7888                 } else {
7889                         let err = unsafe { o.contents.err };
7890                         unsafe { o.contents.err = std::ptr::null_mut(); }
7891                         CResult_DirectionalChannelInfoDecodeErrorZPtr { err }
7892                 };
7893                 Self {
7894                         contents,
7895                         result_ok: o.result_ok,
7896                 }
7897         }
7898 }
7899 impl Clone for CResult_DirectionalChannelInfoDecodeErrorZ {
7900         fn clone(&self) -> Self {
7901                 if self.result_ok {
7902                         Self { result_ok: true, contents: CResult_DirectionalChannelInfoDecodeErrorZPtr {
7903                                 result: Box::into_raw(Box::new(<crate::lightning::routing::network_graph::DirectionalChannelInfo>::clone(unsafe { &*self.contents.result })))
7904                         } }
7905                 } else {
7906                         Self { result_ok: false, contents: CResult_DirectionalChannelInfoDecodeErrorZPtr {
7907                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
7908                         } }
7909                 }
7910         }
7911 }
7912 #[no_mangle]
7913 /// Creates a new CResult_DirectionalChannelInfoDecodeErrorZ which has the same data as `orig`
7914 /// but with all dynamically-allocated buffers duplicated in new buffers.
7915 pub extern "C" fn CResult_DirectionalChannelInfoDecodeErrorZ_clone(orig: &CResult_DirectionalChannelInfoDecodeErrorZ) -> CResult_DirectionalChannelInfoDecodeErrorZ { Clone::clone(&orig) }
7916 #[repr(C)]
7917 /// The contents of CResult_ChannelInfoDecodeErrorZ
7918 pub union CResult_ChannelInfoDecodeErrorZPtr {
7919         /// A pointer to the contents in the success state.
7920         /// Reading from this pointer when `result_ok` is not set is undefined.
7921         pub result: *mut crate::lightning::routing::network_graph::ChannelInfo,
7922         /// A pointer to the contents in the error state.
7923         /// Reading from this pointer when `result_ok` is set is undefined.
7924         pub err: *mut crate::lightning::ln::msgs::DecodeError,
7925 }
7926 #[repr(C)]
7927 /// A CResult_ChannelInfoDecodeErrorZ represents the result of a fallible operation,
7928 /// containing a crate::lightning::routing::network_graph::ChannelInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
7929 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7930 pub struct CResult_ChannelInfoDecodeErrorZ {
7931         /// The contents of this CResult_ChannelInfoDecodeErrorZ, accessible via either
7932         /// `err` or `result` depending on the state of `result_ok`.
7933         pub contents: CResult_ChannelInfoDecodeErrorZPtr,
7934         /// Whether this CResult_ChannelInfoDecodeErrorZ represents a success state.
7935         pub result_ok: bool,
7936 }
7937 #[no_mangle]
7938 /// Creates a new CResult_ChannelInfoDecodeErrorZ in the success state.
7939 pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_ok(o: crate::lightning::routing::network_graph::ChannelInfo) -> CResult_ChannelInfoDecodeErrorZ {
7940         CResult_ChannelInfoDecodeErrorZ {
7941                 contents: CResult_ChannelInfoDecodeErrorZPtr {
7942                         result: Box::into_raw(Box::new(o)),
7943                 },
7944                 result_ok: true,
7945         }
7946 }
7947 #[no_mangle]
7948 /// Creates a new CResult_ChannelInfoDecodeErrorZ in the error state.
7949 pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelInfoDecodeErrorZ {
7950         CResult_ChannelInfoDecodeErrorZ {
7951                 contents: CResult_ChannelInfoDecodeErrorZPtr {
7952                         err: Box::into_raw(Box::new(e)),
7953                 },
7954                 result_ok: false,
7955         }
7956 }
7957 #[no_mangle]
7958 /// Frees any resources used by the CResult_ChannelInfoDecodeErrorZ.
7959 pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_free(_res: CResult_ChannelInfoDecodeErrorZ) { }
7960 impl Drop for CResult_ChannelInfoDecodeErrorZ {
7961         fn drop(&mut self) {
7962                 if self.result_ok {
7963                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
7964                                 let _ = unsafe { Box::from_raw(self.contents.result) };
7965                         }
7966                 } else {
7967                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
7968                                 let _ = unsafe { Box::from_raw(self.contents.err) };
7969                         }
7970                 }
7971         }
7972 }
7973 impl From<crate::c_types::CResultTempl<crate::lightning::routing::network_graph::ChannelInfo, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelInfoDecodeErrorZ {
7974         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::network_graph::ChannelInfo, crate::lightning::ln::msgs::DecodeError>) -> Self {
7975                 let contents = if o.result_ok {
7976                         let result = unsafe { o.contents.result };
7977                         unsafe { o.contents.result = std::ptr::null_mut() };
7978                         CResult_ChannelInfoDecodeErrorZPtr { result }
7979                 } else {
7980                         let err = unsafe { o.contents.err };
7981                         unsafe { o.contents.err = std::ptr::null_mut(); }
7982                         CResult_ChannelInfoDecodeErrorZPtr { err }
7983                 };
7984                 Self {
7985                         contents,
7986                         result_ok: o.result_ok,
7987                 }
7988         }
7989 }
7990 impl Clone for CResult_ChannelInfoDecodeErrorZ {
7991         fn clone(&self) -> Self {
7992                 if self.result_ok {
7993                         Self { result_ok: true, contents: CResult_ChannelInfoDecodeErrorZPtr {
7994                                 result: Box::into_raw(Box::new(<crate::lightning::routing::network_graph::ChannelInfo>::clone(unsafe { &*self.contents.result })))
7995                         } }
7996                 } else {
7997                         Self { result_ok: false, contents: CResult_ChannelInfoDecodeErrorZPtr {
7998                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
7999                         } }
8000                 }
8001         }
8002 }
8003 #[no_mangle]
8004 /// Creates a new CResult_ChannelInfoDecodeErrorZ which has the same data as `orig`
8005 /// but with all dynamically-allocated buffers duplicated in new buffers.
8006 pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_clone(orig: &CResult_ChannelInfoDecodeErrorZ) -> CResult_ChannelInfoDecodeErrorZ { Clone::clone(&orig) }
8007 #[repr(C)]
8008 /// The contents of CResult_RoutingFeesDecodeErrorZ
8009 pub union CResult_RoutingFeesDecodeErrorZPtr {
8010         /// A pointer to the contents in the success state.
8011         /// Reading from this pointer when `result_ok` is not set is undefined.
8012         pub result: *mut crate::lightning::routing::network_graph::RoutingFees,
8013         /// A pointer to the contents in the error state.
8014         /// Reading from this pointer when `result_ok` is set is undefined.
8015         pub err: *mut crate::lightning::ln::msgs::DecodeError,
8016 }
8017 #[repr(C)]
8018 /// A CResult_RoutingFeesDecodeErrorZ represents the result of a fallible operation,
8019 /// containing a crate::lightning::routing::network_graph::RoutingFees on success and a crate::lightning::ln::msgs::DecodeError on failure.
8020 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8021 pub struct CResult_RoutingFeesDecodeErrorZ {
8022         /// The contents of this CResult_RoutingFeesDecodeErrorZ, accessible via either
8023         /// `err` or `result` depending on the state of `result_ok`.
8024         pub contents: CResult_RoutingFeesDecodeErrorZPtr,
8025         /// Whether this CResult_RoutingFeesDecodeErrorZ represents a success state.
8026         pub result_ok: bool,
8027 }
8028 #[no_mangle]
8029 /// Creates a new CResult_RoutingFeesDecodeErrorZ in the success state.
8030 pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_ok(o: crate::lightning::routing::network_graph::RoutingFees) -> CResult_RoutingFeesDecodeErrorZ {
8031         CResult_RoutingFeesDecodeErrorZ {
8032                 contents: CResult_RoutingFeesDecodeErrorZPtr {
8033                         result: Box::into_raw(Box::new(o)),
8034                 },
8035                 result_ok: true,
8036         }
8037 }
8038 #[no_mangle]
8039 /// Creates a new CResult_RoutingFeesDecodeErrorZ in the error state.
8040 pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RoutingFeesDecodeErrorZ {
8041         CResult_RoutingFeesDecodeErrorZ {
8042                 contents: CResult_RoutingFeesDecodeErrorZPtr {
8043                         err: Box::into_raw(Box::new(e)),
8044                 },
8045                 result_ok: false,
8046         }
8047 }
8048 #[no_mangle]
8049 /// Frees any resources used by the CResult_RoutingFeesDecodeErrorZ.
8050 pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_free(_res: CResult_RoutingFeesDecodeErrorZ) { }
8051 impl Drop for CResult_RoutingFeesDecodeErrorZ {
8052         fn drop(&mut self) {
8053                 if self.result_ok {
8054                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
8055                                 let _ = unsafe { Box::from_raw(self.contents.result) };
8056                         }
8057                 } else {
8058                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
8059                                 let _ = unsafe { Box::from_raw(self.contents.err) };
8060                         }
8061                 }
8062         }
8063 }
8064 impl From<crate::c_types::CResultTempl<crate::lightning::routing::network_graph::RoutingFees, crate::lightning::ln::msgs::DecodeError>> for CResult_RoutingFeesDecodeErrorZ {
8065         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::network_graph::RoutingFees, crate::lightning::ln::msgs::DecodeError>) -> Self {
8066                 let contents = if o.result_ok {
8067                         let result = unsafe { o.contents.result };
8068                         unsafe { o.contents.result = std::ptr::null_mut() };
8069                         CResult_RoutingFeesDecodeErrorZPtr { result }
8070                 } else {
8071                         let err = unsafe { o.contents.err };
8072                         unsafe { o.contents.err = std::ptr::null_mut(); }
8073                         CResult_RoutingFeesDecodeErrorZPtr { err }
8074                 };
8075                 Self {
8076                         contents,
8077                         result_ok: o.result_ok,
8078                 }
8079         }
8080 }
8081 impl Clone for CResult_RoutingFeesDecodeErrorZ {
8082         fn clone(&self) -> Self {
8083                 if self.result_ok {
8084                         Self { result_ok: true, contents: CResult_RoutingFeesDecodeErrorZPtr {
8085                                 result: Box::into_raw(Box::new(<crate::lightning::routing::network_graph::RoutingFees>::clone(unsafe { &*self.contents.result })))
8086                         } }
8087                 } else {
8088                         Self { result_ok: false, contents: CResult_RoutingFeesDecodeErrorZPtr {
8089                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
8090                         } }
8091                 }
8092         }
8093 }
8094 #[no_mangle]
8095 /// Creates a new CResult_RoutingFeesDecodeErrorZ which has the same data as `orig`
8096 /// but with all dynamically-allocated buffers duplicated in new buffers.
8097 pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_clone(orig: &CResult_RoutingFeesDecodeErrorZ) -> CResult_RoutingFeesDecodeErrorZ { Clone::clone(&orig) }
8098 #[repr(C)]
8099 /// The contents of CResult_NodeAnnouncementInfoDecodeErrorZ
8100 pub union CResult_NodeAnnouncementInfoDecodeErrorZPtr {
8101         /// A pointer to the contents in the success state.
8102         /// Reading from this pointer when `result_ok` is not set is undefined.
8103         pub result: *mut crate::lightning::routing::network_graph::NodeAnnouncementInfo,
8104         /// A pointer to the contents in the error state.
8105         /// Reading from this pointer when `result_ok` is set is undefined.
8106         pub err: *mut crate::lightning::ln::msgs::DecodeError,
8107 }
8108 #[repr(C)]
8109 /// A CResult_NodeAnnouncementInfoDecodeErrorZ represents the result of a fallible operation,
8110 /// containing a crate::lightning::routing::network_graph::NodeAnnouncementInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
8111 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8112 pub struct CResult_NodeAnnouncementInfoDecodeErrorZ {
8113         /// The contents of this CResult_NodeAnnouncementInfoDecodeErrorZ, accessible via either
8114         /// `err` or `result` depending on the state of `result_ok`.
8115         pub contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr,
8116         /// Whether this CResult_NodeAnnouncementInfoDecodeErrorZ represents a success state.
8117         pub result_ok: bool,
8118 }
8119 #[no_mangle]
8120 /// Creates a new CResult_NodeAnnouncementInfoDecodeErrorZ in the success state.
8121 pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_ok(o: crate::lightning::routing::network_graph::NodeAnnouncementInfo) -> CResult_NodeAnnouncementInfoDecodeErrorZ {
8122         CResult_NodeAnnouncementInfoDecodeErrorZ {
8123                 contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr {
8124                         result: Box::into_raw(Box::new(o)),
8125                 },
8126                 result_ok: true,
8127         }
8128 }
8129 #[no_mangle]
8130 /// Creates a new CResult_NodeAnnouncementInfoDecodeErrorZ in the error state.
8131 pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeAnnouncementInfoDecodeErrorZ {
8132         CResult_NodeAnnouncementInfoDecodeErrorZ {
8133                 contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr {
8134                         err: Box::into_raw(Box::new(e)),
8135                 },
8136                 result_ok: false,
8137         }
8138 }
8139 #[no_mangle]
8140 /// Frees any resources used by the CResult_NodeAnnouncementInfoDecodeErrorZ.
8141 pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_free(_res: CResult_NodeAnnouncementInfoDecodeErrorZ) { }
8142 impl Drop for CResult_NodeAnnouncementInfoDecodeErrorZ {
8143         fn drop(&mut self) {
8144                 if self.result_ok {
8145                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
8146                                 let _ = unsafe { Box::from_raw(self.contents.result) };
8147                         }
8148                 } else {
8149                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
8150                                 let _ = unsafe { Box::from_raw(self.contents.err) };
8151                         }
8152                 }
8153         }
8154 }
8155 impl From<crate::c_types::CResultTempl<crate::lightning::routing::network_graph::NodeAnnouncementInfo, crate::lightning::ln::msgs::DecodeError>> for CResult_NodeAnnouncementInfoDecodeErrorZ {
8156         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::network_graph::NodeAnnouncementInfo, crate::lightning::ln::msgs::DecodeError>) -> Self {
8157                 let contents = if o.result_ok {
8158                         let result = unsafe { o.contents.result };
8159                         unsafe { o.contents.result = std::ptr::null_mut() };
8160                         CResult_NodeAnnouncementInfoDecodeErrorZPtr { result }
8161                 } else {
8162                         let err = unsafe { o.contents.err };
8163                         unsafe { o.contents.err = std::ptr::null_mut(); }
8164                         CResult_NodeAnnouncementInfoDecodeErrorZPtr { err }
8165                 };
8166                 Self {
8167                         contents,
8168                         result_ok: o.result_ok,
8169                 }
8170         }
8171 }
8172 impl Clone for CResult_NodeAnnouncementInfoDecodeErrorZ {
8173         fn clone(&self) -> Self {
8174                 if self.result_ok {
8175                         Self { result_ok: true, contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr {
8176                                 result: Box::into_raw(Box::new(<crate::lightning::routing::network_graph::NodeAnnouncementInfo>::clone(unsafe { &*self.contents.result })))
8177                         } }
8178                 } else {
8179                         Self { result_ok: false, contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr {
8180                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
8181                         } }
8182                 }
8183         }
8184 }
8185 #[no_mangle]
8186 /// Creates a new CResult_NodeAnnouncementInfoDecodeErrorZ which has the same data as `orig`
8187 /// but with all dynamically-allocated buffers duplicated in new buffers.
8188 pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_clone(orig: &CResult_NodeAnnouncementInfoDecodeErrorZ) -> CResult_NodeAnnouncementInfoDecodeErrorZ { Clone::clone(&orig) }
8189 #[repr(C)]
8190 /// A dynamically-allocated array of u64s of arbitrary size.
8191 /// This corresponds to std::vector in C++
8192 pub struct CVec_u64Z {
8193         /// The elements in the array.
8194         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
8195         pub data: *mut u64,
8196         /// The number of elements pointed to by `data`.
8197         pub datalen: usize
8198 }
8199 impl CVec_u64Z {
8200         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<u64> {
8201                 if self.datalen == 0 { return Vec::new(); }
8202                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
8203                 self.data = std::ptr::null_mut();
8204                 self.datalen = 0;
8205                 ret
8206         }
8207         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[u64] {
8208                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
8209         }
8210 }
8211 impl From<Vec<u64>> for CVec_u64Z {
8212         fn from(v: Vec<u64>) -> Self {
8213                 let datalen = v.len();
8214                 let data = Box::into_raw(v.into_boxed_slice());
8215                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
8216         }
8217 }
8218 #[no_mangle]
8219 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
8220 pub extern "C" fn CVec_u64Z_free(_res: CVec_u64Z) { }
8221 impl Drop for CVec_u64Z {
8222         fn drop(&mut self) {
8223                 if self.datalen == 0 { return; }
8224                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
8225         }
8226 }
8227 impl Clone for CVec_u64Z {
8228         fn clone(&self) -> Self {
8229                 let mut res = Vec::new();
8230                 if self.datalen == 0 { return Self::from(res); }
8231                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
8232                 Self::from(res)
8233         }
8234 }
8235 #[repr(C)]
8236 /// The contents of CResult_NodeInfoDecodeErrorZ
8237 pub union CResult_NodeInfoDecodeErrorZPtr {
8238         /// A pointer to the contents in the success state.
8239         /// Reading from this pointer when `result_ok` is not set is undefined.
8240         pub result: *mut crate::lightning::routing::network_graph::NodeInfo,
8241         /// A pointer to the contents in the error state.
8242         /// Reading from this pointer when `result_ok` is set is undefined.
8243         pub err: *mut crate::lightning::ln::msgs::DecodeError,
8244 }
8245 #[repr(C)]
8246 /// A CResult_NodeInfoDecodeErrorZ represents the result of a fallible operation,
8247 /// containing a crate::lightning::routing::network_graph::NodeInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
8248 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8249 pub struct CResult_NodeInfoDecodeErrorZ {
8250         /// The contents of this CResult_NodeInfoDecodeErrorZ, accessible via either
8251         /// `err` or `result` depending on the state of `result_ok`.
8252         pub contents: CResult_NodeInfoDecodeErrorZPtr,
8253         /// Whether this CResult_NodeInfoDecodeErrorZ represents a success state.
8254         pub result_ok: bool,
8255 }
8256 #[no_mangle]
8257 /// Creates a new CResult_NodeInfoDecodeErrorZ in the success state.
8258 pub extern "C" fn CResult_NodeInfoDecodeErrorZ_ok(o: crate::lightning::routing::network_graph::NodeInfo) -> CResult_NodeInfoDecodeErrorZ {
8259         CResult_NodeInfoDecodeErrorZ {
8260                 contents: CResult_NodeInfoDecodeErrorZPtr {
8261                         result: Box::into_raw(Box::new(o)),
8262                 },
8263                 result_ok: true,
8264         }
8265 }
8266 #[no_mangle]
8267 /// Creates a new CResult_NodeInfoDecodeErrorZ in the error state.
8268 pub extern "C" fn CResult_NodeInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeInfoDecodeErrorZ {
8269         CResult_NodeInfoDecodeErrorZ {
8270                 contents: CResult_NodeInfoDecodeErrorZPtr {
8271                         err: Box::into_raw(Box::new(e)),
8272                 },
8273                 result_ok: false,
8274         }
8275 }
8276 #[no_mangle]
8277 /// Frees any resources used by the CResult_NodeInfoDecodeErrorZ.
8278 pub extern "C" fn CResult_NodeInfoDecodeErrorZ_free(_res: CResult_NodeInfoDecodeErrorZ) { }
8279 impl Drop for CResult_NodeInfoDecodeErrorZ {
8280         fn drop(&mut self) {
8281                 if self.result_ok {
8282                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
8283                                 let _ = unsafe { Box::from_raw(self.contents.result) };
8284                         }
8285                 } else {
8286                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
8287                                 let _ = unsafe { Box::from_raw(self.contents.err) };
8288                         }
8289                 }
8290         }
8291 }
8292 impl From<crate::c_types::CResultTempl<crate::lightning::routing::network_graph::NodeInfo, crate::lightning::ln::msgs::DecodeError>> for CResult_NodeInfoDecodeErrorZ {
8293         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::network_graph::NodeInfo, crate::lightning::ln::msgs::DecodeError>) -> Self {
8294                 let contents = if o.result_ok {
8295                         let result = unsafe { o.contents.result };
8296                         unsafe { o.contents.result = std::ptr::null_mut() };
8297                         CResult_NodeInfoDecodeErrorZPtr { result }
8298                 } else {
8299                         let err = unsafe { o.contents.err };
8300                         unsafe { o.contents.err = std::ptr::null_mut(); }
8301                         CResult_NodeInfoDecodeErrorZPtr { err }
8302                 };
8303                 Self {
8304                         contents,
8305                         result_ok: o.result_ok,
8306                 }
8307         }
8308 }
8309 impl Clone for CResult_NodeInfoDecodeErrorZ {
8310         fn clone(&self) -> Self {
8311                 if self.result_ok {
8312                         Self { result_ok: true, contents: CResult_NodeInfoDecodeErrorZPtr {
8313                                 result: Box::into_raw(Box::new(<crate::lightning::routing::network_graph::NodeInfo>::clone(unsafe { &*self.contents.result })))
8314                         } }
8315                 } else {
8316                         Self { result_ok: false, contents: CResult_NodeInfoDecodeErrorZPtr {
8317                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
8318                         } }
8319                 }
8320         }
8321 }
8322 #[no_mangle]
8323 /// Creates a new CResult_NodeInfoDecodeErrorZ which has the same data as `orig`
8324 /// but with all dynamically-allocated buffers duplicated in new buffers.
8325 pub extern "C" fn CResult_NodeInfoDecodeErrorZ_clone(orig: &CResult_NodeInfoDecodeErrorZ) -> CResult_NodeInfoDecodeErrorZ { Clone::clone(&orig) }
8326 #[repr(C)]
8327 /// The contents of CResult_NetworkGraphDecodeErrorZ
8328 pub union CResult_NetworkGraphDecodeErrorZPtr {
8329         /// A pointer to the contents in the success state.
8330         /// Reading from this pointer when `result_ok` is not set is undefined.
8331         pub result: *mut crate::lightning::routing::network_graph::NetworkGraph,
8332         /// A pointer to the contents in the error state.
8333         /// Reading from this pointer when `result_ok` is set is undefined.
8334         pub err: *mut crate::lightning::ln::msgs::DecodeError,
8335 }
8336 #[repr(C)]
8337 /// A CResult_NetworkGraphDecodeErrorZ represents the result of a fallible operation,
8338 /// containing a crate::lightning::routing::network_graph::NetworkGraph on success and a crate::lightning::ln::msgs::DecodeError on failure.
8339 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8340 pub struct CResult_NetworkGraphDecodeErrorZ {
8341         /// The contents of this CResult_NetworkGraphDecodeErrorZ, accessible via either
8342         /// `err` or `result` depending on the state of `result_ok`.
8343         pub contents: CResult_NetworkGraphDecodeErrorZPtr,
8344         /// Whether this CResult_NetworkGraphDecodeErrorZ represents a success state.
8345         pub result_ok: bool,
8346 }
8347 #[no_mangle]
8348 /// Creates a new CResult_NetworkGraphDecodeErrorZ in the success state.
8349 pub extern "C" fn CResult_NetworkGraphDecodeErrorZ_ok(o: crate::lightning::routing::network_graph::NetworkGraph) -> CResult_NetworkGraphDecodeErrorZ {
8350         CResult_NetworkGraphDecodeErrorZ {
8351                 contents: CResult_NetworkGraphDecodeErrorZPtr {
8352                         result: Box::into_raw(Box::new(o)),
8353                 },
8354                 result_ok: true,
8355         }
8356 }
8357 #[no_mangle]
8358 /// Creates a new CResult_NetworkGraphDecodeErrorZ in the error state.
8359 pub extern "C" fn CResult_NetworkGraphDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NetworkGraphDecodeErrorZ {
8360         CResult_NetworkGraphDecodeErrorZ {
8361                 contents: CResult_NetworkGraphDecodeErrorZPtr {
8362                         err: Box::into_raw(Box::new(e)),
8363                 },
8364                 result_ok: false,
8365         }
8366 }
8367 #[no_mangle]
8368 /// Frees any resources used by the CResult_NetworkGraphDecodeErrorZ.
8369 pub extern "C" fn CResult_NetworkGraphDecodeErrorZ_free(_res: CResult_NetworkGraphDecodeErrorZ) { }
8370 impl Drop for CResult_NetworkGraphDecodeErrorZ {
8371         fn drop(&mut self) {
8372                 if self.result_ok {
8373                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
8374                                 let _ = unsafe { Box::from_raw(self.contents.result) };
8375                         }
8376                 } else {
8377                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
8378                                 let _ = unsafe { Box::from_raw(self.contents.err) };
8379                         }
8380                 }
8381         }
8382 }
8383 impl From<crate::c_types::CResultTempl<crate::lightning::routing::network_graph::NetworkGraph, crate::lightning::ln::msgs::DecodeError>> for CResult_NetworkGraphDecodeErrorZ {
8384         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::network_graph::NetworkGraph, crate::lightning::ln::msgs::DecodeError>) -> Self {
8385                 let contents = if o.result_ok {
8386                         let result = unsafe { o.contents.result };
8387                         unsafe { o.contents.result = std::ptr::null_mut() };
8388                         CResult_NetworkGraphDecodeErrorZPtr { result }
8389                 } else {
8390                         let err = unsafe { o.contents.err };
8391                         unsafe { o.contents.err = std::ptr::null_mut(); }
8392                         CResult_NetworkGraphDecodeErrorZPtr { err }
8393                 };
8394                 Self {
8395                         contents,
8396                         result_ok: o.result_ok,
8397                 }
8398         }
8399 }
8400 impl Clone for CResult_NetworkGraphDecodeErrorZ {
8401         fn clone(&self) -> Self {
8402                 if self.result_ok {
8403                         Self { result_ok: true, contents: CResult_NetworkGraphDecodeErrorZPtr {
8404                                 result: Box::into_raw(Box::new(<crate::lightning::routing::network_graph::NetworkGraph>::clone(unsafe { &*self.contents.result })))
8405                         } }
8406                 } else {
8407                         Self { result_ok: false, contents: CResult_NetworkGraphDecodeErrorZPtr {
8408                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
8409                         } }
8410                 }
8411         }
8412 }
8413 #[no_mangle]
8414 /// Creates a new CResult_NetworkGraphDecodeErrorZ which has the same data as `orig`
8415 /// but with all dynamically-allocated buffers duplicated in new buffers.
8416 pub extern "C" fn CResult_NetworkGraphDecodeErrorZ_clone(orig: &CResult_NetworkGraphDecodeErrorZ) -> CResult_NetworkGraphDecodeErrorZ { Clone::clone(&orig) }
8417 #[repr(C)]
8418 /// The contents of CResult_NetAddressu8Z
8419 pub union CResult_NetAddressu8ZPtr {
8420         /// A pointer to the contents in the success state.
8421         /// Reading from this pointer when `result_ok` is not set is undefined.
8422         pub result: *mut crate::lightning::ln::msgs::NetAddress,
8423         /// A pointer to the contents in the error state.
8424         /// Reading from this pointer when `result_ok` is set is undefined.
8425         pub err: *mut u8,
8426 }
8427 #[repr(C)]
8428 /// A CResult_NetAddressu8Z represents the result of a fallible operation,
8429 /// containing a crate::lightning::ln::msgs::NetAddress on success and a u8 on failure.
8430 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8431 pub struct CResult_NetAddressu8Z {
8432         /// The contents of this CResult_NetAddressu8Z, accessible via either
8433         /// `err` or `result` depending on the state of `result_ok`.
8434         pub contents: CResult_NetAddressu8ZPtr,
8435         /// Whether this CResult_NetAddressu8Z represents a success state.
8436         pub result_ok: bool,
8437 }
8438 #[no_mangle]
8439 /// Creates a new CResult_NetAddressu8Z in the success state.
8440 pub extern "C" fn CResult_NetAddressu8Z_ok(o: crate::lightning::ln::msgs::NetAddress) -> CResult_NetAddressu8Z {
8441         CResult_NetAddressu8Z {
8442                 contents: CResult_NetAddressu8ZPtr {
8443                         result: Box::into_raw(Box::new(o)),
8444                 },
8445                 result_ok: true,
8446         }
8447 }
8448 #[no_mangle]
8449 /// Creates a new CResult_NetAddressu8Z in the error state.
8450 pub extern "C" fn CResult_NetAddressu8Z_err(e: u8) -> CResult_NetAddressu8Z {
8451         CResult_NetAddressu8Z {
8452                 contents: CResult_NetAddressu8ZPtr {
8453                         err: Box::into_raw(Box::new(e)),
8454                 },
8455                 result_ok: false,
8456         }
8457 }
8458 #[no_mangle]
8459 /// Frees any resources used by the CResult_NetAddressu8Z.
8460 pub extern "C" fn CResult_NetAddressu8Z_free(_res: CResult_NetAddressu8Z) { }
8461 impl Drop for CResult_NetAddressu8Z {
8462         fn drop(&mut self) {
8463                 if self.result_ok {
8464                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
8465                                 let _ = unsafe { Box::from_raw(self.contents.result) };
8466                         }
8467                 } else {
8468                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
8469                                 let _ = unsafe { Box::from_raw(self.contents.err) };
8470                         }
8471                 }
8472         }
8473 }
8474 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::NetAddress, u8>> for CResult_NetAddressu8Z {
8475         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::NetAddress, u8>) -> Self {
8476                 let contents = if o.result_ok {
8477                         let result = unsafe { o.contents.result };
8478                         unsafe { o.contents.result = std::ptr::null_mut() };
8479                         CResult_NetAddressu8ZPtr { result }
8480                 } else {
8481                         let err = unsafe { o.contents.err };
8482                         unsafe { o.contents.err = std::ptr::null_mut(); }
8483                         CResult_NetAddressu8ZPtr { err }
8484                 };
8485                 Self {
8486                         contents,
8487                         result_ok: o.result_ok,
8488                 }
8489         }
8490 }
8491 impl Clone for CResult_NetAddressu8Z {
8492         fn clone(&self) -> Self {
8493                 if self.result_ok {
8494                         Self { result_ok: true, contents: CResult_NetAddressu8ZPtr {
8495                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::NetAddress>::clone(unsafe { &*self.contents.result })))
8496                         } }
8497                 } else {
8498                         Self { result_ok: false, contents: CResult_NetAddressu8ZPtr {
8499                                 err: Box::into_raw(Box::new(<u8>::clone(unsafe { &*self.contents.err })))
8500                         } }
8501                 }
8502         }
8503 }
8504 #[no_mangle]
8505 /// Creates a new CResult_NetAddressu8Z which has the same data as `orig`
8506 /// but with all dynamically-allocated buffers duplicated in new buffers.
8507 pub extern "C" fn CResult_NetAddressu8Z_clone(orig: &CResult_NetAddressu8Z) -> CResult_NetAddressu8Z { Clone::clone(&orig) }
8508 #[repr(C)]
8509 /// The contents of CResult_CResult_NetAddressu8ZDecodeErrorZ
8510 pub union CResult_CResult_NetAddressu8ZDecodeErrorZPtr {
8511         /// A pointer to the contents in the success state.
8512         /// Reading from this pointer when `result_ok` is not set is undefined.
8513         pub result: *mut crate::c_types::derived::CResult_NetAddressu8Z,
8514         /// A pointer to the contents in the error state.
8515         /// Reading from this pointer when `result_ok` is set is undefined.
8516         pub err: *mut crate::lightning::ln::msgs::DecodeError,
8517 }
8518 #[repr(C)]
8519 /// A CResult_CResult_NetAddressu8ZDecodeErrorZ represents the result of a fallible operation,
8520 /// containing a crate::c_types::derived::CResult_NetAddressu8Z on success and a crate::lightning::ln::msgs::DecodeError on failure.
8521 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8522 pub struct CResult_CResult_NetAddressu8ZDecodeErrorZ {
8523         /// The contents of this CResult_CResult_NetAddressu8ZDecodeErrorZ, accessible via either
8524         /// `err` or `result` depending on the state of `result_ok`.
8525         pub contents: CResult_CResult_NetAddressu8ZDecodeErrorZPtr,
8526         /// Whether this CResult_CResult_NetAddressu8ZDecodeErrorZ represents a success state.
8527         pub result_ok: bool,
8528 }
8529 #[no_mangle]
8530 /// Creates a new CResult_CResult_NetAddressu8ZDecodeErrorZ in the success state.
8531 pub extern "C" fn CResult_CResult_NetAddressu8ZDecodeErrorZ_ok(o: crate::c_types::derived::CResult_NetAddressu8Z) -> CResult_CResult_NetAddressu8ZDecodeErrorZ {
8532         CResult_CResult_NetAddressu8ZDecodeErrorZ {
8533                 contents: CResult_CResult_NetAddressu8ZDecodeErrorZPtr {
8534                         result: Box::into_raw(Box::new(o)),
8535                 },
8536                 result_ok: true,
8537         }
8538 }
8539 #[no_mangle]
8540 /// Creates a new CResult_CResult_NetAddressu8ZDecodeErrorZ in the error state.
8541 pub extern "C" fn CResult_CResult_NetAddressu8ZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_CResult_NetAddressu8ZDecodeErrorZ {
8542         CResult_CResult_NetAddressu8ZDecodeErrorZ {
8543                 contents: CResult_CResult_NetAddressu8ZDecodeErrorZPtr {
8544                         err: Box::into_raw(Box::new(e)),
8545                 },
8546                 result_ok: false,
8547         }
8548 }
8549 #[no_mangle]
8550 /// Frees any resources used by the CResult_CResult_NetAddressu8ZDecodeErrorZ.
8551 pub extern "C" fn CResult_CResult_NetAddressu8ZDecodeErrorZ_free(_res: CResult_CResult_NetAddressu8ZDecodeErrorZ) { }
8552 impl Drop for CResult_CResult_NetAddressu8ZDecodeErrorZ {
8553         fn drop(&mut self) {
8554                 if self.result_ok {
8555                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
8556                                 let _ = unsafe { Box::from_raw(self.contents.result) };
8557                         }
8558                 } else {
8559                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
8560                                 let _ = unsafe { Box::from_raw(self.contents.err) };
8561                         }
8562                 }
8563         }
8564 }
8565 impl From<crate::c_types::CResultTempl<crate::c_types::derived::CResult_NetAddressu8Z, crate::lightning::ln::msgs::DecodeError>> for CResult_CResult_NetAddressu8ZDecodeErrorZ {
8566         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CResult_NetAddressu8Z, crate::lightning::ln::msgs::DecodeError>) -> Self {
8567                 let contents = if o.result_ok {
8568                         let result = unsafe { o.contents.result };
8569                         unsafe { o.contents.result = std::ptr::null_mut() };
8570                         CResult_CResult_NetAddressu8ZDecodeErrorZPtr { result }
8571                 } else {
8572                         let err = unsafe { o.contents.err };
8573                         unsafe { o.contents.err = std::ptr::null_mut(); }
8574                         CResult_CResult_NetAddressu8ZDecodeErrorZPtr { err }
8575                 };
8576                 Self {
8577                         contents,
8578                         result_ok: o.result_ok,
8579                 }
8580         }
8581 }
8582 impl Clone for CResult_CResult_NetAddressu8ZDecodeErrorZ {
8583         fn clone(&self) -> Self {
8584                 if self.result_ok {
8585                         Self { result_ok: true, contents: CResult_CResult_NetAddressu8ZDecodeErrorZPtr {
8586                                 result: Box::into_raw(Box::new(<crate::c_types::derived::CResult_NetAddressu8Z>::clone(unsafe { &*self.contents.result })))
8587                         } }
8588                 } else {
8589                         Self { result_ok: false, contents: CResult_CResult_NetAddressu8ZDecodeErrorZPtr {
8590                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
8591                         } }
8592                 }
8593         }
8594 }
8595 #[no_mangle]
8596 /// Creates a new CResult_CResult_NetAddressu8ZDecodeErrorZ which has the same data as `orig`
8597 /// but with all dynamically-allocated buffers duplicated in new buffers.
8598 pub extern "C" fn CResult_CResult_NetAddressu8ZDecodeErrorZ_clone(orig: &CResult_CResult_NetAddressu8ZDecodeErrorZ) -> CResult_CResult_NetAddressu8ZDecodeErrorZ { Clone::clone(&orig) }
8599 #[repr(C)]
8600 /// The contents of CResult_NetAddressDecodeErrorZ
8601 pub union CResult_NetAddressDecodeErrorZPtr {
8602         /// A pointer to the contents in the success state.
8603         /// Reading from this pointer when `result_ok` is not set is undefined.
8604         pub result: *mut crate::lightning::ln::msgs::NetAddress,
8605         /// A pointer to the contents in the error state.
8606         /// Reading from this pointer when `result_ok` is set is undefined.
8607         pub err: *mut crate::lightning::ln::msgs::DecodeError,
8608 }
8609 #[repr(C)]
8610 /// A CResult_NetAddressDecodeErrorZ represents the result of a fallible operation,
8611 /// containing a crate::lightning::ln::msgs::NetAddress on success and a crate::lightning::ln::msgs::DecodeError on failure.
8612 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8613 pub struct CResult_NetAddressDecodeErrorZ {
8614         /// The contents of this CResult_NetAddressDecodeErrorZ, accessible via either
8615         /// `err` or `result` depending on the state of `result_ok`.
8616         pub contents: CResult_NetAddressDecodeErrorZPtr,
8617         /// Whether this CResult_NetAddressDecodeErrorZ represents a success state.
8618         pub result_ok: bool,
8619 }
8620 #[no_mangle]
8621 /// Creates a new CResult_NetAddressDecodeErrorZ in the success state.
8622 pub extern "C" fn CResult_NetAddressDecodeErrorZ_ok(o: crate::lightning::ln::msgs::NetAddress) -> CResult_NetAddressDecodeErrorZ {
8623         CResult_NetAddressDecodeErrorZ {
8624                 contents: CResult_NetAddressDecodeErrorZPtr {
8625                         result: Box::into_raw(Box::new(o)),
8626                 },
8627                 result_ok: true,
8628         }
8629 }
8630 #[no_mangle]
8631 /// Creates a new CResult_NetAddressDecodeErrorZ in the error state.
8632 pub extern "C" fn CResult_NetAddressDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NetAddressDecodeErrorZ {
8633         CResult_NetAddressDecodeErrorZ {
8634                 contents: CResult_NetAddressDecodeErrorZPtr {
8635                         err: Box::into_raw(Box::new(e)),
8636                 },
8637                 result_ok: false,
8638         }
8639 }
8640 #[no_mangle]
8641 /// Frees any resources used by the CResult_NetAddressDecodeErrorZ.
8642 pub extern "C" fn CResult_NetAddressDecodeErrorZ_free(_res: CResult_NetAddressDecodeErrorZ) { }
8643 impl Drop for CResult_NetAddressDecodeErrorZ {
8644         fn drop(&mut self) {
8645                 if self.result_ok {
8646                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
8647                                 let _ = unsafe { Box::from_raw(self.contents.result) };
8648                         }
8649                 } else {
8650                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
8651                                 let _ = unsafe { Box::from_raw(self.contents.err) };
8652                         }
8653                 }
8654         }
8655 }
8656 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::NetAddress, crate::lightning::ln::msgs::DecodeError>> for CResult_NetAddressDecodeErrorZ {
8657         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::NetAddress, crate::lightning::ln::msgs::DecodeError>) -> Self {
8658                 let contents = if o.result_ok {
8659                         let result = unsafe { o.contents.result };
8660                         unsafe { o.contents.result = std::ptr::null_mut() };
8661                         CResult_NetAddressDecodeErrorZPtr { result }
8662                 } else {
8663                         let err = unsafe { o.contents.err };
8664                         unsafe { o.contents.err = std::ptr::null_mut(); }
8665                         CResult_NetAddressDecodeErrorZPtr { err }
8666                 };
8667                 Self {
8668                         contents,
8669                         result_ok: o.result_ok,
8670                 }
8671         }
8672 }
8673 impl Clone for CResult_NetAddressDecodeErrorZ {
8674         fn clone(&self) -> Self {
8675                 if self.result_ok {
8676                         Self { result_ok: true, contents: CResult_NetAddressDecodeErrorZPtr {
8677                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::NetAddress>::clone(unsafe { &*self.contents.result })))
8678                         } }
8679                 } else {
8680                         Self { result_ok: false, contents: CResult_NetAddressDecodeErrorZPtr {
8681                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
8682                         } }
8683                 }
8684         }
8685 }
8686 #[no_mangle]
8687 /// Creates a new CResult_NetAddressDecodeErrorZ which has the same data as `orig`
8688 /// but with all dynamically-allocated buffers duplicated in new buffers.
8689 pub extern "C" fn CResult_NetAddressDecodeErrorZ_clone(orig: &CResult_NetAddressDecodeErrorZ) -> CResult_NetAddressDecodeErrorZ { Clone::clone(&orig) }
8690 #[repr(C)]
8691 /// A dynamically-allocated array of crate::lightning::ln::msgs::UpdateAddHTLCs of arbitrary size.
8692 /// This corresponds to std::vector in C++
8693 pub struct CVec_UpdateAddHTLCZ {
8694         /// The elements in the array.
8695         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
8696         pub data: *mut crate::lightning::ln::msgs::UpdateAddHTLC,
8697         /// The number of elements pointed to by `data`.
8698         pub datalen: usize
8699 }
8700 impl CVec_UpdateAddHTLCZ {
8701         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::UpdateAddHTLC> {
8702                 if self.datalen == 0 { return Vec::new(); }
8703                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
8704                 self.data = std::ptr::null_mut();
8705                 self.datalen = 0;
8706                 ret
8707         }
8708         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::UpdateAddHTLC] {
8709                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
8710         }
8711 }
8712 impl From<Vec<crate::lightning::ln::msgs::UpdateAddHTLC>> for CVec_UpdateAddHTLCZ {
8713         fn from(v: Vec<crate::lightning::ln::msgs::UpdateAddHTLC>) -> Self {
8714                 let datalen = v.len();
8715                 let data = Box::into_raw(v.into_boxed_slice());
8716                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
8717         }
8718 }
8719 #[no_mangle]
8720 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
8721 pub extern "C" fn CVec_UpdateAddHTLCZ_free(_res: CVec_UpdateAddHTLCZ) { }
8722 impl Drop for CVec_UpdateAddHTLCZ {
8723         fn drop(&mut self) {
8724                 if self.datalen == 0 { return; }
8725                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
8726         }
8727 }
8728 impl Clone for CVec_UpdateAddHTLCZ {
8729         fn clone(&self) -> Self {
8730                 let mut res = Vec::new();
8731                 if self.datalen == 0 { return Self::from(res); }
8732                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
8733                 Self::from(res)
8734         }
8735 }
8736 #[repr(C)]
8737 /// A dynamically-allocated array of crate::lightning::ln::msgs::UpdateFulfillHTLCs of arbitrary size.
8738 /// This corresponds to std::vector in C++
8739 pub struct CVec_UpdateFulfillHTLCZ {
8740         /// The elements in the array.
8741         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
8742         pub data: *mut crate::lightning::ln::msgs::UpdateFulfillHTLC,
8743         /// The number of elements pointed to by `data`.
8744         pub datalen: usize
8745 }
8746 impl CVec_UpdateFulfillHTLCZ {
8747         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::UpdateFulfillHTLC> {
8748                 if self.datalen == 0 { return Vec::new(); }
8749                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
8750                 self.data = std::ptr::null_mut();
8751                 self.datalen = 0;
8752                 ret
8753         }
8754         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::UpdateFulfillHTLC] {
8755                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
8756         }
8757 }
8758 impl From<Vec<crate::lightning::ln::msgs::UpdateFulfillHTLC>> for CVec_UpdateFulfillHTLCZ {
8759         fn from(v: Vec<crate::lightning::ln::msgs::UpdateFulfillHTLC>) -> Self {
8760                 let datalen = v.len();
8761                 let data = Box::into_raw(v.into_boxed_slice());
8762                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
8763         }
8764 }
8765 #[no_mangle]
8766 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
8767 pub extern "C" fn CVec_UpdateFulfillHTLCZ_free(_res: CVec_UpdateFulfillHTLCZ) { }
8768 impl Drop for CVec_UpdateFulfillHTLCZ {
8769         fn drop(&mut self) {
8770                 if self.datalen == 0 { return; }
8771                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
8772         }
8773 }
8774 impl Clone for CVec_UpdateFulfillHTLCZ {
8775         fn clone(&self) -> Self {
8776                 let mut res = Vec::new();
8777                 if self.datalen == 0 { return Self::from(res); }
8778                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
8779                 Self::from(res)
8780         }
8781 }
8782 #[repr(C)]
8783 /// A dynamically-allocated array of crate::lightning::ln::msgs::UpdateFailHTLCs of arbitrary size.
8784 /// This corresponds to std::vector in C++
8785 pub struct CVec_UpdateFailHTLCZ {
8786         /// The elements in the array.
8787         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
8788         pub data: *mut crate::lightning::ln::msgs::UpdateFailHTLC,
8789         /// The number of elements pointed to by `data`.
8790         pub datalen: usize
8791 }
8792 impl CVec_UpdateFailHTLCZ {
8793         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::UpdateFailHTLC> {
8794                 if self.datalen == 0 { return Vec::new(); }
8795                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
8796                 self.data = std::ptr::null_mut();
8797                 self.datalen = 0;
8798                 ret
8799         }
8800         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::UpdateFailHTLC] {
8801                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
8802         }
8803 }
8804 impl From<Vec<crate::lightning::ln::msgs::UpdateFailHTLC>> for CVec_UpdateFailHTLCZ {
8805         fn from(v: Vec<crate::lightning::ln::msgs::UpdateFailHTLC>) -> Self {
8806                 let datalen = v.len();
8807                 let data = Box::into_raw(v.into_boxed_slice());
8808                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
8809         }
8810 }
8811 #[no_mangle]
8812 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
8813 pub extern "C" fn CVec_UpdateFailHTLCZ_free(_res: CVec_UpdateFailHTLCZ) { }
8814 impl Drop for CVec_UpdateFailHTLCZ {
8815         fn drop(&mut self) {
8816                 if self.datalen == 0 { return; }
8817                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
8818         }
8819 }
8820 impl Clone for CVec_UpdateFailHTLCZ {
8821         fn clone(&self) -> Self {
8822                 let mut res = Vec::new();
8823                 if self.datalen == 0 { return Self::from(res); }
8824                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
8825                 Self::from(res)
8826         }
8827 }
8828 #[repr(C)]
8829 /// A dynamically-allocated array of crate::lightning::ln::msgs::UpdateFailMalformedHTLCs of arbitrary size.
8830 /// This corresponds to std::vector in C++
8831 pub struct CVec_UpdateFailMalformedHTLCZ {
8832         /// The elements in the array.
8833         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
8834         pub data: *mut crate::lightning::ln::msgs::UpdateFailMalformedHTLC,
8835         /// The number of elements pointed to by `data`.
8836         pub datalen: usize
8837 }
8838 impl CVec_UpdateFailMalformedHTLCZ {
8839         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::UpdateFailMalformedHTLC> {
8840                 if self.datalen == 0 { return Vec::new(); }
8841                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
8842                 self.data = std::ptr::null_mut();
8843                 self.datalen = 0;
8844                 ret
8845         }
8846         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::UpdateFailMalformedHTLC] {
8847                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
8848         }
8849 }
8850 impl From<Vec<crate::lightning::ln::msgs::UpdateFailMalformedHTLC>> for CVec_UpdateFailMalformedHTLCZ {
8851         fn from(v: Vec<crate::lightning::ln::msgs::UpdateFailMalformedHTLC>) -> Self {
8852                 let datalen = v.len();
8853                 let data = Box::into_raw(v.into_boxed_slice());
8854                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
8855         }
8856 }
8857 #[no_mangle]
8858 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
8859 pub extern "C" fn CVec_UpdateFailMalformedHTLCZ_free(_res: CVec_UpdateFailMalformedHTLCZ) { }
8860 impl Drop for CVec_UpdateFailMalformedHTLCZ {
8861         fn drop(&mut self) {
8862                 if self.datalen == 0 { return; }
8863                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
8864         }
8865 }
8866 impl Clone for CVec_UpdateFailMalformedHTLCZ {
8867         fn clone(&self) -> Self {
8868                 let mut res = Vec::new();
8869                 if self.datalen == 0 { return Self::from(res); }
8870                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
8871                 Self::from(res)
8872         }
8873 }
8874 #[repr(C)]
8875 /// The contents of CResult_AcceptChannelDecodeErrorZ
8876 pub union CResult_AcceptChannelDecodeErrorZPtr {
8877         /// A pointer to the contents in the success state.
8878         /// Reading from this pointer when `result_ok` is not set is undefined.
8879         pub result: *mut crate::lightning::ln::msgs::AcceptChannel,
8880         /// A pointer to the contents in the error state.
8881         /// Reading from this pointer when `result_ok` is set is undefined.
8882         pub err: *mut crate::lightning::ln::msgs::DecodeError,
8883 }
8884 #[repr(C)]
8885 /// A CResult_AcceptChannelDecodeErrorZ represents the result of a fallible operation,
8886 /// containing a crate::lightning::ln::msgs::AcceptChannel on success and a crate::lightning::ln::msgs::DecodeError on failure.
8887 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8888 pub struct CResult_AcceptChannelDecodeErrorZ {
8889         /// The contents of this CResult_AcceptChannelDecodeErrorZ, accessible via either
8890         /// `err` or `result` depending on the state of `result_ok`.
8891         pub contents: CResult_AcceptChannelDecodeErrorZPtr,
8892         /// Whether this CResult_AcceptChannelDecodeErrorZ represents a success state.
8893         pub result_ok: bool,
8894 }
8895 #[no_mangle]
8896 /// Creates a new CResult_AcceptChannelDecodeErrorZ in the success state.
8897 pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_ok(o: crate::lightning::ln::msgs::AcceptChannel) -> CResult_AcceptChannelDecodeErrorZ {
8898         CResult_AcceptChannelDecodeErrorZ {
8899                 contents: CResult_AcceptChannelDecodeErrorZPtr {
8900                         result: Box::into_raw(Box::new(o)),
8901                 },
8902                 result_ok: true,
8903         }
8904 }
8905 #[no_mangle]
8906 /// Creates a new CResult_AcceptChannelDecodeErrorZ in the error state.
8907 pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_AcceptChannelDecodeErrorZ {
8908         CResult_AcceptChannelDecodeErrorZ {
8909                 contents: CResult_AcceptChannelDecodeErrorZPtr {
8910                         err: Box::into_raw(Box::new(e)),
8911                 },
8912                 result_ok: false,
8913         }
8914 }
8915 #[no_mangle]
8916 /// Frees any resources used by the CResult_AcceptChannelDecodeErrorZ.
8917 pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_free(_res: CResult_AcceptChannelDecodeErrorZ) { }
8918 impl Drop for CResult_AcceptChannelDecodeErrorZ {
8919         fn drop(&mut self) {
8920                 if self.result_ok {
8921                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
8922                                 let _ = unsafe { Box::from_raw(self.contents.result) };
8923                         }
8924                 } else {
8925                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
8926                                 let _ = unsafe { Box::from_raw(self.contents.err) };
8927                         }
8928                 }
8929         }
8930 }
8931 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::AcceptChannel, crate::lightning::ln::msgs::DecodeError>> for CResult_AcceptChannelDecodeErrorZ {
8932         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::AcceptChannel, crate::lightning::ln::msgs::DecodeError>) -> Self {
8933                 let contents = if o.result_ok {
8934                         let result = unsafe { o.contents.result };
8935                         unsafe { o.contents.result = std::ptr::null_mut() };
8936                         CResult_AcceptChannelDecodeErrorZPtr { result }
8937                 } else {
8938                         let err = unsafe { o.contents.err };
8939                         unsafe { o.contents.err = std::ptr::null_mut(); }
8940                         CResult_AcceptChannelDecodeErrorZPtr { err }
8941                 };
8942                 Self {
8943                         contents,
8944                         result_ok: o.result_ok,
8945                 }
8946         }
8947 }
8948 impl Clone for CResult_AcceptChannelDecodeErrorZ {
8949         fn clone(&self) -> Self {
8950                 if self.result_ok {
8951                         Self { result_ok: true, contents: CResult_AcceptChannelDecodeErrorZPtr {
8952                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::AcceptChannel>::clone(unsafe { &*self.contents.result })))
8953                         } }
8954                 } else {
8955                         Self { result_ok: false, contents: CResult_AcceptChannelDecodeErrorZPtr {
8956                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
8957                         } }
8958                 }
8959         }
8960 }
8961 #[no_mangle]
8962 /// Creates a new CResult_AcceptChannelDecodeErrorZ which has the same data as `orig`
8963 /// but with all dynamically-allocated buffers duplicated in new buffers.
8964 pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_clone(orig: &CResult_AcceptChannelDecodeErrorZ) -> CResult_AcceptChannelDecodeErrorZ { Clone::clone(&orig) }
8965 #[repr(C)]
8966 /// The contents of CResult_AnnouncementSignaturesDecodeErrorZ
8967 pub union CResult_AnnouncementSignaturesDecodeErrorZPtr {
8968         /// A pointer to the contents in the success state.
8969         /// Reading from this pointer when `result_ok` is not set is undefined.
8970         pub result: *mut crate::lightning::ln::msgs::AnnouncementSignatures,
8971         /// A pointer to the contents in the error state.
8972         /// Reading from this pointer when `result_ok` is set is undefined.
8973         pub err: *mut crate::lightning::ln::msgs::DecodeError,
8974 }
8975 #[repr(C)]
8976 /// A CResult_AnnouncementSignaturesDecodeErrorZ represents the result of a fallible operation,
8977 /// containing a crate::lightning::ln::msgs::AnnouncementSignatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
8978 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8979 pub struct CResult_AnnouncementSignaturesDecodeErrorZ {
8980         /// The contents of this CResult_AnnouncementSignaturesDecodeErrorZ, accessible via either
8981         /// `err` or `result` depending on the state of `result_ok`.
8982         pub contents: CResult_AnnouncementSignaturesDecodeErrorZPtr,
8983         /// Whether this CResult_AnnouncementSignaturesDecodeErrorZ represents a success state.
8984         pub result_ok: bool,
8985 }
8986 #[no_mangle]
8987 /// Creates a new CResult_AnnouncementSignaturesDecodeErrorZ in the success state.
8988 pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_ok(o: crate::lightning::ln::msgs::AnnouncementSignatures) -> CResult_AnnouncementSignaturesDecodeErrorZ {
8989         CResult_AnnouncementSignaturesDecodeErrorZ {
8990                 contents: CResult_AnnouncementSignaturesDecodeErrorZPtr {
8991                         result: Box::into_raw(Box::new(o)),
8992                 },
8993                 result_ok: true,
8994         }
8995 }
8996 #[no_mangle]
8997 /// Creates a new CResult_AnnouncementSignaturesDecodeErrorZ in the error state.
8998 pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_AnnouncementSignaturesDecodeErrorZ {
8999         CResult_AnnouncementSignaturesDecodeErrorZ {
9000                 contents: CResult_AnnouncementSignaturesDecodeErrorZPtr {
9001                         err: Box::into_raw(Box::new(e)),
9002                 },
9003                 result_ok: false,
9004         }
9005 }
9006 #[no_mangle]
9007 /// Frees any resources used by the CResult_AnnouncementSignaturesDecodeErrorZ.
9008 pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_free(_res: CResult_AnnouncementSignaturesDecodeErrorZ) { }
9009 impl Drop for CResult_AnnouncementSignaturesDecodeErrorZ {
9010         fn drop(&mut self) {
9011                 if self.result_ok {
9012                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
9013                                 let _ = unsafe { Box::from_raw(self.contents.result) };
9014                         }
9015                 } else {
9016                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
9017                                 let _ = unsafe { Box::from_raw(self.contents.err) };
9018                         }
9019                 }
9020         }
9021 }
9022 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::AnnouncementSignatures, crate::lightning::ln::msgs::DecodeError>> for CResult_AnnouncementSignaturesDecodeErrorZ {
9023         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::AnnouncementSignatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
9024                 let contents = if o.result_ok {
9025                         let result = unsafe { o.contents.result };
9026                         unsafe { o.contents.result = std::ptr::null_mut() };
9027                         CResult_AnnouncementSignaturesDecodeErrorZPtr { result }
9028                 } else {
9029                         let err = unsafe { o.contents.err };
9030                         unsafe { o.contents.err = std::ptr::null_mut(); }
9031                         CResult_AnnouncementSignaturesDecodeErrorZPtr { err }
9032                 };
9033                 Self {
9034                         contents,
9035                         result_ok: o.result_ok,
9036                 }
9037         }
9038 }
9039 impl Clone for CResult_AnnouncementSignaturesDecodeErrorZ {
9040         fn clone(&self) -> Self {
9041                 if self.result_ok {
9042                         Self { result_ok: true, contents: CResult_AnnouncementSignaturesDecodeErrorZPtr {
9043                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::AnnouncementSignatures>::clone(unsafe { &*self.contents.result })))
9044                         } }
9045                 } else {
9046                         Self { result_ok: false, contents: CResult_AnnouncementSignaturesDecodeErrorZPtr {
9047                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
9048                         } }
9049                 }
9050         }
9051 }
9052 #[no_mangle]
9053 /// Creates a new CResult_AnnouncementSignaturesDecodeErrorZ which has the same data as `orig`
9054 /// but with all dynamically-allocated buffers duplicated in new buffers.
9055 pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_clone(orig: &CResult_AnnouncementSignaturesDecodeErrorZ) -> CResult_AnnouncementSignaturesDecodeErrorZ { Clone::clone(&orig) }
9056 #[repr(C)]
9057 /// The contents of CResult_ChannelReestablishDecodeErrorZ
9058 pub union CResult_ChannelReestablishDecodeErrorZPtr {
9059         /// A pointer to the contents in the success state.
9060         /// Reading from this pointer when `result_ok` is not set is undefined.
9061         pub result: *mut crate::lightning::ln::msgs::ChannelReestablish,
9062         /// A pointer to the contents in the error state.
9063         /// Reading from this pointer when `result_ok` is set is undefined.
9064         pub err: *mut crate::lightning::ln::msgs::DecodeError,
9065 }
9066 #[repr(C)]
9067 /// A CResult_ChannelReestablishDecodeErrorZ represents the result of a fallible operation,
9068 /// containing a crate::lightning::ln::msgs::ChannelReestablish on success and a crate::lightning::ln::msgs::DecodeError on failure.
9069 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9070 pub struct CResult_ChannelReestablishDecodeErrorZ {
9071         /// The contents of this CResult_ChannelReestablishDecodeErrorZ, accessible via either
9072         /// `err` or `result` depending on the state of `result_ok`.
9073         pub contents: CResult_ChannelReestablishDecodeErrorZPtr,
9074         /// Whether this CResult_ChannelReestablishDecodeErrorZ represents a success state.
9075         pub result_ok: bool,
9076 }
9077 #[no_mangle]
9078 /// Creates a new CResult_ChannelReestablishDecodeErrorZ in the success state.
9079 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ChannelReestablish) -> CResult_ChannelReestablishDecodeErrorZ {
9080         CResult_ChannelReestablishDecodeErrorZ {
9081                 contents: CResult_ChannelReestablishDecodeErrorZPtr {
9082                         result: Box::into_raw(Box::new(o)),
9083                 },
9084                 result_ok: true,
9085         }
9086 }
9087 #[no_mangle]
9088 /// Creates a new CResult_ChannelReestablishDecodeErrorZ in the error state.
9089 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelReestablishDecodeErrorZ {
9090         CResult_ChannelReestablishDecodeErrorZ {
9091                 contents: CResult_ChannelReestablishDecodeErrorZPtr {
9092                         err: Box::into_raw(Box::new(e)),
9093                 },
9094                 result_ok: false,
9095         }
9096 }
9097 #[no_mangle]
9098 /// Frees any resources used by the CResult_ChannelReestablishDecodeErrorZ.
9099 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_free(_res: CResult_ChannelReestablishDecodeErrorZ) { }
9100 impl Drop for CResult_ChannelReestablishDecodeErrorZ {
9101         fn drop(&mut self) {
9102                 if self.result_ok {
9103                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
9104                                 let _ = unsafe { Box::from_raw(self.contents.result) };
9105                         }
9106                 } else {
9107                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
9108                                 let _ = unsafe { Box::from_raw(self.contents.err) };
9109                         }
9110                 }
9111         }
9112 }
9113 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelReestablish, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelReestablishDecodeErrorZ {
9114         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelReestablish, crate::lightning::ln::msgs::DecodeError>) -> Self {
9115                 let contents = if o.result_ok {
9116                         let result = unsafe { o.contents.result };
9117                         unsafe { o.contents.result = std::ptr::null_mut() };
9118                         CResult_ChannelReestablishDecodeErrorZPtr { result }
9119                 } else {
9120                         let err = unsafe { o.contents.err };
9121                         unsafe { o.contents.err = std::ptr::null_mut(); }
9122                         CResult_ChannelReestablishDecodeErrorZPtr { err }
9123                 };
9124                 Self {
9125                         contents,
9126                         result_ok: o.result_ok,
9127                 }
9128         }
9129 }
9130 impl Clone for CResult_ChannelReestablishDecodeErrorZ {
9131         fn clone(&self) -> Self {
9132                 if self.result_ok {
9133                         Self { result_ok: true, contents: CResult_ChannelReestablishDecodeErrorZPtr {
9134                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ChannelReestablish>::clone(unsafe { &*self.contents.result })))
9135                         } }
9136                 } else {
9137                         Self { result_ok: false, contents: CResult_ChannelReestablishDecodeErrorZPtr {
9138                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
9139                         } }
9140                 }
9141         }
9142 }
9143 #[no_mangle]
9144 /// Creates a new CResult_ChannelReestablishDecodeErrorZ which has the same data as `orig`
9145 /// but with all dynamically-allocated buffers duplicated in new buffers.
9146 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_clone(orig: &CResult_ChannelReestablishDecodeErrorZ) -> CResult_ChannelReestablishDecodeErrorZ { Clone::clone(&orig) }
9147 #[repr(C)]
9148 /// The contents of CResult_ClosingSignedDecodeErrorZ
9149 pub union CResult_ClosingSignedDecodeErrorZPtr {
9150         /// A pointer to the contents in the success state.
9151         /// Reading from this pointer when `result_ok` is not set is undefined.
9152         pub result: *mut crate::lightning::ln::msgs::ClosingSigned,
9153         /// A pointer to the contents in the error state.
9154         /// Reading from this pointer when `result_ok` is set is undefined.
9155         pub err: *mut crate::lightning::ln::msgs::DecodeError,
9156 }
9157 #[repr(C)]
9158 /// A CResult_ClosingSignedDecodeErrorZ represents the result of a fallible operation,
9159 /// containing a crate::lightning::ln::msgs::ClosingSigned on success and a crate::lightning::ln::msgs::DecodeError on failure.
9160 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9161 pub struct CResult_ClosingSignedDecodeErrorZ {
9162         /// The contents of this CResult_ClosingSignedDecodeErrorZ, accessible via either
9163         /// `err` or `result` depending on the state of `result_ok`.
9164         pub contents: CResult_ClosingSignedDecodeErrorZPtr,
9165         /// Whether this CResult_ClosingSignedDecodeErrorZ represents a success state.
9166         pub result_ok: bool,
9167 }
9168 #[no_mangle]
9169 /// Creates a new CResult_ClosingSignedDecodeErrorZ in the success state.
9170 pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ClosingSigned) -> CResult_ClosingSignedDecodeErrorZ {
9171         CResult_ClosingSignedDecodeErrorZ {
9172                 contents: CResult_ClosingSignedDecodeErrorZPtr {
9173                         result: Box::into_raw(Box::new(o)),
9174                 },
9175                 result_ok: true,
9176         }
9177 }
9178 #[no_mangle]
9179 /// Creates a new CResult_ClosingSignedDecodeErrorZ in the error state.
9180 pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ClosingSignedDecodeErrorZ {
9181         CResult_ClosingSignedDecodeErrorZ {
9182                 contents: CResult_ClosingSignedDecodeErrorZPtr {
9183                         err: Box::into_raw(Box::new(e)),
9184                 },
9185                 result_ok: false,
9186         }
9187 }
9188 #[no_mangle]
9189 /// Frees any resources used by the CResult_ClosingSignedDecodeErrorZ.
9190 pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_free(_res: CResult_ClosingSignedDecodeErrorZ) { }
9191 impl Drop for CResult_ClosingSignedDecodeErrorZ {
9192         fn drop(&mut self) {
9193                 if self.result_ok {
9194                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
9195                                 let _ = unsafe { Box::from_raw(self.contents.result) };
9196                         }
9197                 } else {
9198                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
9199                                 let _ = unsafe { Box::from_raw(self.contents.err) };
9200                         }
9201                 }
9202         }
9203 }
9204 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ClosingSigned, crate::lightning::ln::msgs::DecodeError>> for CResult_ClosingSignedDecodeErrorZ {
9205         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ClosingSigned, crate::lightning::ln::msgs::DecodeError>) -> Self {
9206                 let contents = if o.result_ok {
9207                         let result = unsafe { o.contents.result };
9208                         unsafe { o.contents.result = std::ptr::null_mut() };
9209                         CResult_ClosingSignedDecodeErrorZPtr { result }
9210                 } else {
9211                         let err = unsafe { o.contents.err };
9212                         unsafe { o.contents.err = std::ptr::null_mut(); }
9213                         CResult_ClosingSignedDecodeErrorZPtr { err }
9214                 };
9215                 Self {
9216                         contents,
9217                         result_ok: o.result_ok,
9218                 }
9219         }
9220 }
9221 impl Clone for CResult_ClosingSignedDecodeErrorZ {
9222         fn clone(&self) -> Self {
9223                 if self.result_ok {
9224                         Self { result_ok: true, contents: CResult_ClosingSignedDecodeErrorZPtr {
9225                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ClosingSigned>::clone(unsafe { &*self.contents.result })))
9226                         } }
9227                 } else {
9228                         Self { result_ok: false, contents: CResult_ClosingSignedDecodeErrorZPtr {
9229                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
9230                         } }
9231                 }
9232         }
9233 }
9234 #[no_mangle]
9235 /// Creates a new CResult_ClosingSignedDecodeErrorZ which has the same data as `orig`
9236 /// but with all dynamically-allocated buffers duplicated in new buffers.
9237 pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_clone(orig: &CResult_ClosingSignedDecodeErrorZ) -> CResult_ClosingSignedDecodeErrorZ { Clone::clone(&orig) }
9238 #[repr(C)]
9239 /// The contents of CResult_ClosingSignedFeeRangeDecodeErrorZ
9240 pub union CResult_ClosingSignedFeeRangeDecodeErrorZPtr {
9241         /// A pointer to the contents in the success state.
9242         /// Reading from this pointer when `result_ok` is not set is undefined.
9243         pub result: *mut crate::lightning::ln::msgs::ClosingSignedFeeRange,
9244         /// A pointer to the contents in the error state.
9245         /// Reading from this pointer when `result_ok` is set is undefined.
9246         pub err: *mut crate::lightning::ln::msgs::DecodeError,
9247 }
9248 #[repr(C)]
9249 /// A CResult_ClosingSignedFeeRangeDecodeErrorZ represents the result of a fallible operation,
9250 /// containing a crate::lightning::ln::msgs::ClosingSignedFeeRange on success and a crate::lightning::ln::msgs::DecodeError on failure.
9251 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9252 pub struct CResult_ClosingSignedFeeRangeDecodeErrorZ {
9253         /// The contents of this CResult_ClosingSignedFeeRangeDecodeErrorZ, accessible via either
9254         /// `err` or `result` depending on the state of `result_ok`.
9255         pub contents: CResult_ClosingSignedFeeRangeDecodeErrorZPtr,
9256         /// Whether this CResult_ClosingSignedFeeRangeDecodeErrorZ represents a success state.
9257         pub result_ok: bool,
9258 }
9259 #[no_mangle]
9260 /// Creates a new CResult_ClosingSignedFeeRangeDecodeErrorZ in the success state.
9261 pub extern "C" fn CResult_ClosingSignedFeeRangeDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ClosingSignedFeeRange) -> CResult_ClosingSignedFeeRangeDecodeErrorZ {
9262         CResult_ClosingSignedFeeRangeDecodeErrorZ {
9263                 contents: CResult_ClosingSignedFeeRangeDecodeErrorZPtr {
9264                         result: Box::into_raw(Box::new(o)),
9265                 },
9266                 result_ok: true,
9267         }
9268 }
9269 #[no_mangle]
9270 /// Creates a new CResult_ClosingSignedFeeRangeDecodeErrorZ in the error state.
9271 pub extern "C" fn CResult_ClosingSignedFeeRangeDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ClosingSignedFeeRangeDecodeErrorZ {
9272         CResult_ClosingSignedFeeRangeDecodeErrorZ {
9273                 contents: CResult_ClosingSignedFeeRangeDecodeErrorZPtr {
9274                         err: Box::into_raw(Box::new(e)),
9275                 },
9276                 result_ok: false,
9277         }
9278 }
9279 #[no_mangle]
9280 /// Frees any resources used by the CResult_ClosingSignedFeeRangeDecodeErrorZ.
9281 pub extern "C" fn CResult_ClosingSignedFeeRangeDecodeErrorZ_free(_res: CResult_ClosingSignedFeeRangeDecodeErrorZ) { }
9282 impl Drop for CResult_ClosingSignedFeeRangeDecodeErrorZ {
9283         fn drop(&mut self) {
9284                 if self.result_ok {
9285                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
9286                                 let _ = unsafe { Box::from_raw(self.contents.result) };
9287                         }
9288                 } else {
9289                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
9290                                 let _ = unsafe { Box::from_raw(self.contents.err) };
9291                         }
9292                 }
9293         }
9294 }
9295 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ClosingSignedFeeRange, crate::lightning::ln::msgs::DecodeError>> for CResult_ClosingSignedFeeRangeDecodeErrorZ {
9296         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ClosingSignedFeeRange, crate::lightning::ln::msgs::DecodeError>) -> Self {
9297                 let contents = if o.result_ok {
9298                         let result = unsafe { o.contents.result };
9299                         unsafe { o.contents.result = std::ptr::null_mut() };
9300                         CResult_ClosingSignedFeeRangeDecodeErrorZPtr { result }
9301                 } else {
9302                         let err = unsafe { o.contents.err };
9303                         unsafe { o.contents.err = std::ptr::null_mut(); }
9304                         CResult_ClosingSignedFeeRangeDecodeErrorZPtr { err }
9305                 };
9306                 Self {
9307                         contents,
9308                         result_ok: o.result_ok,
9309                 }
9310         }
9311 }
9312 impl Clone for CResult_ClosingSignedFeeRangeDecodeErrorZ {
9313         fn clone(&self) -> Self {
9314                 if self.result_ok {
9315                         Self { result_ok: true, contents: CResult_ClosingSignedFeeRangeDecodeErrorZPtr {
9316                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ClosingSignedFeeRange>::clone(unsafe { &*self.contents.result })))
9317                         } }
9318                 } else {
9319                         Self { result_ok: false, contents: CResult_ClosingSignedFeeRangeDecodeErrorZPtr {
9320                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
9321                         } }
9322                 }
9323         }
9324 }
9325 #[no_mangle]
9326 /// Creates a new CResult_ClosingSignedFeeRangeDecodeErrorZ which has the same data as `orig`
9327 /// but with all dynamically-allocated buffers duplicated in new buffers.
9328 pub extern "C" fn CResult_ClosingSignedFeeRangeDecodeErrorZ_clone(orig: &CResult_ClosingSignedFeeRangeDecodeErrorZ) -> CResult_ClosingSignedFeeRangeDecodeErrorZ { Clone::clone(&orig) }
9329 #[repr(C)]
9330 /// The contents of CResult_CommitmentSignedDecodeErrorZ
9331 pub union CResult_CommitmentSignedDecodeErrorZPtr {
9332         /// A pointer to the contents in the success state.
9333         /// Reading from this pointer when `result_ok` is not set is undefined.
9334         pub result: *mut crate::lightning::ln::msgs::CommitmentSigned,
9335         /// A pointer to the contents in the error state.
9336         /// Reading from this pointer when `result_ok` is set is undefined.
9337         pub err: *mut crate::lightning::ln::msgs::DecodeError,
9338 }
9339 #[repr(C)]
9340 /// A CResult_CommitmentSignedDecodeErrorZ represents the result of a fallible operation,
9341 /// containing a crate::lightning::ln::msgs::CommitmentSigned on success and a crate::lightning::ln::msgs::DecodeError on failure.
9342 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9343 pub struct CResult_CommitmentSignedDecodeErrorZ {
9344         /// The contents of this CResult_CommitmentSignedDecodeErrorZ, accessible via either
9345         /// `err` or `result` depending on the state of `result_ok`.
9346         pub contents: CResult_CommitmentSignedDecodeErrorZPtr,
9347         /// Whether this CResult_CommitmentSignedDecodeErrorZ represents a success state.
9348         pub result_ok: bool,
9349 }
9350 #[no_mangle]
9351 /// Creates a new CResult_CommitmentSignedDecodeErrorZ in the success state.
9352 pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_ok(o: crate::lightning::ln::msgs::CommitmentSigned) -> CResult_CommitmentSignedDecodeErrorZ {
9353         CResult_CommitmentSignedDecodeErrorZ {
9354                 contents: CResult_CommitmentSignedDecodeErrorZPtr {
9355                         result: Box::into_raw(Box::new(o)),
9356                 },
9357                 result_ok: true,
9358         }
9359 }
9360 #[no_mangle]
9361 /// Creates a new CResult_CommitmentSignedDecodeErrorZ in the error state.
9362 pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_CommitmentSignedDecodeErrorZ {
9363         CResult_CommitmentSignedDecodeErrorZ {
9364                 contents: CResult_CommitmentSignedDecodeErrorZPtr {
9365                         err: Box::into_raw(Box::new(e)),
9366                 },
9367                 result_ok: false,
9368         }
9369 }
9370 #[no_mangle]
9371 /// Frees any resources used by the CResult_CommitmentSignedDecodeErrorZ.
9372 pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_free(_res: CResult_CommitmentSignedDecodeErrorZ) { }
9373 impl Drop for CResult_CommitmentSignedDecodeErrorZ {
9374         fn drop(&mut self) {
9375                 if self.result_ok {
9376                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
9377                                 let _ = unsafe { Box::from_raw(self.contents.result) };
9378                         }
9379                 } else {
9380                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
9381                                 let _ = unsafe { Box::from_raw(self.contents.err) };
9382                         }
9383                 }
9384         }
9385 }
9386 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::CommitmentSigned, crate::lightning::ln::msgs::DecodeError>> for CResult_CommitmentSignedDecodeErrorZ {
9387         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::CommitmentSigned, crate::lightning::ln::msgs::DecodeError>) -> Self {
9388                 let contents = if o.result_ok {
9389                         let result = unsafe { o.contents.result };
9390                         unsafe { o.contents.result = std::ptr::null_mut() };
9391                         CResult_CommitmentSignedDecodeErrorZPtr { result }
9392                 } else {
9393                         let err = unsafe { o.contents.err };
9394                         unsafe { o.contents.err = std::ptr::null_mut(); }
9395                         CResult_CommitmentSignedDecodeErrorZPtr { err }
9396                 };
9397                 Self {
9398                         contents,
9399                         result_ok: o.result_ok,
9400                 }
9401         }
9402 }
9403 impl Clone for CResult_CommitmentSignedDecodeErrorZ {
9404         fn clone(&self) -> Self {
9405                 if self.result_ok {
9406                         Self { result_ok: true, contents: CResult_CommitmentSignedDecodeErrorZPtr {
9407                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::CommitmentSigned>::clone(unsafe { &*self.contents.result })))
9408                         } }
9409                 } else {
9410                         Self { result_ok: false, contents: CResult_CommitmentSignedDecodeErrorZPtr {
9411                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
9412                         } }
9413                 }
9414         }
9415 }
9416 #[no_mangle]
9417 /// Creates a new CResult_CommitmentSignedDecodeErrorZ which has the same data as `orig`
9418 /// but with all dynamically-allocated buffers duplicated in new buffers.
9419 pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_clone(orig: &CResult_CommitmentSignedDecodeErrorZ) -> CResult_CommitmentSignedDecodeErrorZ { Clone::clone(&orig) }
9420 #[repr(C)]
9421 /// The contents of CResult_FundingCreatedDecodeErrorZ
9422 pub union CResult_FundingCreatedDecodeErrorZPtr {
9423         /// A pointer to the contents in the success state.
9424         /// Reading from this pointer when `result_ok` is not set is undefined.
9425         pub result: *mut crate::lightning::ln::msgs::FundingCreated,
9426         /// A pointer to the contents in the error state.
9427         /// Reading from this pointer when `result_ok` is set is undefined.
9428         pub err: *mut crate::lightning::ln::msgs::DecodeError,
9429 }
9430 #[repr(C)]
9431 /// A CResult_FundingCreatedDecodeErrorZ represents the result of a fallible operation,
9432 /// containing a crate::lightning::ln::msgs::FundingCreated on success and a crate::lightning::ln::msgs::DecodeError on failure.
9433 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9434 pub struct CResult_FundingCreatedDecodeErrorZ {
9435         /// The contents of this CResult_FundingCreatedDecodeErrorZ, accessible via either
9436         /// `err` or `result` depending on the state of `result_ok`.
9437         pub contents: CResult_FundingCreatedDecodeErrorZPtr,
9438         /// Whether this CResult_FundingCreatedDecodeErrorZ represents a success state.
9439         pub result_ok: bool,
9440 }
9441 #[no_mangle]
9442 /// Creates a new CResult_FundingCreatedDecodeErrorZ in the success state.
9443 pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_ok(o: crate::lightning::ln::msgs::FundingCreated) -> CResult_FundingCreatedDecodeErrorZ {
9444         CResult_FundingCreatedDecodeErrorZ {
9445                 contents: CResult_FundingCreatedDecodeErrorZPtr {
9446                         result: Box::into_raw(Box::new(o)),
9447                 },
9448                 result_ok: true,
9449         }
9450 }
9451 #[no_mangle]
9452 /// Creates a new CResult_FundingCreatedDecodeErrorZ in the error state.
9453 pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_FundingCreatedDecodeErrorZ {
9454         CResult_FundingCreatedDecodeErrorZ {
9455                 contents: CResult_FundingCreatedDecodeErrorZPtr {
9456                         err: Box::into_raw(Box::new(e)),
9457                 },
9458                 result_ok: false,
9459         }
9460 }
9461 #[no_mangle]
9462 /// Frees any resources used by the CResult_FundingCreatedDecodeErrorZ.
9463 pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_free(_res: CResult_FundingCreatedDecodeErrorZ) { }
9464 impl Drop for CResult_FundingCreatedDecodeErrorZ {
9465         fn drop(&mut self) {
9466                 if self.result_ok {
9467                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
9468                                 let _ = unsafe { Box::from_raw(self.contents.result) };
9469                         }
9470                 } else {
9471                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
9472                                 let _ = unsafe { Box::from_raw(self.contents.err) };
9473                         }
9474                 }
9475         }
9476 }
9477 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::FundingCreated, crate::lightning::ln::msgs::DecodeError>> for CResult_FundingCreatedDecodeErrorZ {
9478         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::FundingCreated, crate::lightning::ln::msgs::DecodeError>) -> Self {
9479                 let contents = if o.result_ok {
9480                         let result = unsafe { o.contents.result };
9481                         unsafe { o.contents.result = std::ptr::null_mut() };
9482                         CResult_FundingCreatedDecodeErrorZPtr { result }
9483                 } else {
9484                         let err = unsafe { o.contents.err };
9485                         unsafe { o.contents.err = std::ptr::null_mut(); }
9486                         CResult_FundingCreatedDecodeErrorZPtr { err }
9487                 };
9488                 Self {
9489                         contents,
9490                         result_ok: o.result_ok,
9491                 }
9492         }
9493 }
9494 impl Clone for CResult_FundingCreatedDecodeErrorZ {
9495         fn clone(&self) -> Self {
9496                 if self.result_ok {
9497                         Self { result_ok: true, contents: CResult_FundingCreatedDecodeErrorZPtr {
9498                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::FundingCreated>::clone(unsafe { &*self.contents.result })))
9499                         } }
9500                 } else {
9501                         Self { result_ok: false, contents: CResult_FundingCreatedDecodeErrorZPtr {
9502                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
9503                         } }
9504                 }
9505         }
9506 }
9507 #[no_mangle]
9508 /// Creates a new CResult_FundingCreatedDecodeErrorZ which has the same data as `orig`
9509 /// but with all dynamically-allocated buffers duplicated in new buffers.
9510 pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_clone(orig: &CResult_FundingCreatedDecodeErrorZ) -> CResult_FundingCreatedDecodeErrorZ { Clone::clone(&orig) }
9511 #[repr(C)]
9512 /// The contents of CResult_FundingSignedDecodeErrorZ
9513 pub union CResult_FundingSignedDecodeErrorZPtr {
9514         /// A pointer to the contents in the success state.
9515         /// Reading from this pointer when `result_ok` is not set is undefined.
9516         pub result: *mut crate::lightning::ln::msgs::FundingSigned,
9517         /// A pointer to the contents in the error state.
9518         /// Reading from this pointer when `result_ok` is set is undefined.
9519         pub err: *mut crate::lightning::ln::msgs::DecodeError,
9520 }
9521 #[repr(C)]
9522 /// A CResult_FundingSignedDecodeErrorZ represents the result of a fallible operation,
9523 /// containing a crate::lightning::ln::msgs::FundingSigned on success and a crate::lightning::ln::msgs::DecodeError on failure.
9524 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9525 pub struct CResult_FundingSignedDecodeErrorZ {
9526         /// The contents of this CResult_FundingSignedDecodeErrorZ, accessible via either
9527         /// `err` or `result` depending on the state of `result_ok`.
9528         pub contents: CResult_FundingSignedDecodeErrorZPtr,
9529         /// Whether this CResult_FundingSignedDecodeErrorZ represents a success state.
9530         pub result_ok: bool,
9531 }
9532 #[no_mangle]
9533 /// Creates a new CResult_FundingSignedDecodeErrorZ in the success state.
9534 pub extern "C" fn CResult_FundingSignedDecodeErrorZ_ok(o: crate::lightning::ln::msgs::FundingSigned) -> CResult_FundingSignedDecodeErrorZ {
9535         CResult_FundingSignedDecodeErrorZ {
9536                 contents: CResult_FundingSignedDecodeErrorZPtr {
9537                         result: Box::into_raw(Box::new(o)),
9538                 },
9539                 result_ok: true,
9540         }
9541 }
9542 #[no_mangle]
9543 /// Creates a new CResult_FundingSignedDecodeErrorZ in the error state.
9544 pub extern "C" fn CResult_FundingSignedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_FundingSignedDecodeErrorZ {
9545         CResult_FundingSignedDecodeErrorZ {
9546                 contents: CResult_FundingSignedDecodeErrorZPtr {
9547                         err: Box::into_raw(Box::new(e)),
9548                 },
9549                 result_ok: false,
9550         }
9551 }
9552 #[no_mangle]
9553 /// Frees any resources used by the CResult_FundingSignedDecodeErrorZ.
9554 pub extern "C" fn CResult_FundingSignedDecodeErrorZ_free(_res: CResult_FundingSignedDecodeErrorZ) { }
9555 impl Drop for CResult_FundingSignedDecodeErrorZ {
9556         fn drop(&mut self) {
9557                 if self.result_ok {
9558                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
9559                                 let _ = unsafe { Box::from_raw(self.contents.result) };
9560                         }
9561                 } else {
9562                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
9563                                 let _ = unsafe { Box::from_raw(self.contents.err) };
9564                         }
9565                 }
9566         }
9567 }
9568 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::FundingSigned, crate::lightning::ln::msgs::DecodeError>> for CResult_FundingSignedDecodeErrorZ {
9569         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::FundingSigned, crate::lightning::ln::msgs::DecodeError>) -> Self {
9570                 let contents = if o.result_ok {
9571                         let result = unsafe { o.contents.result };
9572                         unsafe { o.contents.result = std::ptr::null_mut() };
9573                         CResult_FundingSignedDecodeErrorZPtr { result }
9574                 } else {
9575                         let err = unsafe { o.contents.err };
9576                         unsafe { o.contents.err = std::ptr::null_mut(); }
9577                         CResult_FundingSignedDecodeErrorZPtr { err }
9578                 };
9579                 Self {
9580                         contents,
9581                         result_ok: o.result_ok,
9582                 }
9583         }
9584 }
9585 impl Clone for CResult_FundingSignedDecodeErrorZ {
9586         fn clone(&self) -> Self {
9587                 if self.result_ok {
9588                         Self { result_ok: true, contents: CResult_FundingSignedDecodeErrorZPtr {
9589                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::FundingSigned>::clone(unsafe { &*self.contents.result })))
9590                         } }
9591                 } else {
9592                         Self { result_ok: false, contents: CResult_FundingSignedDecodeErrorZPtr {
9593                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
9594                         } }
9595                 }
9596         }
9597 }
9598 #[no_mangle]
9599 /// Creates a new CResult_FundingSignedDecodeErrorZ which has the same data as `orig`
9600 /// but with all dynamically-allocated buffers duplicated in new buffers.
9601 pub extern "C" fn CResult_FundingSignedDecodeErrorZ_clone(orig: &CResult_FundingSignedDecodeErrorZ) -> CResult_FundingSignedDecodeErrorZ { Clone::clone(&orig) }
9602 #[repr(C)]
9603 /// The contents of CResult_FundingLockedDecodeErrorZ
9604 pub union CResult_FundingLockedDecodeErrorZPtr {
9605         /// A pointer to the contents in the success state.
9606         /// Reading from this pointer when `result_ok` is not set is undefined.
9607         pub result: *mut crate::lightning::ln::msgs::FundingLocked,
9608         /// A pointer to the contents in the error state.
9609         /// Reading from this pointer when `result_ok` is set is undefined.
9610         pub err: *mut crate::lightning::ln::msgs::DecodeError,
9611 }
9612 #[repr(C)]
9613 /// A CResult_FundingLockedDecodeErrorZ represents the result of a fallible operation,
9614 /// containing a crate::lightning::ln::msgs::FundingLocked on success and a crate::lightning::ln::msgs::DecodeError on failure.
9615 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9616 pub struct CResult_FundingLockedDecodeErrorZ {
9617         /// The contents of this CResult_FundingLockedDecodeErrorZ, accessible via either
9618         /// `err` or `result` depending on the state of `result_ok`.
9619         pub contents: CResult_FundingLockedDecodeErrorZPtr,
9620         /// Whether this CResult_FundingLockedDecodeErrorZ represents a success state.
9621         pub result_ok: bool,
9622 }
9623 #[no_mangle]
9624 /// Creates a new CResult_FundingLockedDecodeErrorZ in the success state.
9625 pub extern "C" fn CResult_FundingLockedDecodeErrorZ_ok(o: crate::lightning::ln::msgs::FundingLocked) -> CResult_FundingLockedDecodeErrorZ {
9626         CResult_FundingLockedDecodeErrorZ {
9627                 contents: CResult_FundingLockedDecodeErrorZPtr {
9628                         result: Box::into_raw(Box::new(o)),
9629                 },
9630                 result_ok: true,
9631         }
9632 }
9633 #[no_mangle]
9634 /// Creates a new CResult_FundingLockedDecodeErrorZ in the error state.
9635 pub extern "C" fn CResult_FundingLockedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_FundingLockedDecodeErrorZ {
9636         CResult_FundingLockedDecodeErrorZ {
9637                 contents: CResult_FundingLockedDecodeErrorZPtr {
9638                         err: Box::into_raw(Box::new(e)),
9639                 },
9640                 result_ok: false,
9641         }
9642 }
9643 #[no_mangle]
9644 /// Frees any resources used by the CResult_FundingLockedDecodeErrorZ.
9645 pub extern "C" fn CResult_FundingLockedDecodeErrorZ_free(_res: CResult_FundingLockedDecodeErrorZ) { }
9646 impl Drop for CResult_FundingLockedDecodeErrorZ {
9647         fn drop(&mut self) {
9648                 if self.result_ok {
9649                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
9650                                 let _ = unsafe { Box::from_raw(self.contents.result) };
9651                         }
9652                 } else {
9653                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
9654                                 let _ = unsafe { Box::from_raw(self.contents.err) };
9655                         }
9656                 }
9657         }
9658 }
9659 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::FundingLocked, crate::lightning::ln::msgs::DecodeError>> for CResult_FundingLockedDecodeErrorZ {
9660         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::FundingLocked, crate::lightning::ln::msgs::DecodeError>) -> Self {
9661                 let contents = if o.result_ok {
9662                         let result = unsafe { o.contents.result };
9663                         unsafe { o.contents.result = std::ptr::null_mut() };
9664                         CResult_FundingLockedDecodeErrorZPtr { result }
9665                 } else {
9666                         let err = unsafe { o.contents.err };
9667                         unsafe { o.contents.err = std::ptr::null_mut(); }
9668                         CResult_FundingLockedDecodeErrorZPtr { err }
9669                 };
9670                 Self {
9671                         contents,
9672                         result_ok: o.result_ok,
9673                 }
9674         }
9675 }
9676 impl Clone for CResult_FundingLockedDecodeErrorZ {
9677         fn clone(&self) -> Self {
9678                 if self.result_ok {
9679                         Self { result_ok: true, contents: CResult_FundingLockedDecodeErrorZPtr {
9680                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::FundingLocked>::clone(unsafe { &*self.contents.result })))
9681                         } }
9682                 } else {
9683                         Self { result_ok: false, contents: CResult_FundingLockedDecodeErrorZPtr {
9684                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
9685                         } }
9686                 }
9687         }
9688 }
9689 #[no_mangle]
9690 /// Creates a new CResult_FundingLockedDecodeErrorZ which has the same data as `orig`
9691 /// but with all dynamically-allocated buffers duplicated in new buffers.
9692 pub extern "C" fn CResult_FundingLockedDecodeErrorZ_clone(orig: &CResult_FundingLockedDecodeErrorZ) -> CResult_FundingLockedDecodeErrorZ { Clone::clone(&orig) }
9693 #[repr(C)]
9694 /// The contents of CResult_InitDecodeErrorZ
9695 pub union CResult_InitDecodeErrorZPtr {
9696         /// A pointer to the contents in the success state.
9697         /// Reading from this pointer when `result_ok` is not set is undefined.
9698         pub result: *mut crate::lightning::ln::msgs::Init,
9699         /// A pointer to the contents in the error state.
9700         /// Reading from this pointer when `result_ok` is set is undefined.
9701         pub err: *mut crate::lightning::ln::msgs::DecodeError,
9702 }
9703 #[repr(C)]
9704 /// A CResult_InitDecodeErrorZ represents the result of a fallible operation,
9705 /// containing a crate::lightning::ln::msgs::Init on success and a crate::lightning::ln::msgs::DecodeError on failure.
9706 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9707 pub struct CResult_InitDecodeErrorZ {
9708         /// The contents of this CResult_InitDecodeErrorZ, accessible via either
9709         /// `err` or `result` depending on the state of `result_ok`.
9710         pub contents: CResult_InitDecodeErrorZPtr,
9711         /// Whether this CResult_InitDecodeErrorZ represents a success state.
9712         pub result_ok: bool,
9713 }
9714 #[no_mangle]
9715 /// Creates a new CResult_InitDecodeErrorZ in the success state.
9716 pub extern "C" fn CResult_InitDecodeErrorZ_ok(o: crate::lightning::ln::msgs::Init) -> CResult_InitDecodeErrorZ {
9717         CResult_InitDecodeErrorZ {
9718                 contents: CResult_InitDecodeErrorZPtr {
9719                         result: Box::into_raw(Box::new(o)),
9720                 },
9721                 result_ok: true,
9722         }
9723 }
9724 #[no_mangle]
9725 /// Creates a new CResult_InitDecodeErrorZ in the error state.
9726 pub extern "C" fn CResult_InitDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_InitDecodeErrorZ {
9727         CResult_InitDecodeErrorZ {
9728                 contents: CResult_InitDecodeErrorZPtr {
9729                         err: Box::into_raw(Box::new(e)),
9730                 },
9731                 result_ok: false,
9732         }
9733 }
9734 #[no_mangle]
9735 /// Frees any resources used by the CResult_InitDecodeErrorZ.
9736 pub extern "C" fn CResult_InitDecodeErrorZ_free(_res: CResult_InitDecodeErrorZ) { }
9737 impl Drop for CResult_InitDecodeErrorZ {
9738         fn drop(&mut self) {
9739                 if self.result_ok {
9740                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
9741                                 let _ = unsafe { Box::from_raw(self.contents.result) };
9742                         }
9743                 } else {
9744                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
9745                                 let _ = unsafe { Box::from_raw(self.contents.err) };
9746                         }
9747                 }
9748         }
9749 }
9750 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::Init, crate::lightning::ln::msgs::DecodeError>> for CResult_InitDecodeErrorZ {
9751         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::Init, crate::lightning::ln::msgs::DecodeError>) -> Self {
9752                 let contents = if o.result_ok {
9753                         let result = unsafe { o.contents.result };
9754                         unsafe { o.contents.result = std::ptr::null_mut() };
9755                         CResult_InitDecodeErrorZPtr { result }
9756                 } else {
9757                         let err = unsafe { o.contents.err };
9758                         unsafe { o.contents.err = std::ptr::null_mut(); }
9759                         CResult_InitDecodeErrorZPtr { err }
9760                 };
9761                 Self {
9762                         contents,
9763                         result_ok: o.result_ok,
9764                 }
9765         }
9766 }
9767 impl Clone for CResult_InitDecodeErrorZ {
9768         fn clone(&self) -> Self {
9769                 if self.result_ok {
9770                         Self { result_ok: true, contents: CResult_InitDecodeErrorZPtr {
9771                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::Init>::clone(unsafe { &*self.contents.result })))
9772                         } }
9773                 } else {
9774                         Self { result_ok: false, contents: CResult_InitDecodeErrorZPtr {
9775                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
9776                         } }
9777                 }
9778         }
9779 }
9780 #[no_mangle]
9781 /// Creates a new CResult_InitDecodeErrorZ which has the same data as `orig`
9782 /// but with all dynamically-allocated buffers duplicated in new buffers.
9783 pub extern "C" fn CResult_InitDecodeErrorZ_clone(orig: &CResult_InitDecodeErrorZ) -> CResult_InitDecodeErrorZ { Clone::clone(&orig) }
9784 #[repr(C)]
9785 /// The contents of CResult_OpenChannelDecodeErrorZ
9786 pub union CResult_OpenChannelDecodeErrorZPtr {
9787         /// A pointer to the contents in the success state.
9788         /// Reading from this pointer when `result_ok` is not set is undefined.
9789         pub result: *mut crate::lightning::ln::msgs::OpenChannel,
9790         /// A pointer to the contents in the error state.
9791         /// Reading from this pointer when `result_ok` is set is undefined.
9792         pub err: *mut crate::lightning::ln::msgs::DecodeError,
9793 }
9794 #[repr(C)]
9795 /// A CResult_OpenChannelDecodeErrorZ represents the result of a fallible operation,
9796 /// containing a crate::lightning::ln::msgs::OpenChannel on success and a crate::lightning::ln::msgs::DecodeError on failure.
9797 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9798 pub struct CResult_OpenChannelDecodeErrorZ {
9799         /// The contents of this CResult_OpenChannelDecodeErrorZ, accessible via either
9800         /// `err` or `result` depending on the state of `result_ok`.
9801         pub contents: CResult_OpenChannelDecodeErrorZPtr,
9802         /// Whether this CResult_OpenChannelDecodeErrorZ represents a success state.
9803         pub result_ok: bool,
9804 }
9805 #[no_mangle]
9806 /// Creates a new CResult_OpenChannelDecodeErrorZ in the success state.
9807 pub extern "C" fn CResult_OpenChannelDecodeErrorZ_ok(o: crate::lightning::ln::msgs::OpenChannel) -> CResult_OpenChannelDecodeErrorZ {
9808         CResult_OpenChannelDecodeErrorZ {
9809                 contents: CResult_OpenChannelDecodeErrorZPtr {
9810                         result: Box::into_raw(Box::new(o)),
9811                 },
9812                 result_ok: true,
9813         }
9814 }
9815 #[no_mangle]
9816 /// Creates a new CResult_OpenChannelDecodeErrorZ in the error state.
9817 pub extern "C" fn CResult_OpenChannelDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_OpenChannelDecodeErrorZ {
9818         CResult_OpenChannelDecodeErrorZ {
9819                 contents: CResult_OpenChannelDecodeErrorZPtr {
9820                         err: Box::into_raw(Box::new(e)),
9821                 },
9822                 result_ok: false,
9823         }
9824 }
9825 #[no_mangle]
9826 /// Frees any resources used by the CResult_OpenChannelDecodeErrorZ.
9827 pub extern "C" fn CResult_OpenChannelDecodeErrorZ_free(_res: CResult_OpenChannelDecodeErrorZ) { }
9828 impl Drop for CResult_OpenChannelDecodeErrorZ {
9829         fn drop(&mut self) {
9830                 if self.result_ok {
9831                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
9832                                 let _ = unsafe { Box::from_raw(self.contents.result) };
9833                         }
9834                 } else {
9835                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
9836                                 let _ = unsafe { Box::from_raw(self.contents.err) };
9837                         }
9838                 }
9839         }
9840 }
9841 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::OpenChannel, crate::lightning::ln::msgs::DecodeError>> for CResult_OpenChannelDecodeErrorZ {
9842         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::OpenChannel, crate::lightning::ln::msgs::DecodeError>) -> Self {
9843                 let contents = if o.result_ok {
9844                         let result = unsafe { o.contents.result };
9845                         unsafe { o.contents.result = std::ptr::null_mut() };
9846                         CResult_OpenChannelDecodeErrorZPtr { result }
9847                 } else {
9848                         let err = unsafe { o.contents.err };
9849                         unsafe { o.contents.err = std::ptr::null_mut(); }
9850                         CResult_OpenChannelDecodeErrorZPtr { err }
9851                 };
9852                 Self {
9853                         contents,
9854                         result_ok: o.result_ok,
9855                 }
9856         }
9857 }
9858 impl Clone for CResult_OpenChannelDecodeErrorZ {
9859         fn clone(&self) -> Self {
9860                 if self.result_ok {
9861                         Self { result_ok: true, contents: CResult_OpenChannelDecodeErrorZPtr {
9862                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::OpenChannel>::clone(unsafe { &*self.contents.result })))
9863                         } }
9864                 } else {
9865                         Self { result_ok: false, contents: CResult_OpenChannelDecodeErrorZPtr {
9866                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
9867                         } }
9868                 }
9869         }
9870 }
9871 #[no_mangle]
9872 /// Creates a new CResult_OpenChannelDecodeErrorZ which has the same data as `orig`
9873 /// but with all dynamically-allocated buffers duplicated in new buffers.
9874 pub extern "C" fn CResult_OpenChannelDecodeErrorZ_clone(orig: &CResult_OpenChannelDecodeErrorZ) -> CResult_OpenChannelDecodeErrorZ { Clone::clone(&orig) }
9875 #[repr(C)]
9876 /// The contents of CResult_RevokeAndACKDecodeErrorZ
9877 pub union CResult_RevokeAndACKDecodeErrorZPtr {
9878         /// A pointer to the contents in the success state.
9879         /// Reading from this pointer when `result_ok` is not set is undefined.
9880         pub result: *mut crate::lightning::ln::msgs::RevokeAndACK,
9881         /// A pointer to the contents in the error state.
9882         /// Reading from this pointer when `result_ok` is set is undefined.
9883         pub err: *mut crate::lightning::ln::msgs::DecodeError,
9884 }
9885 #[repr(C)]
9886 /// A CResult_RevokeAndACKDecodeErrorZ represents the result of a fallible operation,
9887 /// containing a crate::lightning::ln::msgs::RevokeAndACK on success and a crate::lightning::ln::msgs::DecodeError on failure.
9888 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9889 pub struct CResult_RevokeAndACKDecodeErrorZ {
9890         /// The contents of this CResult_RevokeAndACKDecodeErrorZ, accessible via either
9891         /// `err` or `result` depending on the state of `result_ok`.
9892         pub contents: CResult_RevokeAndACKDecodeErrorZPtr,
9893         /// Whether this CResult_RevokeAndACKDecodeErrorZ represents a success state.
9894         pub result_ok: bool,
9895 }
9896 #[no_mangle]
9897 /// Creates a new CResult_RevokeAndACKDecodeErrorZ in the success state.
9898 pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_ok(o: crate::lightning::ln::msgs::RevokeAndACK) -> CResult_RevokeAndACKDecodeErrorZ {
9899         CResult_RevokeAndACKDecodeErrorZ {
9900                 contents: CResult_RevokeAndACKDecodeErrorZPtr {
9901                         result: Box::into_raw(Box::new(o)),
9902                 },
9903                 result_ok: true,
9904         }
9905 }
9906 #[no_mangle]
9907 /// Creates a new CResult_RevokeAndACKDecodeErrorZ in the error state.
9908 pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RevokeAndACKDecodeErrorZ {
9909         CResult_RevokeAndACKDecodeErrorZ {
9910                 contents: CResult_RevokeAndACKDecodeErrorZPtr {
9911                         err: Box::into_raw(Box::new(e)),
9912                 },
9913                 result_ok: false,
9914         }
9915 }
9916 #[no_mangle]
9917 /// Frees any resources used by the CResult_RevokeAndACKDecodeErrorZ.
9918 pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_free(_res: CResult_RevokeAndACKDecodeErrorZ) { }
9919 impl Drop for CResult_RevokeAndACKDecodeErrorZ {
9920         fn drop(&mut self) {
9921                 if self.result_ok {
9922                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
9923                                 let _ = unsafe { Box::from_raw(self.contents.result) };
9924                         }
9925                 } else {
9926                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
9927                                 let _ = unsafe { Box::from_raw(self.contents.err) };
9928                         }
9929                 }
9930         }
9931 }
9932 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::RevokeAndACK, crate::lightning::ln::msgs::DecodeError>> for CResult_RevokeAndACKDecodeErrorZ {
9933         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::RevokeAndACK, crate::lightning::ln::msgs::DecodeError>) -> Self {
9934                 let contents = if o.result_ok {
9935                         let result = unsafe { o.contents.result };
9936                         unsafe { o.contents.result = std::ptr::null_mut() };
9937                         CResult_RevokeAndACKDecodeErrorZPtr { result }
9938                 } else {
9939                         let err = unsafe { o.contents.err };
9940                         unsafe { o.contents.err = std::ptr::null_mut(); }
9941                         CResult_RevokeAndACKDecodeErrorZPtr { err }
9942                 };
9943                 Self {
9944                         contents,
9945                         result_ok: o.result_ok,
9946                 }
9947         }
9948 }
9949 impl Clone for CResult_RevokeAndACKDecodeErrorZ {
9950         fn clone(&self) -> Self {
9951                 if self.result_ok {
9952                         Self { result_ok: true, contents: CResult_RevokeAndACKDecodeErrorZPtr {
9953                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::RevokeAndACK>::clone(unsafe { &*self.contents.result })))
9954                         } }
9955                 } else {
9956                         Self { result_ok: false, contents: CResult_RevokeAndACKDecodeErrorZPtr {
9957                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
9958                         } }
9959                 }
9960         }
9961 }
9962 #[no_mangle]
9963 /// Creates a new CResult_RevokeAndACKDecodeErrorZ which has the same data as `orig`
9964 /// but with all dynamically-allocated buffers duplicated in new buffers.
9965 pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_clone(orig: &CResult_RevokeAndACKDecodeErrorZ) -> CResult_RevokeAndACKDecodeErrorZ { Clone::clone(&orig) }
9966 #[repr(C)]
9967 /// The contents of CResult_ShutdownDecodeErrorZ
9968 pub union CResult_ShutdownDecodeErrorZPtr {
9969         /// A pointer to the contents in the success state.
9970         /// Reading from this pointer when `result_ok` is not set is undefined.
9971         pub result: *mut crate::lightning::ln::msgs::Shutdown,
9972         /// A pointer to the contents in the error state.
9973         /// Reading from this pointer when `result_ok` is set is undefined.
9974         pub err: *mut crate::lightning::ln::msgs::DecodeError,
9975 }
9976 #[repr(C)]
9977 /// A CResult_ShutdownDecodeErrorZ represents the result of a fallible operation,
9978 /// containing a crate::lightning::ln::msgs::Shutdown on success and a crate::lightning::ln::msgs::DecodeError on failure.
9979 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9980 pub struct CResult_ShutdownDecodeErrorZ {
9981         /// The contents of this CResult_ShutdownDecodeErrorZ, accessible via either
9982         /// `err` or `result` depending on the state of `result_ok`.
9983         pub contents: CResult_ShutdownDecodeErrorZPtr,
9984         /// Whether this CResult_ShutdownDecodeErrorZ represents a success state.
9985         pub result_ok: bool,
9986 }
9987 #[no_mangle]
9988 /// Creates a new CResult_ShutdownDecodeErrorZ in the success state.
9989 pub extern "C" fn CResult_ShutdownDecodeErrorZ_ok(o: crate::lightning::ln::msgs::Shutdown) -> CResult_ShutdownDecodeErrorZ {
9990         CResult_ShutdownDecodeErrorZ {
9991                 contents: CResult_ShutdownDecodeErrorZPtr {
9992                         result: Box::into_raw(Box::new(o)),
9993                 },
9994                 result_ok: true,
9995         }
9996 }
9997 #[no_mangle]
9998 /// Creates a new CResult_ShutdownDecodeErrorZ in the error state.
9999 pub extern "C" fn CResult_ShutdownDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ShutdownDecodeErrorZ {
10000         CResult_ShutdownDecodeErrorZ {
10001                 contents: CResult_ShutdownDecodeErrorZPtr {
10002                         err: Box::into_raw(Box::new(e)),
10003                 },
10004                 result_ok: false,
10005         }
10006 }
10007 #[no_mangle]
10008 /// Frees any resources used by the CResult_ShutdownDecodeErrorZ.
10009 pub extern "C" fn CResult_ShutdownDecodeErrorZ_free(_res: CResult_ShutdownDecodeErrorZ) { }
10010 impl Drop for CResult_ShutdownDecodeErrorZ {
10011         fn drop(&mut self) {
10012                 if self.result_ok {
10013                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
10014                                 let _ = unsafe { Box::from_raw(self.contents.result) };
10015                         }
10016                 } else {
10017                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
10018                                 let _ = unsafe { Box::from_raw(self.contents.err) };
10019                         }
10020                 }
10021         }
10022 }
10023 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::Shutdown, crate::lightning::ln::msgs::DecodeError>> for CResult_ShutdownDecodeErrorZ {
10024         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::Shutdown, crate::lightning::ln::msgs::DecodeError>) -> Self {
10025                 let contents = if o.result_ok {
10026                         let result = unsafe { o.contents.result };
10027                         unsafe { o.contents.result = std::ptr::null_mut() };
10028                         CResult_ShutdownDecodeErrorZPtr { result }
10029                 } else {
10030                         let err = unsafe { o.contents.err };
10031                         unsafe { o.contents.err = std::ptr::null_mut(); }
10032                         CResult_ShutdownDecodeErrorZPtr { err }
10033                 };
10034                 Self {
10035                         contents,
10036                         result_ok: o.result_ok,
10037                 }
10038         }
10039 }
10040 impl Clone for CResult_ShutdownDecodeErrorZ {
10041         fn clone(&self) -> Self {
10042                 if self.result_ok {
10043                         Self { result_ok: true, contents: CResult_ShutdownDecodeErrorZPtr {
10044                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::Shutdown>::clone(unsafe { &*self.contents.result })))
10045                         } }
10046                 } else {
10047                         Self { result_ok: false, contents: CResult_ShutdownDecodeErrorZPtr {
10048                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
10049                         } }
10050                 }
10051         }
10052 }
10053 #[no_mangle]
10054 /// Creates a new CResult_ShutdownDecodeErrorZ which has the same data as `orig`
10055 /// but with all dynamically-allocated buffers duplicated in new buffers.
10056 pub extern "C" fn CResult_ShutdownDecodeErrorZ_clone(orig: &CResult_ShutdownDecodeErrorZ) -> CResult_ShutdownDecodeErrorZ { Clone::clone(&orig) }
10057 #[repr(C)]
10058 /// The contents of CResult_UpdateFailHTLCDecodeErrorZ
10059 pub union CResult_UpdateFailHTLCDecodeErrorZPtr {
10060         /// A pointer to the contents in the success state.
10061         /// Reading from this pointer when `result_ok` is not set is undefined.
10062         pub result: *mut crate::lightning::ln::msgs::UpdateFailHTLC,
10063         /// A pointer to the contents in the error state.
10064         /// Reading from this pointer when `result_ok` is set is undefined.
10065         pub err: *mut crate::lightning::ln::msgs::DecodeError,
10066 }
10067 #[repr(C)]
10068 /// A CResult_UpdateFailHTLCDecodeErrorZ represents the result of a fallible operation,
10069 /// containing a crate::lightning::ln::msgs::UpdateFailHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
10070 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10071 pub struct CResult_UpdateFailHTLCDecodeErrorZ {
10072         /// The contents of this CResult_UpdateFailHTLCDecodeErrorZ, accessible via either
10073         /// `err` or `result` depending on the state of `result_ok`.
10074         pub contents: CResult_UpdateFailHTLCDecodeErrorZPtr,
10075         /// Whether this CResult_UpdateFailHTLCDecodeErrorZ represents a success state.
10076         pub result_ok: bool,
10077 }
10078 #[no_mangle]
10079 /// Creates a new CResult_UpdateFailHTLCDecodeErrorZ in the success state.
10080 pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateFailHTLC) -> CResult_UpdateFailHTLCDecodeErrorZ {
10081         CResult_UpdateFailHTLCDecodeErrorZ {
10082                 contents: CResult_UpdateFailHTLCDecodeErrorZPtr {
10083                         result: Box::into_raw(Box::new(o)),
10084                 },
10085                 result_ok: true,
10086         }
10087 }
10088 #[no_mangle]
10089 /// Creates a new CResult_UpdateFailHTLCDecodeErrorZ in the error state.
10090 pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateFailHTLCDecodeErrorZ {
10091         CResult_UpdateFailHTLCDecodeErrorZ {
10092                 contents: CResult_UpdateFailHTLCDecodeErrorZPtr {
10093                         err: Box::into_raw(Box::new(e)),
10094                 },
10095                 result_ok: false,
10096         }
10097 }
10098 #[no_mangle]
10099 /// Frees any resources used by the CResult_UpdateFailHTLCDecodeErrorZ.
10100 pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_free(_res: CResult_UpdateFailHTLCDecodeErrorZ) { }
10101 impl Drop for CResult_UpdateFailHTLCDecodeErrorZ {
10102         fn drop(&mut self) {
10103                 if self.result_ok {
10104                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
10105                                 let _ = unsafe { Box::from_raw(self.contents.result) };
10106                         }
10107                 } else {
10108                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
10109                                 let _ = unsafe { Box::from_raw(self.contents.err) };
10110                         }
10111                 }
10112         }
10113 }
10114 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFailHTLC, crate::lightning::ln::msgs::DecodeError>> for CResult_UpdateFailHTLCDecodeErrorZ {
10115         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFailHTLC, crate::lightning::ln::msgs::DecodeError>) -> Self {
10116                 let contents = if o.result_ok {
10117                         let result = unsafe { o.contents.result };
10118                         unsafe { o.contents.result = std::ptr::null_mut() };
10119                         CResult_UpdateFailHTLCDecodeErrorZPtr { result }
10120                 } else {
10121                         let err = unsafe { o.contents.err };
10122                         unsafe { o.contents.err = std::ptr::null_mut(); }
10123                         CResult_UpdateFailHTLCDecodeErrorZPtr { err }
10124                 };
10125                 Self {
10126                         contents,
10127                         result_ok: o.result_ok,
10128                 }
10129         }
10130 }
10131 impl Clone for CResult_UpdateFailHTLCDecodeErrorZ {
10132         fn clone(&self) -> Self {
10133                 if self.result_ok {
10134                         Self { result_ok: true, contents: CResult_UpdateFailHTLCDecodeErrorZPtr {
10135                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UpdateFailHTLC>::clone(unsafe { &*self.contents.result })))
10136                         } }
10137                 } else {
10138                         Self { result_ok: false, contents: CResult_UpdateFailHTLCDecodeErrorZPtr {
10139                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
10140                         } }
10141                 }
10142         }
10143 }
10144 #[no_mangle]
10145 /// Creates a new CResult_UpdateFailHTLCDecodeErrorZ which has the same data as `orig`
10146 /// but with all dynamically-allocated buffers duplicated in new buffers.
10147 pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_clone(orig: &CResult_UpdateFailHTLCDecodeErrorZ) -> CResult_UpdateFailHTLCDecodeErrorZ { Clone::clone(&orig) }
10148 #[repr(C)]
10149 /// The contents of CResult_UpdateFailMalformedHTLCDecodeErrorZ
10150 pub union CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
10151         /// A pointer to the contents in the success state.
10152         /// Reading from this pointer when `result_ok` is not set is undefined.
10153         pub result: *mut crate::lightning::ln::msgs::UpdateFailMalformedHTLC,
10154         /// A pointer to the contents in the error state.
10155         /// Reading from this pointer when `result_ok` is set is undefined.
10156         pub err: *mut crate::lightning::ln::msgs::DecodeError,
10157 }
10158 #[repr(C)]
10159 /// A CResult_UpdateFailMalformedHTLCDecodeErrorZ represents the result of a fallible operation,
10160 /// containing a crate::lightning::ln::msgs::UpdateFailMalformedHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
10161 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10162 pub struct CResult_UpdateFailMalformedHTLCDecodeErrorZ {
10163         /// The contents of this CResult_UpdateFailMalformedHTLCDecodeErrorZ, accessible via either
10164         /// `err` or `result` depending on the state of `result_ok`.
10165         pub contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr,
10166         /// Whether this CResult_UpdateFailMalformedHTLCDecodeErrorZ represents a success state.
10167         pub result_ok: bool,
10168 }
10169 #[no_mangle]
10170 /// Creates a new CResult_UpdateFailMalformedHTLCDecodeErrorZ in the success state.
10171 pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateFailMalformedHTLC) -> CResult_UpdateFailMalformedHTLCDecodeErrorZ {
10172         CResult_UpdateFailMalformedHTLCDecodeErrorZ {
10173                 contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
10174                         result: Box::into_raw(Box::new(o)),
10175                 },
10176                 result_ok: true,
10177         }
10178 }
10179 #[no_mangle]
10180 /// Creates a new CResult_UpdateFailMalformedHTLCDecodeErrorZ in the error state.
10181 pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateFailMalformedHTLCDecodeErrorZ {
10182         CResult_UpdateFailMalformedHTLCDecodeErrorZ {
10183                 contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
10184                         err: Box::into_raw(Box::new(e)),
10185                 },
10186                 result_ok: false,
10187         }
10188 }
10189 #[no_mangle]
10190 /// Frees any resources used by the CResult_UpdateFailMalformedHTLCDecodeErrorZ.
10191 pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_free(_res: CResult_UpdateFailMalformedHTLCDecodeErrorZ) { }
10192 impl Drop for CResult_UpdateFailMalformedHTLCDecodeErrorZ {
10193         fn drop(&mut self) {
10194                 if self.result_ok {
10195                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
10196                                 let _ = unsafe { Box::from_raw(self.contents.result) };
10197                         }
10198                 } else {
10199                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
10200                                 let _ = unsafe { Box::from_raw(self.contents.err) };
10201                         }
10202                 }
10203         }
10204 }
10205 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFailMalformedHTLC, crate::lightning::ln::msgs::DecodeError>> for CResult_UpdateFailMalformedHTLCDecodeErrorZ {
10206         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFailMalformedHTLC, crate::lightning::ln::msgs::DecodeError>) -> Self {
10207                 let contents = if o.result_ok {
10208                         let result = unsafe { o.contents.result };
10209                         unsafe { o.contents.result = std::ptr::null_mut() };
10210                         CResult_UpdateFailMalformedHTLCDecodeErrorZPtr { result }
10211                 } else {
10212                         let err = unsafe { o.contents.err };
10213                         unsafe { o.contents.err = std::ptr::null_mut(); }
10214                         CResult_UpdateFailMalformedHTLCDecodeErrorZPtr { err }
10215                 };
10216                 Self {
10217                         contents,
10218                         result_ok: o.result_ok,
10219                 }
10220         }
10221 }
10222 impl Clone for CResult_UpdateFailMalformedHTLCDecodeErrorZ {
10223         fn clone(&self) -> Self {
10224                 if self.result_ok {
10225                         Self { result_ok: true, contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
10226                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UpdateFailMalformedHTLC>::clone(unsafe { &*self.contents.result })))
10227                         } }
10228                 } else {
10229                         Self { result_ok: false, contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
10230                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
10231                         } }
10232                 }
10233         }
10234 }
10235 #[no_mangle]
10236 /// Creates a new CResult_UpdateFailMalformedHTLCDecodeErrorZ which has the same data as `orig`
10237 /// but with all dynamically-allocated buffers duplicated in new buffers.
10238 pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone(orig: &CResult_UpdateFailMalformedHTLCDecodeErrorZ) -> CResult_UpdateFailMalformedHTLCDecodeErrorZ { Clone::clone(&orig) }
10239 #[repr(C)]
10240 /// The contents of CResult_UpdateFeeDecodeErrorZ
10241 pub union CResult_UpdateFeeDecodeErrorZPtr {
10242         /// A pointer to the contents in the success state.
10243         /// Reading from this pointer when `result_ok` is not set is undefined.
10244         pub result: *mut crate::lightning::ln::msgs::UpdateFee,
10245         /// A pointer to the contents in the error state.
10246         /// Reading from this pointer when `result_ok` is set is undefined.
10247         pub err: *mut crate::lightning::ln::msgs::DecodeError,
10248 }
10249 #[repr(C)]
10250 /// A CResult_UpdateFeeDecodeErrorZ represents the result of a fallible operation,
10251 /// containing a crate::lightning::ln::msgs::UpdateFee on success and a crate::lightning::ln::msgs::DecodeError on failure.
10252 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10253 pub struct CResult_UpdateFeeDecodeErrorZ {
10254         /// The contents of this CResult_UpdateFeeDecodeErrorZ, accessible via either
10255         /// `err` or `result` depending on the state of `result_ok`.
10256         pub contents: CResult_UpdateFeeDecodeErrorZPtr,
10257         /// Whether this CResult_UpdateFeeDecodeErrorZ represents a success state.
10258         pub result_ok: bool,
10259 }
10260 #[no_mangle]
10261 /// Creates a new CResult_UpdateFeeDecodeErrorZ in the success state.
10262 pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateFee) -> CResult_UpdateFeeDecodeErrorZ {
10263         CResult_UpdateFeeDecodeErrorZ {
10264                 contents: CResult_UpdateFeeDecodeErrorZPtr {
10265                         result: Box::into_raw(Box::new(o)),
10266                 },
10267                 result_ok: true,
10268         }
10269 }
10270 #[no_mangle]
10271 /// Creates a new CResult_UpdateFeeDecodeErrorZ in the error state.
10272 pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateFeeDecodeErrorZ {
10273         CResult_UpdateFeeDecodeErrorZ {
10274                 contents: CResult_UpdateFeeDecodeErrorZPtr {
10275                         err: Box::into_raw(Box::new(e)),
10276                 },
10277                 result_ok: false,
10278         }
10279 }
10280 #[no_mangle]
10281 /// Frees any resources used by the CResult_UpdateFeeDecodeErrorZ.
10282 pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_free(_res: CResult_UpdateFeeDecodeErrorZ) { }
10283 impl Drop for CResult_UpdateFeeDecodeErrorZ {
10284         fn drop(&mut self) {
10285                 if self.result_ok {
10286                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
10287                                 let _ = unsafe { Box::from_raw(self.contents.result) };
10288                         }
10289                 } else {
10290                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
10291                                 let _ = unsafe { Box::from_raw(self.contents.err) };
10292                         }
10293                 }
10294         }
10295 }
10296 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFee, crate::lightning::ln::msgs::DecodeError>> for CResult_UpdateFeeDecodeErrorZ {
10297         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFee, crate::lightning::ln::msgs::DecodeError>) -> Self {
10298                 let contents = if o.result_ok {
10299                         let result = unsafe { o.contents.result };
10300                         unsafe { o.contents.result = std::ptr::null_mut() };
10301                         CResult_UpdateFeeDecodeErrorZPtr { result }
10302                 } else {
10303                         let err = unsafe { o.contents.err };
10304                         unsafe { o.contents.err = std::ptr::null_mut(); }
10305                         CResult_UpdateFeeDecodeErrorZPtr { err }
10306                 };
10307                 Self {
10308                         contents,
10309                         result_ok: o.result_ok,
10310                 }
10311         }
10312 }
10313 impl Clone for CResult_UpdateFeeDecodeErrorZ {
10314         fn clone(&self) -> Self {
10315                 if self.result_ok {
10316                         Self { result_ok: true, contents: CResult_UpdateFeeDecodeErrorZPtr {
10317                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UpdateFee>::clone(unsafe { &*self.contents.result })))
10318                         } }
10319                 } else {
10320                         Self { result_ok: false, contents: CResult_UpdateFeeDecodeErrorZPtr {
10321                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
10322                         } }
10323                 }
10324         }
10325 }
10326 #[no_mangle]
10327 /// Creates a new CResult_UpdateFeeDecodeErrorZ which has the same data as `orig`
10328 /// but with all dynamically-allocated buffers duplicated in new buffers.
10329 pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_clone(orig: &CResult_UpdateFeeDecodeErrorZ) -> CResult_UpdateFeeDecodeErrorZ { Clone::clone(&orig) }
10330 #[repr(C)]
10331 /// The contents of CResult_UpdateFulfillHTLCDecodeErrorZ
10332 pub union CResult_UpdateFulfillHTLCDecodeErrorZPtr {
10333         /// A pointer to the contents in the success state.
10334         /// Reading from this pointer when `result_ok` is not set is undefined.
10335         pub result: *mut crate::lightning::ln::msgs::UpdateFulfillHTLC,
10336         /// A pointer to the contents in the error state.
10337         /// Reading from this pointer when `result_ok` is set is undefined.
10338         pub err: *mut crate::lightning::ln::msgs::DecodeError,
10339 }
10340 #[repr(C)]
10341 /// A CResult_UpdateFulfillHTLCDecodeErrorZ represents the result of a fallible operation,
10342 /// containing a crate::lightning::ln::msgs::UpdateFulfillHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
10343 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10344 pub struct CResult_UpdateFulfillHTLCDecodeErrorZ {
10345         /// The contents of this CResult_UpdateFulfillHTLCDecodeErrorZ, accessible via either
10346         /// `err` or `result` depending on the state of `result_ok`.
10347         pub contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr,
10348         /// Whether this CResult_UpdateFulfillHTLCDecodeErrorZ represents a success state.
10349         pub result_ok: bool,
10350 }
10351 #[no_mangle]
10352 /// Creates a new CResult_UpdateFulfillHTLCDecodeErrorZ in the success state.
10353 pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateFulfillHTLC) -> CResult_UpdateFulfillHTLCDecodeErrorZ {
10354         CResult_UpdateFulfillHTLCDecodeErrorZ {
10355                 contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr {
10356                         result: Box::into_raw(Box::new(o)),
10357                 },
10358                 result_ok: true,
10359         }
10360 }
10361 #[no_mangle]
10362 /// Creates a new CResult_UpdateFulfillHTLCDecodeErrorZ in the error state.
10363 pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateFulfillHTLCDecodeErrorZ {
10364         CResult_UpdateFulfillHTLCDecodeErrorZ {
10365                 contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr {
10366                         err: Box::into_raw(Box::new(e)),
10367                 },
10368                 result_ok: false,
10369         }
10370 }
10371 #[no_mangle]
10372 /// Frees any resources used by the CResult_UpdateFulfillHTLCDecodeErrorZ.
10373 pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_free(_res: CResult_UpdateFulfillHTLCDecodeErrorZ) { }
10374 impl Drop for CResult_UpdateFulfillHTLCDecodeErrorZ {
10375         fn drop(&mut self) {
10376                 if self.result_ok {
10377                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
10378                                 let _ = unsafe { Box::from_raw(self.contents.result) };
10379                         }
10380                 } else {
10381                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
10382                                 let _ = unsafe { Box::from_raw(self.contents.err) };
10383                         }
10384                 }
10385         }
10386 }
10387 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFulfillHTLC, crate::lightning::ln::msgs::DecodeError>> for CResult_UpdateFulfillHTLCDecodeErrorZ {
10388         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFulfillHTLC, crate::lightning::ln::msgs::DecodeError>) -> Self {
10389                 let contents = if o.result_ok {
10390                         let result = unsafe { o.contents.result };
10391                         unsafe { o.contents.result = std::ptr::null_mut() };
10392                         CResult_UpdateFulfillHTLCDecodeErrorZPtr { result }
10393                 } else {
10394                         let err = unsafe { o.contents.err };
10395                         unsafe { o.contents.err = std::ptr::null_mut(); }
10396                         CResult_UpdateFulfillHTLCDecodeErrorZPtr { err }
10397                 };
10398                 Self {
10399                         contents,
10400                         result_ok: o.result_ok,
10401                 }
10402         }
10403 }
10404 impl Clone for CResult_UpdateFulfillHTLCDecodeErrorZ {
10405         fn clone(&self) -> Self {
10406                 if self.result_ok {
10407                         Self { result_ok: true, contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr {
10408                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UpdateFulfillHTLC>::clone(unsafe { &*self.contents.result })))
10409                         } }
10410                 } else {
10411                         Self { result_ok: false, contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr {
10412                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
10413                         } }
10414                 }
10415         }
10416 }
10417 #[no_mangle]
10418 /// Creates a new CResult_UpdateFulfillHTLCDecodeErrorZ which has the same data as `orig`
10419 /// but with all dynamically-allocated buffers duplicated in new buffers.
10420 pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_clone(orig: &CResult_UpdateFulfillHTLCDecodeErrorZ) -> CResult_UpdateFulfillHTLCDecodeErrorZ { Clone::clone(&orig) }
10421 #[repr(C)]
10422 /// The contents of CResult_UpdateAddHTLCDecodeErrorZ
10423 pub union CResult_UpdateAddHTLCDecodeErrorZPtr {
10424         /// A pointer to the contents in the success state.
10425         /// Reading from this pointer when `result_ok` is not set is undefined.
10426         pub result: *mut crate::lightning::ln::msgs::UpdateAddHTLC,
10427         /// A pointer to the contents in the error state.
10428         /// Reading from this pointer when `result_ok` is set is undefined.
10429         pub err: *mut crate::lightning::ln::msgs::DecodeError,
10430 }
10431 #[repr(C)]
10432 /// A CResult_UpdateAddHTLCDecodeErrorZ represents the result of a fallible operation,
10433 /// containing a crate::lightning::ln::msgs::UpdateAddHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
10434 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10435 pub struct CResult_UpdateAddHTLCDecodeErrorZ {
10436         /// The contents of this CResult_UpdateAddHTLCDecodeErrorZ, accessible via either
10437         /// `err` or `result` depending on the state of `result_ok`.
10438         pub contents: CResult_UpdateAddHTLCDecodeErrorZPtr,
10439         /// Whether this CResult_UpdateAddHTLCDecodeErrorZ represents a success state.
10440         pub result_ok: bool,
10441 }
10442 #[no_mangle]
10443 /// Creates a new CResult_UpdateAddHTLCDecodeErrorZ in the success state.
10444 pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateAddHTLC) -> CResult_UpdateAddHTLCDecodeErrorZ {
10445         CResult_UpdateAddHTLCDecodeErrorZ {
10446                 contents: CResult_UpdateAddHTLCDecodeErrorZPtr {
10447                         result: Box::into_raw(Box::new(o)),
10448                 },
10449                 result_ok: true,
10450         }
10451 }
10452 #[no_mangle]
10453 /// Creates a new CResult_UpdateAddHTLCDecodeErrorZ in the error state.
10454 pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateAddHTLCDecodeErrorZ {
10455         CResult_UpdateAddHTLCDecodeErrorZ {
10456                 contents: CResult_UpdateAddHTLCDecodeErrorZPtr {
10457                         err: Box::into_raw(Box::new(e)),
10458                 },
10459                 result_ok: false,
10460         }
10461 }
10462 #[no_mangle]
10463 /// Frees any resources used by the CResult_UpdateAddHTLCDecodeErrorZ.
10464 pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_free(_res: CResult_UpdateAddHTLCDecodeErrorZ) { }
10465 impl Drop for CResult_UpdateAddHTLCDecodeErrorZ {
10466         fn drop(&mut self) {
10467                 if self.result_ok {
10468                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
10469                                 let _ = unsafe { Box::from_raw(self.contents.result) };
10470                         }
10471                 } else {
10472                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
10473                                 let _ = unsafe { Box::from_raw(self.contents.err) };
10474                         }
10475                 }
10476         }
10477 }
10478 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateAddHTLC, crate::lightning::ln::msgs::DecodeError>> for CResult_UpdateAddHTLCDecodeErrorZ {
10479         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateAddHTLC, crate::lightning::ln::msgs::DecodeError>) -> Self {
10480                 let contents = if o.result_ok {
10481                         let result = unsafe { o.contents.result };
10482                         unsafe { o.contents.result = std::ptr::null_mut() };
10483                         CResult_UpdateAddHTLCDecodeErrorZPtr { result }
10484                 } else {
10485                         let err = unsafe { o.contents.err };
10486                         unsafe { o.contents.err = std::ptr::null_mut(); }
10487                         CResult_UpdateAddHTLCDecodeErrorZPtr { err }
10488                 };
10489                 Self {
10490                         contents,
10491                         result_ok: o.result_ok,
10492                 }
10493         }
10494 }
10495 impl Clone for CResult_UpdateAddHTLCDecodeErrorZ {
10496         fn clone(&self) -> Self {
10497                 if self.result_ok {
10498                         Self { result_ok: true, contents: CResult_UpdateAddHTLCDecodeErrorZPtr {
10499                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UpdateAddHTLC>::clone(unsafe { &*self.contents.result })))
10500                         } }
10501                 } else {
10502                         Self { result_ok: false, contents: CResult_UpdateAddHTLCDecodeErrorZPtr {
10503                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
10504                         } }
10505                 }
10506         }
10507 }
10508 #[no_mangle]
10509 /// Creates a new CResult_UpdateAddHTLCDecodeErrorZ which has the same data as `orig`
10510 /// but with all dynamically-allocated buffers duplicated in new buffers.
10511 pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_clone(orig: &CResult_UpdateAddHTLCDecodeErrorZ) -> CResult_UpdateAddHTLCDecodeErrorZ { Clone::clone(&orig) }
10512 #[repr(C)]
10513 /// The contents of CResult_PingDecodeErrorZ
10514 pub union CResult_PingDecodeErrorZPtr {
10515         /// A pointer to the contents in the success state.
10516         /// Reading from this pointer when `result_ok` is not set is undefined.
10517         pub result: *mut crate::lightning::ln::msgs::Ping,
10518         /// A pointer to the contents in the error state.
10519         /// Reading from this pointer when `result_ok` is set is undefined.
10520         pub err: *mut crate::lightning::ln::msgs::DecodeError,
10521 }
10522 #[repr(C)]
10523 /// A CResult_PingDecodeErrorZ represents the result of a fallible operation,
10524 /// containing a crate::lightning::ln::msgs::Ping on success and a crate::lightning::ln::msgs::DecodeError on failure.
10525 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10526 pub struct CResult_PingDecodeErrorZ {
10527         /// The contents of this CResult_PingDecodeErrorZ, accessible via either
10528         /// `err` or `result` depending on the state of `result_ok`.
10529         pub contents: CResult_PingDecodeErrorZPtr,
10530         /// Whether this CResult_PingDecodeErrorZ represents a success state.
10531         pub result_ok: bool,
10532 }
10533 #[no_mangle]
10534 /// Creates a new CResult_PingDecodeErrorZ in the success state.
10535 pub extern "C" fn CResult_PingDecodeErrorZ_ok(o: crate::lightning::ln::msgs::Ping) -> CResult_PingDecodeErrorZ {
10536         CResult_PingDecodeErrorZ {
10537                 contents: CResult_PingDecodeErrorZPtr {
10538                         result: Box::into_raw(Box::new(o)),
10539                 },
10540                 result_ok: true,
10541         }
10542 }
10543 #[no_mangle]
10544 /// Creates a new CResult_PingDecodeErrorZ in the error state.
10545 pub extern "C" fn CResult_PingDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_PingDecodeErrorZ {
10546         CResult_PingDecodeErrorZ {
10547                 contents: CResult_PingDecodeErrorZPtr {
10548                         err: Box::into_raw(Box::new(e)),
10549                 },
10550                 result_ok: false,
10551         }
10552 }
10553 #[no_mangle]
10554 /// Frees any resources used by the CResult_PingDecodeErrorZ.
10555 pub extern "C" fn CResult_PingDecodeErrorZ_free(_res: CResult_PingDecodeErrorZ) { }
10556 impl Drop for CResult_PingDecodeErrorZ {
10557         fn drop(&mut self) {
10558                 if self.result_ok {
10559                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
10560                                 let _ = unsafe { Box::from_raw(self.contents.result) };
10561                         }
10562                 } else {
10563                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
10564                                 let _ = unsafe { Box::from_raw(self.contents.err) };
10565                         }
10566                 }
10567         }
10568 }
10569 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::Ping, crate::lightning::ln::msgs::DecodeError>> for CResult_PingDecodeErrorZ {
10570         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::Ping, crate::lightning::ln::msgs::DecodeError>) -> Self {
10571                 let contents = if o.result_ok {
10572                         let result = unsafe { o.contents.result };
10573                         unsafe { o.contents.result = std::ptr::null_mut() };
10574                         CResult_PingDecodeErrorZPtr { result }
10575                 } else {
10576                         let err = unsafe { o.contents.err };
10577                         unsafe { o.contents.err = std::ptr::null_mut(); }
10578                         CResult_PingDecodeErrorZPtr { err }
10579                 };
10580                 Self {
10581                         contents,
10582                         result_ok: o.result_ok,
10583                 }
10584         }
10585 }
10586 impl Clone for CResult_PingDecodeErrorZ {
10587         fn clone(&self) -> Self {
10588                 if self.result_ok {
10589                         Self { result_ok: true, contents: CResult_PingDecodeErrorZPtr {
10590                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::Ping>::clone(unsafe { &*self.contents.result })))
10591                         } }
10592                 } else {
10593                         Self { result_ok: false, contents: CResult_PingDecodeErrorZPtr {
10594                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
10595                         } }
10596                 }
10597         }
10598 }
10599 #[no_mangle]
10600 /// Creates a new CResult_PingDecodeErrorZ which has the same data as `orig`
10601 /// but with all dynamically-allocated buffers duplicated in new buffers.
10602 pub extern "C" fn CResult_PingDecodeErrorZ_clone(orig: &CResult_PingDecodeErrorZ) -> CResult_PingDecodeErrorZ { Clone::clone(&orig) }
10603 #[repr(C)]
10604 /// The contents of CResult_PongDecodeErrorZ
10605 pub union CResult_PongDecodeErrorZPtr {
10606         /// A pointer to the contents in the success state.
10607         /// Reading from this pointer when `result_ok` is not set is undefined.
10608         pub result: *mut crate::lightning::ln::msgs::Pong,
10609         /// A pointer to the contents in the error state.
10610         /// Reading from this pointer when `result_ok` is set is undefined.
10611         pub err: *mut crate::lightning::ln::msgs::DecodeError,
10612 }
10613 #[repr(C)]
10614 /// A CResult_PongDecodeErrorZ represents the result of a fallible operation,
10615 /// containing a crate::lightning::ln::msgs::Pong on success and a crate::lightning::ln::msgs::DecodeError on failure.
10616 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10617 pub struct CResult_PongDecodeErrorZ {
10618         /// The contents of this CResult_PongDecodeErrorZ, accessible via either
10619         /// `err` or `result` depending on the state of `result_ok`.
10620         pub contents: CResult_PongDecodeErrorZPtr,
10621         /// Whether this CResult_PongDecodeErrorZ represents a success state.
10622         pub result_ok: bool,
10623 }
10624 #[no_mangle]
10625 /// Creates a new CResult_PongDecodeErrorZ in the success state.
10626 pub extern "C" fn CResult_PongDecodeErrorZ_ok(o: crate::lightning::ln::msgs::Pong) -> CResult_PongDecodeErrorZ {
10627         CResult_PongDecodeErrorZ {
10628                 contents: CResult_PongDecodeErrorZPtr {
10629                         result: Box::into_raw(Box::new(o)),
10630                 },
10631                 result_ok: true,
10632         }
10633 }
10634 #[no_mangle]
10635 /// Creates a new CResult_PongDecodeErrorZ in the error state.
10636 pub extern "C" fn CResult_PongDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_PongDecodeErrorZ {
10637         CResult_PongDecodeErrorZ {
10638                 contents: CResult_PongDecodeErrorZPtr {
10639                         err: Box::into_raw(Box::new(e)),
10640                 },
10641                 result_ok: false,
10642         }
10643 }
10644 #[no_mangle]
10645 /// Frees any resources used by the CResult_PongDecodeErrorZ.
10646 pub extern "C" fn CResult_PongDecodeErrorZ_free(_res: CResult_PongDecodeErrorZ) { }
10647 impl Drop for CResult_PongDecodeErrorZ {
10648         fn drop(&mut self) {
10649                 if self.result_ok {
10650                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
10651                                 let _ = unsafe { Box::from_raw(self.contents.result) };
10652                         }
10653                 } else {
10654                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
10655                                 let _ = unsafe { Box::from_raw(self.contents.err) };
10656                         }
10657                 }
10658         }
10659 }
10660 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::Pong, crate::lightning::ln::msgs::DecodeError>> for CResult_PongDecodeErrorZ {
10661         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::Pong, crate::lightning::ln::msgs::DecodeError>) -> Self {
10662                 let contents = if o.result_ok {
10663                         let result = unsafe { o.contents.result };
10664                         unsafe { o.contents.result = std::ptr::null_mut() };
10665                         CResult_PongDecodeErrorZPtr { result }
10666                 } else {
10667                         let err = unsafe { o.contents.err };
10668                         unsafe { o.contents.err = std::ptr::null_mut(); }
10669                         CResult_PongDecodeErrorZPtr { err }
10670                 };
10671                 Self {
10672                         contents,
10673                         result_ok: o.result_ok,
10674                 }
10675         }
10676 }
10677 impl Clone for CResult_PongDecodeErrorZ {
10678         fn clone(&self) -> Self {
10679                 if self.result_ok {
10680                         Self { result_ok: true, contents: CResult_PongDecodeErrorZPtr {
10681                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::Pong>::clone(unsafe { &*self.contents.result })))
10682                         } }
10683                 } else {
10684                         Self { result_ok: false, contents: CResult_PongDecodeErrorZPtr {
10685                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
10686                         } }
10687                 }
10688         }
10689 }
10690 #[no_mangle]
10691 /// Creates a new CResult_PongDecodeErrorZ which has the same data as `orig`
10692 /// but with all dynamically-allocated buffers duplicated in new buffers.
10693 pub extern "C" fn CResult_PongDecodeErrorZ_clone(orig: &CResult_PongDecodeErrorZ) -> CResult_PongDecodeErrorZ { Clone::clone(&orig) }
10694 #[repr(C)]
10695 /// The contents of CResult_UnsignedChannelAnnouncementDecodeErrorZ
10696 pub union CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
10697         /// A pointer to the contents in the success state.
10698         /// Reading from this pointer when `result_ok` is not set is undefined.
10699         pub result: *mut crate::lightning::ln::msgs::UnsignedChannelAnnouncement,
10700         /// A pointer to the contents in the error state.
10701         /// Reading from this pointer when `result_ok` is set is undefined.
10702         pub err: *mut crate::lightning::ln::msgs::DecodeError,
10703 }
10704 #[repr(C)]
10705 /// A CResult_UnsignedChannelAnnouncementDecodeErrorZ represents the result of a fallible operation,
10706 /// containing a crate::lightning::ln::msgs::UnsignedChannelAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
10707 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10708 pub struct CResult_UnsignedChannelAnnouncementDecodeErrorZ {
10709         /// The contents of this CResult_UnsignedChannelAnnouncementDecodeErrorZ, accessible via either
10710         /// `err` or `result` depending on the state of `result_ok`.
10711         pub contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr,
10712         /// Whether this CResult_UnsignedChannelAnnouncementDecodeErrorZ represents a success state.
10713         pub result_ok: bool,
10714 }
10715 #[no_mangle]
10716 /// Creates a new CResult_UnsignedChannelAnnouncementDecodeErrorZ in the success state.
10717 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UnsignedChannelAnnouncement) -> CResult_UnsignedChannelAnnouncementDecodeErrorZ {
10718         CResult_UnsignedChannelAnnouncementDecodeErrorZ {
10719                 contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
10720                         result: Box::into_raw(Box::new(o)),
10721                 },
10722                 result_ok: true,
10723         }
10724 }
10725 #[no_mangle]
10726 /// Creates a new CResult_UnsignedChannelAnnouncementDecodeErrorZ in the error state.
10727 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UnsignedChannelAnnouncementDecodeErrorZ {
10728         CResult_UnsignedChannelAnnouncementDecodeErrorZ {
10729                 contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
10730                         err: Box::into_raw(Box::new(e)),
10731                 },
10732                 result_ok: false,
10733         }
10734 }
10735 #[no_mangle]
10736 /// Frees any resources used by the CResult_UnsignedChannelAnnouncementDecodeErrorZ.
10737 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_free(_res: CResult_UnsignedChannelAnnouncementDecodeErrorZ) { }
10738 impl Drop for CResult_UnsignedChannelAnnouncementDecodeErrorZ {
10739         fn drop(&mut self) {
10740                 if self.result_ok {
10741                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
10742                                 let _ = unsafe { Box::from_raw(self.contents.result) };
10743                         }
10744                 } else {
10745                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
10746                                 let _ = unsafe { Box::from_raw(self.contents.err) };
10747                         }
10748                 }
10749         }
10750 }
10751 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedChannelAnnouncement, crate::lightning::ln::msgs::DecodeError>> for CResult_UnsignedChannelAnnouncementDecodeErrorZ {
10752         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedChannelAnnouncement, crate::lightning::ln::msgs::DecodeError>) -> Self {
10753                 let contents = if o.result_ok {
10754                         let result = unsafe { o.contents.result };
10755                         unsafe { o.contents.result = std::ptr::null_mut() };
10756                         CResult_UnsignedChannelAnnouncementDecodeErrorZPtr { result }
10757                 } else {
10758                         let err = unsafe { o.contents.err };
10759                         unsafe { o.contents.err = std::ptr::null_mut(); }
10760                         CResult_UnsignedChannelAnnouncementDecodeErrorZPtr { err }
10761                 };
10762                 Self {
10763                         contents,
10764                         result_ok: o.result_ok,
10765                 }
10766         }
10767 }
10768 impl Clone for CResult_UnsignedChannelAnnouncementDecodeErrorZ {
10769         fn clone(&self) -> Self {
10770                 if self.result_ok {
10771                         Self { result_ok: true, contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
10772                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UnsignedChannelAnnouncement>::clone(unsafe { &*self.contents.result })))
10773                         } }
10774                 } else {
10775                         Self { result_ok: false, contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
10776                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
10777                         } }
10778                 }
10779         }
10780 }
10781 #[no_mangle]
10782 /// Creates a new CResult_UnsignedChannelAnnouncementDecodeErrorZ which has the same data as `orig`
10783 /// but with all dynamically-allocated buffers duplicated in new buffers.
10784 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone(orig: &CResult_UnsignedChannelAnnouncementDecodeErrorZ) -> CResult_UnsignedChannelAnnouncementDecodeErrorZ { Clone::clone(&orig) }
10785 #[repr(C)]
10786 /// The contents of CResult_ChannelAnnouncementDecodeErrorZ
10787 pub union CResult_ChannelAnnouncementDecodeErrorZPtr {
10788         /// A pointer to the contents in the success state.
10789         /// Reading from this pointer when `result_ok` is not set is undefined.
10790         pub result: *mut crate::lightning::ln::msgs::ChannelAnnouncement,
10791         /// A pointer to the contents in the error state.
10792         /// Reading from this pointer when `result_ok` is set is undefined.
10793         pub err: *mut crate::lightning::ln::msgs::DecodeError,
10794 }
10795 #[repr(C)]
10796 /// A CResult_ChannelAnnouncementDecodeErrorZ represents the result of a fallible operation,
10797 /// containing a crate::lightning::ln::msgs::ChannelAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
10798 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10799 pub struct CResult_ChannelAnnouncementDecodeErrorZ {
10800         /// The contents of this CResult_ChannelAnnouncementDecodeErrorZ, accessible via either
10801         /// `err` or `result` depending on the state of `result_ok`.
10802         pub contents: CResult_ChannelAnnouncementDecodeErrorZPtr,
10803         /// Whether this CResult_ChannelAnnouncementDecodeErrorZ represents a success state.
10804         pub result_ok: bool,
10805 }
10806 #[no_mangle]
10807 /// Creates a new CResult_ChannelAnnouncementDecodeErrorZ in the success state.
10808 pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ChannelAnnouncement) -> CResult_ChannelAnnouncementDecodeErrorZ {
10809         CResult_ChannelAnnouncementDecodeErrorZ {
10810                 contents: CResult_ChannelAnnouncementDecodeErrorZPtr {
10811                         result: Box::into_raw(Box::new(o)),
10812                 },
10813                 result_ok: true,
10814         }
10815 }
10816 #[no_mangle]
10817 /// Creates a new CResult_ChannelAnnouncementDecodeErrorZ in the error state.
10818 pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelAnnouncementDecodeErrorZ {
10819         CResult_ChannelAnnouncementDecodeErrorZ {
10820                 contents: CResult_ChannelAnnouncementDecodeErrorZPtr {
10821                         err: Box::into_raw(Box::new(e)),
10822                 },
10823                 result_ok: false,
10824         }
10825 }
10826 #[no_mangle]
10827 /// Frees any resources used by the CResult_ChannelAnnouncementDecodeErrorZ.
10828 pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_free(_res: CResult_ChannelAnnouncementDecodeErrorZ) { }
10829 impl Drop for CResult_ChannelAnnouncementDecodeErrorZ {
10830         fn drop(&mut self) {
10831                 if self.result_ok {
10832                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
10833                                 let _ = unsafe { Box::from_raw(self.contents.result) };
10834                         }
10835                 } else {
10836                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
10837                                 let _ = unsafe { Box::from_raw(self.contents.err) };
10838                         }
10839                 }
10840         }
10841 }
10842 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelAnnouncement, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelAnnouncementDecodeErrorZ {
10843         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelAnnouncement, crate::lightning::ln::msgs::DecodeError>) -> Self {
10844                 let contents = if o.result_ok {
10845                         let result = unsafe { o.contents.result };
10846                         unsafe { o.contents.result = std::ptr::null_mut() };
10847                         CResult_ChannelAnnouncementDecodeErrorZPtr { result }
10848                 } else {
10849                         let err = unsafe { o.contents.err };
10850                         unsafe { o.contents.err = std::ptr::null_mut(); }
10851                         CResult_ChannelAnnouncementDecodeErrorZPtr { err }
10852                 };
10853                 Self {
10854                         contents,
10855                         result_ok: o.result_ok,
10856                 }
10857         }
10858 }
10859 impl Clone for CResult_ChannelAnnouncementDecodeErrorZ {
10860         fn clone(&self) -> Self {
10861                 if self.result_ok {
10862                         Self { result_ok: true, contents: CResult_ChannelAnnouncementDecodeErrorZPtr {
10863                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ChannelAnnouncement>::clone(unsafe { &*self.contents.result })))
10864                         } }
10865                 } else {
10866                         Self { result_ok: false, contents: CResult_ChannelAnnouncementDecodeErrorZPtr {
10867                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
10868                         } }
10869                 }
10870         }
10871 }
10872 #[no_mangle]
10873 /// Creates a new CResult_ChannelAnnouncementDecodeErrorZ which has the same data as `orig`
10874 /// but with all dynamically-allocated buffers duplicated in new buffers.
10875 pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_clone(orig: &CResult_ChannelAnnouncementDecodeErrorZ) -> CResult_ChannelAnnouncementDecodeErrorZ { Clone::clone(&orig) }
10876 #[repr(C)]
10877 /// The contents of CResult_UnsignedChannelUpdateDecodeErrorZ
10878 pub union CResult_UnsignedChannelUpdateDecodeErrorZPtr {
10879         /// A pointer to the contents in the success state.
10880         /// Reading from this pointer when `result_ok` is not set is undefined.
10881         pub result: *mut crate::lightning::ln::msgs::UnsignedChannelUpdate,
10882         /// A pointer to the contents in the error state.
10883         /// Reading from this pointer when `result_ok` is set is undefined.
10884         pub err: *mut crate::lightning::ln::msgs::DecodeError,
10885 }
10886 #[repr(C)]
10887 /// A CResult_UnsignedChannelUpdateDecodeErrorZ represents the result of a fallible operation,
10888 /// containing a crate::lightning::ln::msgs::UnsignedChannelUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
10889 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10890 pub struct CResult_UnsignedChannelUpdateDecodeErrorZ {
10891         /// The contents of this CResult_UnsignedChannelUpdateDecodeErrorZ, accessible via either
10892         /// `err` or `result` depending on the state of `result_ok`.
10893         pub contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr,
10894         /// Whether this CResult_UnsignedChannelUpdateDecodeErrorZ represents a success state.
10895         pub result_ok: bool,
10896 }
10897 #[no_mangle]
10898 /// Creates a new CResult_UnsignedChannelUpdateDecodeErrorZ in the success state.
10899 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UnsignedChannelUpdate) -> CResult_UnsignedChannelUpdateDecodeErrorZ {
10900         CResult_UnsignedChannelUpdateDecodeErrorZ {
10901                 contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr {
10902                         result: Box::into_raw(Box::new(o)),
10903                 },
10904                 result_ok: true,
10905         }
10906 }
10907 #[no_mangle]
10908 /// Creates a new CResult_UnsignedChannelUpdateDecodeErrorZ in the error state.
10909 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UnsignedChannelUpdateDecodeErrorZ {
10910         CResult_UnsignedChannelUpdateDecodeErrorZ {
10911                 contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr {
10912                         err: Box::into_raw(Box::new(e)),
10913                 },
10914                 result_ok: false,
10915         }
10916 }
10917 #[no_mangle]
10918 /// Frees any resources used by the CResult_UnsignedChannelUpdateDecodeErrorZ.
10919 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_free(_res: CResult_UnsignedChannelUpdateDecodeErrorZ) { }
10920 impl Drop for CResult_UnsignedChannelUpdateDecodeErrorZ {
10921         fn drop(&mut self) {
10922                 if self.result_ok {
10923                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
10924                                 let _ = unsafe { Box::from_raw(self.contents.result) };
10925                         }
10926                 } else {
10927                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
10928                                 let _ = unsafe { Box::from_raw(self.contents.err) };
10929                         }
10930                 }
10931         }
10932 }
10933 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedChannelUpdate, crate::lightning::ln::msgs::DecodeError>> for CResult_UnsignedChannelUpdateDecodeErrorZ {
10934         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedChannelUpdate, crate::lightning::ln::msgs::DecodeError>) -> Self {
10935                 let contents = if o.result_ok {
10936                         let result = unsafe { o.contents.result };
10937                         unsafe { o.contents.result = std::ptr::null_mut() };
10938                         CResult_UnsignedChannelUpdateDecodeErrorZPtr { result }
10939                 } else {
10940                         let err = unsafe { o.contents.err };
10941                         unsafe { o.contents.err = std::ptr::null_mut(); }
10942                         CResult_UnsignedChannelUpdateDecodeErrorZPtr { err }
10943                 };
10944                 Self {
10945                         contents,
10946                         result_ok: o.result_ok,
10947                 }
10948         }
10949 }
10950 impl Clone for CResult_UnsignedChannelUpdateDecodeErrorZ {
10951         fn clone(&self) -> Self {
10952                 if self.result_ok {
10953                         Self { result_ok: true, contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr {
10954                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UnsignedChannelUpdate>::clone(unsafe { &*self.contents.result })))
10955                         } }
10956                 } else {
10957                         Self { result_ok: false, contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr {
10958                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
10959                         } }
10960                 }
10961         }
10962 }
10963 #[no_mangle]
10964 /// Creates a new CResult_UnsignedChannelUpdateDecodeErrorZ which has the same data as `orig`
10965 /// but with all dynamically-allocated buffers duplicated in new buffers.
10966 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_clone(orig: &CResult_UnsignedChannelUpdateDecodeErrorZ) -> CResult_UnsignedChannelUpdateDecodeErrorZ { Clone::clone(&orig) }
10967 #[repr(C)]
10968 /// The contents of CResult_ChannelUpdateDecodeErrorZ
10969 pub union CResult_ChannelUpdateDecodeErrorZPtr {
10970         /// A pointer to the contents in the success state.
10971         /// Reading from this pointer when `result_ok` is not set is undefined.
10972         pub result: *mut crate::lightning::ln::msgs::ChannelUpdate,
10973         /// A pointer to the contents in the error state.
10974         /// Reading from this pointer when `result_ok` is set is undefined.
10975         pub err: *mut crate::lightning::ln::msgs::DecodeError,
10976 }
10977 #[repr(C)]
10978 /// A CResult_ChannelUpdateDecodeErrorZ represents the result of a fallible operation,
10979 /// containing a crate::lightning::ln::msgs::ChannelUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
10980 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10981 pub struct CResult_ChannelUpdateDecodeErrorZ {
10982         /// The contents of this CResult_ChannelUpdateDecodeErrorZ, accessible via either
10983         /// `err` or `result` depending on the state of `result_ok`.
10984         pub contents: CResult_ChannelUpdateDecodeErrorZPtr,
10985         /// Whether this CResult_ChannelUpdateDecodeErrorZ represents a success state.
10986         pub result_ok: bool,
10987 }
10988 #[no_mangle]
10989 /// Creates a new CResult_ChannelUpdateDecodeErrorZ in the success state.
10990 pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ChannelUpdate) -> CResult_ChannelUpdateDecodeErrorZ {
10991         CResult_ChannelUpdateDecodeErrorZ {
10992                 contents: CResult_ChannelUpdateDecodeErrorZPtr {
10993                         result: Box::into_raw(Box::new(o)),
10994                 },
10995                 result_ok: true,
10996         }
10997 }
10998 #[no_mangle]
10999 /// Creates a new CResult_ChannelUpdateDecodeErrorZ in the error state.
11000 pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelUpdateDecodeErrorZ {
11001         CResult_ChannelUpdateDecodeErrorZ {
11002                 contents: CResult_ChannelUpdateDecodeErrorZPtr {
11003                         err: Box::into_raw(Box::new(e)),
11004                 },
11005                 result_ok: false,
11006         }
11007 }
11008 #[no_mangle]
11009 /// Frees any resources used by the CResult_ChannelUpdateDecodeErrorZ.
11010 pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_free(_res: CResult_ChannelUpdateDecodeErrorZ) { }
11011 impl Drop for CResult_ChannelUpdateDecodeErrorZ {
11012         fn drop(&mut self) {
11013                 if self.result_ok {
11014                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
11015                                 let _ = unsafe { Box::from_raw(self.contents.result) };
11016                         }
11017                 } else {
11018                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
11019                                 let _ = unsafe { Box::from_raw(self.contents.err) };
11020                         }
11021                 }
11022         }
11023 }
11024 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelUpdate, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelUpdateDecodeErrorZ {
11025         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelUpdate, crate::lightning::ln::msgs::DecodeError>) -> Self {
11026                 let contents = if o.result_ok {
11027                         let result = unsafe { o.contents.result };
11028                         unsafe { o.contents.result = std::ptr::null_mut() };
11029                         CResult_ChannelUpdateDecodeErrorZPtr { result }
11030                 } else {
11031                         let err = unsafe { o.contents.err };
11032                         unsafe { o.contents.err = std::ptr::null_mut(); }
11033                         CResult_ChannelUpdateDecodeErrorZPtr { err }
11034                 };
11035                 Self {
11036                         contents,
11037                         result_ok: o.result_ok,
11038                 }
11039         }
11040 }
11041 impl Clone for CResult_ChannelUpdateDecodeErrorZ {
11042         fn clone(&self) -> Self {
11043                 if self.result_ok {
11044                         Self { result_ok: true, contents: CResult_ChannelUpdateDecodeErrorZPtr {
11045                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ChannelUpdate>::clone(unsafe { &*self.contents.result })))
11046                         } }
11047                 } else {
11048                         Self { result_ok: false, contents: CResult_ChannelUpdateDecodeErrorZPtr {
11049                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
11050                         } }
11051                 }
11052         }
11053 }
11054 #[no_mangle]
11055 /// Creates a new CResult_ChannelUpdateDecodeErrorZ which has the same data as `orig`
11056 /// but with all dynamically-allocated buffers duplicated in new buffers.
11057 pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_clone(orig: &CResult_ChannelUpdateDecodeErrorZ) -> CResult_ChannelUpdateDecodeErrorZ { Clone::clone(&orig) }
11058 #[repr(C)]
11059 /// The contents of CResult_ErrorMessageDecodeErrorZ
11060 pub union CResult_ErrorMessageDecodeErrorZPtr {
11061         /// A pointer to the contents in the success state.
11062         /// Reading from this pointer when `result_ok` is not set is undefined.
11063         pub result: *mut crate::lightning::ln::msgs::ErrorMessage,
11064         /// A pointer to the contents in the error state.
11065         /// Reading from this pointer when `result_ok` is set is undefined.
11066         pub err: *mut crate::lightning::ln::msgs::DecodeError,
11067 }
11068 #[repr(C)]
11069 /// A CResult_ErrorMessageDecodeErrorZ represents the result of a fallible operation,
11070 /// containing a crate::lightning::ln::msgs::ErrorMessage on success and a crate::lightning::ln::msgs::DecodeError on failure.
11071 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11072 pub struct CResult_ErrorMessageDecodeErrorZ {
11073         /// The contents of this CResult_ErrorMessageDecodeErrorZ, accessible via either
11074         /// `err` or `result` depending on the state of `result_ok`.
11075         pub contents: CResult_ErrorMessageDecodeErrorZPtr,
11076         /// Whether this CResult_ErrorMessageDecodeErrorZ represents a success state.
11077         pub result_ok: bool,
11078 }
11079 #[no_mangle]
11080 /// Creates a new CResult_ErrorMessageDecodeErrorZ in the success state.
11081 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ErrorMessage) -> CResult_ErrorMessageDecodeErrorZ {
11082         CResult_ErrorMessageDecodeErrorZ {
11083                 contents: CResult_ErrorMessageDecodeErrorZPtr {
11084                         result: Box::into_raw(Box::new(o)),
11085                 },
11086                 result_ok: true,
11087         }
11088 }
11089 #[no_mangle]
11090 /// Creates a new CResult_ErrorMessageDecodeErrorZ in the error state.
11091 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ErrorMessageDecodeErrorZ {
11092         CResult_ErrorMessageDecodeErrorZ {
11093                 contents: CResult_ErrorMessageDecodeErrorZPtr {
11094                         err: Box::into_raw(Box::new(e)),
11095                 },
11096                 result_ok: false,
11097         }
11098 }
11099 #[no_mangle]
11100 /// Frees any resources used by the CResult_ErrorMessageDecodeErrorZ.
11101 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_free(_res: CResult_ErrorMessageDecodeErrorZ) { }
11102 impl Drop for CResult_ErrorMessageDecodeErrorZ {
11103         fn drop(&mut self) {
11104                 if self.result_ok {
11105                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
11106                                 let _ = unsafe { Box::from_raw(self.contents.result) };
11107                         }
11108                 } else {
11109                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
11110                                 let _ = unsafe { Box::from_raw(self.contents.err) };
11111                         }
11112                 }
11113         }
11114 }
11115 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ErrorMessage, crate::lightning::ln::msgs::DecodeError>> for CResult_ErrorMessageDecodeErrorZ {
11116         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ErrorMessage, crate::lightning::ln::msgs::DecodeError>) -> Self {
11117                 let contents = if o.result_ok {
11118                         let result = unsafe { o.contents.result };
11119                         unsafe { o.contents.result = std::ptr::null_mut() };
11120                         CResult_ErrorMessageDecodeErrorZPtr { result }
11121                 } else {
11122                         let err = unsafe { o.contents.err };
11123                         unsafe { o.contents.err = std::ptr::null_mut(); }
11124                         CResult_ErrorMessageDecodeErrorZPtr { err }
11125                 };
11126                 Self {
11127                         contents,
11128                         result_ok: o.result_ok,
11129                 }
11130         }
11131 }
11132 impl Clone for CResult_ErrorMessageDecodeErrorZ {
11133         fn clone(&self) -> Self {
11134                 if self.result_ok {
11135                         Self { result_ok: true, contents: CResult_ErrorMessageDecodeErrorZPtr {
11136                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ErrorMessage>::clone(unsafe { &*self.contents.result })))
11137                         } }
11138                 } else {
11139                         Self { result_ok: false, contents: CResult_ErrorMessageDecodeErrorZPtr {
11140                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
11141                         } }
11142                 }
11143         }
11144 }
11145 #[no_mangle]
11146 /// Creates a new CResult_ErrorMessageDecodeErrorZ which has the same data as `orig`
11147 /// but with all dynamically-allocated buffers duplicated in new buffers.
11148 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_clone(orig: &CResult_ErrorMessageDecodeErrorZ) -> CResult_ErrorMessageDecodeErrorZ { Clone::clone(&orig) }
11149 #[repr(C)]
11150 /// The contents of CResult_UnsignedNodeAnnouncementDecodeErrorZ
11151 pub union CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
11152         /// A pointer to the contents in the success state.
11153         /// Reading from this pointer when `result_ok` is not set is undefined.
11154         pub result: *mut crate::lightning::ln::msgs::UnsignedNodeAnnouncement,
11155         /// A pointer to the contents in the error state.
11156         /// Reading from this pointer when `result_ok` is set is undefined.
11157         pub err: *mut crate::lightning::ln::msgs::DecodeError,
11158 }
11159 #[repr(C)]
11160 /// A CResult_UnsignedNodeAnnouncementDecodeErrorZ represents the result of a fallible operation,
11161 /// containing a crate::lightning::ln::msgs::UnsignedNodeAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
11162 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11163 pub struct CResult_UnsignedNodeAnnouncementDecodeErrorZ {
11164         /// The contents of this CResult_UnsignedNodeAnnouncementDecodeErrorZ, accessible via either
11165         /// `err` or `result` depending on the state of `result_ok`.
11166         pub contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr,
11167         /// Whether this CResult_UnsignedNodeAnnouncementDecodeErrorZ represents a success state.
11168         pub result_ok: bool,
11169 }
11170 #[no_mangle]
11171 /// Creates a new CResult_UnsignedNodeAnnouncementDecodeErrorZ in the success state.
11172 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UnsignedNodeAnnouncement) -> CResult_UnsignedNodeAnnouncementDecodeErrorZ {
11173         CResult_UnsignedNodeAnnouncementDecodeErrorZ {
11174                 contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
11175                         result: Box::into_raw(Box::new(o)),
11176                 },
11177                 result_ok: true,
11178         }
11179 }
11180 #[no_mangle]
11181 /// Creates a new CResult_UnsignedNodeAnnouncementDecodeErrorZ in the error state.
11182 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UnsignedNodeAnnouncementDecodeErrorZ {
11183         CResult_UnsignedNodeAnnouncementDecodeErrorZ {
11184                 contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
11185                         err: Box::into_raw(Box::new(e)),
11186                 },
11187                 result_ok: false,
11188         }
11189 }
11190 #[no_mangle]
11191 /// Frees any resources used by the CResult_UnsignedNodeAnnouncementDecodeErrorZ.
11192 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_free(_res: CResult_UnsignedNodeAnnouncementDecodeErrorZ) { }
11193 impl Drop for CResult_UnsignedNodeAnnouncementDecodeErrorZ {
11194         fn drop(&mut self) {
11195                 if self.result_ok {
11196                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
11197                                 let _ = unsafe { Box::from_raw(self.contents.result) };
11198                         }
11199                 } else {
11200                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
11201                                 let _ = unsafe { Box::from_raw(self.contents.err) };
11202                         }
11203                 }
11204         }
11205 }
11206 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedNodeAnnouncement, crate::lightning::ln::msgs::DecodeError>> for CResult_UnsignedNodeAnnouncementDecodeErrorZ {
11207         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedNodeAnnouncement, crate::lightning::ln::msgs::DecodeError>) -> Self {
11208                 let contents = if o.result_ok {
11209                         let result = unsafe { o.contents.result };
11210                         unsafe { o.contents.result = std::ptr::null_mut() };
11211                         CResult_UnsignedNodeAnnouncementDecodeErrorZPtr { result }
11212                 } else {
11213                         let err = unsafe { o.contents.err };
11214                         unsafe { o.contents.err = std::ptr::null_mut(); }
11215                         CResult_UnsignedNodeAnnouncementDecodeErrorZPtr { err }
11216                 };
11217                 Self {
11218                         contents,
11219                         result_ok: o.result_ok,
11220                 }
11221         }
11222 }
11223 impl Clone for CResult_UnsignedNodeAnnouncementDecodeErrorZ {
11224         fn clone(&self) -> Self {
11225                 if self.result_ok {
11226                         Self { result_ok: true, contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
11227                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UnsignedNodeAnnouncement>::clone(unsafe { &*self.contents.result })))
11228                         } }
11229                 } else {
11230                         Self { result_ok: false, contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
11231                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
11232                         } }
11233                 }
11234         }
11235 }
11236 #[no_mangle]
11237 /// Creates a new CResult_UnsignedNodeAnnouncementDecodeErrorZ which has the same data as `orig`
11238 /// but with all dynamically-allocated buffers duplicated in new buffers.
11239 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone(orig: &CResult_UnsignedNodeAnnouncementDecodeErrorZ) -> CResult_UnsignedNodeAnnouncementDecodeErrorZ { Clone::clone(&orig) }
11240 #[repr(C)]
11241 /// The contents of CResult_NodeAnnouncementDecodeErrorZ
11242 pub union CResult_NodeAnnouncementDecodeErrorZPtr {
11243         /// A pointer to the contents in the success state.
11244         /// Reading from this pointer when `result_ok` is not set is undefined.
11245         pub result: *mut crate::lightning::ln::msgs::NodeAnnouncement,
11246         /// A pointer to the contents in the error state.
11247         /// Reading from this pointer when `result_ok` is set is undefined.
11248         pub err: *mut crate::lightning::ln::msgs::DecodeError,
11249 }
11250 #[repr(C)]
11251 /// A CResult_NodeAnnouncementDecodeErrorZ represents the result of a fallible operation,
11252 /// containing a crate::lightning::ln::msgs::NodeAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
11253 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11254 pub struct CResult_NodeAnnouncementDecodeErrorZ {
11255         /// The contents of this CResult_NodeAnnouncementDecodeErrorZ, accessible via either
11256         /// `err` or `result` depending on the state of `result_ok`.
11257         pub contents: CResult_NodeAnnouncementDecodeErrorZPtr,
11258         /// Whether this CResult_NodeAnnouncementDecodeErrorZ represents a success state.
11259         pub result_ok: bool,
11260 }
11261 #[no_mangle]
11262 /// Creates a new CResult_NodeAnnouncementDecodeErrorZ in the success state.
11263 pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_ok(o: crate::lightning::ln::msgs::NodeAnnouncement) -> CResult_NodeAnnouncementDecodeErrorZ {
11264         CResult_NodeAnnouncementDecodeErrorZ {
11265                 contents: CResult_NodeAnnouncementDecodeErrorZPtr {
11266                         result: Box::into_raw(Box::new(o)),
11267                 },
11268                 result_ok: true,
11269         }
11270 }
11271 #[no_mangle]
11272 /// Creates a new CResult_NodeAnnouncementDecodeErrorZ in the error state.
11273 pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeAnnouncementDecodeErrorZ {
11274         CResult_NodeAnnouncementDecodeErrorZ {
11275                 contents: CResult_NodeAnnouncementDecodeErrorZPtr {
11276                         err: Box::into_raw(Box::new(e)),
11277                 },
11278                 result_ok: false,
11279         }
11280 }
11281 #[no_mangle]
11282 /// Frees any resources used by the CResult_NodeAnnouncementDecodeErrorZ.
11283 pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_free(_res: CResult_NodeAnnouncementDecodeErrorZ) { }
11284 impl Drop for CResult_NodeAnnouncementDecodeErrorZ {
11285         fn drop(&mut self) {
11286                 if self.result_ok {
11287                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
11288                                 let _ = unsafe { Box::from_raw(self.contents.result) };
11289                         }
11290                 } else {
11291                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
11292                                 let _ = unsafe { Box::from_raw(self.contents.err) };
11293                         }
11294                 }
11295         }
11296 }
11297 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::NodeAnnouncement, crate::lightning::ln::msgs::DecodeError>> for CResult_NodeAnnouncementDecodeErrorZ {
11298         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::NodeAnnouncement, crate::lightning::ln::msgs::DecodeError>) -> Self {
11299                 let contents = if o.result_ok {
11300                         let result = unsafe { o.contents.result };
11301                         unsafe { o.contents.result = std::ptr::null_mut() };
11302                         CResult_NodeAnnouncementDecodeErrorZPtr { result }
11303                 } else {
11304                         let err = unsafe { o.contents.err };
11305                         unsafe { o.contents.err = std::ptr::null_mut(); }
11306                         CResult_NodeAnnouncementDecodeErrorZPtr { err }
11307                 };
11308                 Self {
11309                         contents,
11310                         result_ok: o.result_ok,
11311                 }
11312         }
11313 }
11314 impl Clone for CResult_NodeAnnouncementDecodeErrorZ {
11315         fn clone(&self) -> Self {
11316                 if self.result_ok {
11317                         Self { result_ok: true, contents: CResult_NodeAnnouncementDecodeErrorZPtr {
11318                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::NodeAnnouncement>::clone(unsafe { &*self.contents.result })))
11319                         } }
11320                 } else {
11321                         Self { result_ok: false, contents: CResult_NodeAnnouncementDecodeErrorZPtr {
11322                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
11323                         } }
11324                 }
11325         }
11326 }
11327 #[no_mangle]
11328 /// Creates a new CResult_NodeAnnouncementDecodeErrorZ which has the same data as `orig`
11329 /// but with all dynamically-allocated buffers duplicated in new buffers.
11330 pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_clone(orig: &CResult_NodeAnnouncementDecodeErrorZ) -> CResult_NodeAnnouncementDecodeErrorZ { Clone::clone(&orig) }
11331 #[repr(C)]
11332 /// The contents of CResult_QueryShortChannelIdsDecodeErrorZ
11333 pub union CResult_QueryShortChannelIdsDecodeErrorZPtr {
11334         /// A pointer to the contents in the success state.
11335         /// Reading from this pointer when `result_ok` is not set is undefined.
11336         pub result: *mut crate::lightning::ln::msgs::QueryShortChannelIds,
11337         /// A pointer to the contents in the error state.
11338         /// Reading from this pointer when `result_ok` is set is undefined.
11339         pub err: *mut crate::lightning::ln::msgs::DecodeError,
11340 }
11341 #[repr(C)]
11342 /// A CResult_QueryShortChannelIdsDecodeErrorZ represents the result of a fallible operation,
11343 /// containing a crate::lightning::ln::msgs::QueryShortChannelIds on success and a crate::lightning::ln::msgs::DecodeError on failure.
11344 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11345 pub struct CResult_QueryShortChannelIdsDecodeErrorZ {
11346         /// The contents of this CResult_QueryShortChannelIdsDecodeErrorZ, accessible via either
11347         /// `err` or `result` depending on the state of `result_ok`.
11348         pub contents: CResult_QueryShortChannelIdsDecodeErrorZPtr,
11349         /// Whether this CResult_QueryShortChannelIdsDecodeErrorZ represents a success state.
11350         pub result_ok: bool,
11351 }
11352 #[no_mangle]
11353 /// Creates a new CResult_QueryShortChannelIdsDecodeErrorZ in the success state.
11354 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_ok(o: crate::lightning::ln::msgs::QueryShortChannelIds) -> CResult_QueryShortChannelIdsDecodeErrorZ {
11355         CResult_QueryShortChannelIdsDecodeErrorZ {
11356                 contents: CResult_QueryShortChannelIdsDecodeErrorZPtr {
11357                         result: Box::into_raw(Box::new(o)),
11358                 },
11359                 result_ok: true,
11360         }
11361 }
11362 #[no_mangle]
11363 /// Creates a new CResult_QueryShortChannelIdsDecodeErrorZ in the error state.
11364 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_QueryShortChannelIdsDecodeErrorZ {
11365         CResult_QueryShortChannelIdsDecodeErrorZ {
11366                 contents: CResult_QueryShortChannelIdsDecodeErrorZPtr {
11367                         err: Box::into_raw(Box::new(e)),
11368                 },
11369                 result_ok: false,
11370         }
11371 }
11372 #[no_mangle]
11373 /// Frees any resources used by the CResult_QueryShortChannelIdsDecodeErrorZ.
11374 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_free(_res: CResult_QueryShortChannelIdsDecodeErrorZ) { }
11375 impl Drop for CResult_QueryShortChannelIdsDecodeErrorZ {
11376         fn drop(&mut self) {
11377                 if self.result_ok {
11378                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
11379                                 let _ = unsafe { Box::from_raw(self.contents.result) };
11380                         }
11381                 } else {
11382                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
11383                                 let _ = unsafe { Box::from_raw(self.contents.err) };
11384                         }
11385                 }
11386         }
11387 }
11388 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::QueryShortChannelIds, crate::lightning::ln::msgs::DecodeError>> for CResult_QueryShortChannelIdsDecodeErrorZ {
11389         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::QueryShortChannelIds, crate::lightning::ln::msgs::DecodeError>) -> Self {
11390                 let contents = if o.result_ok {
11391                         let result = unsafe { o.contents.result };
11392                         unsafe { o.contents.result = std::ptr::null_mut() };
11393                         CResult_QueryShortChannelIdsDecodeErrorZPtr { result }
11394                 } else {
11395                         let err = unsafe { o.contents.err };
11396                         unsafe { o.contents.err = std::ptr::null_mut(); }
11397                         CResult_QueryShortChannelIdsDecodeErrorZPtr { err }
11398                 };
11399                 Self {
11400                         contents,
11401                         result_ok: o.result_ok,
11402                 }
11403         }
11404 }
11405 impl Clone for CResult_QueryShortChannelIdsDecodeErrorZ {
11406         fn clone(&self) -> Self {
11407                 if self.result_ok {
11408                         Self { result_ok: true, contents: CResult_QueryShortChannelIdsDecodeErrorZPtr {
11409                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::QueryShortChannelIds>::clone(unsafe { &*self.contents.result })))
11410                         } }
11411                 } else {
11412                         Self { result_ok: false, contents: CResult_QueryShortChannelIdsDecodeErrorZPtr {
11413                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
11414                         } }
11415                 }
11416         }
11417 }
11418 #[no_mangle]
11419 /// Creates a new CResult_QueryShortChannelIdsDecodeErrorZ which has the same data as `orig`
11420 /// but with all dynamically-allocated buffers duplicated in new buffers.
11421 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_clone(orig: &CResult_QueryShortChannelIdsDecodeErrorZ) -> CResult_QueryShortChannelIdsDecodeErrorZ { Clone::clone(&orig) }
11422 #[repr(C)]
11423 /// The contents of CResult_ReplyShortChannelIdsEndDecodeErrorZ
11424 pub union CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
11425         /// A pointer to the contents in the success state.
11426         /// Reading from this pointer when `result_ok` is not set is undefined.
11427         pub result: *mut crate::lightning::ln::msgs::ReplyShortChannelIdsEnd,
11428         /// A pointer to the contents in the error state.
11429         /// Reading from this pointer when `result_ok` is set is undefined.
11430         pub err: *mut crate::lightning::ln::msgs::DecodeError,
11431 }
11432 #[repr(C)]
11433 /// A CResult_ReplyShortChannelIdsEndDecodeErrorZ represents the result of a fallible operation,
11434 /// containing a crate::lightning::ln::msgs::ReplyShortChannelIdsEnd on success and a crate::lightning::ln::msgs::DecodeError on failure.
11435 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11436 pub struct CResult_ReplyShortChannelIdsEndDecodeErrorZ {
11437         /// The contents of this CResult_ReplyShortChannelIdsEndDecodeErrorZ, accessible via either
11438         /// `err` or `result` depending on the state of `result_ok`.
11439         pub contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr,
11440         /// Whether this CResult_ReplyShortChannelIdsEndDecodeErrorZ represents a success state.
11441         pub result_ok: bool,
11442 }
11443 #[no_mangle]
11444 /// Creates a new CResult_ReplyShortChannelIdsEndDecodeErrorZ in the success state.
11445 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ReplyShortChannelIdsEnd) -> CResult_ReplyShortChannelIdsEndDecodeErrorZ {
11446         CResult_ReplyShortChannelIdsEndDecodeErrorZ {
11447                 contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
11448                         result: Box::into_raw(Box::new(o)),
11449                 },
11450                 result_ok: true,
11451         }
11452 }
11453 #[no_mangle]
11454 /// Creates a new CResult_ReplyShortChannelIdsEndDecodeErrorZ in the error state.
11455 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ReplyShortChannelIdsEndDecodeErrorZ {
11456         CResult_ReplyShortChannelIdsEndDecodeErrorZ {
11457                 contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
11458                         err: Box::into_raw(Box::new(e)),
11459                 },
11460                 result_ok: false,
11461         }
11462 }
11463 #[no_mangle]
11464 /// Frees any resources used by the CResult_ReplyShortChannelIdsEndDecodeErrorZ.
11465 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_free(_res: CResult_ReplyShortChannelIdsEndDecodeErrorZ) { }
11466 impl Drop for CResult_ReplyShortChannelIdsEndDecodeErrorZ {
11467         fn drop(&mut self) {
11468                 if self.result_ok {
11469                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
11470                                 let _ = unsafe { Box::from_raw(self.contents.result) };
11471                         }
11472                 } else {
11473                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
11474                                 let _ = unsafe { Box::from_raw(self.contents.err) };
11475                         }
11476                 }
11477         }
11478 }
11479 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ReplyShortChannelIdsEnd, crate::lightning::ln::msgs::DecodeError>> for CResult_ReplyShortChannelIdsEndDecodeErrorZ {
11480         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ReplyShortChannelIdsEnd, crate::lightning::ln::msgs::DecodeError>) -> Self {
11481                 let contents = if o.result_ok {
11482                         let result = unsafe { o.contents.result };
11483                         unsafe { o.contents.result = std::ptr::null_mut() };
11484                         CResult_ReplyShortChannelIdsEndDecodeErrorZPtr { result }
11485                 } else {
11486                         let err = unsafe { o.contents.err };
11487                         unsafe { o.contents.err = std::ptr::null_mut(); }
11488                         CResult_ReplyShortChannelIdsEndDecodeErrorZPtr { err }
11489                 };
11490                 Self {
11491                         contents,
11492                         result_ok: o.result_ok,
11493                 }
11494         }
11495 }
11496 impl Clone for CResult_ReplyShortChannelIdsEndDecodeErrorZ {
11497         fn clone(&self) -> Self {
11498                 if self.result_ok {
11499                         Self { result_ok: true, contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
11500                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ReplyShortChannelIdsEnd>::clone(unsafe { &*self.contents.result })))
11501                         } }
11502                 } else {
11503                         Self { result_ok: false, contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
11504                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
11505                         } }
11506                 }
11507         }
11508 }
11509 #[no_mangle]
11510 /// Creates a new CResult_ReplyShortChannelIdsEndDecodeErrorZ which has the same data as `orig`
11511 /// but with all dynamically-allocated buffers duplicated in new buffers.
11512 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone(orig: &CResult_ReplyShortChannelIdsEndDecodeErrorZ) -> CResult_ReplyShortChannelIdsEndDecodeErrorZ { Clone::clone(&orig) }
11513 #[repr(C)]
11514 /// The contents of CResult_QueryChannelRangeDecodeErrorZ
11515 pub union CResult_QueryChannelRangeDecodeErrorZPtr {
11516         /// A pointer to the contents in the success state.
11517         /// Reading from this pointer when `result_ok` is not set is undefined.
11518         pub result: *mut crate::lightning::ln::msgs::QueryChannelRange,
11519         /// A pointer to the contents in the error state.
11520         /// Reading from this pointer when `result_ok` is set is undefined.
11521         pub err: *mut crate::lightning::ln::msgs::DecodeError,
11522 }
11523 #[repr(C)]
11524 /// A CResult_QueryChannelRangeDecodeErrorZ represents the result of a fallible operation,
11525 /// containing a crate::lightning::ln::msgs::QueryChannelRange on success and a crate::lightning::ln::msgs::DecodeError on failure.
11526 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11527 pub struct CResult_QueryChannelRangeDecodeErrorZ {
11528         /// The contents of this CResult_QueryChannelRangeDecodeErrorZ, accessible via either
11529         /// `err` or `result` depending on the state of `result_ok`.
11530         pub contents: CResult_QueryChannelRangeDecodeErrorZPtr,
11531         /// Whether this CResult_QueryChannelRangeDecodeErrorZ represents a success state.
11532         pub result_ok: bool,
11533 }
11534 #[no_mangle]
11535 /// Creates a new CResult_QueryChannelRangeDecodeErrorZ in the success state.
11536 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_ok(o: crate::lightning::ln::msgs::QueryChannelRange) -> CResult_QueryChannelRangeDecodeErrorZ {
11537         CResult_QueryChannelRangeDecodeErrorZ {
11538                 contents: CResult_QueryChannelRangeDecodeErrorZPtr {
11539                         result: Box::into_raw(Box::new(o)),
11540                 },
11541                 result_ok: true,
11542         }
11543 }
11544 #[no_mangle]
11545 /// Creates a new CResult_QueryChannelRangeDecodeErrorZ in the error state.
11546 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_QueryChannelRangeDecodeErrorZ {
11547         CResult_QueryChannelRangeDecodeErrorZ {
11548                 contents: CResult_QueryChannelRangeDecodeErrorZPtr {
11549                         err: Box::into_raw(Box::new(e)),
11550                 },
11551                 result_ok: false,
11552         }
11553 }
11554 #[no_mangle]
11555 /// Frees any resources used by the CResult_QueryChannelRangeDecodeErrorZ.
11556 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_free(_res: CResult_QueryChannelRangeDecodeErrorZ) { }
11557 impl Drop for CResult_QueryChannelRangeDecodeErrorZ {
11558         fn drop(&mut self) {
11559                 if self.result_ok {
11560                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
11561                                 let _ = unsafe { Box::from_raw(self.contents.result) };
11562                         }
11563                 } else {
11564                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
11565                                 let _ = unsafe { Box::from_raw(self.contents.err) };
11566                         }
11567                 }
11568         }
11569 }
11570 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::QueryChannelRange, crate::lightning::ln::msgs::DecodeError>> for CResult_QueryChannelRangeDecodeErrorZ {
11571         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::QueryChannelRange, crate::lightning::ln::msgs::DecodeError>) -> Self {
11572                 let contents = if o.result_ok {
11573                         let result = unsafe { o.contents.result };
11574                         unsafe { o.contents.result = std::ptr::null_mut() };
11575                         CResult_QueryChannelRangeDecodeErrorZPtr { result }
11576                 } else {
11577                         let err = unsafe { o.contents.err };
11578                         unsafe { o.contents.err = std::ptr::null_mut(); }
11579                         CResult_QueryChannelRangeDecodeErrorZPtr { err }
11580                 };
11581                 Self {
11582                         contents,
11583                         result_ok: o.result_ok,
11584                 }
11585         }
11586 }
11587 impl Clone for CResult_QueryChannelRangeDecodeErrorZ {
11588         fn clone(&self) -> Self {
11589                 if self.result_ok {
11590                         Self { result_ok: true, contents: CResult_QueryChannelRangeDecodeErrorZPtr {
11591                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::QueryChannelRange>::clone(unsafe { &*self.contents.result })))
11592                         } }
11593                 } else {
11594                         Self { result_ok: false, contents: CResult_QueryChannelRangeDecodeErrorZPtr {
11595                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
11596                         } }
11597                 }
11598         }
11599 }
11600 #[no_mangle]
11601 /// Creates a new CResult_QueryChannelRangeDecodeErrorZ which has the same data as `orig`
11602 /// but with all dynamically-allocated buffers duplicated in new buffers.
11603 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_clone(orig: &CResult_QueryChannelRangeDecodeErrorZ) -> CResult_QueryChannelRangeDecodeErrorZ { Clone::clone(&orig) }
11604 #[repr(C)]
11605 /// The contents of CResult_ReplyChannelRangeDecodeErrorZ
11606 pub union CResult_ReplyChannelRangeDecodeErrorZPtr {
11607         /// A pointer to the contents in the success state.
11608         /// Reading from this pointer when `result_ok` is not set is undefined.
11609         pub result: *mut crate::lightning::ln::msgs::ReplyChannelRange,
11610         /// A pointer to the contents in the error state.
11611         /// Reading from this pointer when `result_ok` is set is undefined.
11612         pub err: *mut crate::lightning::ln::msgs::DecodeError,
11613 }
11614 #[repr(C)]
11615 /// A CResult_ReplyChannelRangeDecodeErrorZ represents the result of a fallible operation,
11616 /// containing a crate::lightning::ln::msgs::ReplyChannelRange on success and a crate::lightning::ln::msgs::DecodeError on failure.
11617 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11618 pub struct CResult_ReplyChannelRangeDecodeErrorZ {
11619         /// The contents of this CResult_ReplyChannelRangeDecodeErrorZ, accessible via either
11620         /// `err` or `result` depending on the state of `result_ok`.
11621         pub contents: CResult_ReplyChannelRangeDecodeErrorZPtr,
11622         /// Whether this CResult_ReplyChannelRangeDecodeErrorZ represents a success state.
11623         pub result_ok: bool,
11624 }
11625 #[no_mangle]
11626 /// Creates a new CResult_ReplyChannelRangeDecodeErrorZ in the success state.
11627 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ReplyChannelRange) -> CResult_ReplyChannelRangeDecodeErrorZ {
11628         CResult_ReplyChannelRangeDecodeErrorZ {
11629                 contents: CResult_ReplyChannelRangeDecodeErrorZPtr {
11630                         result: Box::into_raw(Box::new(o)),
11631                 },
11632                 result_ok: true,
11633         }
11634 }
11635 #[no_mangle]
11636 /// Creates a new CResult_ReplyChannelRangeDecodeErrorZ in the error state.
11637 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ReplyChannelRangeDecodeErrorZ {
11638         CResult_ReplyChannelRangeDecodeErrorZ {
11639                 contents: CResult_ReplyChannelRangeDecodeErrorZPtr {
11640                         err: Box::into_raw(Box::new(e)),
11641                 },
11642                 result_ok: false,
11643         }
11644 }
11645 #[no_mangle]
11646 /// Frees any resources used by the CResult_ReplyChannelRangeDecodeErrorZ.
11647 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_free(_res: CResult_ReplyChannelRangeDecodeErrorZ) { }
11648 impl Drop for CResult_ReplyChannelRangeDecodeErrorZ {
11649         fn drop(&mut self) {
11650                 if self.result_ok {
11651                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
11652                                 let _ = unsafe { Box::from_raw(self.contents.result) };
11653                         }
11654                 } else {
11655                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
11656                                 let _ = unsafe { Box::from_raw(self.contents.err) };
11657                         }
11658                 }
11659         }
11660 }
11661 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ReplyChannelRange, crate::lightning::ln::msgs::DecodeError>> for CResult_ReplyChannelRangeDecodeErrorZ {
11662         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ReplyChannelRange, crate::lightning::ln::msgs::DecodeError>) -> Self {
11663                 let contents = if o.result_ok {
11664                         let result = unsafe { o.contents.result };
11665                         unsafe { o.contents.result = std::ptr::null_mut() };
11666                         CResult_ReplyChannelRangeDecodeErrorZPtr { result }
11667                 } else {
11668                         let err = unsafe { o.contents.err };
11669                         unsafe { o.contents.err = std::ptr::null_mut(); }
11670                         CResult_ReplyChannelRangeDecodeErrorZPtr { err }
11671                 };
11672                 Self {
11673                         contents,
11674                         result_ok: o.result_ok,
11675                 }
11676         }
11677 }
11678 impl Clone for CResult_ReplyChannelRangeDecodeErrorZ {
11679         fn clone(&self) -> Self {
11680                 if self.result_ok {
11681                         Self { result_ok: true, contents: CResult_ReplyChannelRangeDecodeErrorZPtr {
11682                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ReplyChannelRange>::clone(unsafe { &*self.contents.result })))
11683                         } }
11684                 } else {
11685                         Self { result_ok: false, contents: CResult_ReplyChannelRangeDecodeErrorZPtr {
11686                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
11687                         } }
11688                 }
11689         }
11690 }
11691 #[no_mangle]
11692 /// Creates a new CResult_ReplyChannelRangeDecodeErrorZ which has the same data as `orig`
11693 /// but with all dynamically-allocated buffers duplicated in new buffers.
11694 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_clone(orig: &CResult_ReplyChannelRangeDecodeErrorZ) -> CResult_ReplyChannelRangeDecodeErrorZ { Clone::clone(&orig) }
11695 #[repr(C)]
11696 /// The contents of CResult_GossipTimestampFilterDecodeErrorZ
11697 pub union CResult_GossipTimestampFilterDecodeErrorZPtr {
11698         /// A pointer to the contents in the success state.
11699         /// Reading from this pointer when `result_ok` is not set is undefined.
11700         pub result: *mut crate::lightning::ln::msgs::GossipTimestampFilter,
11701         /// A pointer to the contents in the error state.
11702         /// Reading from this pointer when `result_ok` is set is undefined.
11703         pub err: *mut crate::lightning::ln::msgs::DecodeError,
11704 }
11705 #[repr(C)]
11706 /// A CResult_GossipTimestampFilterDecodeErrorZ represents the result of a fallible operation,
11707 /// containing a crate::lightning::ln::msgs::GossipTimestampFilter on success and a crate::lightning::ln::msgs::DecodeError on failure.
11708 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11709 pub struct CResult_GossipTimestampFilterDecodeErrorZ {
11710         /// The contents of this CResult_GossipTimestampFilterDecodeErrorZ, accessible via either
11711         /// `err` or `result` depending on the state of `result_ok`.
11712         pub contents: CResult_GossipTimestampFilterDecodeErrorZPtr,
11713         /// Whether this CResult_GossipTimestampFilterDecodeErrorZ represents a success state.
11714         pub result_ok: bool,
11715 }
11716 #[no_mangle]
11717 /// Creates a new CResult_GossipTimestampFilterDecodeErrorZ in the success state.
11718 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_ok(o: crate::lightning::ln::msgs::GossipTimestampFilter) -> CResult_GossipTimestampFilterDecodeErrorZ {
11719         CResult_GossipTimestampFilterDecodeErrorZ {
11720                 contents: CResult_GossipTimestampFilterDecodeErrorZPtr {
11721                         result: Box::into_raw(Box::new(o)),
11722                 },
11723                 result_ok: true,
11724         }
11725 }
11726 #[no_mangle]
11727 /// Creates a new CResult_GossipTimestampFilterDecodeErrorZ in the error state.
11728 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_GossipTimestampFilterDecodeErrorZ {
11729         CResult_GossipTimestampFilterDecodeErrorZ {
11730                 contents: CResult_GossipTimestampFilterDecodeErrorZPtr {
11731                         err: Box::into_raw(Box::new(e)),
11732                 },
11733                 result_ok: false,
11734         }
11735 }
11736 #[no_mangle]
11737 /// Frees any resources used by the CResult_GossipTimestampFilterDecodeErrorZ.
11738 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_free(_res: CResult_GossipTimestampFilterDecodeErrorZ) { }
11739 impl Drop for CResult_GossipTimestampFilterDecodeErrorZ {
11740         fn drop(&mut self) {
11741                 if self.result_ok {
11742                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
11743                                 let _ = unsafe { Box::from_raw(self.contents.result) };
11744                         }
11745                 } else {
11746                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
11747                                 let _ = unsafe { Box::from_raw(self.contents.err) };
11748                         }
11749                 }
11750         }
11751 }
11752 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::GossipTimestampFilter, crate::lightning::ln::msgs::DecodeError>> for CResult_GossipTimestampFilterDecodeErrorZ {
11753         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::GossipTimestampFilter, crate::lightning::ln::msgs::DecodeError>) -> Self {
11754                 let contents = if o.result_ok {
11755                         let result = unsafe { o.contents.result };
11756                         unsafe { o.contents.result = std::ptr::null_mut() };
11757                         CResult_GossipTimestampFilterDecodeErrorZPtr { result }
11758                 } else {
11759                         let err = unsafe { o.contents.err };
11760                         unsafe { o.contents.err = std::ptr::null_mut(); }
11761                         CResult_GossipTimestampFilterDecodeErrorZPtr { err }
11762                 };
11763                 Self {
11764                         contents,
11765                         result_ok: o.result_ok,
11766                 }
11767         }
11768 }
11769 impl Clone for CResult_GossipTimestampFilterDecodeErrorZ {
11770         fn clone(&self) -> Self {
11771                 if self.result_ok {
11772                         Self { result_ok: true, contents: CResult_GossipTimestampFilterDecodeErrorZPtr {
11773                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::GossipTimestampFilter>::clone(unsafe { &*self.contents.result })))
11774                         } }
11775                 } else {
11776                         Self { result_ok: false, contents: CResult_GossipTimestampFilterDecodeErrorZPtr {
11777                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
11778                         } }
11779                 }
11780         }
11781 }
11782 #[no_mangle]
11783 /// Creates a new CResult_GossipTimestampFilterDecodeErrorZ which has the same data as `orig`
11784 /// but with all dynamically-allocated buffers duplicated in new buffers.
11785 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_clone(orig: &CResult_GossipTimestampFilterDecodeErrorZ) -> CResult_GossipTimestampFilterDecodeErrorZ { Clone::clone(&orig) }
11786 #[repr(C)]
11787 /// The contents of CResult_InvoiceSignOrCreationErrorZ
11788 pub union CResult_InvoiceSignOrCreationErrorZPtr {
11789         /// A pointer to the contents in the success state.
11790         /// Reading from this pointer when `result_ok` is not set is undefined.
11791         pub result: *mut crate::lightning_invoice::Invoice,
11792         /// A pointer to the contents in the error state.
11793         /// Reading from this pointer when `result_ok` is set is undefined.
11794         pub err: *mut crate::lightning_invoice::SignOrCreationError,
11795 }
11796 #[repr(C)]
11797 /// A CResult_InvoiceSignOrCreationErrorZ represents the result of a fallible operation,
11798 /// containing a crate::lightning_invoice::Invoice on success and a crate::lightning_invoice::SignOrCreationError on failure.
11799 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11800 pub struct CResult_InvoiceSignOrCreationErrorZ {
11801         /// The contents of this CResult_InvoiceSignOrCreationErrorZ, accessible via either
11802         /// `err` or `result` depending on the state of `result_ok`.
11803         pub contents: CResult_InvoiceSignOrCreationErrorZPtr,
11804         /// Whether this CResult_InvoiceSignOrCreationErrorZ represents a success state.
11805         pub result_ok: bool,
11806 }
11807 #[no_mangle]
11808 /// Creates a new CResult_InvoiceSignOrCreationErrorZ in the success state.
11809 pub extern "C" fn CResult_InvoiceSignOrCreationErrorZ_ok(o: crate::lightning_invoice::Invoice) -> CResult_InvoiceSignOrCreationErrorZ {
11810         CResult_InvoiceSignOrCreationErrorZ {
11811                 contents: CResult_InvoiceSignOrCreationErrorZPtr {
11812                         result: Box::into_raw(Box::new(o)),
11813                 },
11814                 result_ok: true,
11815         }
11816 }
11817 #[no_mangle]
11818 /// Creates a new CResult_InvoiceSignOrCreationErrorZ in the error state.
11819 pub extern "C" fn CResult_InvoiceSignOrCreationErrorZ_err(e: crate::lightning_invoice::SignOrCreationError) -> CResult_InvoiceSignOrCreationErrorZ {
11820         CResult_InvoiceSignOrCreationErrorZ {
11821                 contents: CResult_InvoiceSignOrCreationErrorZPtr {
11822                         err: Box::into_raw(Box::new(e)),
11823                 },
11824                 result_ok: false,
11825         }
11826 }
11827 #[no_mangle]
11828 /// Frees any resources used by the CResult_InvoiceSignOrCreationErrorZ.
11829 pub extern "C" fn CResult_InvoiceSignOrCreationErrorZ_free(_res: CResult_InvoiceSignOrCreationErrorZ) { }
11830 impl Drop for CResult_InvoiceSignOrCreationErrorZ {
11831         fn drop(&mut self) {
11832                 if self.result_ok {
11833                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
11834                                 let _ = unsafe { Box::from_raw(self.contents.result) };
11835                         }
11836                 } else {
11837                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
11838                                 let _ = unsafe { Box::from_raw(self.contents.err) };
11839                         }
11840                 }
11841         }
11842 }
11843 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::Invoice, crate::lightning_invoice::SignOrCreationError>> for CResult_InvoiceSignOrCreationErrorZ {
11844         fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::Invoice, crate::lightning_invoice::SignOrCreationError>) -> Self {
11845                 let contents = if o.result_ok {
11846                         let result = unsafe { o.contents.result };
11847                         unsafe { o.contents.result = std::ptr::null_mut() };
11848                         CResult_InvoiceSignOrCreationErrorZPtr { result }
11849                 } else {
11850                         let err = unsafe { o.contents.err };
11851                         unsafe { o.contents.err = std::ptr::null_mut(); }
11852                         CResult_InvoiceSignOrCreationErrorZPtr { err }
11853                 };
11854                 Self {
11855                         contents,
11856                         result_ok: o.result_ok,
11857                 }
11858         }
11859 }
11860 impl Clone for CResult_InvoiceSignOrCreationErrorZ {
11861         fn clone(&self) -> Self {
11862                 if self.result_ok {
11863                         Self { result_ok: true, contents: CResult_InvoiceSignOrCreationErrorZPtr {
11864                                 result: Box::into_raw(Box::new(<crate::lightning_invoice::Invoice>::clone(unsafe { &*self.contents.result })))
11865                         } }
11866                 } else {
11867                         Self { result_ok: false, contents: CResult_InvoiceSignOrCreationErrorZPtr {
11868                                 err: Box::into_raw(Box::new(<crate::lightning_invoice::SignOrCreationError>::clone(unsafe { &*self.contents.err })))
11869                         } }
11870                 }
11871         }
11872 }
11873 #[no_mangle]
11874 /// Creates a new CResult_InvoiceSignOrCreationErrorZ which has the same data as `orig`
11875 /// but with all dynamically-allocated buffers duplicated in new buffers.
11876 pub extern "C" fn CResult_InvoiceSignOrCreationErrorZ_clone(orig: &CResult_InvoiceSignOrCreationErrorZ) -> CResult_InvoiceSignOrCreationErrorZ { Clone::clone(&orig) }
11877 #[repr(C)]
11878 /// An enum which can either contain a crate::lightning::chain::Filter or not
11879 pub enum COption_FilterZ {
11880         /// When we're in this state, this COption_FilterZ contains a crate::lightning::chain::Filter
11881         Some(crate::lightning::chain::Filter),
11882         /// When we're in this state, this COption_FilterZ contains nothing
11883         None
11884 }
11885 impl COption_FilterZ {
11886         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
11887                 if let Self::Some(_) = self { true } else { false }
11888         }
11889         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
11890                 !self.is_some()
11891         }
11892         #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::chain::Filter {
11893                 if let Self::Some(v) = self { v } else { unreachable!() }
11894         }
11895 }
11896 #[no_mangle]
11897 /// Constructs a new COption_FilterZ containing a crate::lightning::chain::Filter
11898 pub extern "C" fn COption_FilterZ_some(o: crate::lightning::chain::Filter) -> COption_FilterZ {
11899         COption_FilterZ::Some(o)
11900 }
11901 #[no_mangle]
11902 /// Constructs a new COption_FilterZ containing nothing
11903 pub extern "C" fn COption_FilterZ_none() -> COption_FilterZ {
11904         COption_FilterZ::None
11905 }
11906 #[no_mangle]
11907 /// Frees any resources associated with the crate::lightning::chain::Filter, if we are in the Some state
11908 pub extern "C" fn COption_FilterZ_free(_res: COption_FilterZ) { }