Merge pull request #48 from TheBlueMatt/main
[ldk-c-bindings] / lightning-c-bindings / src / c_types / derived.rs
1 #[repr(C)]
2 /// The contents of CResult_SecretKeyErrorZ
3 pub union CResult_SecretKeyErrorZPtr {
4         /// A pointer to the contents in the success state.
5         /// Reading from this pointer when `result_ok` is not set is undefined.
6         pub result: *mut crate::c_types::SecretKey,
7         /// A pointer to the contents in the error state.
8         /// Reading from this pointer when `result_ok` is set is undefined.
9         pub err: *mut crate::c_types::Secp256k1Error,
10 }
11 #[repr(C)]
12 /// A CResult_SecretKeyErrorZ represents the result of a fallible operation,
13 /// containing a crate::c_types::SecretKey on success and a crate::c_types::Secp256k1Error on failure.
14 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
15 pub struct CResult_SecretKeyErrorZ {
16         /// The contents of this CResult_SecretKeyErrorZ, accessible via either
17         /// `err` or `result` depending on the state of `result_ok`.
18         pub contents: CResult_SecretKeyErrorZPtr,
19         /// Whether this CResult_SecretKeyErrorZ represents a success state.
20         pub result_ok: bool,
21 }
22 #[no_mangle]
23 /// Creates a new CResult_SecretKeyErrorZ in the success state.
24 pub extern "C" fn CResult_SecretKeyErrorZ_ok(o: crate::c_types::SecretKey) -> CResult_SecretKeyErrorZ {
25         CResult_SecretKeyErrorZ {
26                 contents: CResult_SecretKeyErrorZPtr {
27                         result: Box::into_raw(Box::new(o)),
28                 },
29                 result_ok: true,
30         }
31 }
32 #[no_mangle]
33 /// Creates a new CResult_SecretKeyErrorZ in the error state.
34 pub extern "C" fn CResult_SecretKeyErrorZ_err(e: crate::c_types::Secp256k1Error) -> CResult_SecretKeyErrorZ {
35         CResult_SecretKeyErrorZ {
36                 contents: CResult_SecretKeyErrorZPtr {
37                         err: Box::into_raw(Box::new(e)),
38                 },
39                 result_ok: false,
40         }
41 }
42 #[no_mangle]
43 /// Frees any resources used by the CResult_SecretKeyErrorZ.
44 pub extern "C" fn CResult_SecretKeyErrorZ_free(_res: CResult_SecretKeyErrorZ) { }
45 impl Drop for CResult_SecretKeyErrorZ {
46         fn drop(&mut self) {
47                 if self.result_ok {
48                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
49                                 let _ = unsafe { Box::from_raw(self.contents.result) };
50                         }
51                 } else {
52                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
53                                 let _ = unsafe { Box::from_raw(self.contents.err) };
54                         }
55                 }
56         }
57 }
58 impl From<crate::c_types::CResultTempl<crate::c_types::SecretKey, crate::c_types::Secp256k1Error>> for CResult_SecretKeyErrorZ {
59         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::SecretKey, crate::c_types::Secp256k1Error>) -> Self {
60                 let contents = if o.result_ok {
61                         let result = unsafe { o.contents.result };
62                         unsafe { o.contents.result = std::ptr::null_mut() };
63                         CResult_SecretKeyErrorZPtr { result }
64                 } else {
65                         let err = unsafe { o.contents.err };
66                         unsafe { o.contents.err = std::ptr::null_mut(); }
67                         CResult_SecretKeyErrorZPtr { err }
68                 };
69                 Self {
70                         contents,
71                         result_ok: o.result_ok,
72                 }
73         }
74 }
75 #[repr(C)]
76 /// The contents of CResult_PublicKeyErrorZ
77 pub union CResult_PublicKeyErrorZPtr {
78         /// A pointer to the contents in the success state.
79         /// Reading from this pointer when `result_ok` is not set is undefined.
80         pub result: *mut crate::c_types::PublicKey,
81         /// A pointer to the contents in the error state.
82         /// Reading from this pointer when `result_ok` is set is undefined.
83         pub err: *mut crate::c_types::Secp256k1Error,
84 }
85 #[repr(C)]
86 /// A CResult_PublicKeyErrorZ represents the result of a fallible operation,
87 /// containing a crate::c_types::PublicKey on success and a crate::c_types::Secp256k1Error on failure.
88 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
89 pub struct CResult_PublicKeyErrorZ {
90         /// The contents of this CResult_PublicKeyErrorZ, accessible via either
91         /// `err` or `result` depending on the state of `result_ok`.
92         pub contents: CResult_PublicKeyErrorZPtr,
93         /// Whether this CResult_PublicKeyErrorZ represents a success state.
94         pub result_ok: bool,
95 }
96 #[no_mangle]
97 /// Creates a new CResult_PublicKeyErrorZ in the success state.
98 pub extern "C" fn CResult_PublicKeyErrorZ_ok(o: crate::c_types::PublicKey) -> CResult_PublicKeyErrorZ {
99         CResult_PublicKeyErrorZ {
100                 contents: CResult_PublicKeyErrorZPtr {
101                         result: Box::into_raw(Box::new(o)),
102                 },
103                 result_ok: true,
104         }
105 }
106 #[no_mangle]
107 /// Creates a new CResult_PublicKeyErrorZ in the error state.
108 pub extern "C" fn CResult_PublicKeyErrorZ_err(e: crate::c_types::Secp256k1Error) -> CResult_PublicKeyErrorZ {
109         CResult_PublicKeyErrorZ {
110                 contents: CResult_PublicKeyErrorZPtr {
111                         err: Box::into_raw(Box::new(e)),
112                 },
113                 result_ok: false,
114         }
115 }
116 #[no_mangle]
117 /// Frees any resources used by the CResult_PublicKeyErrorZ.
118 pub extern "C" fn CResult_PublicKeyErrorZ_free(_res: CResult_PublicKeyErrorZ) { }
119 impl Drop for CResult_PublicKeyErrorZ {
120         fn drop(&mut self) {
121                 if self.result_ok {
122                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
123                                 let _ = unsafe { Box::from_raw(self.contents.result) };
124                         }
125                 } else {
126                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
127                                 let _ = unsafe { Box::from_raw(self.contents.err) };
128                         }
129                 }
130         }
131 }
132 impl From<crate::c_types::CResultTempl<crate::c_types::PublicKey, crate::c_types::Secp256k1Error>> for CResult_PublicKeyErrorZ {
133         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::PublicKey, crate::c_types::Secp256k1Error>) -> Self {
134                 let contents = if o.result_ok {
135                         let result = unsafe { o.contents.result };
136                         unsafe { o.contents.result = std::ptr::null_mut() };
137                         CResult_PublicKeyErrorZPtr { result }
138                 } else {
139                         let err = unsafe { o.contents.err };
140                         unsafe { o.contents.err = std::ptr::null_mut(); }
141                         CResult_PublicKeyErrorZPtr { err }
142                 };
143                 Self {
144                         contents,
145                         result_ok: o.result_ok,
146                 }
147         }
148 }
149 impl Clone for CResult_PublicKeyErrorZ {
150         fn clone(&self) -> Self {
151                 if self.result_ok {
152                         Self { result_ok: true, contents: CResult_PublicKeyErrorZPtr {
153                                 result: Box::into_raw(Box::new(<crate::c_types::PublicKey>::clone(unsafe { &*self.contents.result })))
154                         } }
155                 } else {
156                         Self { result_ok: false, contents: CResult_PublicKeyErrorZPtr {
157                                 err: Box::into_raw(Box::new(<crate::c_types::Secp256k1Error>::clone(unsafe { &*self.contents.err })))
158                         } }
159                 }
160         }
161 }
162 #[no_mangle]
163 /// Creates a new CResult_PublicKeyErrorZ which has the same data as `orig`
164 /// but with all dynamically-allocated buffers duplicated in new buffers.
165 pub extern "C" fn CResult_PublicKeyErrorZ_clone(orig: &CResult_PublicKeyErrorZ) -> CResult_PublicKeyErrorZ { Clone::clone(&orig) }
166 #[repr(C)]
167 /// The contents of CResult_TxCreationKeysDecodeErrorZ
168 pub union CResult_TxCreationKeysDecodeErrorZPtr {
169         /// A pointer to the contents in the success state.
170         /// Reading from this pointer when `result_ok` is not set is undefined.
171         pub result: *mut crate::lightning::ln::chan_utils::TxCreationKeys,
172         /// A pointer to the contents in the error state.
173         /// Reading from this pointer when `result_ok` is set is undefined.
174         pub err: *mut crate::lightning::ln::msgs::DecodeError,
175 }
176 #[repr(C)]
177 /// A CResult_TxCreationKeysDecodeErrorZ represents the result of a fallible operation,
178 /// containing a crate::lightning::ln::chan_utils::TxCreationKeys on success and a crate::lightning::ln::msgs::DecodeError on failure.
179 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
180 pub struct CResult_TxCreationKeysDecodeErrorZ {
181         /// The contents of this CResult_TxCreationKeysDecodeErrorZ, accessible via either
182         /// `err` or `result` depending on the state of `result_ok`.
183         pub contents: CResult_TxCreationKeysDecodeErrorZPtr,
184         /// Whether this CResult_TxCreationKeysDecodeErrorZ represents a success state.
185         pub result_ok: bool,
186 }
187 #[no_mangle]
188 /// Creates a new CResult_TxCreationKeysDecodeErrorZ in the success state.
189 pub extern "C" fn CResult_TxCreationKeysDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::TxCreationKeys) -> CResult_TxCreationKeysDecodeErrorZ {
190         CResult_TxCreationKeysDecodeErrorZ {
191                 contents: CResult_TxCreationKeysDecodeErrorZPtr {
192                         result: Box::into_raw(Box::new(o)),
193                 },
194                 result_ok: true,
195         }
196 }
197 #[no_mangle]
198 /// Creates a new CResult_TxCreationKeysDecodeErrorZ in the error state.
199 pub extern "C" fn CResult_TxCreationKeysDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_TxCreationKeysDecodeErrorZ {
200         CResult_TxCreationKeysDecodeErrorZ {
201                 contents: CResult_TxCreationKeysDecodeErrorZPtr {
202                         err: Box::into_raw(Box::new(e)),
203                 },
204                 result_ok: false,
205         }
206 }
207 #[no_mangle]
208 /// Frees any resources used by the CResult_TxCreationKeysDecodeErrorZ.
209 pub extern "C" fn CResult_TxCreationKeysDecodeErrorZ_free(_res: CResult_TxCreationKeysDecodeErrorZ) { }
210 impl Drop for CResult_TxCreationKeysDecodeErrorZ {
211         fn drop(&mut self) {
212                 if self.result_ok {
213                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
214                                 let _ = unsafe { Box::from_raw(self.contents.result) };
215                         }
216                 } else {
217                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
218                                 let _ = unsafe { Box::from_raw(self.contents.err) };
219                         }
220                 }
221         }
222 }
223 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::TxCreationKeys, crate::lightning::ln::msgs::DecodeError>> for CResult_TxCreationKeysDecodeErrorZ {
224         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::TxCreationKeys, crate::lightning::ln::msgs::DecodeError>) -> Self {
225                 let contents = if o.result_ok {
226                         let result = unsafe { o.contents.result };
227                         unsafe { o.contents.result = std::ptr::null_mut() };
228                         CResult_TxCreationKeysDecodeErrorZPtr { result }
229                 } else {
230                         let err = unsafe { o.contents.err };
231                         unsafe { o.contents.err = std::ptr::null_mut(); }
232                         CResult_TxCreationKeysDecodeErrorZPtr { err }
233                 };
234                 Self {
235                         contents,
236                         result_ok: o.result_ok,
237                 }
238         }
239 }
240 impl Clone for CResult_TxCreationKeysDecodeErrorZ {
241         fn clone(&self) -> Self {
242                 if self.result_ok {
243                         Self { result_ok: true, contents: CResult_TxCreationKeysDecodeErrorZPtr {
244                                 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::TxCreationKeys>::clone(unsafe { &*self.contents.result })))
245                         } }
246                 } else {
247                         Self { result_ok: false, contents: CResult_TxCreationKeysDecodeErrorZPtr {
248                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
249                         } }
250                 }
251         }
252 }
253 #[no_mangle]
254 /// Creates a new CResult_TxCreationKeysDecodeErrorZ which has the same data as `orig`
255 /// but with all dynamically-allocated buffers duplicated in new buffers.
256 pub extern "C" fn CResult_TxCreationKeysDecodeErrorZ_clone(orig: &CResult_TxCreationKeysDecodeErrorZ) -> CResult_TxCreationKeysDecodeErrorZ { Clone::clone(&orig) }
257 #[repr(C)]
258 /// The contents of CResult_ChannelPublicKeysDecodeErrorZ
259 pub union CResult_ChannelPublicKeysDecodeErrorZPtr {
260         /// A pointer to the contents in the success state.
261         /// Reading from this pointer when `result_ok` is not set is undefined.
262         pub result: *mut crate::lightning::ln::chan_utils::ChannelPublicKeys,
263         /// A pointer to the contents in the error state.
264         /// Reading from this pointer when `result_ok` is set is undefined.
265         pub err: *mut crate::lightning::ln::msgs::DecodeError,
266 }
267 #[repr(C)]
268 /// A CResult_ChannelPublicKeysDecodeErrorZ represents the result of a fallible operation,
269 /// containing a crate::lightning::ln::chan_utils::ChannelPublicKeys on success and a crate::lightning::ln::msgs::DecodeError on failure.
270 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
271 pub struct CResult_ChannelPublicKeysDecodeErrorZ {
272         /// The contents of this CResult_ChannelPublicKeysDecodeErrorZ, accessible via either
273         /// `err` or `result` depending on the state of `result_ok`.
274         pub contents: CResult_ChannelPublicKeysDecodeErrorZPtr,
275         /// Whether this CResult_ChannelPublicKeysDecodeErrorZ represents a success state.
276         pub result_ok: bool,
277 }
278 #[no_mangle]
279 /// Creates a new CResult_ChannelPublicKeysDecodeErrorZ in the success state.
280 pub extern "C" fn CResult_ChannelPublicKeysDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::ChannelPublicKeys) -> CResult_ChannelPublicKeysDecodeErrorZ {
281         CResult_ChannelPublicKeysDecodeErrorZ {
282                 contents: CResult_ChannelPublicKeysDecodeErrorZPtr {
283                         result: Box::into_raw(Box::new(o)),
284                 },
285                 result_ok: true,
286         }
287 }
288 #[no_mangle]
289 /// Creates a new CResult_ChannelPublicKeysDecodeErrorZ in the error state.
290 pub extern "C" fn CResult_ChannelPublicKeysDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelPublicKeysDecodeErrorZ {
291         CResult_ChannelPublicKeysDecodeErrorZ {
292                 contents: CResult_ChannelPublicKeysDecodeErrorZPtr {
293                         err: Box::into_raw(Box::new(e)),
294                 },
295                 result_ok: false,
296         }
297 }
298 #[no_mangle]
299 /// Frees any resources used by the CResult_ChannelPublicKeysDecodeErrorZ.
300 pub extern "C" fn CResult_ChannelPublicKeysDecodeErrorZ_free(_res: CResult_ChannelPublicKeysDecodeErrorZ) { }
301 impl Drop for CResult_ChannelPublicKeysDecodeErrorZ {
302         fn drop(&mut self) {
303                 if self.result_ok {
304                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
305                                 let _ = unsafe { Box::from_raw(self.contents.result) };
306                         }
307                 } else {
308                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
309                                 let _ = unsafe { Box::from_raw(self.contents.err) };
310                         }
311                 }
312         }
313 }
314 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::ChannelPublicKeys, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelPublicKeysDecodeErrorZ {
315         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::ChannelPublicKeys, crate::lightning::ln::msgs::DecodeError>) -> Self {
316                 let contents = if o.result_ok {
317                         let result = unsafe { o.contents.result };
318                         unsafe { o.contents.result = std::ptr::null_mut() };
319                         CResult_ChannelPublicKeysDecodeErrorZPtr { result }
320                 } else {
321                         let err = unsafe { o.contents.err };
322                         unsafe { o.contents.err = std::ptr::null_mut(); }
323                         CResult_ChannelPublicKeysDecodeErrorZPtr { err }
324                 };
325                 Self {
326                         contents,
327                         result_ok: o.result_ok,
328                 }
329         }
330 }
331 impl Clone for CResult_ChannelPublicKeysDecodeErrorZ {
332         fn clone(&self) -> Self {
333                 if self.result_ok {
334                         Self { result_ok: true, contents: CResult_ChannelPublicKeysDecodeErrorZPtr {
335                                 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::ChannelPublicKeys>::clone(unsafe { &*self.contents.result })))
336                         } }
337                 } else {
338                         Self { result_ok: false, contents: CResult_ChannelPublicKeysDecodeErrorZPtr {
339                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
340                         } }
341                 }
342         }
343 }
344 #[no_mangle]
345 /// Creates a new CResult_ChannelPublicKeysDecodeErrorZ which has the same data as `orig`
346 /// but with all dynamically-allocated buffers duplicated in new buffers.
347 pub extern "C" fn CResult_ChannelPublicKeysDecodeErrorZ_clone(orig: &CResult_ChannelPublicKeysDecodeErrorZ) -> CResult_ChannelPublicKeysDecodeErrorZ { Clone::clone(&orig) }
348 #[repr(C)]
349 /// The contents of CResult_TxCreationKeysErrorZ
350 pub union CResult_TxCreationKeysErrorZPtr {
351         /// A pointer to the contents in the success state.
352         /// Reading from this pointer when `result_ok` is not set is undefined.
353         pub result: *mut crate::lightning::ln::chan_utils::TxCreationKeys,
354         /// A pointer to the contents in the error state.
355         /// Reading from this pointer when `result_ok` is set is undefined.
356         pub err: *mut crate::c_types::Secp256k1Error,
357 }
358 #[repr(C)]
359 /// A CResult_TxCreationKeysErrorZ represents the result of a fallible operation,
360 /// containing a crate::lightning::ln::chan_utils::TxCreationKeys on success and a crate::c_types::Secp256k1Error on failure.
361 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
362 pub struct CResult_TxCreationKeysErrorZ {
363         /// The contents of this CResult_TxCreationKeysErrorZ, accessible via either
364         /// `err` or `result` depending on the state of `result_ok`.
365         pub contents: CResult_TxCreationKeysErrorZPtr,
366         /// Whether this CResult_TxCreationKeysErrorZ represents a success state.
367         pub result_ok: bool,
368 }
369 #[no_mangle]
370 /// Creates a new CResult_TxCreationKeysErrorZ in the success state.
371 pub extern "C" fn CResult_TxCreationKeysErrorZ_ok(o: crate::lightning::ln::chan_utils::TxCreationKeys) -> CResult_TxCreationKeysErrorZ {
372         CResult_TxCreationKeysErrorZ {
373                 contents: CResult_TxCreationKeysErrorZPtr {
374                         result: Box::into_raw(Box::new(o)),
375                 },
376                 result_ok: true,
377         }
378 }
379 #[no_mangle]
380 /// Creates a new CResult_TxCreationKeysErrorZ in the error state.
381 pub extern "C" fn CResult_TxCreationKeysErrorZ_err(e: crate::c_types::Secp256k1Error) -> CResult_TxCreationKeysErrorZ {
382         CResult_TxCreationKeysErrorZ {
383                 contents: CResult_TxCreationKeysErrorZPtr {
384                         err: Box::into_raw(Box::new(e)),
385                 },
386                 result_ok: false,
387         }
388 }
389 #[no_mangle]
390 /// Frees any resources used by the CResult_TxCreationKeysErrorZ.
391 pub extern "C" fn CResult_TxCreationKeysErrorZ_free(_res: CResult_TxCreationKeysErrorZ) { }
392 impl Drop for CResult_TxCreationKeysErrorZ {
393         fn drop(&mut self) {
394                 if self.result_ok {
395                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
396                                 let _ = unsafe { Box::from_raw(self.contents.result) };
397                         }
398                 } else {
399                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
400                                 let _ = unsafe { Box::from_raw(self.contents.err) };
401                         }
402                 }
403         }
404 }
405 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::TxCreationKeys, crate::c_types::Secp256k1Error>> for CResult_TxCreationKeysErrorZ {
406         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::TxCreationKeys, crate::c_types::Secp256k1Error>) -> Self {
407                 let contents = if o.result_ok {
408                         let result = unsafe { o.contents.result };
409                         unsafe { o.contents.result = std::ptr::null_mut() };
410                         CResult_TxCreationKeysErrorZPtr { result }
411                 } else {
412                         let err = unsafe { o.contents.err };
413                         unsafe { o.contents.err = std::ptr::null_mut(); }
414                         CResult_TxCreationKeysErrorZPtr { err }
415                 };
416                 Self {
417                         contents,
418                         result_ok: o.result_ok,
419                 }
420         }
421 }
422 impl Clone for CResult_TxCreationKeysErrorZ {
423         fn clone(&self) -> Self {
424                 if self.result_ok {
425                         Self { result_ok: true, contents: CResult_TxCreationKeysErrorZPtr {
426                                 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::TxCreationKeys>::clone(unsafe { &*self.contents.result })))
427                         } }
428                 } else {
429                         Self { result_ok: false, contents: CResult_TxCreationKeysErrorZPtr {
430                                 err: Box::into_raw(Box::new(<crate::c_types::Secp256k1Error>::clone(unsafe { &*self.contents.err })))
431                         } }
432                 }
433         }
434 }
435 #[no_mangle]
436 /// Creates a new CResult_TxCreationKeysErrorZ which has the same data as `orig`
437 /// but with all dynamically-allocated buffers duplicated in new buffers.
438 pub extern "C" fn CResult_TxCreationKeysErrorZ_clone(orig: &CResult_TxCreationKeysErrorZ) -> CResult_TxCreationKeysErrorZ { Clone::clone(&orig) }
439 #[repr(C)]
440 #[derive(Clone)]
441 /// An enum which can either contain a u32 or not
442 pub enum COption_u32Z {
443         /// When we're in this state, this COption_u32Z contains a u32
444         Some(u32),
445         /// When we're in this state, this COption_u32Z contains nothing
446         None
447 }
448 impl COption_u32Z {
449         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
450                 if let Self::Some(_) = self { true } else { false }
451         }
452         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
453                 !self.is_some()
454         }
455         #[allow(unused)] pub(crate) fn take(mut self) -> u32 {
456                 if let Self::Some(v) = self { v } else { unreachable!() }
457         }
458 }
459 #[no_mangle]
460 /// Constructs a new COption_u32Z containing a u32
461 pub extern "C" fn COption_u32Z_some(o: u32) -> COption_u32Z {
462         COption_u32Z::Some(o)
463 }
464 #[no_mangle]
465 /// Constructs a new COption_u32Z containing nothing
466 pub extern "C" fn COption_u32Z_none() -> COption_u32Z {
467         COption_u32Z::None
468 }
469 #[no_mangle]
470 /// Frees any resources associated with the u32, if we are in the Some state
471 pub extern "C" fn COption_u32Z_free(_res: COption_u32Z) { }
472 #[no_mangle]
473 /// Creates a new COption_u32Z which has the same data as `orig`
474 /// but with all dynamically-allocated buffers duplicated in new buffers.
475 pub extern "C" fn COption_u32Z_clone(orig: &COption_u32Z) -> COption_u32Z { Clone::clone(&orig) }
476 #[repr(C)]
477 /// The contents of CResult_HTLCOutputInCommitmentDecodeErrorZ
478 pub union CResult_HTLCOutputInCommitmentDecodeErrorZPtr {
479         /// A pointer to the contents in the success state.
480         /// Reading from this pointer when `result_ok` is not set is undefined.
481         pub result: *mut crate::lightning::ln::chan_utils::HTLCOutputInCommitment,
482         /// A pointer to the contents in the error state.
483         /// Reading from this pointer when `result_ok` is set is undefined.
484         pub err: *mut crate::lightning::ln::msgs::DecodeError,
485 }
486 #[repr(C)]
487 /// A CResult_HTLCOutputInCommitmentDecodeErrorZ represents the result of a fallible operation,
488 /// containing a crate::lightning::ln::chan_utils::HTLCOutputInCommitment on success and a crate::lightning::ln::msgs::DecodeError on failure.
489 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
490 pub struct CResult_HTLCOutputInCommitmentDecodeErrorZ {
491         /// The contents of this CResult_HTLCOutputInCommitmentDecodeErrorZ, accessible via either
492         /// `err` or `result` depending on the state of `result_ok`.
493         pub contents: CResult_HTLCOutputInCommitmentDecodeErrorZPtr,
494         /// Whether this CResult_HTLCOutputInCommitmentDecodeErrorZ represents a success state.
495         pub result_ok: bool,
496 }
497 #[no_mangle]
498 /// Creates a new CResult_HTLCOutputInCommitmentDecodeErrorZ in the success state.
499 pub extern "C" fn CResult_HTLCOutputInCommitmentDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::HTLCOutputInCommitment) -> CResult_HTLCOutputInCommitmentDecodeErrorZ {
500         CResult_HTLCOutputInCommitmentDecodeErrorZ {
501                 contents: CResult_HTLCOutputInCommitmentDecodeErrorZPtr {
502                         result: Box::into_raw(Box::new(o)),
503                 },
504                 result_ok: true,
505         }
506 }
507 #[no_mangle]
508 /// Creates a new CResult_HTLCOutputInCommitmentDecodeErrorZ in the error state.
509 pub extern "C" fn CResult_HTLCOutputInCommitmentDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_HTLCOutputInCommitmentDecodeErrorZ {
510         CResult_HTLCOutputInCommitmentDecodeErrorZ {
511                 contents: CResult_HTLCOutputInCommitmentDecodeErrorZPtr {
512                         err: Box::into_raw(Box::new(e)),
513                 },
514                 result_ok: false,
515         }
516 }
517 #[no_mangle]
518 /// Frees any resources used by the CResult_HTLCOutputInCommitmentDecodeErrorZ.
519 pub extern "C" fn CResult_HTLCOutputInCommitmentDecodeErrorZ_free(_res: CResult_HTLCOutputInCommitmentDecodeErrorZ) { }
520 impl Drop for CResult_HTLCOutputInCommitmentDecodeErrorZ {
521         fn drop(&mut self) {
522                 if self.result_ok {
523                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
524                                 let _ = unsafe { Box::from_raw(self.contents.result) };
525                         }
526                 } else {
527                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
528                                 let _ = unsafe { Box::from_raw(self.contents.err) };
529                         }
530                 }
531         }
532 }
533 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::HTLCOutputInCommitment, crate::lightning::ln::msgs::DecodeError>> for CResult_HTLCOutputInCommitmentDecodeErrorZ {
534         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::HTLCOutputInCommitment, crate::lightning::ln::msgs::DecodeError>) -> Self {
535                 let contents = if o.result_ok {
536                         let result = unsafe { o.contents.result };
537                         unsafe { o.contents.result = std::ptr::null_mut() };
538                         CResult_HTLCOutputInCommitmentDecodeErrorZPtr { result }
539                 } else {
540                         let err = unsafe { o.contents.err };
541                         unsafe { o.contents.err = std::ptr::null_mut(); }
542                         CResult_HTLCOutputInCommitmentDecodeErrorZPtr { err }
543                 };
544                 Self {
545                         contents,
546                         result_ok: o.result_ok,
547                 }
548         }
549 }
550 impl Clone for CResult_HTLCOutputInCommitmentDecodeErrorZ {
551         fn clone(&self) -> Self {
552                 if self.result_ok {
553                         Self { result_ok: true, contents: CResult_HTLCOutputInCommitmentDecodeErrorZPtr {
554                                 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::HTLCOutputInCommitment>::clone(unsafe { &*self.contents.result })))
555                         } }
556                 } else {
557                         Self { result_ok: false, contents: CResult_HTLCOutputInCommitmentDecodeErrorZPtr {
558                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
559                         } }
560                 }
561         }
562 }
563 #[no_mangle]
564 /// Creates a new CResult_HTLCOutputInCommitmentDecodeErrorZ which has the same data as `orig`
565 /// but with all dynamically-allocated buffers duplicated in new buffers.
566 pub extern "C" fn CResult_HTLCOutputInCommitmentDecodeErrorZ_clone(orig: &CResult_HTLCOutputInCommitmentDecodeErrorZ) -> CResult_HTLCOutputInCommitmentDecodeErrorZ { Clone::clone(&orig) }
567 #[repr(C)]
568 /// The contents of CResult_CounterpartyChannelTransactionParametersDecodeErrorZ
569 pub union CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr {
570         /// A pointer to the contents in the success state.
571         /// Reading from this pointer when `result_ok` is not set is undefined.
572         pub result: *mut crate::lightning::ln::chan_utils::CounterpartyChannelTransactionParameters,
573         /// A pointer to the contents in the error state.
574         /// Reading from this pointer when `result_ok` is set is undefined.
575         pub err: *mut crate::lightning::ln::msgs::DecodeError,
576 }
577 #[repr(C)]
578 /// A CResult_CounterpartyChannelTransactionParametersDecodeErrorZ represents the result of a fallible operation,
579 /// containing a crate::lightning::ln::chan_utils::CounterpartyChannelTransactionParameters on success and a crate::lightning::ln::msgs::DecodeError on failure.
580 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
581 pub struct CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
582         /// The contents of this CResult_CounterpartyChannelTransactionParametersDecodeErrorZ, accessible via either
583         /// `err` or `result` depending on the state of `result_ok`.
584         pub contents: CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr,
585         /// Whether this CResult_CounterpartyChannelTransactionParametersDecodeErrorZ represents a success state.
586         pub result_ok: bool,
587 }
588 #[no_mangle]
589 /// Creates a new CResult_CounterpartyChannelTransactionParametersDecodeErrorZ in the success state.
590 pub extern "C" fn CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::CounterpartyChannelTransactionParameters) -> CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
591         CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
592                 contents: CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr {
593                         result: Box::into_raw(Box::new(o)),
594                 },
595                 result_ok: true,
596         }
597 }
598 #[no_mangle]
599 /// Creates a new CResult_CounterpartyChannelTransactionParametersDecodeErrorZ in the error state.
600 pub extern "C" fn CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
601         CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
602                 contents: CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr {
603                         err: Box::into_raw(Box::new(e)),
604                 },
605                 result_ok: false,
606         }
607 }
608 #[no_mangle]
609 /// Frees any resources used by the CResult_CounterpartyChannelTransactionParametersDecodeErrorZ.
610 pub extern "C" fn CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_free(_res: CResult_CounterpartyChannelTransactionParametersDecodeErrorZ) { }
611 impl Drop for CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
612         fn drop(&mut self) {
613                 if self.result_ok {
614                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
615                                 let _ = unsafe { Box::from_raw(self.contents.result) };
616                         }
617                 } else {
618                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
619                                 let _ = unsafe { Box::from_raw(self.contents.err) };
620                         }
621                 }
622         }
623 }
624 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::CounterpartyChannelTransactionParameters, crate::lightning::ln::msgs::DecodeError>> for CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
625         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::CounterpartyChannelTransactionParameters, crate::lightning::ln::msgs::DecodeError>) -> Self {
626                 let contents = if o.result_ok {
627                         let result = unsafe { o.contents.result };
628                         unsafe { o.contents.result = std::ptr::null_mut() };
629                         CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr { result }
630                 } else {
631                         let err = unsafe { o.contents.err };
632                         unsafe { o.contents.err = std::ptr::null_mut(); }
633                         CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr { err }
634                 };
635                 Self {
636                         contents,
637                         result_ok: o.result_ok,
638                 }
639         }
640 }
641 impl Clone for CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
642         fn clone(&self) -> Self {
643                 if self.result_ok {
644                         Self { result_ok: true, contents: CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr {
645                                 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::CounterpartyChannelTransactionParameters>::clone(unsafe { &*self.contents.result })))
646                         } }
647                 } else {
648                         Self { result_ok: false, contents: CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr {
649                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
650                         } }
651                 }
652         }
653 }
654 #[no_mangle]
655 /// Creates a new CResult_CounterpartyChannelTransactionParametersDecodeErrorZ which has the same data as `orig`
656 /// but with all dynamically-allocated buffers duplicated in new buffers.
657 pub extern "C" fn CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone(orig: &CResult_CounterpartyChannelTransactionParametersDecodeErrorZ) -> CResult_CounterpartyChannelTransactionParametersDecodeErrorZ { Clone::clone(&orig) }
658 #[repr(C)]
659 /// The contents of CResult_ChannelTransactionParametersDecodeErrorZ
660 pub union CResult_ChannelTransactionParametersDecodeErrorZPtr {
661         /// A pointer to the contents in the success state.
662         /// Reading from this pointer when `result_ok` is not set is undefined.
663         pub result: *mut crate::lightning::ln::chan_utils::ChannelTransactionParameters,
664         /// A pointer to the contents in the error state.
665         /// Reading from this pointer when `result_ok` is set is undefined.
666         pub err: *mut crate::lightning::ln::msgs::DecodeError,
667 }
668 #[repr(C)]
669 /// A CResult_ChannelTransactionParametersDecodeErrorZ represents the result of a fallible operation,
670 /// containing a crate::lightning::ln::chan_utils::ChannelTransactionParameters on success and a crate::lightning::ln::msgs::DecodeError on failure.
671 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
672 pub struct CResult_ChannelTransactionParametersDecodeErrorZ {
673         /// The contents of this CResult_ChannelTransactionParametersDecodeErrorZ, accessible via either
674         /// `err` or `result` depending on the state of `result_ok`.
675         pub contents: CResult_ChannelTransactionParametersDecodeErrorZPtr,
676         /// Whether this CResult_ChannelTransactionParametersDecodeErrorZ represents a success state.
677         pub result_ok: bool,
678 }
679 #[no_mangle]
680 /// Creates a new CResult_ChannelTransactionParametersDecodeErrorZ in the success state.
681 pub extern "C" fn CResult_ChannelTransactionParametersDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::ChannelTransactionParameters) -> CResult_ChannelTransactionParametersDecodeErrorZ {
682         CResult_ChannelTransactionParametersDecodeErrorZ {
683                 contents: CResult_ChannelTransactionParametersDecodeErrorZPtr {
684                         result: Box::into_raw(Box::new(o)),
685                 },
686                 result_ok: true,
687         }
688 }
689 #[no_mangle]
690 /// Creates a new CResult_ChannelTransactionParametersDecodeErrorZ in the error state.
691 pub extern "C" fn CResult_ChannelTransactionParametersDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelTransactionParametersDecodeErrorZ {
692         CResult_ChannelTransactionParametersDecodeErrorZ {
693                 contents: CResult_ChannelTransactionParametersDecodeErrorZPtr {
694                         err: Box::into_raw(Box::new(e)),
695                 },
696                 result_ok: false,
697         }
698 }
699 #[no_mangle]
700 /// Frees any resources used by the CResult_ChannelTransactionParametersDecodeErrorZ.
701 pub extern "C" fn CResult_ChannelTransactionParametersDecodeErrorZ_free(_res: CResult_ChannelTransactionParametersDecodeErrorZ) { }
702 impl Drop for CResult_ChannelTransactionParametersDecodeErrorZ {
703         fn drop(&mut self) {
704                 if self.result_ok {
705                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
706                                 let _ = unsafe { Box::from_raw(self.contents.result) };
707                         }
708                 } else {
709                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
710                                 let _ = unsafe { Box::from_raw(self.contents.err) };
711                         }
712                 }
713         }
714 }
715 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::ChannelTransactionParameters, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelTransactionParametersDecodeErrorZ {
716         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::ChannelTransactionParameters, crate::lightning::ln::msgs::DecodeError>) -> Self {
717                 let contents = if o.result_ok {
718                         let result = unsafe { o.contents.result };
719                         unsafe { o.contents.result = std::ptr::null_mut() };
720                         CResult_ChannelTransactionParametersDecodeErrorZPtr { result }
721                 } else {
722                         let err = unsafe { o.contents.err };
723                         unsafe { o.contents.err = std::ptr::null_mut(); }
724                         CResult_ChannelTransactionParametersDecodeErrorZPtr { err }
725                 };
726                 Self {
727                         contents,
728                         result_ok: o.result_ok,
729                 }
730         }
731 }
732 impl Clone for CResult_ChannelTransactionParametersDecodeErrorZ {
733         fn clone(&self) -> Self {
734                 if self.result_ok {
735                         Self { result_ok: true, contents: CResult_ChannelTransactionParametersDecodeErrorZPtr {
736                                 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::ChannelTransactionParameters>::clone(unsafe { &*self.contents.result })))
737                         } }
738                 } else {
739                         Self { result_ok: false, contents: CResult_ChannelTransactionParametersDecodeErrorZPtr {
740                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
741                         } }
742                 }
743         }
744 }
745 #[no_mangle]
746 /// Creates a new CResult_ChannelTransactionParametersDecodeErrorZ which has the same data as `orig`
747 /// but with all dynamically-allocated buffers duplicated in new buffers.
748 pub extern "C" fn CResult_ChannelTransactionParametersDecodeErrorZ_clone(orig: &CResult_ChannelTransactionParametersDecodeErrorZ) -> CResult_ChannelTransactionParametersDecodeErrorZ { Clone::clone(&orig) }
749 #[repr(C)]
750 /// A dynamically-allocated array of crate::c_types::Signatures of arbitrary size.
751 /// This corresponds to std::vector in C++
752 pub struct CVec_SignatureZ {
753         /// The elements in the array.
754         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
755         pub data: *mut crate::c_types::Signature,
756         /// The number of elements pointed to by `data`.
757         pub datalen: usize
758 }
759 impl CVec_SignatureZ {
760         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::Signature> {
761                 if self.datalen == 0 { return Vec::new(); }
762                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
763                 self.data = std::ptr::null_mut();
764                 self.datalen = 0;
765                 ret
766         }
767         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::Signature] {
768                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
769         }
770 }
771 impl From<Vec<crate::c_types::Signature>> for CVec_SignatureZ {
772         fn from(v: Vec<crate::c_types::Signature>) -> Self {
773                 let datalen = v.len();
774                 let data = Box::into_raw(v.into_boxed_slice());
775                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
776         }
777 }
778 #[no_mangle]
779 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
780 pub extern "C" fn CVec_SignatureZ_free(_res: CVec_SignatureZ) { }
781 impl Drop for CVec_SignatureZ {
782         fn drop(&mut self) {
783                 if self.datalen == 0 { return; }
784                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
785         }
786 }
787 impl Clone for CVec_SignatureZ {
788         fn clone(&self) -> Self {
789                 let mut res = Vec::new();
790                 if self.datalen == 0 { return Self::from(res); }
791                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
792                 Self::from(res)
793         }
794 }
795 #[repr(C)]
796 /// The contents of CResult_HolderCommitmentTransactionDecodeErrorZ
797 pub union CResult_HolderCommitmentTransactionDecodeErrorZPtr {
798         /// A pointer to the contents in the success state.
799         /// Reading from this pointer when `result_ok` is not set is undefined.
800         pub result: *mut crate::lightning::ln::chan_utils::HolderCommitmentTransaction,
801         /// A pointer to the contents in the error state.
802         /// Reading from this pointer when `result_ok` is set is undefined.
803         pub err: *mut crate::lightning::ln::msgs::DecodeError,
804 }
805 #[repr(C)]
806 /// A CResult_HolderCommitmentTransactionDecodeErrorZ represents the result of a fallible operation,
807 /// containing a crate::lightning::ln::chan_utils::HolderCommitmentTransaction on success and a crate::lightning::ln::msgs::DecodeError on failure.
808 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
809 pub struct CResult_HolderCommitmentTransactionDecodeErrorZ {
810         /// The contents of this CResult_HolderCommitmentTransactionDecodeErrorZ, accessible via either
811         /// `err` or `result` depending on the state of `result_ok`.
812         pub contents: CResult_HolderCommitmentTransactionDecodeErrorZPtr,
813         /// Whether this CResult_HolderCommitmentTransactionDecodeErrorZ represents a success state.
814         pub result_ok: bool,
815 }
816 #[no_mangle]
817 /// Creates a new CResult_HolderCommitmentTransactionDecodeErrorZ in the success state.
818 pub extern "C" fn CResult_HolderCommitmentTransactionDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::HolderCommitmentTransaction) -> CResult_HolderCommitmentTransactionDecodeErrorZ {
819         CResult_HolderCommitmentTransactionDecodeErrorZ {
820                 contents: CResult_HolderCommitmentTransactionDecodeErrorZPtr {
821                         result: Box::into_raw(Box::new(o)),
822                 },
823                 result_ok: true,
824         }
825 }
826 #[no_mangle]
827 /// Creates a new CResult_HolderCommitmentTransactionDecodeErrorZ in the error state.
828 pub extern "C" fn CResult_HolderCommitmentTransactionDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_HolderCommitmentTransactionDecodeErrorZ {
829         CResult_HolderCommitmentTransactionDecodeErrorZ {
830                 contents: CResult_HolderCommitmentTransactionDecodeErrorZPtr {
831                         err: Box::into_raw(Box::new(e)),
832                 },
833                 result_ok: false,
834         }
835 }
836 #[no_mangle]
837 /// Frees any resources used by the CResult_HolderCommitmentTransactionDecodeErrorZ.
838 pub extern "C" fn CResult_HolderCommitmentTransactionDecodeErrorZ_free(_res: CResult_HolderCommitmentTransactionDecodeErrorZ) { }
839 impl Drop for CResult_HolderCommitmentTransactionDecodeErrorZ {
840         fn drop(&mut self) {
841                 if self.result_ok {
842                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
843                                 let _ = unsafe { Box::from_raw(self.contents.result) };
844                         }
845                 } else {
846                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
847                                 let _ = unsafe { Box::from_raw(self.contents.err) };
848                         }
849                 }
850         }
851 }
852 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::HolderCommitmentTransaction, crate::lightning::ln::msgs::DecodeError>> for CResult_HolderCommitmentTransactionDecodeErrorZ {
853         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::HolderCommitmentTransaction, crate::lightning::ln::msgs::DecodeError>) -> Self {
854                 let contents = if o.result_ok {
855                         let result = unsafe { o.contents.result };
856                         unsafe { o.contents.result = std::ptr::null_mut() };
857                         CResult_HolderCommitmentTransactionDecodeErrorZPtr { result }
858                 } else {
859                         let err = unsafe { o.contents.err };
860                         unsafe { o.contents.err = std::ptr::null_mut(); }
861                         CResult_HolderCommitmentTransactionDecodeErrorZPtr { err }
862                 };
863                 Self {
864                         contents,
865                         result_ok: o.result_ok,
866                 }
867         }
868 }
869 impl Clone for CResult_HolderCommitmentTransactionDecodeErrorZ {
870         fn clone(&self) -> Self {
871                 if self.result_ok {
872                         Self { result_ok: true, contents: CResult_HolderCommitmentTransactionDecodeErrorZPtr {
873                                 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::HolderCommitmentTransaction>::clone(unsafe { &*self.contents.result })))
874                         } }
875                 } else {
876                         Self { result_ok: false, contents: CResult_HolderCommitmentTransactionDecodeErrorZPtr {
877                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
878                         } }
879                 }
880         }
881 }
882 #[no_mangle]
883 /// Creates a new CResult_HolderCommitmentTransactionDecodeErrorZ which has the same data as `orig`
884 /// but with all dynamically-allocated buffers duplicated in new buffers.
885 pub extern "C" fn CResult_HolderCommitmentTransactionDecodeErrorZ_clone(orig: &CResult_HolderCommitmentTransactionDecodeErrorZ) -> CResult_HolderCommitmentTransactionDecodeErrorZ { Clone::clone(&orig) }
886 #[repr(C)]
887 /// The contents of CResult_BuiltCommitmentTransactionDecodeErrorZ
888 pub union CResult_BuiltCommitmentTransactionDecodeErrorZPtr {
889         /// A pointer to the contents in the success state.
890         /// Reading from this pointer when `result_ok` is not set is undefined.
891         pub result: *mut crate::lightning::ln::chan_utils::BuiltCommitmentTransaction,
892         /// A pointer to the contents in the error state.
893         /// Reading from this pointer when `result_ok` is set is undefined.
894         pub err: *mut crate::lightning::ln::msgs::DecodeError,
895 }
896 #[repr(C)]
897 /// A CResult_BuiltCommitmentTransactionDecodeErrorZ represents the result of a fallible operation,
898 /// containing a crate::lightning::ln::chan_utils::BuiltCommitmentTransaction on success and a crate::lightning::ln::msgs::DecodeError on failure.
899 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
900 pub struct CResult_BuiltCommitmentTransactionDecodeErrorZ {
901         /// The contents of this CResult_BuiltCommitmentTransactionDecodeErrorZ, accessible via either
902         /// `err` or `result` depending on the state of `result_ok`.
903         pub contents: CResult_BuiltCommitmentTransactionDecodeErrorZPtr,
904         /// Whether this CResult_BuiltCommitmentTransactionDecodeErrorZ represents a success state.
905         pub result_ok: bool,
906 }
907 #[no_mangle]
908 /// Creates a new CResult_BuiltCommitmentTransactionDecodeErrorZ in the success state.
909 pub extern "C" fn CResult_BuiltCommitmentTransactionDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::BuiltCommitmentTransaction) -> CResult_BuiltCommitmentTransactionDecodeErrorZ {
910         CResult_BuiltCommitmentTransactionDecodeErrorZ {
911                 contents: CResult_BuiltCommitmentTransactionDecodeErrorZPtr {
912                         result: Box::into_raw(Box::new(o)),
913                 },
914                 result_ok: true,
915         }
916 }
917 #[no_mangle]
918 /// Creates a new CResult_BuiltCommitmentTransactionDecodeErrorZ in the error state.
919 pub extern "C" fn CResult_BuiltCommitmentTransactionDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_BuiltCommitmentTransactionDecodeErrorZ {
920         CResult_BuiltCommitmentTransactionDecodeErrorZ {
921                 contents: CResult_BuiltCommitmentTransactionDecodeErrorZPtr {
922                         err: Box::into_raw(Box::new(e)),
923                 },
924                 result_ok: false,
925         }
926 }
927 #[no_mangle]
928 /// Frees any resources used by the CResult_BuiltCommitmentTransactionDecodeErrorZ.
929 pub extern "C" fn CResult_BuiltCommitmentTransactionDecodeErrorZ_free(_res: CResult_BuiltCommitmentTransactionDecodeErrorZ) { }
930 impl Drop for CResult_BuiltCommitmentTransactionDecodeErrorZ {
931         fn drop(&mut self) {
932                 if self.result_ok {
933                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
934                                 let _ = unsafe { Box::from_raw(self.contents.result) };
935                         }
936                 } else {
937                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
938                                 let _ = unsafe { Box::from_raw(self.contents.err) };
939                         }
940                 }
941         }
942 }
943 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::BuiltCommitmentTransaction, crate::lightning::ln::msgs::DecodeError>> for CResult_BuiltCommitmentTransactionDecodeErrorZ {
944         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::BuiltCommitmentTransaction, crate::lightning::ln::msgs::DecodeError>) -> Self {
945                 let contents = if o.result_ok {
946                         let result = unsafe { o.contents.result };
947                         unsafe { o.contents.result = std::ptr::null_mut() };
948                         CResult_BuiltCommitmentTransactionDecodeErrorZPtr { result }
949                 } else {
950                         let err = unsafe { o.contents.err };
951                         unsafe { o.contents.err = std::ptr::null_mut(); }
952                         CResult_BuiltCommitmentTransactionDecodeErrorZPtr { err }
953                 };
954                 Self {
955                         contents,
956                         result_ok: o.result_ok,
957                 }
958         }
959 }
960 impl Clone for CResult_BuiltCommitmentTransactionDecodeErrorZ {
961         fn clone(&self) -> Self {
962                 if self.result_ok {
963                         Self { result_ok: true, contents: CResult_BuiltCommitmentTransactionDecodeErrorZPtr {
964                                 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::BuiltCommitmentTransaction>::clone(unsafe { &*self.contents.result })))
965                         } }
966                 } else {
967                         Self { result_ok: false, contents: CResult_BuiltCommitmentTransactionDecodeErrorZPtr {
968                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
969                         } }
970                 }
971         }
972 }
973 #[no_mangle]
974 /// Creates a new CResult_BuiltCommitmentTransactionDecodeErrorZ which has the same data as `orig`
975 /// but with all dynamically-allocated buffers duplicated in new buffers.
976 pub extern "C" fn CResult_BuiltCommitmentTransactionDecodeErrorZ_clone(orig: &CResult_BuiltCommitmentTransactionDecodeErrorZ) -> CResult_BuiltCommitmentTransactionDecodeErrorZ { Clone::clone(&orig) }
977 #[repr(C)]
978 /// The contents of CResult_TrustedClosingTransactionNoneZ
979 pub union CResult_TrustedClosingTransactionNoneZPtr {
980         /// A pointer to the contents in the success state.
981         /// Reading from this pointer when `result_ok` is not set is undefined.
982         pub result: *mut crate::lightning::ln::chan_utils::TrustedClosingTransaction,
983         /// Note that this value is always NULL, as there are no contents in the Err variant
984         pub err: *mut std::ffi::c_void,
985 }
986 #[repr(C)]
987 /// A CResult_TrustedClosingTransactionNoneZ represents the result of a fallible operation,
988 /// containing a crate::lightning::ln::chan_utils::TrustedClosingTransaction on success and a () on failure.
989 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
990 pub struct CResult_TrustedClosingTransactionNoneZ {
991         /// The contents of this CResult_TrustedClosingTransactionNoneZ, accessible via either
992         /// `err` or `result` depending on the state of `result_ok`.
993         pub contents: CResult_TrustedClosingTransactionNoneZPtr,
994         /// Whether this CResult_TrustedClosingTransactionNoneZ represents a success state.
995         pub result_ok: bool,
996 }
997 #[no_mangle]
998 /// Creates a new CResult_TrustedClosingTransactionNoneZ in the success state.
999 pub extern "C" fn CResult_TrustedClosingTransactionNoneZ_ok(o: crate::lightning::ln::chan_utils::TrustedClosingTransaction) -> CResult_TrustedClosingTransactionNoneZ {
1000         CResult_TrustedClosingTransactionNoneZ {
1001                 contents: CResult_TrustedClosingTransactionNoneZPtr {
1002                         result: Box::into_raw(Box::new(o)),
1003                 },
1004                 result_ok: true,
1005         }
1006 }
1007 #[no_mangle]
1008 /// Creates a new CResult_TrustedClosingTransactionNoneZ in the error state.
1009 pub extern "C" fn CResult_TrustedClosingTransactionNoneZ_err() -> CResult_TrustedClosingTransactionNoneZ {
1010         CResult_TrustedClosingTransactionNoneZ {
1011                 contents: CResult_TrustedClosingTransactionNoneZPtr {
1012                         err: std::ptr::null_mut(),
1013                 },
1014                 result_ok: false,
1015         }
1016 }
1017 #[no_mangle]
1018 /// Frees any resources used by the CResult_TrustedClosingTransactionNoneZ.
1019 pub extern "C" fn CResult_TrustedClosingTransactionNoneZ_free(_res: CResult_TrustedClosingTransactionNoneZ) { }
1020 impl Drop for CResult_TrustedClosingTransactionNoneZ {
1021         fn drop(&mut self) {
1022                 if self.result_ok {
1023                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
1024                                 let _ = unsafe { Box::from_raw(self.contents.result) };
1025                         }
1026                 } else {
1027                 }
1028         }
1029 }
1030 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::TrustedClosingTransaction, ()>> for CResult_TrustedClosingTransactionNoneZ {
1031         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::TrustedClosingTransaction, ()>) -> Self {
1032                 let contents = if o.result_ok {
1033                         let result = unsafe { o.contents.result };
1034                         unsafe { o.contents.result = std::ptr::null_mut() };
1035                         CResult_TrustedClosingTransactionNoneZPtr { result }
1036                 } else {
1037                         let _ = unsafe { Box::from_raw(o.contents.err) };
1038                         o.contents.err = std::ptr::null_mut();
1039                         CResult_TrustedClosingTransactionNoneZPtr { err: std::ptr::null_mut() }
1040                 };
1041                 Self {
1042                         contents,
1043                         result_ok: o.result_ok,
1044                 }
1045         }
1046 }
1047 #[repr(C)]
1048 /// The contents of CResult_CommitmentTransactionDecodeErrorZ
1049 pub union CResult_CommitmentTransactionDecodeErrorZPtr {
1050         /// A pointer to the contents in the success state.
1051         /// Reading from this pointer when `result_ok` is not set is undefined.
1052         pub result: *mut crate::lightning::ln::chan_utils::CommitmentTransaction,
1053         /// A pointer to the contents in the error state.
1054         /// Reading from this pointer when `result_ok` is set is undefined.
1055         pub err: *mut crate::lightning::ln::msgs::DecodeError,
1056 }
1057 #[repr(C)]
1058 /// A CResult_CommitmentTransactionDecodeErrorZ represents the result of a fallible operation,
1059 /// containing a crate::lightning::ln::chan_utils::CommitmentTransaction on success and a crate::lightning::ln::msgs::DecodeError on failure.
1060 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1061 pub struct CResult_CommitmentTransactionDecodeErrorZ {
1062         /// The contents of this CResult_CommitmentTransactionDecodeErrorZ, accessible via either
1063         /// `err` or `result` depending on the state of `result_ok`.
1064         pub contents: CResult_CommitmentTransactionDecodeErrorZPtr,
1065         /// Whether this CResult_CommitmentTransactionDecodeErrorZ represents a success state.
1066         pub result_ok: bool,
1067 }
1068 #[no_mangle]
1069 /// Creates a new CResult_CommitmentTransactionDecodeErrorZ in the success state.
1070 pub extern "C" fn CResult_CommitmentTransactionDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::CommitmentTransaction) -> CResult_CommitmentTransactionDecodeErrorZ {
1071         CResult_CommitmentTransactionDecodeErrorZ {
1072                 contents: CResult_CommitmentTransactionDecodeErrorZPtr {
1073                         result: Box::into_raw(Box::new(o)),
1074                 },
1075                 result_ok: true,
1076         }
1077 }
1078 #[no_mangle]
1079 /// Creates a new CResult_CommitmentTransactionDecodeErrorZ in the error state.
1080 pub extern "C" fn CResult_CommitmentTransactionDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_CommitmentTransactionDecodeErrorZ {
1081         CResult_CommitmentTransactionDecodeErrorZ {
1082                 contents: CResult_CommitmentTransactionDecodeErrorZPtr {
1083                         err: Box::into_raw(Box::new(e)),
1084                 },
1085                 result_ok: false,
1086         }
1087 }
1088 #[no_mangle]
1089 /// Frees any resources used by the CResult_CommitmentTransactionDecodeErrorZ.
1090 pub extern "C" fn CResult_CommitmentTransactionDecodeErrorZ_free(_res: CResult_CommitmentTransactionDecodeErrorZ) { }
1091 impl Drop for CResult_CommitmentTransactionDecodeErrorZ {
1092         fn drop(&mut self) {
1093                 if self.result_ok {
1094                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
1095                                 let _ = unsafe { Box::from_raw(self.contents.result) };
1096                         }
1097                 } else {
1098                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
1099                                 let _ = unsafe { Box::from_raw(self.contents.err) };
1100                         }
1101                 }
1102         }
1103 }
1104 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::CommitmentTransaction, crate::lightning::ln::msgs::DecodeError>> for CResult_CommitmentTransactionDecodeErrorZ {
1105         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::CommitmentTransaction, crate::lightning::ln::msgs::DecodeError>) -> Self {
1106                 let contents = if o.result_ok {
1107                         let result = unsafe { o.contents.result };
1108                         unsafe { o.contents.result = std::ptr::null_mut() };
1109                         CResult_CommitmentTransactionDecodeErrorZPtr { result }
1110                 } else {
1111                         let err = unsafe { o.contents.err };
1112                         unsafe { o.contents.err = std::ptr::null_mut(); }
1113                         CResult_CommitmentTransactionDecodeErrorZPtr { err }
1114                 };
1115                 Self {
1116                         contents,
1117                         result_ok: o.result_ok,
1118                 }
1119         }
1120 }
1121 impl Clone for CResult_CommitmentTransactionDecodeErrorZ {
1122         fn clone(&self) -> Self {
1123                 if self.result_ok {
1124                         Self { result_ok: true, contents: CResult_CommitmentTransactionDecodeErrorZPtr {
1125                                 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::CommitmentTransaction>::clone(unsafe { &*self.contents.result })))
1126                         } }
1127                 } else {
1128                         Self { result_ok: false, contents: CResult_CommitmentTransactionDecodeErrorZPtr {
1129                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
1130                         } }
1131                 }
1132         }
1133 }
1134 #[no_mangle]
1135 /// Creates a new CResult_CommitmentTransactionDecodeErrorZ which has the same data as `orig`
1136 /// but with all dynamically-allocated buffers duplicated in new buffers.
1137 pub extern "C" fn CResult_CommitmentTransactionDecodeErrorZ_clone(orig: &CResult_CommitmentTransactionDecodeErrorZ) -> CResult_CommitmentTransactionDecodeErrorZ { Clone::clone(&orig) }
1138 #[repr(C)]
1139 /// The contents of CResult_TrustedCommitmentTransactionNoneZ
1140 pub union CResult_TrustedCommitmentTransactionNoneZPtr {
1141         /// A pointer to the contents in the success state.
1142         /// Reading from this pointer when `result_ok` is not set is undefined.
1143         pub result: *mut crate::lightning::ln::chan_utils::TrustedCommitmentTransaction,
1144         /// Note that this value is always NULL, as there are no contents in the Err variant
1145         pub err: *mut std::ffi::c_void,
1146 }
1147 #[repr(C)]
1148 /// A CResult_TrustedCommitmentTransactionNoneZ represents the result of a fallible operation,
1149 /// containing a crate::lightning::ln::chan_utils::TrustedCommitmentTransaction on success and a () on failure.
1150 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1151 pub struct CResult_TrustedCommitmentTransactionNoneZ {
1152         /// The contents of this CResult_TrustedCommitmentTransactionNoneZ, accessible via either
1153         /// `err` or `result` depending on the state of `result_ok`.
1154         pub contents: CResult_TrustedCommitmentTransactionNoneZPtr,
1155         /// Whether this CResult_TrustedCommitmentTransactionNoneZ represents a success state.
1156         pub result_ok: bool,
1157 }
1158 #[no_mangle]
1159 /// Creates a new CResult_TrustedCommitmentTransactionNoneZ in the success state.
1160 pub extern "C" fn CResult_TrustedCommitmentTransactionNoneZ_ok(o: crate::lightning::ln::chan_utils::TrustedCommitmentTransaction) -> CResult_TrustedCommitmentTransactionNoneZ {
1161         CResult_TrustedCommitmentTransactionNoneZ {
1162                 contents: CResult_TrustedCommitmentTransactionNoneZPtr {
1163                         result: Box::into_raw(Box::new(o)),
1164                 },
1165                 result_ok: true,
1166         }
1167 }
1168 #[no_mangle]
1169 /// Creates a new CResult_TrustedCommitmentTransactionNoneZ in the error state.
1170 pub extern "C" fn CResult_TrustedCommitmentTransactionNoneZ_err() -> CResult_TrustedCommitmentTransactionNoneZ {
1171         CResult_TrustedCommitmentTransactionNoneZ {
1172                 contents: CResult_TrustedCommitmentTransactionNoneZPtr {
1173                         err: std::ptr::null_mut(),
1174                 },
1175                 result_ok: false,
1176         }
1177 }
1178 #[no_mangle]
1179 /// Frees any resources used by the CResult_TrustedCommitmentTransactionNoneZ.
1180 pub extern "C" fn CResult_TrustedCommitmentTransactionNoneZ_free(_res: CResult_TrustedCommitmentTransactionNoneZ) { }
1181 impl Drop for CResult_TrustedCommitmentTransactionNoneZ {
1182         fn drop(&mut self) {
1183                 if self.result_ok {
1184                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
1185                                 let _ = unsafe { Box::from_raw(self.contents.result) };
1186                         }
1187                 } else {
1188                 }
1189         }
1190 }
1191 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::TrustedCommitmentTransaction, ()>> for CResult_TrustedCommitmentTransactionNoneZ {
1192         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::TrustedCommitmentTransaction, ()>) -> Self {
1193                 let contents = if o.result_ok {
1194                         let result = unsafe { o.contents.result };
1195                         unsafe { o.contents.result = std::ptr::null_mut() };
1196                         CResult_TrustedCommitmentTransactionNoneZPtr { result }
1197                 } else {
1198                         let _ = unsafe { Box::from_raw(o.contents.err) };
1199                         o.contents.err = std::ptr::null_mut();
1200                         CResult_TrustedCommitmentTransactionNoneZPtr { err: std::ptr::null_mut() }
1201                 };
1202                 Self {
1203                         contents,
1204                         result_ok: o.result_ok,
1205                 }
1206         }
1207 }
1208 #[repr(C)]
1209 /// The contents of CResult_CVec_SignatureZNoneZ
1210 pub union CResult_CVec_SignatureZNoneZPtr {
1211         /// A pointer to the contents in the success state.
1212         /// Reading from this pointer when `result_ok` is not set is undefined.
1213         pub result: *mut crate::c_types::derived::CVec_SignatureZ,
1214         /// Note that this value is always NULL, as there are no contents in the Err variant
1215         pub err: *mut std::ffi::c_void,
1216 }
1217 #[repr(C)]
1218 /// A CResult_CVec_SignatureZNoneZ represents the result of a fallible operation,
1219 /// containing a crate::c_types::derived::CVec_SignatureZ on success and a () on failure.
1220 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1221 pub struct CResult_CVec_SignatureZNoneZ {
1222         /// The contents of this CResult_CVec_SignatureZNoneZ, accessible via either
1223         /// `err` or `result` depending on the state of `result_ok`.
1224         pub contents: CResult_CVec_SignatureZNoneZPtr,
1225         /// Whether this CResult_CVec_SignatureZNoneZ represents a success state.
1226         pub result_ok: bool,
1227 }
1228 #[no_mangle]
1229 /// Creates a new CResult_CVec_SignatureZNoneZ in the success state.
1230 pub extern "C" fn CResult_CVec_SignatureZNoneZ_ok(o: crate::c_types::derived::CVec_SignatureZ) -> CResult_CVec_SignatureZNoneZ {
1231         CResult_CVec_SignatureZNoneZ {
1232                 contents: CResult_CVec_SignatureZNoneZPtr {
1233                         result: Box::into_raw(Box::new(o)),
1234                 },
1235                 result_ok: true,
1236         }
1237 }
1238 #[no_mangle]
1239 /// Creates a new CResult_CVec_SignatureZNoneZ in the error state.
1240 pub extern "C" fn CResult_CVec_SignatureZNoneZ_err() -> CResult_CVec_SignatureZNoneZ {
1241         CResult_CVec_SignatureZNoneZ {
1242                 contents: CResult_CVec_SignatureZNoneZPtr {
1243                         err: std::ptr::null_mut(),
1244                 },
1245                 result_ok: false,
1246         }
1247 }
1248 #[no_mangle]
1249 /// Frees any resources used by the CResult_CVec_SignatureZNoneZ.
1250 pub extern "C" fn CResult_CVec_SignatureZNoneZ_free(_res: CResult_CVec_SignatureZNoneZ) { }
1251 impl Drop for CResult_CVec_SignatureZNoneZ {
1252         fn drop(&mut self) {
1253                 if self.result_ok {
1254                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
1255                                 let _ = unsafe { Box::from_raw(self.contents.result) };
1256                         }
1257                 } else {
1258                 }
1259         }
1260 }
1261 impl From<crate::c_types::CResultTempl<crate::c_types::derived::CVec_SignatureZ, ()>> for CResult_CVec_SignatureZNoneZ {
1262         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CVec_SignatureZ, ()>) -> Self {
1263                 let contents = if o.result_ok {
1264                         let result = unsafe { o.contents.result };
1265                         unsafe { o.contents.result = std::ptr::null_mut() };
1266                         CResult_CVec_SignatureZNoneZPtr { result }
1267                 } else {
1268                         let _ = unsafe { Box::from_raw(o.contents.err) };
1269                         o.contents.err = std::ptr::null_mut();
1270                         CResult_CVec_SignatureZNoneZPtr { err: std::ptr::null_mut() }
1271                 };
1272                 Self {
1273                         contents,
1274                         result_ok: o.result_ok,
1275                 }
1276         }
1277 }
1278 impl Clone for CResult_CVec_SignatureZNoneZ {
1279         fn clone(&self) -> Self {
1280                 if self.result_ok {
1281                         Self { result_ok: true, contents: CResult_CVec_SignatureZNoneZPtr {
1282                                 result: Box::into_raw(Box::new(<crate::c_types::derived::CVec_SignatureZ>::clone(unsafe { &*self.contents.result })))
1283                         } }
1284                 } else {
1285                         Self { result_ok: false, contents: CResult_CVec_SignatureZNoneZPtr {
1286                                 err: std::ptr::null_mut()
1287                         } }
1288                 }
1289         }
1290 }
1291 #[no_mangle]
1292 /// Creates a new CResult_CVec_SignatureZNoneZ which has the same data as `orig`
1293 /// but with all dynamically-allocated buffers duplicated in new buffers.
1294 pub extern "C" fn CResult_CVec_SignatureZNoneZ_clone(orig: &CResult_CVec_SignatureZNoneZ) -> CResult_CVec_SignatureZNoneZ { Clone::clone(&orig) }
1295 #[repr(C)]
1296 /// The contents of CResult_ShutdownScriptDecodeErrorZ
1297 pub union CResult_ShutdownScriptDecodeErrorZPtr {
1298         /// A pointer to the contents in the success state.
1299         /// Reading from this pointer when `result_ok` is not set is undefined.
1300         pub result: *mut crate::lightning::ln::script::ShutdownScript,
1301         /// A pointer to the contents in the error state.
1302         /// Reading from this pointer when `result_ok` is set is undefined.
1303         pub err: *mut crate::lightning::ln::msgs::DecodeError,
1304 }
1305 #[repr(C)]
1306 /// A CResult_ShutdownScriptDecodeErrorZ represents the result of a fallible operation,
1307 /// containing a crate::lightning::ln::script::ShutdownScript on success and a crate::lightning::ln::msgs::DecodeError on failure.
1308 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1309 pub struct CResult_ShutdownScriptDecodeErrorZ {
1310         /// The contents of this CResult_ShutdownScriptDecodeErrorZ, accessible via either
1311         /// `err` or `result` depending on the state of `result_ok`.
1312         pub contents: CResult_ShutdownScriptDecodeErrorZPtr,
1313         /// Whether this CResult_ShutdownScriptDecodeErrorZ represents a success state.
1314         pub result_ok: bool,
1315 }
1316 #[no_mangle]
1317 /// Creates a new CResult_ShutdownScriptDecodeErrorZ in the success state.
1318 pub extern "C" fn CResult_ShutdownScriptDecodeErrorZ_ok(o: crate::lightning::ln::script::ShutdownScript) -> CResult_ShutdownScriptDecodeErrorZ {
1319         CResult_ShutdownScriptDecodeErrorZ {
1320                 contents: CResult_ShutdownScriptDecodeErrorZPtr {
1321                         result: Box::into_raw(Box::new(o)),
1322                 },
1323                 result_ok: true,
1324         }
1325 }
1326 #[no_mangle]
1327 /// Creates a new CResult_ShutdownScriptDecodeErrorZ in the error state.
1328 pub extern "C" fn CResult_ShutdownScriptDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ShutdownScriptDecodeErrorZ {
1329         CResult_ShutdownScriptDecodeErrorZ {
1330                 contents: CResult_ShutdownScriptDecodeErrorZPtr {
1331                         err: Box::into_raw(Box::new(e)),
1332                 },
1333                 result_ok: false,
1334         }
1335 }
1336 #[no_mangle]
1337 /// Frees any resources used by the CResult_ShutdownScriptDecodeErrorZ.
1338 pub extern "C" fn CResult_ShutdownScriptDecodeErrorZ_free(_res: CResult_ShutdownScriptDecodeErrorZ) { }
1339 impl Drop for CResult_ShutdownScriptDecodeErrorZ {
1340         fn drop(&mut self) {
1341                 if self.result_ok {
1342                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
1343                                 let _ = unsafe { Box::from_raw(self.contents.result) };
1344                         }
1345                 } else {
1346                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
1347                                 let _ = unsafe { Box::from_raw(self.contents.err) };
1348                         }
1349                 }
1350         }
1351 }
1352 impl From<crate::c_types::CResultTempl<crate::lightning::ln::script::ShutdownScript, crate::lightning::ln::msgs::DecodeError>> for CResult_ShutdownScriptDecodeErrorZ {
1353         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::script::ShutdownScript, crate::lightning::ln::msgs::DecodeError>) -> Self {
1354                 let contents = if o.result_ok {
1355                         let result = unsafe { o.contents.result };
1356                         unsafe { o.contents.result = std::ptr::null_mut() };
1357                         CResult_ShutdownScriptDecodeErrorZPtr { result }
1358                 } else {
1359                         let err = unsafe { o.contents.err };
1360                         unsafe { o.contents.err = std::ptr::null_mut(); }
1361                         CResult_ShutdownScriptDecodeErrorZPtr { err }
1362                 };
1363                 Self {
1364                         contents,
1365                         result_ok: o.result_ok,
1366                 }
1367         }
1368 }
1369 impl Clone for CResult_ShutdownScriptDecodeErrorZ {
1370         fn clone(&self) -> Self {
1371                 if self.result_ok {
1372                         Self { result_ok: true, contents: CResult_ShutdownScriptDecodeErrorZPtr {
1373                                 result: Box::into_raw(Box::new(<crate::lightning::ln::script::ShutdownScript>::clone(unsafe { &*self.contents.result })))
1374                         } }
1375                 } else {
1376                         Self { result_ok: false, contents: CResult_ShutdownScriptDecodeErrorZPtr {
1377                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
1378                         } }
1379                 }
1380         }
1381 }
1382 #[no_mangle]
1383 /// Creates a new CResult_ShutdownScriptDecodeErrorZ which has the same data as `orig`
1384 /// but with all dynamically-allocated buffers duplicated in new buffers.
1385 pub extern "C" fn CResult_ShutdownScriptDecodeErrorZ_clone(orig: &CResult_ShutdownScriptDecodeErrorZ) -> CResult_ShutdownScriptDecodeErrorZ { Clone::clone(&orig) }
1386 #[repr(C)]
1387 /// The contents of CResult_ShutdownScriptInvalidShutdownScriptZ
1388 pub union CResult_ShutdownScriptInvalidShutdownScriptZPtr {
1389         /// A pointer to the contents in the success state.
1390         /// Reading from this pointer when `result_ok` is not set is undefined.
1391         pub result: *mut crate::lightning::ln::script::ShutdownScript,
1392         /// A pointer to the contents in the error state.
1393         /// Reading from this pointer when `result_ok` is set is undefined.
1394         pub err: *mut crate::lightning::ln::script::InvalidShutdownScript,
1395 }
1396 #[repr(C)]
1397 /// A CResult_ShutdownScriptInvalidShutdownScriptZ represents the result of a fallible operation,
1398 /// containing a crate::lightning::ln::script::ShutdownScript on success and a crate::lightning::ln::script::InvalidShutdownScript on failure.
1399 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1400 pub struct CResult_ShutdownScriptInvalidShutdownScriptZ {
1401         /// The contents of this CResult_ShutdownScriptInvalidShutdownScriptZ, accessible via either
1402         /// `err` or `result` depending on the state of `result_ok`.
1403         pub contents: CResult_ShutdownScriptInvalidShutdownScriptZPtr,
1404         /// Whether this CResult_ShutdownScriptInvalidShutdownScriptZ represents a success state.
1405         pub result_ok: bool,
1406 }
1407 #[no_mangle]
1408 /// Creates a new CResult_ShutdownScriptInvalidShutdownScriptZ in the success state.
1409 pub extern "C" fn CResult_ShutdownScriptInvalidShutdownScriptZ_ok(o: crate::lightning::ln::script::ShutdownScript) -> CResult_ShutdownScriptInvalidShutdownScriptZ {
1410         CResult_ShutdownScriptInvalidShutdownScriptZ {
1411                 contents: CResult_ShutdownScriptInvalidShutdownScriptZPtr {
1412                         result: Box::into_raw(Box::new(o)),
1413                 },
1414                 result_ok: true,
1415         }
1416 }
1417 #[no_mangle]
1418 /// Creates a new CResult_ShutdownScriptInvalidShutdownScriptZ in the error state.
1419 pub extern "C" fn CResult_ShutdownScriptInvalidShutdownScriptZ_err(e: crate::lightning::ln::script::InvalidShutdownScript) -> CResult_ShutdownScriptInvalidShutdownScriptZ {
1420         CResult_ShutdownScriptInvalidShutdownScriptZ {
1421                 contents: CResult_ShutdownScriptInvalidShutdownScriptZPtr {
1422                         err: Box::into_raw(Box::new(e)),
1423                 },
1424                 result_ok: false,
1425         }
1426 }
1427 #[no_mangle]
1428 /// Frees any resources used by the CResult_ShutdownScriptInvalidShutdownScriptZ.
1429 pub extern "C" fn CResult_ShutdownScriptInvalidShutdownScriptZ_free(_res: CResult_ShutdownScriptInvalidShutdownScriptZ) { }
1430 impl Drop for CResult_ShutdownScriptInvalidShutdownScriptZ {
1431         fn drop(&mut self) {
1432                 if self.result_ok {
1433                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
1434                                 let _ = unsafe { Box::from_raw(self.contents.result) };
1435                         }
1436                 } else {
1437                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
1438                                 let _ = unsafe { Box::from_raw(self.contents.err) };
1439                         }
1440                 }
1441         }
1442 }
1443 impl From<crate::c_types::CResultTempl<crate::lightning::ln::script::ShutdownScript, crate::lightning::ln::script::InvalidShutdownScript>> for CResult_ShutdownScriptInvalidShutdownScriptZ {
1444         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::script::ShutdownScript, crate::lightning::ln::script::InvalidShutdownScript>) -> Self {
1445                 let contents = if o.result_ok {
1446                         let result = unsafe { o.contents.result };
1447                         unsafe { o.contents.result = std::ptr::null_mut() };
1448                         CResult_ShutdownScriptInvalidShutdownScriptZPtr { result }
1449                 } else {
1450                         let err = unsafe { o.contents.err };
1451                         unsafe { o.contents.err = std::ptr::null_mut(); }
1452                         CResult_ShutdownScriptInvalidShutdownScriptZPtr { err }
1453                 };
1454                 Self {
1455                         contents,
1456                         result_ok: o.result_ok,
1457                 }
1458         }
1459 }
1460 #[repr(C)]
1461 /// The contents of CResult_NoneErrorZ
1462 pub union CResult_NoneErrorZPtr {
1463         /// Note that this value is always NULL, as there are no contents in the OK variant
1464         pub result: *mut std::ffi::c_void,
1465         /// A pointer to the contents in the error state.
1466         /// Reading from this pointer when `result_ok` is set is undefined.
1467         pub err: *mut crate::c_types::IOError,
1468 }
1469 #[repr(C)]
1470 /// A CResult_NoneErrorZ represents the result of a fallible operation,
1471 /// containing a () on success and a crate::c_types::IOError on failure.
1472 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1473 pub struct CResult_NoneErrorZ {
1474         /// The contents of this CResult_NoneErrorZ, accessible via either
1475         /// `err` or `result` depending on the state of `result_ok`.
1476         pub contents: CResult_NoneErrorZPtr,
1477         /// Whether this CResult_NoneErrorZ represents a success state.
1478         pub result_ok: bool,
1479 }
1480 #[no_mangle]
1481 /// Creates a new CResult_NoneErrorZ in the success state.
1482 pub extern "C" fn CResult_NoneErrorZ_ok() -> CResult_NoneErrorZ {
1483         CResult_NoneErrorZ {
1484                 contents: CResult_NoneErrorZPtr {
1485                         result: std::ptr::null_mut(),
1486                 },
1487                 result_ok: true,
1488         }
1489 }
1490 #[no_mangle]
1491 /// Creates a new CResult_NoneErrorZ in the error state.
1492 pub extern "C" fn CResult_NoneErrorZ_err(e: crate::c_types::IOError) -> CResult_NoneErrorZ {
1493         CResult_NoneErrorZ {
1494                 contents: CResult_NoneErrorZPtr {
1495                         err: Box::into_raw(Box::new(e)),
1496                 },
1497                 result_ok: false,
1498         }
1499 }
1500 #[no_mangle]
1501 /// Frees any resources used by the CResult_NoneErrorZ.
1502 pub extern "C" fn CResult_NoneErrorZ_free(_res: CResult_NoneErrorZ) { }
1503 impl Drop for CResult_NoneErrorZ {
1504         fn drop(&mut self) {
1505                 if self.result_ok {
1506                 } else {
1507                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
1508                                 let _ = unsafe { Box::from_raw(self.contents.err) };
1509                         }
1510                 }
1511         }
1512 }
1513 impl From<crate::c_types::CResultTempl<(), crate::c_types::IOError>> for CResult_NoneErrorZ {
1514         fn from(mut o: crate::c_types::CResultTempl<(), crate::c_types::IOError>) -> Self {
1515                 let contents = if o.result_ok {
1516                         let _ = unsafe { Box::from_raw(o.contents.result) };
1517                         o.contents.result = std::ptr::null_mut();
1518                         CResult_NoneErrorZPtr { result: std::ptr::null_mut() }
1519                 } else {
1520                         let err = unsafe { o.contents.err };
1521                         unsafe { o.contents.err = std::ptr::null_mut(); }
1522                         CResult_NoneErrorZPtr { err }
1523                 };
1524                 Self {
1525                         contents,
1526                         result_ok: o.result_ok,
1527                 }
1528         }
1529 }
1530 impl Clone for CResult_NoneErrorZ {
1531         fn clone(&self) -> Self {
1532                 if self.result_ok {
1533                         Self { result_ok: true, contents: CResult_NoneErrorZPtr {
1534                                 result: std::ptr::null_mut()
1535                         } }
1536                 } else {
1537                         Self { result_ok: false, contents: CResult_NoneErrorZPtr {
1538                                 err: Box::into_raw(Box::new(<crate::c_types::IOError>::clone(unsafe { &*self.contents.err })))
1539                         } }
1540                 }
1541         }
1542 }
1543 #[no_mangle]
1544 /// Creates a new CResult_NoneErrorZ which has the same data as `orig`
1545 /// but with all dynamically-allocated buffers duplicated in new buffers.
1546 pub extern "C" fn CResult_NoneErrorZ_clone(orig: &CResult_NoneErrorZ) -> CResult_NoneErrorZ { Clone::clone(&orig) }
1547 #[repr(C)]
1548 /// The contents of CResult_RouteHopDecodeErrorZ
1549 pub union CResult_RouteHopDecodeErrorZPtr {
1550         /// A pointer to the contents in the success state.
1551         /// Reading from this pointer when `result_ok` is not set is undefined.
1552         pub result: *mut crate::lightning::routing::router::RouteHop,
1553         /// A pointer to the contents in the error state.
1554         /// Reading from this pointer when `result_ok` is set is undefined.
1555         pub err: *mut crate::lightning::ln::msgs::DecodeError,
1556 }
1557 #[repr(C)]
1558 /// A CResult_RouteHopDecodeErrorZ represents the result of a fallible operation,
1559 /// containing a crate::lightning::routing::router::RouteHop on success and a crate::lightning::ln::msgs::DecodeError on failure.
1560 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1561 pub struct CResult_RouteHopDecodeErrorZ {
1562         /// The contents of this CResult_RouteHopDecodeErrorZ, accessible via either
1563         /// `err` or `result` depending on the state of `result_ok`.
1564         pub contents: CResult_RouteHopDecodeErrorZPtr,
1565         /// Whether this CResult_RouteHopDecodeErrorZ represents a success state.
1566         pub result_ok: bool,
1567 }
1568 #[no_mangle]
1569 /// Creates a new CResult_RouteHopDecodeErrorZ in the success state.
1570 pub extern "C" fn CResult_RouteHopDecodeErrorZ_ok(o: crate::lightning::routing::router::RouteHop) -> CResult_RouteHopDecodeErrorZ {
1571         CResult_RouteHopDecodeErrorZ {
1572                 contents: CResult_RouteHopDecodeErrorZPtr {
1573                         result: Box::into_raw(Box::new(o)),
1574                 },
1575                 result_ok: true,
1576         }
1577 }
1578 #[no_mangle]
1579 /// Creates a new CResult_RouteHopDecodeErrorZ in the error state.
1580 pub extern "C" fn CResult_RouteHopDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RouteHopDecodeErrorZ {
1581         CResult_RouteHopDecodeErrorZ {
1582                 contents: CResult_RouteHopDecodeErrorZPtr {
1583                         err: Box::into_raw(Box::new(e)),
1584                 },
1585                 result_ok: false,
1586         }
1587 }
1588 #[no_mangle]
1589 /// Frees any resources used by the CResult_RouteHopDecodeErrorZ.
1590 pub extern "C" fn CResult_RouteHopDecodeErrorZ_free(_res: CResult_RouteHopDecodeErrorZ) { }
1591 impl Drop for CResult_RouteHopDecodeErrorZ {
1592         fn drop(&mut self) {
1593                 if self.result_ok {
1594                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
1595                                 let _ = unsafe { Box::from_raw(self.contents.result) };
1596                         }
1597                 } else {
1598                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
1599                                 let _ = unsafe { Box::from_raw(self.contents.err) };
1600                         }
1601                 }
1602         }
1603 }
1604 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::RouteHop, crate::lightning::ln::msgs::DecodeError>> for CResult_RouteHopDecodeErrorZ {
1605         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::RouteHop, crate::lightning::ln::msgs::DecodeError>) -> Self {
1606                 let contents = if o.result_ok {
1607                         let result = unsafe { o.contents.result };
1608                         unsafe { o.contents.result = std::ptr::null_mut() };
1609                         CResult_RouteHopDecodeErrorZPtr { result }
1610                 } else {
1611                         let err = unsafe { o.contents.err };
1612                         unsafe { o.contents.err = std::ptr::null_mut(); }
1613                         CResult_RouteHopDecodeErrorZPtr { err }
1614                 };
1615                 Self {
1616                         contents,
1617                         result_ok: o.result_ok,
1618                 }
1619         }
1620 }
1621 impl Clone for CResult_RouteHopDecodeErrorZ {
1622         fn clone(&self) -> Self {
1623                 if self.result_ok {
1624                         Self { result_ok: true, contents: CResult_RouteHopDecodeErrorZPtr {
1625                                 result: Box::into_raw(Box::new(<crate::lightning::routing::router::RouteHop>::clone(unsafe { &*self.contents.result })))
1626                         } }
1627                 } else {
1628                         Self { result_ok: false, contents: CResult_RouteHopDecodeErrorZPtr {
1629                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
1630                         } }
1631                 }
1632         }
1633 }
1634 #[no_mangle]
1635 /// Creates a new CResult_RouteHopDecodeErrorZ which has the same data as `orig`
1636 /// but with all dynamically-allocated buffers duplicated in new buffers.
1637 pub extern "C" fn CResult_RouteHopDecodeErrorZ_clone(orig: &CResult_RouteHopDecodeErrorZ) -> CResult_RouteHopDecodeErrorZ { Clone::clone(&orig) }
1638 #[repr(C)]
1639 /// A dynamically-allocated array of crate::lightning::routing::router::RouteHops of arbitrary size.
1640 /// This corresponds to std::vector in C++
1641 pub struct CVec_RouteHopZ {
1642         /// The elements in the array.
1643         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
1644         pub data: *mut crate::lightning::routing::router::RouteHop,
1645         /// The number of elements pointed to by `data`.
1646         pub datalen: usize
1647 }
1648 impl CVec_RouteHopZ {
1649         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::routing::router::RouteHop> {
1650                 if self.datalen == 0 { return Vec::new(); }
1651                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
1652                 self.data = std::ptr::null_mut();
1653                 self.datalen = 0;
1654                 ret
1655         }
1656         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::routing::router::RouteHop] {
1657                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
1658         }
1659 }
1660 impl From<Vec<crate::lightning::routing::router::RouteHop>> for CVec_RouteHopZ {
1661         fn from(v: Vec<crate::lightning::routing::router::RouteHop>) -> Self {
1662                 let datalen = v.len();
1663                 let data = Box::into_raw(v.into_boxed_slice());
1664                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
1665         }
1666 }
1667 #[no_mangle]
1668 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
1669 pub extern "C" fn CVec_RouteHopZ_free(_res: CVec_RouteHopZ) { }
1670 impl Drop for CVec_RouteHopZ {
1671         fn drop(&mut self) {
1672                 if self.datalen == 0 { return; }
1673                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
1674         }
1675 }
1676 impl Clone for CVec_RouteHopZ {
1677         fn clone(&self) -> Self {
1678                 let mut res = Vec::new();
1679                 if self.datalen == 0 { return Self::from(res); }
1680                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
1681                 Self::from(res)
1682         }
1683 }
1684 #[repr(C)]
1685 /// A dynamically-allocated array of crate::c_types::derived::CVec_RouteHopZs of arbitrary size.
1686 /// This corresponds to std::vector in C++
1687 pub struct CVec_CVec_RouteHopZZ {
1688         /// The elements in the array.
1689         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
1690         pub data: *mut crate::c_types::derived::CVec_RouteHopZ,
1691         /// The number of elements pointed to by `data`.
1692         pub datalen: usize
1693 }
1694 impl CVec_CVec_RouteHopZZ {
1695         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::CVec_RouteHopZ> {
1696                 if self.datalen == 0 { return Vec::new(); }
1697                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
1698                 self.data = std::ptr::null_mut();
1699                 self.datalen = 0;
1700                 ret
1701         }
1702         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::CVec_RouteHopZ] {
1703                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
1704         }
1705 }
1706 impl From<Vec<crate::c_types::derived::CVec_RouteHopZ>> for CVec_CVec_RouteHopZZ {
1707         fn from(v: Vec<crate::c_types::derived::CVec_RouteHopZ>) -> Self {
1708                 let datalen = v.len();
1709                 let data = Box::into_raw(v.into_boxed_slice());
1710                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
1711         }
1712 }
1713 #[no_mangle]
1714 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
1715 pub extern "C" fn CVec_CVec_RouteHopZZ_free(_res: CVec_CVec_RouteHopZZ) { }
1716 impl Drop for CVec_CVec_RouteHopZZ {
1717         fn drop(&mut self) {
1718                 if self.datalen == 0 { return; }
1719                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
1720         }
1721 }
1722 impl Clone for CVec_CVec_RouteHopZZ {
1723         fn clone(&self) -> Self {
1724                 let mut res = Vec::new();
1725                 if self.datalen == 0 { return Self::from(res); }
1726                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
1727                 Self::from(res)
1728         }
1729 }
1730 #[repr(C)]
1731 /// The contents of CResult_RouteDecodeErrorZ
1732 pub union CResult_RouteDecodeErrorZPtr {
1733         /// A pointer to the contents in the success state.
1734         /// Reading from this pointer when `result_ok` is not set is undefined.
1735         pub result: *mut crate::lightning::routing::router::Route,
1736         /// A pointer to the contents in the error state.
1737         /// Reading from this pointer when `result_ok` is set is undefined.
1738         pub err: *mut crate::lightning::ln::msgs::DecodeError,
1739 }
1740 #[repr(C)]
1741 /// A CResult_RouteDecodeErrorZ represents the result of a fallible operation,
1742 /// containing a crate::lightning::routing::router::Route on success and a crate::lightning::ln::msgs::DecodeError on failure.
1743 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1744 pub struct CResult_RouteDecodeErrorZ {
1745         /// The contents of this CResult_RouteDecodeErrorZ, accessible via either
1746         /// `err` or `result` depending on the state of `result_ok`.
1747         pub contents: CResult_RouteDecodeErrorZPtr,
1748         /// Whether this CResult_RouteDecodeErrorZ represents a success state.
1749         pub result_ok: bool,
1750 }
1751 #[no_mangle]
1752 /// Creates a new CResult_RouteDecodeErrorZ in the success state.
1753 pub extern "C" fn CResult_RouteDecodeErrorZ_ok(o: crate::lightning::routing::router::Route) -> CResult_RouteDecodeErrorZ {
1754         CResult_RouteDecodeErrorZ {
1755                 contents: CResult_RouteDecodeErrorZPtr {
1756                         result: Box::into_raw(Box::new(o)),
1757                 },
1758                 result_ok: true,
1759         }
1760 }
1761 #[no_mangle]
1762 /// Creates a new CResult_RouteDecodeErrorZ in the error state.
1763 pub extern "C" fn CResult_RouteDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RouteDecodeErrorZ {
1764         CResult_RouteDecodeErrorZ {
1765                 contents: CResult_RouteDecodeErrorZPtr {
1766                         err: Box::into_raw(Box::new(e)),
1767                 },
1768                 result_ok: false,
1769         }
1770 }
1771 #[no_mangle]
1772 /// Frees any resources used by the CResult_RouteDecodeErrorZ.
1773 pub extern "C" fn CResult_RouteDecodeErrorZ_free(_res: CResult_RouteDecodeErrorZ) { }
1774 impl Drop for CResult_RouteDecodeErrorZ {
1775         fn drop(&mut self) {
1776                 if self.result_ok {
1777                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
1778                                 let _ = unsafe { Box::from_raw(self.contents.result) };
1779                         }
1780                 } else {
1781                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
1782                                 let _ = unsafe { Box::from_raw(self.contents.err) };
1783                         }
1784                 }
1785         }
1786 }
1787 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::Route, crate::lightning::ln::msgs::DecodeError>> for CResult_RouteDecodeErrorZ {
1788         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::Route, crate::lightning::ln::msgs::DecodeError>) -> Self {
1789                 let contents = if o.result_ok {
1790                         let result = unsafe { o.contents.result };
1791                         unsafe { o.contents.result = std::ptr::null_mut() };
1792                         CResult_RouteDecodeErrorZPtr { result }
1793                 } else {
1794                         let err = unsafe { o.contents.err };
1795                         unsafe { o.contents.err = std::ptr::null_mut(); }
1796                         CResult_RouteDecodeErrorZPtr { err }
1797                 };
1798                 Self {
1799                         contents,
1800                         result_ok: o.result_ok,
1801                 }
1802         }
1803 }
1804 impl Clone for CResult_RouteDecodeErrorZ {
1805         fn clone(&self) -> Self {
1806                 if self.result_ok {
1807                         Self { result_ok: true, contents: CResult_RouteDecodeErrorZPtr {
1808                                 result: Box::into_raw(Box::new(<crate::lightning::routing::router::Route>::clone(unsafe { &*self.contents.result })))
1809                         } }
1810                 } else {
1811                         Self { result_ok: false, contents: CResult_RouteDecodeErrorZPtr {
1812                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
1813                         } }
1814                 }
1815         }
1816 }
1817 #[no_mangle]
1818 /// Creates a new CResult_RouteDecodeErrorZ which has the same data as `orig`
1819 /// but with all dynamically-allocated buffers duplicated in new buffers.
1820 pub extern "C" fn CResult_RouteDecodeErrorZ_clone(orig: &CResult_RouteDecodeErrorZ) -> CResult_RouteDecodeErrorZ { Clone::clone(&orig) }
1821 #[repr(C)]
1822 /// The contents of CResult_RouteParametersDecodeErrorZ
1823 pub union CResult_RouteParametersDecodeErrorZPtr {
1824         /// A pointer to the contents in the success state.
1825         /// Reading from this pointer when `result_ok` is not set is undefined.
1826         pub result: *mut crate::lightning::routing::router::RouteParameters,
1827         /// A pointer to the contents in the error state.
1828         /// Reading from this pointer when `result_ok` is set is undefined.
1829         pub err: *mut crate::lightning::ln::msgs::DecodeError,
1830 }
1831 #[repr(C)]
1832 /// A CResult_RouteParametersDecodeErrorZ represents the result of a fallible operation,
1833 /// containing a crate::lightning::routing::router::RouteParameters on success and a crate::lightning::ln::msgs::DecodeError on failure.
1834 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1835 pub struct CResult_RouteParametersDecodeErrorZ {
1836         /// The contents of this CResult_RouteParametersDecodeErrorZ, accessible via either
1837         /// `err` or `result` depending on the state of `result_ok`.
1838         pub contents: CResult_RouteParametersDecodeErrorZPtr,
1839         /// Whether this CResult_RouteParametersDecodeErrorZ represents a success state.
1840         pub result_ok: bool,
1841 }
1842 #[no_mangle]
1843 /// Creates a new CResult_RouteParametersDecodeErrorZ in the success state.
1844 pub extern "C" fn CResult_RouteParametersDecodeErrorZ_ok(o: crate::lightning::routing::router::RouteParameters) -> CResult_RouteParametersDecodeErrorZ {
1845         CResult_RouteParametersDecodeErrorZ {
1846                 contents: CResult_RouteParametersDecodeErrorZPtr {
1847                         result: Box::into_raw(Box::new(o)),
1848                 },
1849                 result_ok: true,
1850         }
1851 }
1852 #[no_mangle]
1853 /// Creates a new CResult_RouteParametersDecodeErrorZ in the error state.
1854 pub extern "C" fn CResult_RouteParametersDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RouteParametersDecodeErrorZ {
1855         CResult_RouteParametersDecodeErrorZ {
1856                 contents: CResult_RouteParametersDecodeErrorZPtr {
1857                         err: Box::into_raw(Box::new(e)),
1858                 },
1859                 result_ok: false,
1860         }
1861 }
1862 #[no_mangle]
1863 /// Frees any resources used by the CResult_RouteParametersDecodeErrorZ.
1864 pub extern "C" fn CResult_RouteParametersDecodeErrorZ_free(_res: CResult_RouteParametersDecodeErrorZ) { }
1865 impl Drop for CResult_RouteParametersDecodeErrorZ {
1866         fn drop(&mut self) {
1867                 if self.result_ok {
1868                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
1869                                 let _ = unsafe { Box::from_raw(self.contents.result) };
1870                         }
1871                 } else {
1872                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
1873                                 let _ = unsafe { Box::from_raw(self.contents.err) };
1874                         }
1875                 }
1876         }
1877 }
1878 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::RouteParameters, crate::lightning::ln::msgs::DecodeError>> for CResult_RouteParametersDecodeErrorZ {
1879         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::RouteParameters, crate::lightning::ln::msgs::DecodeError>) -> Self {
1880                 let contents = if o.result_ok {
1881                         let result = unsafe { o.contents.result };
1882                         unsafe { o.contents.result = std::ptr::null_mut() };
1883                         CResult_RouteParametersDecodeErrorZPtr { result }
1884                 } else {
1885                         let err = unsafe { o.contents.err };
1886                         unsafe { o.contents.err = std::ptr::null_mut(); }
1887                         CResult_RouteParametersDecodeErrorZPtr { err }
1888                 };
1889                 Self {
1890                         contents,
1891                         result_ok: o.result_ok,
1892                 }
1893         }
1894 }
1895 impl Clone for CResult_RouteParametersDecodeErrorZ {
1896         fn clone(&self) -> Self {
1897                 if self.result_ok {
1898                         Self { result_ok: true, contents: CResult_RouteParametersDecodeErrorZPtr {
1899                                 result: Box::into_raw(Box::new(<crate::lightning::routing::router::RouteParameters>::clone(unsafe { &*self.contents.result })))
1900                         } }
1901                 } else {
1902                         Self { result_ok: false, contents: CResult_RouteParametersDecodeErrorZPtr {
1903                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
1904                         } }
1905                 }
1906         }
1907 }
1908 #[no_mangle]
1909 /// Creates a new CResult_RouteParametersDecodeErrorZ which has the same data as `orig`
1910 /// but with all dynamically-allocated buffers duplicated in new buffers.
1911 pub extern "C" fn CResult_RouteParametersDecodeErrorZ_clone(orig: &CResult_RouteParametersDecodeErrorZ) -> CResult_RouteParametersDecodeErrorZ { Clone::clone(&orig) }
1912 #[repr(C)]
1913 /// A dynamically-allocated array of crate::lightning::routing::router::RouteHints of arbitrary size.
1914 /// This corresponds to std::vector in C++
1915 pub struct CVec_RouteHintZ {
1916         /// The elements in the array.
1917         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
1918         pub data: *mut crate::lightning::routing::router::RouteHint,
1919         /// The number of elements pointed to by `data`.
1920         pub datalen: usize
1921 }
1922 impl CVec_RouteHintZ {
1923         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::routing::router::RouteHint> {
1924                 if self.datalen == 0 { return Vec::new(); }
1925                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
1926                 self.data = std::ptr::null_mut();
1927                 self.datalen = 0;
1928                 ret
1929         }
1930         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::routing::router::RouteHint] {
1931                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
1932         }
1933 }
1934 impl From<Vec<crate::lightning::routing::router::RouteHint>> for CVec_RouteHintZ {
1935         fn from(v: Vec<crate::lightning::routing::router::RouteHint>) -> Self {
1936                 let datalen = v.len();
1937                 let data = Box::into_raw(v.into_boxed_slice());
1938                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
1939         }
1940 }
1941 #[no_mangle]
1942 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
1943 pub extern "C" fn CVec_RouteHintZ_free(_res: CVec_RouteHintZ) { }
1944 impl Drop for CVec_RouteHintZ {
1945         fn drop(&mut self) {
1946                 if self.datalen == 0 { return; }
1947                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
1948         }
1949 }
1950 impl Clone for CVec_RouteHintZ {
1951         fn clone(&self) -> Self {
1952                 let mut res = Vec::new();
1953                 if self.datalen == 0 { return Self::from(res); }
1954                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
1955                 Self::from(res)
1956         }
1957 }
1958 #[repr(C)]
1959 #[derive(Clone)]
1960 /// An enum which can either contain a u64 or not
1961 pub enum COption_u64Z {
1962         /// When we're in this state, this COption_u64Z contains a u64
1963         Some(u64),
1964         /// When we're in this state, this COption_u64Z contains nothing
1965         None
1966 }
1967 impl COption_u64Z {
1968         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
1969                 if let Self::Some(_) = self { true } else { false }
1970         }
1971         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
1972                 !self.is_some()
1973         }
1974         #[allow(unused)] pub(crate) fn take(mut self) -> u64 {
1975                 if let Self::Some(v) = self { v } else { unreachable!() }
1976         }
1977 }
1978 #[no_mangle]
1979 /// Constructs a new COption_u64Z containing a u64
1980 pub extern "C" fn COption_u64Z_some(o: u64) -> COption_u64Z {
1981         COption_u64Z::Some(o)
1982 }
1983 #[no_mangle]
1984 /// Constructs a new COption_u64Z containing nothing
1985 pub extern "C" fn COption_u64Z_none() -> COption_u64Z {
1986         COption_u64Z::None
1987 }
1988 #[no_mangle]
1989 /// Frees any resources associated with the u64, if we are in the Some state
1990 pub extern "C" fn COption_u64Z_free(_res: COption_u64Z) { }
1991 #[no_mangle]
1992 /// Creates a new COption_u64Z which has the same data as `orig`
1993 /// but with all dynamically-allocated buffers duplicated in new buffers.
1994 pub extern "C" fn COption_u64Z_clone(orig: &COption_u64Z) -> COption_u64Z { Clone::clone(&orig) }
1995 #[repr(C)]
1996 /// The contents of CResult_PayeeDecodeErrorZ
1997 pub union CResult_PayeeDecodeErrorZPtr {
1998         /// A pointer to the contents in the success state.
1999         /// Reading from this pointer when `result_ok` is not set is undefined.
2000         pub result: *mut crate::lightning::routing::router::Payee,
2001         /// A pointer to the contents in the error state.
2002         /// Reading from this pointer when `result_ok` is set is undefined.
2003         pub err: *mut crate::lightning::ln::msgs::DecodeError,
2004 }
2005 #[repr(C)]
2006 /// A CResult_PayeeDecodeErrorZ represents the result of a fallible operation,
2007 /// containing a crate::lightning::routing::router::Payee on success and a crate::lightning::ln::msgs::DecodeError on failure.
2008 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2009 pub struct CResult_PayeeDecodeErrorZ {
2010         /// The contents of this CResult_PayeeDecodeErrorZ, accessible via either
2011         /// `err` or `result` depending on the state of `result_ok`.
2012         pub contents: CResult_PayeeDecodeErrorZPtr,
2013         /// Whether this CResult_PayeeDecodeErrorZ represents a success state.
2014         pub result_ok: bool,
2015 }
2016 #[no_mangle]
2017 /// Creates a new CResult_PayeeDecodeErrorZ in the success state.
2018 pub extern "C" fn CResult_PayeeDecodeErrorZ_ok(o: crate::lightning::routing::router::Payee) -> CResult_PayeeDecodeErrorZ {
2019         CResult_PayeeDecodeErrorZ {
2020                 contents: CResult_PayeeDecodeErrorZPtr {
2021                         result: Box::into_raw(Box::new(o)),
2022                 },
2023                 result_ok: true,
2024         }
2025 }
2026 #[no_mangle]
2027 /// Creates a new CResult_PayeeDecodeErrorZ in the error state.
2028 pub extern "C" fn CResult_PayeeDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_PayeeDecodeErrorZ {
2029         CResult_PayeeDecodeErrorZ {
2030                 contents: CResult_PayeeDecodeErrorZPtr {
2031                         err: Box::into_raw(Box::new(e)),
2032                 },
2033                 result_ok: false,
2034         }
2035 }
2036 #[no_mangle]
2037 /// Frees any resources used by the CResult_PayeeDecodeErrorZ.
2038 pub extern "C" fn CResult_PayeeDecodeErrorZ_free(_res: CResult_PayeeDecodeErrorZ) { }
2039 impl Drop for CResult_PayeeDecodeErrorZ {
2040         fn drop(&mut self) {
2041                 if self.result_ok {
2042                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
2043                                 let _ = unsafe { Box::from_raw(self.contents.result) };
2044                         }
2045                 } else {
2046                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
2047                                 let _ = unsafe { Box::from_raw(self.contents.err) };
2048                         }
2049                 }
2050         }
2051 }
2052 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::Payee, crate::lightning::ln::msgs::DecodeError>> for CResult_PayeeDecodeErrorZ {
2053         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::Payee, crate::lightning::ln::msgs::DecodeError>) -> Self {
2054                 let contents = if o.result_ok {
2055                         let result = unsafe { o.contents.result };
2056                         unsafe { o.contents.result = std::ptr::null_mut() };
2057                         CResult_PayeeDecodeErrorZPtr { result }
2058                 } else {
2059                         let err = unsafe { o.contents.err };
2060                         unsafe { o.contents.err = std::ptr::null_mut(); }
2061                         CResult_PayeeDecodeErrorZPtr { err }
2062                 };
2063                 Self {
2064                         contents,
2065                         result_ok: o.result_ok,
2066                 }
2067         }
2068 }
2069 impl Clone for CResult_PayeeDecodeErrorZ {
2070         fn clone(&self) -> Self {
2071                 if self.result_ok {
2072                         Self { result_ok: true, contents: CResult_PayeeDecodeErrorZPtr {
2073                                 result: Box::into_raw(Box::new(<crate::lightning::routing::router::Payee>::clone(unsafe { &*self.contents.result })))
2074                         } }
2075                 } else {
2076                         Self { result_ok: false, contents: CResult_PayeeDecodeErrorZPtr {
2077                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
2078                         } }
2079                 }
2080         }
2081 }
2082 #[no_mangle]
2083 /// Creates a new CResult_PayeeDecodeErrorZ which has the same data as `orig`
2084 /// but with all dynamically-allocated buffers duplicated in new buffers.
2085 pub extern "C" fn CResult_PayeeDecodeErrorZ_clone(orig: &CResult_PayeeDecodeErrorZ) -> CResult_PayeeDecodeErrorZ { Clone::clone(&orig) }
2086 #[repr(C)]
2087 /// A dynamically-allocated array of crate::lightning::routing::router::RouteHintHops of arbitrary size.
2088 /// This corresponds to std::vector in C++
2089 pub struct CVec_RouteHintHopZ {
2090         /// The elements in the array.
2091         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2092         pub data: *mut crate::lightning::routing::router::RouteHintHop,
2093         /// The number of elements pointed to by `data`.
2094         pub datalen: usize
2095 }
2096 impl CVec_RouteHintHopZ {
2097         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::routing::router::RouteHintHop> {
2098                 if self.datalen == 0 { return Vec::new(); }
2099                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
2100                 self.data = std::ptr::null_mut();
2101                 self.datalen = 0;
2102                 ret
2103         }
2104         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::routing::router::RouteHintHop] {
2105                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
2106         }
2107 }
2108 impl From<Vec<crate::lightning::routing::router::RouteHintHop>> for CVec_RouteHintHopZ {
2109         fn from(v: Vec<crate::lightning::routing::router::RouteHintHop>) -> Self {
2110                 let datalen = v.len();
2111                 let data = Box::into_raw(v.into_boxed_slice());
2112                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
2113         }
2114 }
2115 #[no_mangle]
2116 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
2117 pub extern "C" fn CVec_RouteHintHopZ_free(_res: CVec_RouteHintHopZ) { }
2118 impl Drop for CVec_RouteHintHopZ {
2119         fn drop(&mut self) {
2120                 if self.datalen == 0 { return; }
2121                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
2122         }
2123 }
2124 impl Clone for CVec_RouteHintHopZ {
2125         fn clone(&self) -> Self {
2126                 let mut res = Vec::new();
2127                 if self.datalen == 0 { return Self::from(res); }
2128                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
2129                 Self::from(res)
2130         }
2131 }
2132 #[repr(C)]
2133 /// The contents of CResult_RouteHintDecodeErrorZ
2134 pub union CResult_RouteHintDecodeErrorZPtr {
2135         /// A pointer to the contents in the success state.
2136         /// Reading from this pointer when `result_ok` is not set is undefined.
2137         pub result: *mut crate::lightning::routing::router::RouteHint,
2138         /// A pointer to the contents in the error state.
2139         /// Reading from this pointer when `result_ok` is set is undefined.
2140         pub err: *mut crate::lightning::ln::msgs::DecodeError,
2141 }
2142 #[repr(C)]
2143 /// A CResult_RouteHintDecodeErrorZ represents the result of a fallible operation,
2144 /// containing a crate::lightning::routing::router::RouteHint on success and a crate::lightning::ln::msgs::DecodeError on failure.
2145 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2146 pub struct CResult_RouteHintDecodeErrorZ {
2147         /// The contents of this CResult_RouteHintDecodeErrorZ, accessible via either
2148         /// `err` or `result` depending on the state of `result_ok`.
2149         pub contents: CResult_RouteHintDecodeErrorZPtr,
2150         /// Whether this CResult_RouteHintDecodeErrorZ represents a success state.
2151         pub result_ok: bool,
2152 }
2153 #[no_mangle]
2154 /// Creates a new CResult_RouteHintDecodeErrorZ in the success state.
2155 pub extern "C" fn CResult_RouteHintDecodeErrorZ_ok(o: crate::lightning::routing::router::RouteHint) -> CResult_RouteHintDecodeErrorZ {
2156         CResult_RouteHintDecodeErrorZ {
2157                 contents: CResult_RouteHintDecodeErrorZPtr {
2158                         result: Box::into_raw(Box::new(o)),
2159                 },
2160                 result_ok: true,
2161         }
2162 }
2163 #[no_mangle]
2164 /// Creates a new CResult_RouteHintDecodeErrorZ in the error state.
2165 pub extern "C" fn CResult_RouteHintDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RouteHintDecodeErrorZ {
2166         CResult_RouteHintDecodeErrorZ {
2167                 contents: CResult_RouteHintDecodeErrorZPtr {
2168                         err: Box::into_raw(Box::new(e)),
2169                 },
2170                 result_ok: false,
2171         }
2172 }
2173 #[no_mangle]
2174 /// Frees any resources used by the CResult_RouteHintDecodeErrorZ.
2175 pub extern "C" fn CResult_RouteHintDecodeErrorZ_free(_res: CResult_RouteHintDecodeErrorZ) { }
2176 impl Drop for CResult_RouteHintDecodeErrorZ {
2177         fn drop(&mut self) {
2178                 if self.result_ok {
2179                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
2180                                 let _ = unsafe { Box::from_raw(self.contents.result) };
2181                         }
2182                 } else {
2183                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
2184                                 let _ = unsafe { Box::from_raw(self.contents.err) };
2185                         }
2186                 }
2187         }
2188 }
2189 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::RouteHint, crate::lightning::ln::msgs::DecodeError>> for CResult_RouteHintDecodeErrorZ {
2190         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::RouteHint, crate::lightning::ln::msgs::DecodeError>) -> Self {
2191                 let contents = if o.result_ok {
2192                         let result = unsafe { o.contents.result };
2193                         unsafe { o.contents.result = std::ptr::null_mut() };
2194                         CResult_RouteHintDecodeErrorZPtr { result }
2195                 } else {
2196                         let err = unsafe { o.contents.err };
2197                         unsafe { o.contents.err = std::ptr::null_mut(); }
2198                         CResult_RouteHintDecodeErrorZPtr { err }
2199                 };
2200                 Self {
2201                         contents,
2202                         result_ok: o.result_ok,
2203                 }
2204         }
2205 }
2206 impl Clone for CResult_RouteHintDecodeErrorZ {
2207         fn clone(&self) -> Self {
2208                 if self.result_ok {
2209                         Self { result_ok: true, contents: CResult_RouteHintDecodeErrorZPtr {
2210                                 result: Box::into_raw(Box::new(<crate::lightning::routing::router::RouteHint>::clone(unsafe { &*self.contents.result })))
2211                         } }
2212                 } else {
2213                         Self { result_ok: false, contents: CResult_RouteHintDecodeErrorZPtr {
2214                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
2215                         } }
2216                 }
2217         }
2218 }
2219 #[no_mangle]
2220 /// Creates a new CResult_RouteHintDecodeErrorZ which has the same data as `orig`
2221 /// but with all dynamically-allocated buffers duplicated in new buffers.
2222 pub extern "C" fn CResult_RouteHintDecodeErrorZ_clone(orig: &CResult_RouteHintDecodeErrorZ) -> CResult_RouteHintDecodeErrorZ { Clone::clone(&orig) }
2223 #[repr(C)]
2224 /// The contents of CResult_RouteHintHopDecodeErrorZ
2225 pub union CResult_RouteHintHopDecodeErrorZPtr {
2226         /// A pointer to the contents in the success state.
2227         /// Reading from this pointer when `result_ok` is not set is undefined.
2228         pub result: *mut crate::lightning::routing::router::RouteHintHop,
2229         /// A pointer to the contents in the error state.
2230         /// Reading from this pointer when `result_ok` is set is undefined.
2231         pub err: *mut crate::lightning::ln::msgs::DecodeError,
2232 }
2233 #[repr(C)]
2234 /// A CResult_RouteHintHopDecodeErrorZ represents the result of a fallible operation,
2235 /// containing a crate::lightning::routing::router::RouteHintHop on success and a crate::lightning::ln::msgs::DecodeError on failure.
2236 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2237 pub struct CResult_RouteHintHopDecodeErrorZ {
2238         /// The contents of this CResult_RouteHintHopDecodeErrorZ, accessible via either
2239         /// `err` or `result` depending on the state of `result_ok`.
2240         pub contents: CResult_RouteHintHopDecodeErrorZPtr,
2241         /// Whether this CResult_RouteHintHopDecodeErrorZ represents a success state.
2242         pub result_ok: bool,
2243 }
2244 #[no_mangle]
2245 /// Creates a new CResult_RouteHintHopDecodeErrorZ in the success state.
2246 pub extern "C" fn CResult_RouteHintHopDecodeErrorZ_ok(o: crate::lightning::routing::router::RouteHintHop) -> CResult_RouteHintHopDecodeErrorZ {
2247         CResult_RouteHintHopDecodeErrorZ {
2248                 contents: CResult_RouteHintHopDecodeErrorZPtr {
2249                         result: Box::into_raw(Box::new(o)),
2250                 },
2251                 result_ok: true,
2252         }
2253 }
2254 #[no_mangle]
2255 /// Creates a new CResult_RouteHintHopDecodeErrorZ in the error state.
2256 pub extern "C" fn CResult_RouteHintHopDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RouteHintHopDecodeErrorZ {
2257         CResult_RouteHintHopDecodeErrorZ {
2258                 contents: CResult_RouteHintHopDecodeErrorZPtr {
2259                         err: Box::into_raw(Box::new(e)),
2260                 },
2261                 result_ok: false,
2262         }
2263 }
2264 #[no_mangle]
2265 /// Frees any resources used by the CResult_RouteHintHopDecodeErrorZ.
2266 pub extern "C" fn CResult_RouteHintHopDecodeErrorZ_free(_res: CResult_RouteHintHopDecodeErrorZ) { }
2267 impl Drop for CResult_RouteHintHopDecodeErrorZ {
2268         fn drop(&mut self) {
2269                 if self.result_ok {
2270                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
2271                                 let _ = unsafe { Box::from_raw(self.contents.result) };
2272                         }
2273                 } else {
2274                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
2275                                 let _ = unsafe { Box::from_raw(self.contents.err) };
2276                         }
2277                 }
2278         }
2279 }
2280 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::RouteHintHop, crate::lightning::ln::msgs::DecodeError>> for CResult_RouteHintHopDecodeErrorZ {
2281         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::RouteHintHop, crate::lightning::ln::msgs::DecodeError>) -> Self {
2282                 let contents = if o.result_ok {
2283                         let result = unsafe { o.contents.result };
2284                         unsafe { o.contents.result = std::ptr::null_mut() };
2285                         CResult_RouteHintHopDecodeErrorZPtr { result }
2286                 } else {
2287                         let err = unsafe { o.contents.err };
2288                         unsafe { o.contents.err = std::ptr::null_mut(); }
2289                         CResult_RouteHintHopDecodeErrorZPtr { err }
2290                 };
2291                 Self {
2292                         contents,
2293                         result_ok: o.result_ok,
2294                 }
2295         }
2296 }
2297 impl Clone for CResult_RouteHintHopDecodeErrorZ {
2298         fn clone(&self) -> Self {
2299                 if self.result_ok {
2300                         Self { result_ok: true, contents: CResult_RouteHintHopDecodeErrorZPtr {
2301                                 result: Box::into_raw(Box::new(<crate::lightning::routing::router::RouteHintHop>::clone(unsafe { &*self.contents.result })))
2302                         } }
2303                 } else {
2304                         Self { result_ok: false, contents: CResult_RouteHintHopDecodeErrorZPtr {
2305                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
2306                         } }
2307                 }
2308         }
2309 }
2310 #[no_mangle]
2311 /// Creates a new CResult_RouteHintHopDecodeErrorZ which has the same data as `orig`
2312 /// but with all dynamically-allocated buffers duplicated in new buffers.
2313 pub extern "C" fn CResult_RouteHintHopDecodeErrorZ_clone(orig: &CResult_RouteHintHopDecodeErrorZ) -> CResult_RouteHintHopDecodeErrorZ { Clone::clone(&orig) }
2314 #[repr(C)]
2315 /// A dynamically-allocated array of crate::lightning::ln::channelmanager::ChannelDetailss of arbitrary size.
2316 /// This corresponds to std::vector in C++
2317 pub struct CVec_ChannelDetailsZ {
2318         /// The elements in the array.
2319         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2320         pub data: *mut crate::lightning::ln::channelmanager::ChannelDetails,
2321         /// The number of elements pointed to by `data`.
2322         pub datalen: usize
2323 }
2324 impl CVec_ChannelDetailsZ {
2325         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::channelmanager::ChannelDetails> {
2326                 if self.datalen == 0 { return Vec::new(); }
2327                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
2328                 self.data = std::ptr::null_mut();
2329                 self.datalen = 0;
2330                 ret
2331         }
2332         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::channelmanager::ChannelDetails] {
2333                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
2334         }
2335 }
2336 impl From<Vec<crate::lightning::ln::channelmanager::ChannelDetails>> for CVec_ChannelDetailsZ {
2337         fn from(v: Vec<crate::lightning::ln::channelmanager::ChannelDetails>) -> Self {
2338                 let datalen = v.len();
2339                 let data = Box::into_raw(v.into_boxed_slice());
2340                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
2341         }
2342 }
2343 #[no_mangle]
2344 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
2345 pub extern "C" fn CVec_ChannelDetailsZ_free(_res: CVec_ChannelDetailsZ) { }
2346 impl Drop for CVec_ChannelDetailsZ {
2347         fn drop(&mut self) {
2348                 if self.datalen == 0 { return; }
2349                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
2350         }
2351 }
2352 impl Clone for CVec_ChannelDetailsZ {
2353         fn clone(&self) -> Self {
2354                 let mut res = Vec::new();
2355                 if self.datalen == 0 { return Self::from(res); }
2356                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
2357                 Self::from(res)
2358         }
2359 }
2360 #[repr(C)]
2361 /// The contents of CResult_RouteLightningErrorZ
2362 pub union CResult_RouteLightningErrorZPtr {
2363         /// A pointer to the contents in the success state.
2364         /// Reading from this pointer when `result_ok` is not set is undefined.
2365         pub result: *mut crate::lightning::routing::router::Route,
2366         /// A pointer to the contents in the error state.
2367         /// Reading from this pointer when `result_ok` is set is undefined.
2368         pub err: *mut crate::lightning::ln::msgs::LightningError,
2369 }
2370 #[repr(C)]
2371 /// A CResult_RouteLightningErrorZ represents the result of a fallible operation,
2372 /// containing a crate::lightning::routing::router::Route on success and a crate::lightning::ln::msgs::LightningError on failure.
2373 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2374 pub struct CResult_RouteLightningErrorZ {
2375         /// The contents of this CResult_RouteLightningErrorZ, accessible via either
2376         /// `err` or `result` depending on the state of `result_ok`.
2377         pub contents: CResult_RouteLightningErrorZPtr,
2378         /// Whether this CResult_RouteLightningErrorZ represents a success state.
2379         pub result_ok: bool,
2380 }
2381 #[no_mangle]
2382 /// Creates a new CResult_RouteLightningErrorZ in the success state.
2383 pub extern "C" fn CResult_RouteLightningErrorZ_ok(o: crate::lightning::routing::router::Route) -> CResult_RouteLightningErrorZ {
2384         CResult_RouteLightningErrorZ {
2385                 contents: CResult_RouteLightningErrorZPtr {
2386                         result: Box::into_raw(Box::new(o)),
2387                 },
2388                 result_ok: true,
2389         }
2390 }
2391 #[no_mangle]
2392 /// Creates a new CResult_RouteLightningErrorZ in the error state.
2393 pub extern "C" fn CResult_RouteLightningErrorZ_err(e: crate::lightning::ln::msgs::LightningError) -> CResult_RouteLightningErrorZ {
2394         CResult_RouteLightningErrorZ {
2395                 contents: CResult_RouteLightningErrorZPtr {
2396                         err: Box::into_raw(Box::new(e)),
2397                 },
2398                 result_ok: false,
2399         }
2400 }
2401 #[no_mangle]
2402 /// Frees any resources used by the CResult_RouteLightningErrorZ.
2403 pub extern "C" fn CResult_RouteLightningErrorZ_free(_res: CResult_RouteLightningErrorZ) { }
2404 impl Drop for CResult_RouteLightningErrorZ {
2405         fn drop(&mut self) {
2406                 if self.result_ok {
2407                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
2408                                 let _ = unsafe { Box::from_raw(self.contents.result) };
2409                         }
2410                 } else {
2411                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
2412                                 let _ = unsafe { Box::from_raw(self.contents.err) };
2413                         }
2414                 }
2415         }
2416 }
2417 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::Route, crate::lightning::ln::msgs::LightningError>> for CResult_RouteLightningErrorZ {
2418         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::Route, crate::lightning::ln::msgs::LightningError>) -> Self {
2419                 let contents = if o.result_ok {
2420                         let result = unsafe { o.contents.result };
2421                         unsafe { o.contents.result = std::ptr::null_mut() };
2422                         CResult_RouteLightningErrorZPtr { result }
2423                 } else {
2424                         let err = unsafe { o.contents.err };
2425                         unsafe { o.contents.err = std::ptr::null_mut(); }
2426                         CResult_RouteLightningErrorZPtr { err }
2427                 };
2428                 Self {
2429                         contents,
2430                         result_ok: o.result_ok,
2431                 }
2432         }
2433 }
2434 impl Clone for CResult_RouteLightningErrorZ {
2435         fn clone(&self) -> Self {
2436                 if self.result_ok {
2437                         Self { result_ok: true, contents: CResult_RouteLightningErrorZPtr {
2438                                 result: Box::into_raw(Box::new(<crate::lightning::routing::router::Route>::clone(unsafe { &*self.contents.result })))
2439                         } }
2440                 } else {
2441                         Self { result_ok: false, contents: CResult_RouteLightningErrorZPtr {
2442                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::LightningError>::clone(unsafe { &*self.contents.err })))
2443                         } }
2444                 }
2445         }
2446 }
2447 #[no_mangle]
2448 /// Creates a new CResult_RouteLightningErrorZ which has the same data as `orig`
2449 /// but with all dynamically-allocated buffers duplicated in new buffers.
2450 pub extern "C" fn CResult_RouteLightningErrorZ_clone(orig: &CResult_RouteLightningErrorZ) -> CResult_RouteLightningErrorZ { Clone::clone(&orig) }
2451 #[repr(C)]
2452 /// The contents of CResult_TxOutAccessErrorZ
2453 pub union CResult_TxOutAccessErrorZPtr {
2454         /// A pointer to the contents in the success state.
2455         /// Reading from this pointer when `result_ok` is not set is undefined.
2456         pub result: *mut crate::c_types::TxOut,
2457         /// A pointer to the contents in the error state.
2458         /// Reading from this pointer when `result_ok` is set is undefined.
2459         pub err: *mut crate::lightning::chain::AccessError,
2460 }
2461 #[repr(C)]
2462 /// A CResult_TxOutAccessErrorZ represents the result of a fallible operation,
2463 /// containing a crate::c_types::TxOut on success and a crate::lightning::chain::AccessError on failure.
2464 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2465 pub struct CResult_TxOutAccessErrorZ {
2466         /// The contents of this CResult_TxOutAccessErrorZ, accessible via either
2467         /// `err` or `result` depending on the state of `result_ok`.
2468         pub contents: CResult_TxOutAccessErrorZPtr,
2469         /// Whether this CResult_TxOutAccessErrorZ represents a success state.
2470         pub result_ok: bool,
2471 }
2472 #[no_mangle]
2473 /// Creates a new CResult_TxOutAccessErrorZ in the success state.
2474 pub extern "C" fn CResult_TxOutAccessErrorZ_ok(o: crate::c_types::TxOut) -> CResult_TxOutAccessErrorZ {
2475         CResult_TxOutAccessErrorZ {
2476                 contents: CResult_TxOutAccessErrorZPtr {
2477                         result: Box::into_raw(Box::new(o)),
2478                 },
2479                 result_ok: true,
2480         }
2481 }
2482 #[no_mangle]
2483 /// Creates a new CResult_TxOutAccessErrorZ in the error state.
2484 pub extern "C" fn CResult_TxOutAccessErrorZ_err(e: crate::lightning::chain::AccessError) -> CResult_TxOutAccessErrorZ {
2485         CResult_TxOutAccessErrorZ {
2486                 contents: CResult_TxOutAccessErrorZPtr {
2487                         err: Box::into_raw(Box::new(e)),
2488                 },
2489                 result_ok: false,
2490         }
2491 }
2492 #[no_mangle]
2493 /// Frees any resources used by the CResult_TxOutAccessErrorZ.
2494 pub extern "C" fn CResult_TxOutAccessErrorZ_free(_res: CResult_TxOutAccessErrorZ) { }
2495 impl Drop for CResult_TxOutAccessErrorZ {
2496         fn drop(&mut self) {
2497                 if self.result_ok {
2498                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
2499                                 let _ = unsafe { Box::from_raw(self.contents.result) };
2500                         }
2501                 } else {
2502                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
2503                                 let _ = unsafe { Box::from_raw(self.contents.err) };
2504                         }
2505                 }
2506         }
2507 }
2508 impl From<crate::c_types::CResultTempl<crate::c_types::TxOut, crate::lightning::chain::AccessError>> for CResult_TxOutAccessErrorZ {
2509         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::TxOut, crate::lightning::chain::AccessError>) -> Self {
2510                 let contents = if o.result_ok {
2511                         let result = unsafe { o.contents.result };
2512                         unsafe { o.contents.result = std::ptr::null_mut() };
2513                         CResult_TxOutAccessErrorZPtr { result }
2514                 } else {
2515                         let err = unsafe { o.contents.err };
2516                         unsafe { o.contents.err = std::ptr::null_mut(); }
2517                         CResult_TxOutAccessErrorZPtr { err }
2518                 };
2519                 Self {
2520                         contents,
2521                         result_ok: o.result_ok,
2522                 }
2523         }
2524 }
2525 impl Clone for CResult_TxOutAccessErrorZ {
2526         fn clone(&self) -> Self {
2527                 if self.result_ok {
2528                         Self { result_ok: true, contents: CResult_TxOutAccessErrorZPtr {
2529                                 result: Box::into_raw(Box::new(<crate::c_types::TxOut>::clone(unsafe { &*self.contents.result })))
2530                         } }
2531                 } else {
2532                         Self { result_ok: false, contents: CResult_TxOutAccessErrorZPtr {
2533                                 err: Box::into_raw(Box::new(<crate::lightning::chain::AccessError>::clone(unsafe { &*self.contents.err })))
2534                         } }
2535                 }
2536         }
2537 }
2538 #[no_mangle]
2539 /// Creates a new CResult_TxOutAccessErrorZ which has the same data as `orig`
2540 /// but with all dynamically-allocated buffers duplicated in new buffers.
2541 pub extern "C" fn CResult_TxOutAccessErrorZ_clone(orig: &CResult_TxOutAccessErrorZ) -> CResult_TxOutAccessErrorZ { Clone::clone(&orig) }
2542 #[repr(C)]
2543 /// A tuple of 2 elements. See the individual fields for the types contained.
2544 pub struct C2Tuple_usizeTransactionZ {
2545         /// The element at position 0
2546         pub a: usize,
2547         /// The element at position 1
2548         pub b: crate::c_types::Transaction,
2549 }
2550 impl From<(usize, crate::c_types::Transaction)> for C2Tuple_usizeTransactionZ {
2551         fn from (tup: (usize, crate::c_types::Transaction)) -> Self {
2552                 Self {
2553                         a: tup.0,
2554                         b: tup.1,
2555                 }
2556         }
2557 }
2558 impl C2Tuple_usizeTransactionZ {
2559         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (usize, crate::c_types::Transaction) {
2560                 (self.a, self.b)
2561         }
2562 }
2563 impl Clone for C2Tuple_usizeTransactionZ {
2564         fn clone(&self) -> Self {
2565                 Self {
2566                         a: Clone::clone(&self.a),
2567                         b: Clone::clone(&self.b),
2568                 }
2569         }
2570 }
2571 #[no_mangle]
2572 /// Creates a new tuple which has the same data as `orig`
2573 /// but with all dynamically-allocated buffers duplicated in new buffers.
2574 pub extern "C" fn C2Tuple_usizeTransactionZ_clone(orig: &C2Tuple_usizeTransactionZ) -> C2Tuple_usizeTransactionZ { Clone::clone(&orig) }
2575 /// Creates a new C2Tuple_usizeTransactionZ from the contained elements.
2576 #[no_mangle]
2577 pub extern "C" fn C2Tuple_usizeTransactionZ_new(a: usize, b: crate::c_types::Transaction) -> C2Tuple_usizeTransactionZ {
2578         C2Tuple_usizeTransactionZ { a, b, }
2579 }
2580
2581 #[no_mangle]
2582 /// Frees any resources used by the C2Tuple_usizeTransactionZ.
2583 pub extern "C" fn C2Tuple_usizeTransactionZ_free(_res: C2Tuple_usizeTransactionZ) { }
2584 #[repr(C)]
2585 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_usizeTransactionZs of arbitrary size.
2586 /// This corresponds to std::vector in C++
2587 pub struct CVec_C2Tuple_usizeTransactionZZ {
2588         /// The elements in the array.
2589         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2590         pub data: *mut crate::c_types::derived::C2Tuple_usizeTransactionZ,
2591         /// The number of elements pointed to by `data`.
2592         pub datalen: usize
2593 }
2594 impl CVec_C2Tuple_usizeTransactionZZ {
2595         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_usizeTransactionZ> {
2596                 if self.datalen == 0 { return Vec::new(); }
2597                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
2598                 self.data = std::ptr::null_mut();
2599                 self.datalen = 0;
2600                 ret
2601         }
2602         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_usizeTransactionZ] {
2603                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
2604         }
2605 }
2606 impl From<Vec<crate::c_types::derived::C2Tuple_usizeTransactionZ>> for CVec_C2Tuple_usizeTransactionZZ {
2607         fn from(v: Vec<crate::c_types::derived::C2Tuple_usizeTransactionZ>) -> Self {
2608                 let datalen = v.len();
2609                 let data = Box::into_raw(v.into_boxed_slice());
2610                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
2611         }
2612 }
2613 #[no_mangle]
2614 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
2615 pub extern "C" fn CVec_C2Tuple_usizeTransactionZZ_free(_res: CVec_C2Tuple_usizeTransactionZZ) { }
2616 impl Drop for CVec_C2Tuple_usizeTransactionZZ {
2617         fn drop(&mut self) {
2618                 if self.datalen == 0 { return; }
2619                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
2620         }
2621 }
2622 impl Clone for CVec_C2Tuple_usizeTransactionZZ {
2623         fn clone(&self) -> Self {
2624                 let mut res = Vec::new();
2625                 if self.datalen == 0 { return Self::from(res); }
2626                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
2627                 Self::from(res)
2628         }
2629 }
2630 #[repr(C)]
2631 /// A dynamically-allocated array of crate::c_types::ThirtyTwoBytess of arbitrary size.
2632 /// This corresponds to std::vector in C++
2633 pub struct CVec_TxidZ {
2634         /// The elements in the array.
2635         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2636         pub data: *mut crate::c_types::ThirtyTwoBytes,
2637         /// The number of elements pointed to by `data`.
2638         pub datalen: usize
2639 }
2640 impl CVec_TxidZ {
2641         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::ThirtyTwoBytes> {
2642                 if self.datalen == 0 { return Vec::new(); }
2643                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
2644                 self.data = std::ptr::null_mut();
2645                 self.datalen = 0;
2646                 ret
2647         }
2648         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::ThirtyTwoBytes] {
2649                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
2650         }
2651 }
2652 impl From<Vec<crate::c_types::ThirtyTwoBytes>> for CVec_TxidZ {
2653         fn from(v: Vec<crate::c_types::ThirtyTwoBytes>) -> Self {
2654                 let datalen = v.len();
2655                 let data = Box::into_raw(v.into_boxed_slice());
2656                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
2657         }
2658 }
2659 #[no_mangle]
2660 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
2661 pub extern "C" fn CVec_TxidZ_free(_res: CVec_TxidZ) { }
2662 impl Drop for CVec_TxidZ {
2663         fn drop(&mut self) {
2664                 if self.datalen == 0 { return; }
2665                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
2666         }
2667 }
2668 impl Clone for CVec_TxidZ {
2669         fn clone(&self) -> Self {
2670                 let mut res = Vec::new();
2671                 if self.datalen == 0 { return Self::from(res); }
2672                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
2673                 Self::from(res)
2674         }
2675 }
2676 #[repr(C)]
2677 /// The contents of CResult_NoneChannelMonitorUpdateErrZ
2678 pub union CResult_NoneChannelMonitorUpdateErrZPtr {
2679         /// Note that this value is always NULL, as there are no contents in the OK variant
2680         pub result: *mut std::ffi::c_void,
2681         /// A pointer to the contents in the error state.
2682         /// Reading from this pointer when `result_ok` is set is undefined.
2683         pub err: *mut crate::lightning::chain::ChannelMonitorUpdateErr,
2684 }
2685 #[repr(C)]
2686 /// A CResult_NoneChannelMonitorUpdateErrZ represents the result of a fallible operation,
2687 /// containing a () on success and a crate::lightning::chain::ChannelMonitorUpdateErr on failure.
2688 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2689 pub struct CResult_NoneChannelMonitorUpdateErrZ {
2690         /// The contents of this CResult_NoneChannelMonitorUpdateErrZ, accessible via either
2691         /// `err` or `result` depending on the state of `result_ok`.
2692         pub contents: CResult_NoneChannelMonitorUpdateErrZPtr,
2693         /// Whether this CResult_NoneChannelMonitorUpdateErrZ represents a success state.
2694         pub result_ok: bool,
2695 }
2696 #[no_mangle]
2697 /// Creates a new CResult_NoneChannelMonitorUpdateErrZ in the success state.
2698 pub extern "C" fn CResult_NoneChannelMonitorUpdateErrZ_ok() -> CResult_NoneChannelMonitorUpdateErrZ {
2699         CResult_NoneChannelMonitorUpdateErrZ {
2700                 contents: CResult_NoneChannelMonitorUpdateErrZPtr {
2701                         result: std::ptr::null_mut(),
2702                 },
2703                 result_ok: true,
2704         }
2705 }
2706 #[no_mangle]
2707 /// Creates a new CResult_NoneChannelMonitorUpdateErrZ in the error state.
2708 pub extern "C" fn CResult_NoneChannelMonitorUpdateErrZ_err(e: crate::lightning::chain::ChannelMonitorUpdateErr) -> CResult_NoneChannelMonitorUpdateErrZ {
2709         CResult_NoneChannelMonitorUpdateErrZ {
2710                 contents: CResult_NoneChannelMonitorUpdateErrZPtr {
2711                         err: Box::into_raw(Box::new(e)),
2712                 },
2713                 result_ok: false,
2714         }
2715 }
2716 #[no_mangle]
2717 /// Frees any resources used by the CResult_NoneChannelMonitorUpdateErrZ.
2718 pub extern "C" fn CResult_NoneChannelMonitorUpdateErrZ_free(_res: CResult_NoneChannelMonitorUpdateErrZ) { }
2719 impl Drop for CResult_NoneChannelMonitorUpdateErrZ {
2720         fn drop(&mut self) {
2721                 if self.result_ok {
2722                 } else {
2723                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
2724                                 let _ = unsafe { Box::from_raw(self.contents.err) };
2725                         }
2726                 }
2727         }
2728 }
2729 impl From<crate::c_types::CResultTempl<(), crate::lightning::chain::ChannelMonitorUpdateErr>> for CResult_NoneChannelMonitorUpdateErrZ {
2730         fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::chain::ChannelMonitorUpdateErr>) -> Self {
2731                 let contents = if o.result_ok {
2732                         let _ = unsafe { Box::from_raw(o.contents.result) };
2733                         o.contents.result = std::ptr::null_mut();
2734                         CResult_NoneChannelMonitorUpdateErrZPtr { result: std::ptr::null_mut() }
2735                 } else {
2736                         let err = unsafe { o.contents.err };
2737                         unsafe { o.contents.err = std::ptr::null_mut(); }
2738                         CResult_NoneChannelMonitorUpdateErrZPtr { err }
2739                 };
2740                 Self {
2741                         contents,
2742                         result_ok: o.result_ok,
2743                 }
2744         }
2745 }
2746 impl Clone for CResult_NoneChannelMonitorUpdateErrZ {
2747         fn clone(&self) -> Self {
2748                 if self.result_ok {
2749                         Self { result_ok: true, contents: CResult_NoneChannelMonitorUpdateErrZPtr {
2750                                 result: std::ptr::null_mut()
2751                         } }
2752                 } else {
2753                         Self { result_ok: false, contents: CResult_NoneChannelMonitorUpdateErrZPtr {
2754                                 err: Box::into_raw(Box::new(<crate::lightning::chain::ChannelMonitorUpdateErr>::clone(unsafe { &*self.contents.err })))
2755                         } }
2756                 }
2757         }
2758 }
2759 #[no_mangle]
2760 /// Creates a new CResult_NoneChannelMonitorUpdateErrZ which has the same data as `orig`
2761 /// but with all dynamically-allocated buffers duplicated in new buffers.
2762 pub extern "C" fn CResult_NoneChannelMonitorUpdateErrZ_clone(orig: &CResult_NoneChannelMonitorUpdateErrZ) -> CResult_NoneChannelMonitorUpdateErrZ { Clone::clone(&orig) }
2763 #[repr(C)]
2764 /// A dynamically-allocated array of crate::lightning::chain::channelmonitor::MonitorEvents of arbitrary size.
2765 /// This corresponds to std::vector in C++
2766 pub struct CVec_MonitorEventZ {
2767         /// The elements in the array.
2768         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2769         pub data: *mut crate::lightning::chain::channelmonitor::MonitorEvent,
2770         /// The number of elements pointed to by `data`.
2771         pub datalen: usize
2772 }
2773 impl CVec_MonitorEventZ {
2774         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::chain::channelmonitor::MonitorEvent> {
2775                 if self.datalen == 0 { return Vec::new(); }
2776                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
2777                 self.data = std::ptr::null_mut();
2778                 self.datalen = 0;
2779                 ret
2780         }
2781         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::chain::channelmonitor::MonitorEvent] {
2782                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
2783         }
2784 }
2785 impl From<Vec<crate::lightning::chain::channelmonitor::MonitorEvent>> for CVec_MonitorEventZ {
2786         fn from(v: Vec<crate::lightning::chain::channelmonitor::MonitorEvent>) -> Self {
2787                 let datalen = v.len();
2788                 let data = Box::into_raw(v.into_boxed_slice());
2789                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
2790         }
2791 }
2792 #[no_mangle]
2793 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
2794 pub extern "C" fn CVec_MonitorEventZ_free(_res: CVec_MonitorEventZ) { }
2795 impl Drop for CVec_MonitorEventZ {
2796         fn drop(&mut self) {
2797                 if self.datalen == 0 { return; }
2798                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
2799         }
2800 }
2801 impl Clone for CVec_MonitorEventZ {
2802         fn clone(&self) -> Self {
2803                 let mut res = Vec::new();
2804                 if self.datalen == 0 { return Self::from(res); }
2805                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
2806                 Self::from(res)
2807         }
2808 }
2809 #[repr(C)]
2810 #[derive(Clone)]
2811 /// An enum which can either contain a crate::c_types::derived::C2Tuple_usizeTransactionZ or not
2812 pub enum COption_C2Tuple_usizeTransactionZZ {
2813         /// When we're in this state, this COption_C2Tuple_usizeTransactionZZ contains a crate::c_types::derived::C2Tuple_usizeTransactionZ
2814         Some(crate::c_types::derived::C2Tuple_usizeTransactionZ),
2815         /// When we're in this state, this COption_C2Tuple_usizeTransactionZZ contains nothing
2816         None
2817 }
2818 impl COption_C2Tuple_usizeTransactionZZ {
2819         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
2820                 if let Self::Some(_) = self { true } else { false }
2821         }
2822         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
2823                 !self.is_some()
2824         }
2825         #[allow(unused)] pub(crate) fn take(mut self) -> crate::c_types::derived::C2Tuple_usizeTransactionZ {
2826                 if let Self::Some(v) = self { v } else { unreachable!() }
2827         }
2828 }
2829 #[no_mangle]
2830 /// Constructs a new COption_C2Tuple_usizeTransactionZZ containing a crate::c_types::derived::C2Tuple_usizeTransactionZ
2831 pub extern "C" fn COption_C2Tuple_usizeTransactionZZ_some(o: crate::c_types::derived::C2Tuple_usizeTransactionZ) -> COption_C2Tuple_usizeTransactionZZ {
2832         COption_C2Tuple_usizeTransactionZZ::Some(o)
2833 }
2834 #[no_mangle]
2835 /// Constructs a new COption_C2Tuple_usizeTransactionZZ containing nothing
2836 pub extern "C" fn COption_C2Tuple_usizeTransactionZZ_none() -> COption_C2Tuple_usizeTransactionZZ {
2837         COption_C2Tuple_usizeTransactionZZ::None
2838 }
2839 #[no_mangle]
2840 /// Frees any resources associated with the crate::c_types::derived::C2Tuple_usizeTransactionZ, if we are in the Some state
2841 pub extern "C" fn COption_C2Tuple_usizeTransactionZZ_free(_res: COption_C2Tuple_usizeTransactionZZ) { }
2842 #[no_mangle]
2843 /// Creates a new COption_C2Tuple_usizeTransactionZZ which has the same data as `orig`
2844 /// but with all dynamically-allocated buffers duplicated in new buffers.
2845 pub extern "C" fn COption_C2Tuple_usizeTransactionZZ_clone(orig: &COption_C2Tuple_usizeTransactionZZ) -> COption_C2Tuple_usizeTransactionZZ { Clone::clone(&orig) }
2846 #[repr(C)]
2847 #[derive(Clone)]
2848 /// An enum which can either contain a crate::lightning::routing::network_graph::NetworkUpdate or not
2849 pub enum COption_NetworkUpdateZ {
2850         /// When we're in this state, this COption_NetworkUpdateZ contains a crate::lightning::routing::network_graph::NetworkUpdate
2851         Some(crate::lightning::routing::network_graph::NetworkUpdate),
2852         /// When we're in this state, this COption_NetworkUpdateZ contains nothing
2853         None
2854 }
2855 impl COption_NetworkUpdateZ {
2856         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
2857                 if let Self::Some(_) = self { true } else { false }
2858         }
2859         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
2860                 !self.is_some()
2861         }
2862         #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::routing::network_graph::NetworkUpdate {
2863                 if let Self::Some(v) = self { v } else { unreachable!() }
2864         }
2865 }
2866 #[no_mangle]
2867 /// Constructs a new COption_NetworkUpdateZ containing a crate::lightning::routing::network_graph::NetworkUpdate
2868 pub extern "C" fn COption_NetworkUpdateZ_some(o: crate::lightning::routing::network_graph::NetworkUpdate) -> COption_NetworkUpdateZ {
2869         COption_NetworkUpdateZ::Some(o)
2870 }
2871 #[no_mangle]
2872 /// Constructs a new COption_NetworkUpdateZ containing nothing
2873 pub extern "C" fn COption_NetworkUpdateZ_none() -> COption_NetworkUpdateZ {
2874         COption_NetworkUpdateZ::None
2875 }
2876 #[no_mangle]
2877 /// Frees any resources associated with the crate::lightning::routing::network_graph::NetworkUpdate, if we are in the Some state
2878 pub extern "C" fn COption_NetworkUpdateZ_free(_res: COption_NetworkUpdateZ) { }
2879 #[no_mangle]
2880 /// Creates a new COption_NetworkUpdateZ which has the same data as `orig`
2881 /// but with all dynamically-allocated buffers duplicated in new buffers.
2882 pub extern "C" fn COption_NetworkUpdateZ_clone(orig: &COption_NetworkUpdateZ) -> COption_NetworkUpdateZ { Clone::clone(&orig) }
2883 #[repr(C)]
2884 /// A dynamically-allocated array of crate::lightning::chain::keysinterface::SpendableOutputDescriptors of arbitrary size.
2885 /// This corresponds to std::vector in C++
2886 pub struct CVec_SpendableOutputDescriptorZ {
2887         /// The elements in the array.
2888         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2889         pub data: *mut crate::lightning::chain::keysinterface::SpendableOutputDescriptor,
2890         /// The number of elements pointed to by `data`.
2891         pub datalen: usize
2892 }
2893 impl CVec_SpendableOutputDescriptorZ {
2894         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::chain::keysinterface::SpendableOutputDescriptor> {
2895                 if self.datalen == 0 { return Vec::new(); }
2896                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
2897                 self.data = std::ptr::null_mut();
2898                 self.datalen = 0;
2899                 ret
2900         }
2901         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::chain::keysinterface::SpendableOutputDescriptor] {
2902                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
2903         }
2904 }
2905 impl From<Vec<crate::lightning::chain::keysinterface::SpendableOutputDescriptor>> for CVec_SpendableOutputDescriptorZ {
2906         fn from(v: Vec<crate::lightning::chain::keysinterface::SpendableOutputDescriptor>) -> Self {
2907                 let datalen = v.len();
2908                 let data = Box::into_raw(v.into_boxed_slice());
2909                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
2910         }
2911 }
2912 #[no_mangle]
2913 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
2914 pub extern "C" fn CVec_SpendableOutputDescriptorZ_free(_res: CVec_SpendableOutputDescriptorZ) { }
2915 impl Drop for CVec_SpendableOutputDescriptorZ {
2916         fn drop(&mut self) {
2917                 if self.datalen == 0 { return; }
2918                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
2919         }
2920 }
2921 impl Clone for CVec_SpendableOutputDescriptorZ {
2922         fn clone(&self) -> Self {
2923                 let mut res = Vec::new();
2924                 if self.datalen == 0 { return Self::from(res); }
2925                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
2926                 Self::from(res)
2927         }
2928 }
2929 #[repr(C)]
2930 /// A dynamically-allocated array of crate::lightning::util::events::MessageSendEvents of arbitrary size.
2931 /// This corresponds to std::vector in C++
2932 pub struct CVec_MessageSendEventZ {
2933         /// The elements in the array.
2934         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2935         pub data: *mut crate::lightning::util::events::MessageSendEvent,
2936         /// The number of elements pointed to by `data`.
2937         pub datalen: usize
2938 }
2939 impl CVec_MessageSendEventZ {
2940         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::util::events::MessageSendEvent> {
2941                 if self.datalen == 0 { return Vec::new(); }
2942                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
2943                 self.data = std::ptr::null_mut();
2944                 self.datalen = 0;
2945                 ret
2946         }
2947         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::util::events::MessageSendEvent] {
2948                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
2949         }
2950 }
2951 impl From<Vec<crate::lightning::util::events::MessageSendEvent>> for CVec_MessageSendEventZ {
2952         fn from(v: Vec<crate::lightning::util::events::MessageSendEvent>) -> Self {
2953                 let datalen = v.len();
2954                 let data = Box::into_raw(v.into_boxed_slice());
2955                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
2956         }
2957 }
2958 #[no_mangle]
2959 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
2960 pub extern "C" fn CVec_MessageSendEventZ_free(_res: CVec_MessageSendEventZ) { }
2961 impl Drop for CVec_MessageSendEventZ {
2962         fn drop(&mut self) {
2963                 if self.datalen == 0 { return; }
2964                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
2965         }
2966 }
2967 impl Clone for CVec_MessageSendEventZ {
2968         fn clone(&self) -> Self {
2969                 let mut res = Vec::new();
2970                 if self.datalen == 0 { return Self::from(res); }
2971                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
2972                 Self::from(res)
2973         }
2974 }
2975 #[repr(C)]
2976 /// The contents of CResult_InitFeaturesDecodeErrorZ
2977 pub union CResult_InitFeaturesDecodeErrorZPtr {
2978         /// A pointer to the contents in the success state.
2979         /// Reading from this pointer when `result_ok` is not set is undefined.
2980         pub result: *mut crate::lightning::ln::features::InitFeatures,
2981         /// A pointer to the contents in the error state.
2982         /// Reading from this pointer when `result_ok` is set is undefined.
2983         pub err: *mut crate::lightning::ln::msgs::DecodeError,
2984 }
2985 #[repr(C)]
2986 /// A CResult_InitFeaturesDecodeErrorZ represents the result of a fallible operation,
2987 /// containing a crate::lightning::ln::features::InitFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
2988 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2989 pub struct CResult_InitFeaturesDecodeErrorZ {
2990         /// The contents of this CResult_InitFeaturesDecodeErrorZ, accessible via either
2991         /// `err` or `result` depending on the state of `result_ok`.
2992         pub contents: CResult_InitFeaturesDecodeErrorZPtr,
2993         /// Whether this CResult_InitFeaturesDecodeErrorZ represents a success state.
2994         pub result_ok: bool,
2995 }
2996 #[no_mangle]
2997 /// Creates a new CResult_InitFeaturesDecodeErrorZ in the success state.
2998 pub extern "C" fn CResult_InitFeaturesDecodeErrorZ_ok(o: crate::lightning::ln::features::InitFeatures) -> CResult_InitFeaturesDecodeErrorZ {
2999         CResult_InitFeaturesDecodeErrorZ {
3000                 contents: CResult_InitFeaturesDecodeErrorZPtr {
3001                         result: Box::into_raw(Box::new(o)),
3002                 },
3003                 result_ok: true,
3004         }
3005 }
3006 #[no_mangle]
3007 /// Creates a new CResult_InitFeaturesDecodeErrorZ in the error state.
3008 pub extern "C" fn CResult_InitFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_InitFeaturesDecodeErrorZ {
3009         CResult_InitFeaturesDecodeErrorZ {
3010                 contents: CResult_InitFeaturesDecodeErrorZPtr {
3011                         err: Box::into_raw(Box::new(e)),
3012                 },
3013                 result_ok: false,
3014         }
3015 }
3016 #[no_mangle]
3017 /// Frees any resources used by the CResult_InitFeaturesDecodeErrorZ.
3018 pub extern "C" fn CResult_InitFeaturesDecodeErrorZ_free(_res: CResult_InitFeaturesDecodeErrorZ) { }
3019 impl Drop for CResult_InitFeaturesDecodeErrorZ {
3020         fn drop(&mut self) {
3021                 if self.result_ok {
3022                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
3023                                 let _ = unsafe { Box::from_raw(self.contents.result) };
3024                         }
3025                 } else {
3026                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
3027                                 let _ = unsafe { Box::from_raw(self.contents.err) };
3028                         }
3029                 }
3030         }
3031 }
3032 impl From<crate::c_types::CResultTempl<crate::lightning::ln::features::InitFeatures, crate::lightning::ln::msgs::DecodeError>> for CResult_InitFeaturesDecodeErrorZ {
3033         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::features::InitFeatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
3034                 let contents = if o.result_ok {
3035                         let result = unsafe { o.contents.result };
3036                         unsafe { o.contents.result = std::ptr::null_mut() };
3037                         CResult_InitFeaturesDecodeErrorZPtr { result }
3038                 } else {
3039                         let err = unsafe { o.contents.err };
3040                         unsafe { o.contents.err = std::ptr::null_mut(); }
3041                         CResult_InitFeaturesDecodeErrorZPtr { err }
3042                 };
3043                 Self {
3044                         contents,
3045                         result_ok: o.result_ok,
3046                 }
3047         }
3048 }
3049 #[repr(C)]
3050 /// The contents of CResult_NodeFeaturesDecodeErrorZ
3051 pub union CResult_NodeFeaturesDecodeErrorZPtr {
3052         /// A pointer to the contents in the success state.
3053         /// Reading from this pointer when `result_ok` is not set is undefined.
3054         pub result: *mut crate::lightning::ln::features::NodeFeatures,
3055         /// A pointer to the contents in the error state.
3056         /// Reading from this pointer when `result_ok` is set is undefined.
3057         pub err: *mut crate::lightning::ln::msgs::DecodeError,
3058 }
3059 #[repr(C)]
3060 /// A CResult_NodeFeaturesDecodeErrorZ represents the result of a fallible operation,
3061 /// containing a crate::lightning::ln::features::NodeFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
3062 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3063 pub struct CResult_NodeFeaturesDecodeErrorZ {
3064         /// The contents of this CResult_NodeFeaturesDecodeErrorZ, accessible via either
3065         /// `err` or `result` depending on the state of `result_ok`.
3066         pub contents: CResult_NodeFeaturesDecodeErrorZPtr,
3067         /// Whether this CResult_NodeFeaturesDecodeErrorZ represents a success state.
3068         pub result_ok: bool,
3069 }
3070 #[no_mangle]
3071 /// Creates a new CResult_NodeFeaturesDecodeErrorZ in the success state.
3072 pub extern "C" fn CResult_NodeFeaturesDecodeErrorZ_ok(o: crate::lightning::ln::features::NodeFeatures) -> CResult_NodeFeaturesDecodeErrorZ {
3073         CResult_NodeFeaturesDecodeErrorZ {
3074                 contents: CResult_NodeFeaturesDecodeErrorZPtr {
3075                         result: Box::into_raw(Box::new(o)),
3076                 },
3077                 result_ok: true,
3078         }
3079 }
3080 #[no_mangle]
3081 /// Creates a new CResult_NodeFeaturesDecodeErrorZ in the error state.
3082 pub extern "C" fn CResult_NodeFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeFeaturesDecodeErrorZ {
3083         CResult_NodeFeaturesDecodeErrorZ {
3084                 contents: CResult_NodeFeaturesDecodeErrorZPtr {
3085                         err: Box::into_raw(Box::new(e)),
3086                 },
3087                 result_ok: false,
3088         }
3089 }
3090 #[no_mangle]
3091 /// Frees any resources used by the CResult_NodeFeaturesDecodeErrorZ.
3092 pub extern "C" fn CResult_NodeFeaturesDecodeErrorZ_free(_res: CResult_NodeFeaturesDecodeErrorZ) { }
3093 impl Drop for CResult_NodeFeaturesDecodeErrorZ {
3094         fn drop(&mut self) {
3095                 if self.result_ok {
3096                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
3097                                 let _ = unsafe { Box::from_raw(self.contents.result) };
3098                         }
3099                 } else {
3100                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
3101                                 let _ = unsafe { Box::from_raw(self.contents.err) };
3102                         }
3103                 }
3104         }
3105 }
3106 impl From<crate::c_types::CResultTempl<crate::lightning::ln::features::NodeFeatures, crate::lightning::ln::msgs::DecodeError>> for CResult_NodeFeaturesDecodeErrorZ {
3107         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::features::NodeFeatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
3108                 let contents = if o.result_ok {
3109                         let result = unsafe { o.contents.result };
3110                         unsafe { o.contents.result = std::ptr::null_mut() };
3111                         CResult_NodeFeaturesDecodeErrorZPtr { result }
3112                 } else {
3113                         let err = unsafe { o.contents.err };
3114                         unsafe { o.contents.err = std::ptr::null_mut(); }
3115                         CResult_NodeFeaturesDecodeErrorZPtr { err }
3116                 };
3117                 Self {
3118                         contents,
3119                         result_ok: o.result_ok,
3120                 }
3121         }
3122 }
3123 #[repr(C)]
3124 /// The contents of CResult_ChannelFeaturesDecodeErrorZ
3125 pub union CResult_ChannelFeaturesDecodeErrorZPtr {
3126         /// A pointer to the contents in the success state.
3127         /// Reading from this pointer when `result_ok` is not set is undefined.
3128         pub result: *mut crate::lightning::ln::features::ChannelFeatures,
3129         /// A pointer to the contents in the error state.
3130         /// Reading from this pointer when `result_ok` is set is undefined.
3131         pub err: *mut crate::lightning::ln::msgs::DecodeError,
3132 }
3133 #[repr(C)]
3134 /// A CResult_ChannelFeaturesDecodeErrorZ represents the result of a fallible operation,
3135 /// containing a crate::lightning::ln::features::ChannelFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
3136 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3137 pub struct CResult_ChannelFeaturesDecodeErrorZ {
3138         /// The contents of this CResult_ChannelFeaturesDecodeErrorZ, accessible via either
3139         /// `err` or `result` depending on the state of `result_ok`.
3140         pub contents: CResult_ChannelFeaturesDecodeErrorZPtr,
3141         /// Whether this CResult_ChannelFeaturesDecodeErrorZ represents a success state.
3142         pub result_ok: bool,
3143 }
3144 #[no_mangle]
3145 /// Creates a new CResult_ChannelFeaturesDecodeErrorZ in the success state.
3146 pub extern "C" fn CResult_ChannelFeaturesDecodeErrorZ_ok(o: crate::lightning::ln::features::ChannelFeatures) -> CResult_ChannelFeaturesDecodeErrorZ {
3147         CResult_ChannelFeaturesDecodeErrorZ {
3148                 contents: CResult_ChannelFeaturesDecodeErrorZPtr {
3149                         result: Box::into_raw(Box::new(o)),
3150                 },
3151                 result_ok: true,
3152         }
3153 }
3154 #[no_mangle]
3155 /// Creates a new CResult_ChannelFeaturesDecodeErrorZ in the error state.
3156 pub extern "C" fn CResult_ChannelFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelFeaturesDecodeErrorZ {
3157         CResult_ChannelFeaturesDecodeErrorZ {
3158                 contents: CResult_ChannelFeaturesDecodeErrorZPtr {
3159                         err: Box::into_raw(Box::new(e)),
3160                 },
3161                 result_ok: false,
3162         }
3163 }
3164 #[no_mangle]
3165 /// Frees any resources used by the CResult_ChannelFeaturesDecodeErrorZ.
3166 pub extern "C" fn CResult_ChannelFeaturesDecodeErrorZ_free(_res: CResult_ChannelFeaturesDecodeErrorZ) { }
3167 impl Drop for CResult_ChannelFeaturesDecodeErrorZ {
3168         fn drop(&mut self) {
3169                 if self.result_ok {
3170                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
3171                                 let _ = unsafe { Box::from_raw(self.contents.result) };
3172                         }
3173                 } else {
3174                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
3175                                 let _ = unsafe { Box::from_raw(self.contents.err) };
3176                         }
3177                 }
3178         }
3179 }
3180 impl From<crate::c_types::CResultTempl<crate::lightning::ln::features::ChannelFeatures, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelFeaturesDecodeErrorZ {
3181         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::features::ChannelFeatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
3182                 let contents = if o.result_ok {
3183                         let result = unsafe { o.contents.result };
3184                         unsafe { o.contents.result = std::ptr::null_mut() };
3185                         CResult_ChannelFeaturesDecodeErrorZPtr { result }
3186                 } else {
3187                         let err = unsafe { o.contents.err };
3188                         unsafe { o.contents.err = std::ptr::null_mut(); }
3189                         CResult_ChannelFeaturesDecodeErrorZPtr { err }
3190                 };
3191                 Self {
3192                         contents,
3193                         result_ok: o.result_ok,
3194                 }
3195         }
3196 }
3197 #[repr(C)]
3198 /// The contents of CResult_InvoiceFeaturesDecodeErrorZ
3199 pub union CResult_InvoiceFeaturesDecodeErrorZPtr {
3200         /// A pointer to the contents in the success state.
3201         /// Reading from this pointer when `result_ok` is not set is undefined.
3202         pub result: *mut crate::lightning::ln::features::InvoiceFeatures,
3203         /// A pointer to the contents in the error state.
3204         /// Reading from this pointer when `result_ok` is set is undefined.
3205         pub err: *mut crate::lightning::ln::msgs::DecodeError,
3206 }
3207 #[repr(C)]
3208 /// A CResult_InvoiceFeaturesDecodeErrorZ represents the result of a fallible operation,
3209 /// containing a crate::lightning::ln::features::InvoiceFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
3210 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3211 pub struct CResult_InvoiceFeaturesDecodeErrorZ {
3212         /// The contents of this CResult_InvoiceFeaturesDecodeErrorZ, accessible via either
3213         /// `err` or `result` depending on the state of `result_ok`.
3214         pub contents: CResult_InvoiceFeaturesDecodeErrorZPtr,
3215         /// Whether this CResult_InvoiceFeaturesDecodeErrorZ represents a success state.
3216         pub result_ok: bool,
3217 }
3218 #[no_mangle]
3219 /// Creates a new CResult_InvoiceFeaturesDecodeErrorZ in the success state.
3220 pub extern "C" fn CResult_InvoiceFeaturesDecodeErrorZ_ok(o: crate::lightning::ln::features::InvoiceFeatures) -> CResult_InvoiceFeaturesDecodeErrorZ {
3221         CResult_InvoiceFeaturesDecodeErrorZ {
3222                 contents: CResult_InvoiceFeaturesDecodeErrorZPtr {
3223                         result: Box::into_raw(Box::new(o)),
3224                 },
3225                 result_ok: true,
3226         }
3227 }
3228 #[no_mangle]
3229 /// Creates a new CResult_InvoiceFeaturesDecodeErrorZ in the error state.
3230 pub extern "C" fn CResult_InvoiceFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_InvoiceFeaturesDecodeErrorZ {
3231         CResult_InvoiceFeaturesDecodeErrorZ {
3232                 contents: CResult_InvoiceFeaturesDecodeErrorZPtr {
3233                         err: Box::into_raw(Box::new(e)),
3234                 },
3235                 result_ok: false,
3236         }
3237 }
3238 #[no_mangle]
3239 /// Frees any resources used by the CResult_InvoiceFeaturesDecodeErrorZ.
3240 pub extern "C" fn CResult_InvoiceFeaturesDecodeErrorZ_free(_res: CResult_InvoiceFeaturesDecodeErrorZ) { }
3241 impl Drop for CResult_InvoiceFeaturesDecodeErrorZ {
3242         fn drop(&mut self) {
3243                 if self.result_ok {
3244                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
3245                                 let _ = unsafe { Box::from_raw(self.contents.result) };
3246                         }
3247                 } else {
3248                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
3249                                 let _ = unsafe { Box::from_raw(self.contents.err) };
3250                         }
3251                 }
3252         }
3253 }
3254 impl From<crate::c_types::CResultTempl<crate::lightning::ln::features::InvoiceFeatures, crate::lightning::ln::msgs::DecodeError>> for CResult_InvoiceFeaturesDecodeErrorZ {
3255         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::features::InvoiceFeatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
3256                 let contents = if o.result_ok {
3257                         let result = unsafe { o.contents.result };
3258                         unsafe { o.contents.result = std::ptr::null_mut() };
3259                         CResult_InvoiceFeaturesDecodeErrorZPtr { result }
3260                 } else {
3261                         let err = unsafe { o.contents.err };
3262                         unsafe { o.contents.err = std::ptr::null_mut(); }
3263                         CResult_InvoiceFeaturesDecodeErrorZPtr { err }
3264                 };
3265                 Self {
3266                         contents,
3267                         result_ok: o.result_ok,
3268                 }
3269         }
3270 }
3271 #[repr(C)]
3272 /// The contents of CResult_ScoringParametersDecodeErrorZ
3273 pub union CResult_ScoringParametersDecodeErrorZPtr {
3274         /// A pointer to the contents in the success state.
3275         /// Reading from this pointer when `result_ok` is not set is undefined.
3276         pub result: *mut crate::lightning::routing::scorer::ScoringParameters,
3277         /// A pointer to the contents in the error state.
3278         /// Reading from this pointer when `result_ok` is set is undefined.
3279         pub err: *mut crate::lightning::ln::msgs::DecodeError,
3280 }
3281 #[repr(C)]
3282 /// A CResult_ScoringParametersDecodeErrorZ represents the result of a fallible operation,
3283 /// containing a crate::lightning::routing::scorer::ScoringParameters on success and a crate::lightning::ln::msgs::DecodeError on failure.
3284 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3285 pub struct CResult_ScoringParametersDecodeErrorZ {
3286         /// The contents of this CResult_ScoringParametersDecodeErrorZ, accessible via either
3287         /// `err` or `result` depending on the state of `result_ok`.
3288         pub contents: CResult_ScoringParametersDecodeErrorZPtr,
3289         /// Whether this CResult_ScoringParametersDecodeErrorZ represents a success state.
3290         pub result_ok: bool,
3291 }
3292 #[no_mangle]
3293 /// Creates a new CResult_ScoringParametersDecodeErrorZ in the success state.
3294 pub extern "C" fn CResult_ScoringParametersDecodeErrorZ_ok(o: crate::lightning::routing::scorer::ScoringParameters) -> CResult_ScoringParametersDecodeErrorZ {
3295         CResult_ScoringParametersDecodeErrorZ {
3296                 contents: CResult_ScoringParametersDecodeErrorZPtr {
3297                         result: Box::into_raw(Box::new(o)),
3298                 },
3299                 result_ok: true,
3300         }
3301 }
3302 #[no_mangle]
3303 /// Creates a new CResult_ScoringParametersDecodeErrorZ in the error state.
3304 pub extern "C" fn CResult_ScoringParametersDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ScoringParametersDecodeErrorZ {
3305         CResult_ScoringParametersDecodeErrorZ {
3306                 contents: CResult_ScoringParametersDecodeErrorZPtr {
3307                         err: Box::into_raw(Box::new(e)),
3308                 },
3309                 result_ok: false,
3310         }
3311 }
3312 #[no_mangle]
3313 /// Frees any resources used by the CResult_ScoringParametersDecodeErrorZ.
3314 pub extern "C" fn CResult_ScoringParametersDecodeErrorZ_free(_res: CResult_ScoringParametersDecodeErrorZ) { }
3315 impl Drop for CResult_ScoringParametersDecodeErrorZ {
3316         fn drop(&mut self) {
3317                 if self.result_ok {
3318                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
3319                                 let _ = unsafe { Box::from_raw(self.contents.result) };
3320                         }
3321                 } else {
3322                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
3323                                 let _ = unsafe { Box::from_raw(self.contents.err) };
3324                         }
3325                 }
3326         }
3327 }
3328 impl From<crate::c_types::CResultTempl<crate::lightning::routing::scorer::ScoringParameters, crate::lightning::ln::msgs::DecodeError>> for CResult_ScoringParametersDecodeErrorZ {
3329         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::scorer::ScoringParameters, crate::lightning::ln::msgs::DecodeError>) -> Self {
3330                 let contents = if o.result_ok {
3331                         let result = unsafe { o.contents.result };
3332                         unsafe { o.contents.result = std::ptr::null_mut() };
3333                         CResult_ScoringParametersDecodeErrorZPtr { result }
3334                 } else {
3335                         let err = unsafe { o.contents.err };
3336                         unsafe { o.contents.err = std::ptr::null_mut(); }
3337                         CResult_ScoringParametersDecodeErrorZPtr { err }
3338                 };
3339                 Self {
3340                         contents,
3341                         result_ok: o.result_ok,
3342                 }
3343         }
3344 }
3345 #[repr(C)]
3346 /// The contents of CResult_ScorerDecodeErrorZ
3347 pub union CResult_ScorerDecodeErrorZPtr {
3348         /// A pointer to the contents in the success state.
3349         /// Reading from this pointer when `result_ok` is not set is undefined.
3350         pub result: *mut crate::lightning::routing::scorer::Scorer,
3351         /// A pointer to the contents in the error state.
3352         /// Reading from this pointer when `result_ok` is set is undefined.
3353         pub err: *mut crate::lightning::ln::msgs::DecodeError,
3354 }
3355 #[repr(C)]
3356 /// A CResult_ScorerDecodeErrorZ represents the result of a fallible operation,
3357 /// containing a crate::lightning::routing::scorer::Scorer on success and a crate::lightning::ln::msgs::DecodeError on failure.
3358 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3359 pub struct CResult_ScorerDecodeErrorZ {
3360         /// The contents of this CResult_ScorerDecodeErrorZ, accessible via either
3361         /// `err` or `result` depending on the state of `result_ok`.
3362         pub contents: CResult_ScorerDecodeErrorZPtr,
3363         /// Whether this CResult_ScorerDecodeErrorZ represents a success state.
3364         pub result_ok: bool,
3365 }
3366 #[no_mangle]
3367 /// Creates a new CResult_ScorerDecodeErrorZ in the success state.
3368 pub extern "C" fn CResult_ScorerDecodeErrorZ_ok(o: crate::lightning::routing::scorer::Scorer) -> CResult_ScorerDecodeErrorZ {
3369         CResult_ScorerDecodeErrorZ {
3370                 contents: CResult_ScorerDecodeErrorZPtr {
3371                         result: Box::into_raw(Box::new(o)),
3372                 },
3373                 result_ok: true,
3374         }
3375 }
3376 #[no_mangle]
3377 /// Creates a new CResult_ScorerDecodeErrorZ in the error state.
3378 pub extern "C" fn CResult_ScorerDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ScorerDecodeErrorZ {
3379         CResult_ScorerDecodeErrorZ {
3380                 contents: CResult_ScorerDecodeErrorZPtr {
3381                         err: Box::into_raw(Box::new(e)),
3382                 },
3383                 result_ok: false,
3384         }
3385 }
3386 #[no_mangle]
3387 /// Frees any resources used by the CResult_ScorerDecodeErrorZ.
3388 pub extern "C" fn CResult_ScorerDecodeErrorZ_free(_res: CResult_ScorerDecodeErrorZ) { }
3389 impl Drop for CResult_ScorerDecodeErrorZ {
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                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
3397                                 let _ = unsafe { Box::from_raw(self.contents.err) };
3398                         }
3399                 }
3400         }
3401 }
3402 impl From<crate::c_types::CResultTempl<crate::lightning::routing::scorer::Scorer, crate::lightning::ln::msgs::DecodeError>> for CResult_ScorerDecodeErrorZ {
3403         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::scorer::Scorer, crate::lightning::ln::msgs::DecodeError>) -> Self {
3404                 let contents = if o.result_ok {
3405                         let result = unsafe { o.contents.result };
3406                         unsafe { o.contents.result = std::ptr::null_mut() };
3407                         CResult_ScorerDecodeErrorZPtr { result }
3408                 } else {
3409                         let err = unsafe { o.contents.err };
3410                         unsafe { o.contents.err = std::ptr::null_mut(); }
3411                         CResult_ScorerDecodeErrorZPtr { err }
3412                 };
3413                 Self {
3414                         contents,
3415                         result_ok: o.result_ok,
3416                 }
3417         }
3418 }
3419 #[repr(C)]
3420 /// The contents of CResult_DelayedPaymentOutputDescriptorDecodeErrorZ
3421 pub union CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr {
3422         /// A pointer to the contents in the success state.
3423         /// Reading from this pointer when `result_ok` is not set is undefined.
3424         pub result: *mut crate::lightning::chain::keysinterface::DelayedPaymentOutputDescriptor,
3425         /// A pointer to the contents in the error state.
3426         /// Reading from this pointer when `result_ok` is set is undefined.
3427         pub err: *mut crate::lightning::ln::msgs::DecodeError,
3428 }
3429 #[repr(C)]
3430 /// A CResult_DelayedPaymentOutputDescriptorDecodeErrorZ represents the result of a fallible operation,
3431 /// containing a crate::lightning::chain::keysinterface::DelayedPaymentOutputDescriptor on success and a crate::lightning::ln::msgs::DecodeError on failure.
3432 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3433 pub struct CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
3434         /// The contents of this CResult_DelayedPaymentOutputDescriptorDecodeErrorZ, accessible via either
3435         /// `err` or `result` depending on the state of `result_ok`.
3436         pub contents: CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr,
3437         /// Whether this CResult_DelayedPaymentOutputDescriptorDecodeErrorZ represents a success state.
3438         pub result_ok: bool,
3439 }
3440 #[no_mangle]
3441 /// Creates a new CResult_DelayedPaymentOutputDescriptorDecodeErrorZ in the success state.
3442 pub extern "C" fn CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_ok(o: crate::lightning::chain::keysinterface::DelayedPaymentOutputDescriptor) -> CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
3443         CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
3444                 contents: CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr {
3445                         result: Box::into_raw(Box::new(o)),
3446                 },
3447                 result_ok: true,
3448         }
3449 }
3450 #[no_mangle]
3451 /// Creates a new CResult_DelayedPaymentOutputDescriptorDecodeErrorZ in the error state.
3452 pub extern "C" fn CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
3453         CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
3454                 contents: CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr {
3455                         err: Box::into_raw(Box::new(e)),
3456                 },
3457                 result_ok: false,
3458         }
3459 }
3460 #[no_mangle]
3461 /// Frees any resources used by the CResult_DelayedPaymentOutputDescriptorDecodeErrorZ.
3462 pub extern "C" fn CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_free(_res: CResult_DelayedPaymentOutputDescriptorDecodeErrorZ) { }
3463 impl Drop for CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
3464         fn drop(&mut self) {
3465                 if self.result_ok {
3466                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
3467                                 let _ = unsafe { Box::from_raw(self.contents.result) };
3468                         }
3469                 } else {
3470                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
3471                                 let _ = unsafe { Box::from_raw(self.contents.err) };
3472                         }
3473                 }
3474         }
3475 }
3476 impl From<crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::DelayedPaymentOutputDescriptor, crate::lightning::ln::msgs::DecodeError>> for CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
3477         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::DelayedPaymentOutputDescriptor, crate::lightning::ln::msgs::DecodeError>) -> Self {
3478                 let contents = if o.result_ok {
3479                         let result = unsafe { o.contents.result };
3480                         unsafe { o.contents.result = std::ptr::null_mut() };
3481                         CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr { result }
3482                 } else {
3483                         let err = unsafe { o.contents.err };
3484                         unsafe { o.contents.err = std::ptr::null_mut(); }
3485                         CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr { err }
3486                 };
3487                 Self {
3488                         contents,
3489                         result_ok: o.result_ok,
3490                 }
3491         }
3492 }
3493 impl Clone for CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
3494         fn clone(&self) -> Self {
3495                 if self.result_ok {
3496                         Self { result_ok: true, contents: CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr {
3497                                 result: Box::into_raw(Box::new(<crate::lightning::chain::keysinterface::DelayedPaymentOutputDescriptor>::clone(unsafe { &*self.contents.result })))
3498                         } }
3499                 } else {
3500                         Self { result_ok: false, contents: CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr {
3501                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
3502                         } }
3503                 }
3504         }
3505 }
3506 #[no_mangle]
3507 /// Creates a new CResult_DelayedPaymentOutputDescriptorDecodeErrorZ which has the same data as `orig`
3508 /// but with all dynamically-allocated buffers duplicated in new buffers.
3509 pub extern "C" fn CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone(orig: &CResult_DelayedPaymentOutputDescriptorDecodeErrorZ) -> CResult_DelayedPaymentOutputDescriptorDecodeErrorZ { Clone::clone(&orig) }
3510 #[repr(C)]
3511 /// The contents of CResult_StaticPaymentOutputDescriptorDecodeErrorZ
3512 pub union CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr {
3513         /// A pointer to the contents in the success state.
3514         /// Reading from this pointer when `result_ok` is not set is undefined.
3515         pub result: *mut crate::lightning::chain::keysinterface::StaticPaymentOutputDescriptor,
3516         /// A pointer to the contents in the error state.
3517         /// Reading from this pointer when `result_ok` is set is undefined.
3518         pub err: *mut crate::lightning::ln::msgs::DecodeError,
3519 }
3520 #[repr(C)]
3521 /// A CResult_StaticPaymentOutputDescriptorDecodeErrorZ represents the result of a fallible operation,
3522 /// containing a crate::lightning::chain::keysinterface::StaticPaymentOutputDescriptor on success and a crate::lightning::ln::msgs::DecodeError on failure.
3523 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3524 pub struct CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
3525         /// The contents of this CResult_StaticPaymentOutputDescriptorDecodeErrorZ, accessible via either
3526         /// `err` or `result` depending on the state of `result_ok`.
3527         pub contents: CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr,
3528         /// Whether this CResult_StaticPaymentOutputDescriptorDecodeErrorZ represents a success state.
3529         pub result_ok: bool,
3530 }
3531 #[no_mangle]
3532 /// Creates a new CResult_StaticPaymentOutputDescriptorDecodeErrorZ in the success state.
3533 pub extern "C" fn CResult_StaticPaymentOutputDescriptorDecodeErrorZ_ok(o: crate::lightning::chain::keysinterface::StaticPaymentOutputDescriptor) -> CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
3534         CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
3535                 contents: CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr {
3536                         result: Box::into_raw(Box::new(o)),
3537                 },
3538                 result_ok: true,
3539         }
3540 }
3541 #[no_mangle]
3542 /// Creates a new CResult_StaticPaymentOutputDescriptorDecodeErrorZ in the error state.
3543 pub extern "C" fn CResult_StaticPaymentOutputDescriptorDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
3544         CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
3545                 contents: CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr {
3546                         err: Box::into_raw(Box::new(e)),
3547                 },
3548                 result_ok: false,
3549         }
3550 }
3551 #[no_mangle]
3552 /// Frees any resources used by the CResult_StaticPaymentOutputDescriptorDecodeErrorZ.
3553 pub extern "C" fn CResult_StaticPaymentOutputDescriptorDecodeErrorZ_free(_res: CResult_StaticPaymentOutputDescriptorDecodeErrorZ) { }
3554 impl Drop for CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
3555         fn drop(&mut self) {
3556                 if self.result_ok {
3557                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
3558                                 let _ = unsafe { Box::from_raw(self.contents.result) };
3559                         }
3560                 } else {
3561                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
3562                                 let _ = unsafe { Box::from_raw(self.contents.err) };
3563                         }
3564                 }
3565         }
3566 }
3567 impl From<crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::StaticPaymentOutputDescriptor, crate::lightning::ln::msgs::DecodeError>> for CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
3568         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::StaticPaymentOutputDescriptor, crate::lightning::ln::msgs::DecodeError>) -> Self {
3569                 let contents = if o.result_ok {
3570                         let result = unsafe { o.contents.result };
3571                         unsafe { o.contents.result = std::ptr::null_mut() };
3572                         CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr { result }
3573                 } else {
3574                         let err = unsafe { o.contents.err };
3575                         unsafe { o.contents.err = std::ptr::null_mut(); }
3576                         CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr { err }
3577                 };
3578                 Self {
3579                         contents,
3580                         result_ok: o.result_ok,
3581                 }
3582         }
3583 }
3584 impl Clone for CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
3585         fn clone(&self) -> Self {
3586                 if self.result_ok {
3587                         Self { result_ok: true, contents: CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr {
3588                                 result: Box::into_raw(Box::new(<crate::lightning::chain::keysinterface::StaticPaymentOutputDescriptor>::clone(unsafe { &*self.contents.result })))
3589                         } }
3590                 } else {
3591                         Self { result_ok: false, contents: CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr {
3592                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
3593                         } }
3594                 }
3595         }
3596 }
3597 #[no_mangle]
3598 /// Creates a new CResult_StaticPaymentOutputDescriptorDecodeErrorZ which has the same data as `orig`
3599 /// but with all dynamically-allocated buffers duplicated in new buffers.
3600 pub extern "C" fn CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone(orig: &CResult_StaticPaymentOutputDescriptorDecodeErrorZ) -> CResult_StaticPaymentOutputDescriptorDecodeErrorZ { Clone::clone(&orig) }
3601 #[repr(C)]
3602 /// The contents of CResult_SpendableOutputDescriptorDecodeErrorZ
3603 pub union CResult_SpendableOutputDescriptorDecodeErrorZPtr {
3604         /// A pointer to the contents in the success state.
3605         /// Reading from this pointer when `result_ok` is not set is undefined.
3606         pub result: *mut crate::lightning::chain::keysinterface::SpendableOutputDescriptor,
3607         /// A pointer to the contents in the error state.
3608         /// Reading from this pointer when `result_ok` is set is undefined.
3609         pub err: *mut crate::lightning::ln::msgs::DecodeError,
3610 }
3611 #[repr(C)]
3612 /// A CResult_SpendableOutputDescriptorDecodeErrorZ represents the result of a fallible operation,
3613 /// containing a crate::lightning::chain::keysinterface::SpendableOutputDescriptor on success and a crate::lightning::ln::msgs::DecodeError on failure.
3614 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3615 pub struct CResult_SpendableOutputDescriptorDecodeErrorZ {
3616         /// The contents of this CResult_SpendableOutputDescriptorDecodeErrorZ, accessible via either
3617         /// `err` or `result` depending on the state of `result_ok`.
3618         pub contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr,
3619         /// Whether this CResult_SpendableOutputDescriptorDecodeErrorZ represents a success state.
3620         pub result_ok: bool,
3621 }
3622 #[no_mangle]
3623 /// Creates a new CResult_SpendableOutputDescriptorDecodeErrorZ in the success state.
3624 pub extern "C" fn CResult_SpendableOutputDescriptorDecodeErrorZ_ok(o: crate::lightning::chain::keysinterface::SpendableOutputDescriptor) -> CResult_SpendableOutputDescriptorDecodeErrorZ {
3625         CResult_SpendableOutputDescriptorDecodeErrorZ {
3626                 contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr {
3627                         result: Box::into_raw(Box::new(o)),
3628                 },
3629                 result_ok: true,
3630         }
3631 }
3632 #[no_mangle]
3633 /// Creates a new CResult_SpendableOutputDescriptorDecodeErrorZ in the error state.
3634 pub extern "C" fn CResult_SpendableOutputDescriptorDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_SpendableOutputDescriptorDecodeErrorZ {
3635         CResult_SpendableOutputDescriptorDecodeErrorZ {
3636                 contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr {
3637                         err: Box::into_raw(Box::new(e)),
3638                 },
3639                 result_ok: false,
3640         }
3641 }
3642 #[no_mangle]
3643 /// Frees any resources used by the CResult_SpendableOutputDescriptorDecodeErrorZ.
3644 pub extern "C" fn CResult_SpendableOutputDescriptorDecodeErrorZ_free(_res: CResult_SpendableOutputDescriptorDecodeErrorZ) { }
3645 impl Drop for CResult_SpendableOutputDescriptorDecodeErrorZ {
3646         fn drop(&mut self) {
3647                 if self.result_ok {
3648                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
3649                                 let _ = unsafe { Box::from_raw(self.contents.result) };
3650                         }
3651                 } else {
3652                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
3653                                 let _ = unsafe { Box::from_raw(self.contents.err) };
3654                         }
3655                 }
3656         }
3657 }
3658 impl From<crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::SpendableOutputDescriptor, crate::lightning::ln::msgs::DecodeError>> for CResult_SpendableOutputDescriptorDecodeErrorZ {
3659         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::SpendableOutputDescriptor, crate::lightning::ln::msgs::DecodeError>) -> Self {
3660                 let contents = if o.result_ok {
3661                         let result = unsafe { o.contents.result };
3662                         unsafe { o.contents.result = std::ptr::null_mut() };
3663                         CResult_SpendableOutputDescriptorDecodeErrorZPtr { result }
3664                 } else {
3665                         let err = unsafe { o.contents.err };
3666                         unsafe { o.contents.err = std::ptr::null_mut(); }
3667                         CResult_SpendableOutputDescriptorDecodeErrorZPtr { err }
3668                 };
3669                 Self {
3670                         contents,
3671                         result_ok: o.result_ok,
3672                 }
3673         }
3674 }
3675 impl Clone for CResult_SpendableOutputDescriptorDecodeErrorZ {
3676         fn clone(&self) -> Self {
3677                 if self.result_ok {
3678                         Self { result_ok: true, contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr {
3679                                 result: Box::into_raw(Box::new(<crate::lightning::chain::keysinterface::SpendableOutputDescriptor>::clone(unsafe { &*self.contents.result })))
3680                         } }
3681                 } else {
3682                         Self { result_ok: false, contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr {
3683                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
3684                         } }
3685                 }
3686         }
3687 }
3688 #[no_mangle]
3689 /// Creates a new CResult_SpendableOutputDescriptorDecodeErrorZ which has the same data as `orig`
3690 /// but with all dynamically-allocated buffers duplicated in new buffers.
3691 pub extern "C" fn CResult_SpendableOutputDescriptorDecodeErrorZ_clone(orig: &CResult_SpendableOutputDescriptorDecodeErrorZ) -> CResult_SpendableOutputDescriptorDecodeErrorZ { Clone::clone(&orig) }
3692 #[repr(C)]
3693 /// The contents of CResult_NoneNoneZ
3694 pub union CResult_NoneNoneZPtr {
3695         /// Note that this value is always NULL, as there are no contents in the OK variant
3696         pub result: *mut std::ffi::c_void,
3697         /// Note that this value is always NULL, as there are no contents in the Err variant
3698         pub err: *mut std::ffi::c_void,
3699 }
3700 #[repr(C)]
3701 /// A CResult_NoneNoneZ represents the result of a fallible operation,
3702 /// containing a () on success and a () on failure.
3703 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3704 pub struct CResult_NoneNoneZ {
3705         /// The contents of this CResult_NoneNoneZ, accessible via either
3706         /// `err` or `result` depending on the state of `result_ok`.
3707         pub contents: CResult_NoneNoneZPtr,
3708         /// Whether this CResult_NoneNoneZ represents a success state.
3709         pub result_ok: bool,
3710 }
3711 #[no_mangle]
3712 /// Creates a new CResult_NoneNoneZ in the success state.
3713 pub extern "C" fn CResult_NoneNoneZ_ok() -> CResult_NoneNoneZ {
3714         CResult_NoneNoneZ {
3715                 contents: CResult_NoneNoneZPtr {
3716                         result: std::ptr::null_mut(),
3717                 },
3718                 result_ok: true,
3719         }
3720 }
3721 #[no_mangle]
3722 /// Creates a new CResult_NoneNoneZ in the error state.
3723 pub extern "C" fn CResult_NoneNoneZ_err() -> CResult_NoneNoneZ {
3724         CResult_NoneNoneZ {
3725                 contents: CResult_NoneNoneZPtr {
3726                         err: std::ptr::null_mut(),
3727                 },
3728                 result_ok: false,
3729         }
3730 }
3731 #[no_mangle]
3732 /// Frees any resources used by the CResult_NoneNoneZ.
3733 pub extern "C" fn CResult_NoneNoneZ_free(_res: CResult_NoneNoneZ) { }
3734 impl Drop for CResult_NoneNoneZ {
3735         fn drop(&mut self) {
3736                 if self.result_ok {
3737                 } else {
3738                 }
3739         }
3740 }
3741 impl From<crate::c_types::CResultTempl<(), ()>> for CResult_NoneNoneZ {
3742         fn from(mut o: crate::c_types::CResultTempl<(), ()>) -> Self {
3743                 let contents = if o.result_ok {
3744                         let _ = unsafe { Box::from_raw(o.contents.result) };
3745                         o.contents.result = std::ptr::null_mut();
3746                         CResult_NoneNoneZPtr { result: std::ptr::null_mut() }
3747                 } else {
3748                         let _ = unsafe { Box::from_raw(o.contents.err) };
3749                         o.contents.err = std::ptr::null_mut();
3750                         CResult_NoneNoneZPtr { err: std::ptr::null_mut() }
3751                 };
3752                 Self {
3753                         contents,
3754                         result_ok: o.result_ok,
3755                 }
3756         }
3757 }
3758 impl Clone for CResult_NoneNoneZ {
3759         fn clone(&self) -> Self {
3760                 if self.result_ok {
3761                         Self { result_ok: true, contents: CResult_NoneNoneZPtr {
3762                                 result: std::ptr::null_mut()
3763                         } }
3764                 } else {
3765                         Self { result_ok: false, contents: CResult_NoneNoneZPtr {
3766                                 err: std::ptr::null_mut()
3767                         } }
3768                 }
3769         }
3770 }
3771 #[no_mangle]
3772 /// Creates a new CResult_NoneNoneZ which has the same data as `orig`
3773 /// but with all dynamically-allocated buffers duplicated in new buffers.
3774 pub extern "C" fn CResult_NoneNoneZ_clone(orig: &CResult_NoneNoneZ) -> CResult_NoneNoneZ { Clone::clone(&orig) }
3775 #[repr(C)]
3776 /// A tuple of 2 elements. See the individual fields for the types contained.
3777 pub struct C2Tuple_SignatureCVec_SignatureZZ {
3778         /// The element at position 0
3779         pub a: crate::c_types::Signature,
3780         /// The element at position 1
3781         pub b: crate::c_types::derived::CVec_SignatureZ,
3782 }
3783 impl From<(crate::c_types::Signature, crate::c_types::derived::CVec_SignatureZ)> for C2Tuple_SignatureCVec_SignatureZZ {
3784         fn from (tup: (crate::c_types::Signature, crate::c_types::derived::CVec_SignatureZ)) -> Self {
3785                 Self {
3786                         a: tup.0,
3787                         b: tup.1,
3788                 }
3789         }
3790 }
3791 impl C2Tuple_SignatureCVec_SignatureZZ {
3792         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::Signature, crate::c_types::derived::CVec_SignatureZ) {
3793                 (self.a, self.b)
3794         }
3795 }
3796 impl Clone for C2Tuple_SignatureCVec_SignatureZZ {
3797         fn clone(&self) -> Self {
3798                 Self {
3799                         a: Clone::clone(&self.a),
3800                         b: Clone::clone(&self.b),
3801                 }
3802         }
3803 }
3804 #[no_mangle]
3805 /// Creates a new tuple which has the same data as `orig`
3806 /// but with all dynamically-allocated buffers duplicated in new buffers.
3807 pub extern "C" fn C2Tuple_SignatureCVec_SignatureZZ_clone(orig: &C2Tuple_SignatureCVec_SignatureZZ) -> C2Tuple_SignatureCVec_SignatureZZ { Clone::clone(&orig) }
3808 /// Creates a new C2Tuple_SignatureCVec_SignatureZZ from the contained elements.
3809 #[no_mangle]
3810 pub extern "C" fn C2Tuple_SignatureCVec_SignatureZZ_new(a: crate::c_types::Signature, b: crate::c_types::derived::CVec_SignatureZ) -> C2Tuple_SignatureCVec_SignatureZZ {
3811         C2Tuple_SignatureCVec_SignatureZZ { a, b, }
3812 }
3813
3814 #[no_mangle]
3815 /// Frees any resources used by the C2Tuple_SignatureCVec_SignatureZZ.
3816 pub extern "C" fn C2Tuple_SignatureCVec_SignatureZZ_free(_res: C2Tuple_SignatureCVec_SignatureZZ) { }
3817 #[repr(C)]
3818 /// The contents of CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ
3819 pub union CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
3820         /// A pointer to the contents in the success state.
3821         /// Reading from this pointer when `result_ok` is not set is undefined.
3822         pub result: *mut crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ,
3823         /// Note that this value is always NULL, as there are no contents in the Err variant
3824         pub err: *mut std::ffi::c_void,
3825 }
3826 #[repr(C)]
3827 /// A CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ represents the result of a fallible operation,
3828 /// containing a crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ on success and a () on failure.
3829 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3830 pub struct CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
3831         /// The contents of this CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ, accessible via either
3832         /// `err` or `result` depending on the state of `result_ok`.
3833         pub contents: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr,
3834         /// Whether this CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ represents a success state.
3835         pub result_ok: bool,
3836 }
3837 #[no_mangle]
3838 /// Creates a new CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ in the success state.
3839 pub extern "C" fn CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_ok(o: crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ) -> CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
3840         CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
3841                 contents: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
3842                         result: Box::into_raw(Box::new(o)),
3843                 },
3844                 result_ok: true,
3845         }
3846 }
3847 #[no_mangle]
3848 /// Creates a new CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ in the error state.
3849 pub extern "C" fn CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_err() -> CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
3850         CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
3851                 contents: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
3852                         err: std::ptr::null_mut(),
3853                 },
3854                 result_ok: false,
3855         }
3856 }
3857 #[no_mangle]
3858 /// Frees any resources used by the CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ.
3859 pub extern "C" fn CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_free(_res: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ) { }
3860 impl Drop for CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
3861         fn drop(&mut self) {
3862                 if self.result_ok {
3863                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
3864                                 let _ = unsafe { Box::from_raw(self.contents.result) };
3865                         }
3866                 } else {
3867                 }
3868         }
3869 }
3870 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ, ()>> for CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
3871         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ, ()>) -> Self {
3872                 let contents = if o.result_ok {
3873                         let result = unsafe { o.contents.result };
3874                         unsafe { o.contents.result = std::ptr::null_mut() };
3875                         CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr { result }
3876                 } else {
3877                         let _ = unsafe { Box::from_raw(o.contents.err) };
3878                         o.contents.err = std::ptr::null_mut();
3879                         CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr { err: std::ptr::null_mut() }
3880                 };
3881                 Self {
3882                         contents,
3883                         result_ok: o.result_ok,
3884                 }
3885         }
3886 }
3887 impl Clone for CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
3888         fn clone(&self) -> Self {
3889                 if self.result_ok {
3890                         Self { result_ok: true, contents: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
3891                                 result: Box::into_raw(Box::new(<crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ>::clone(unsafe { &*self.contents.result })))
3892                         } }
3893                 } else {
3894                         Self { result_ok: false, contents: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
3895                                 err: std::ptr::null_mut()
3896                         } }
3897                 }
3898         }
3899 }
3900 #[no_mangle]
3901 /// Creates a new CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ which has the same data as `orig`
3902 /// but with all dynamically-allocated buffers duplicated in new buffers.
3903 pub extern "C" fn CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone(orig: &CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ) -> CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ { Clone::clone(&orig) }
3904 #[repr(C)]
3905 /// The contents of CResult_SignatureNoneZ
3906 pub union CResult_SignatureNoneZPtr {
3907         /// A pointer to the contents in the success state.
3908         /// Reading from this pointer when `result_ok` is not set is undefined.
3909         pub result: *mut crate::c_types::Signature,
3910         /// Note that this value is always NULL, as there are no contents in the Err variant
3911         pub err: *mut std::ffi::c_void,
3912 }
3913 #[repr(C)]
3914 /// A CResult_SignatureNoneZ represents the result of a fallible operation,
3915 /// containing a crate::c_types::Signature on success and a () on failure.
3916 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3917 pub struct CResult_SignatureNoneZ {
3918         /// The contents of this CResult_SignatureNoneZ, accessible via either
3919         /// `err` or `result` depending on the state of `result_ok`.
3920         pub contents: CResult_SignatureNoneZPtr,
3921         /// Whether this CResult_SignatureNoneZ represents a success state.
3922         pub result_ok: bool,
3923 }
3924 #[no_mangle]
3925 /// Creates a new CResult_SignatureNoneZ in the success state.
3926 pub extern "C" fn CResult_SignatureNoneZ_ok(o: crate::c_types::Signature) -> CResult_SignatureNoneZ {
3927         CResult_SignatureNoneZ {
3928                 contents: CResult_SignatureNoneZPtr {
3929                         result: Box::into_raw(Box::new(o)),
3930                 },
3931                 result_ok: true,
3932         }
3933 }
3934 #[no_mangle]
3935 /// Creates a new CResult_SignatureNoneZ in the error state.
3936 pub extern "C" fn CResult_SignatureNoneZ_err() -> CResult_SignatureNoneZ {
3937         CResult_SignatureNoneZ {
3938                 contents: CResult_SignatureNoneZPtr {
3939                         err: std::ptr::null_mut(),
3940                 },
3941                 result_ok: false,
3942         }
3943 }
3944 #[no_mangle]
3945 /// Frees any resources used by the CResult_SignatureNoneZ.
3946 pub extern "C" fn CResult_SignatureNoneZ_free(_res: CResult_SignatureNoneZ) { }
3947 impl Drop for CResult_SignatureNoneZ {
3948         fn drop(&mut self) {
3949                 if self.result_ok {
3950                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
3951                                 let _ = unsafe { Box::from_raw(self.contents.result) };
3952                         }
3953                 } else {
3954                 }
3955         }
3956 }
3957 impl From<crate::c_types::CResultTempl<crate::c_types::Signature, ()>> for CResult_SignatureNoneZ {
3958         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::Signature, ()>) -> Self {
3959                 let contents = if o.result_ok {
3960                         let result = unsafe { o.contents.result };
3961                         unsafe { o.contents.result = std::ptr::null_mut() };
3962                         CResult_SignatureNoneZPtr { result }
3963                 } else {
3964                         let _ = unsafe { Box::from_raw(o.contents.err) };
3965                         o.contents.err = std::ptr::null_mut();
3966                         CResult_SignatureNoneZPtr { err: std::ptr::null_mut() }
3967                 };
3968                 Self {
3969                         contents,
3970                         result_ok: o.result_ok,
3971                 }
3972         }
3973 }
3974 impl Clone for CResult_SignatureNoneZ {
3975         fn clone(&self) -> Self {
3976                 if self.result_ok {
3977                         Self { result_ok: true, contents: CResult_SignatureNoneZPtr {
3978                                 result: Box::into_raw(Box::new(<crate::c_types::Signature>::clone(unsafe { &*self.contents.result })))
3979                         } }
3980                 } else {
3981                         Self { result_ok: false, contents: CResult_SignatureNoneZPtr {
3982                                 err: std::ptr::null_mut()
3983                         } }
3984                 }
3985         }
3986 }
3987 #[no_mangle]
3988 /// Creates a new CResult_SignatureNoneZ which has the same data as `orig`
3989 /// but with all dynamically-allocated buffers duplicated in new buffers.
3990 pub extern "C" fn CResult_SignatureNoneZ_clone(orig: &CResult_SignatureNoneZ) -> CResult_SignatureNoneZ { Clone::clone(&orig) }
3991 #[repr(C)]
3992 /// The contents of CResult_SignDecodeErrorZ
3993 pub union CResult_SignDecodeErrorZPtr {
3994         /// A pointer to the contents in the success state.
3995         /// Reading from this pointer when `result_ok` is not set is undefined.
3996         pub result: *mut crate::lightning::chain::keysinterface::Sign,
3997         /// A pointer to the contents in the error state.
3998         /// Reading from this pointer when `result_ok` is set is undefined.
3999         pub err: *mut crate::lightning::ln::msgs::DecodeError,
4000 }
4001 #[repr(C)]
4002 /// A CResult_SignDecodeErrorZ represents the result of a fallible operation,
4003 /// containing a crate::lightning::chain::keysinterface::Sign on success and a crate::lightning::ln::msgs::DecodeError on failure.
4004 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4005 pub struct CResult_SignDecodeErrorZ {
4006         /// The contents of this CResult_SignDecodeErrorZ, accessible via either
4007         /// `err` or `result` depending on the state of `result_ok`.
4008         pub contents: CResult_SignDecodeErrorZPtr,
4009         /// Whether this CResult_SignDecodeErrorZ represents a success state.
4010         pub result_ok: bool,
4011 }
4012 #[no_mangle]
4013 /// Creates a new CResult_SignDecodeErrorZ in the success state.
4014 pub extern "C" fn CResult_SignDecodeErrorZ_ok(o: crate::lightning::chain::keysinterface::Sign) -> CResult_SignDecodeErrorZ {
4015         CResult_SignDecodeErrorZ {
4016                 contents: CResult_SignDecodeErrorZPtr {
4017                         result: Box::into_raw(Box::new(o)),
4018                 },
4019                 result_ok: true,
4020         }
4021 }
4022 #[no_mangle]
4023 /// Creates a new CResult_SignDecodeErrorZ in the error state.
4024 pub extern "C" fn CResult_SignDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_SignDecodeErrorZ {
4025         CResult_SignDecodeErrorZ {
4026                 contents: CResult_SignDecodeErrorZPtr {
4027                         err: Box::into_raw(Box::new(e)),
4028                 },
4029                 result_ok: false,
4030         }
4031 }
4032 #[no_mangle]
4033 /// Frees any resources used by the CResult_SignDecodeErrorZ.
4034 pub extern "C" fn CResult_SignDecodeErrorZ_free(_res: CResult_SignDecodeErrorZ) { }
4035 impl Drop for CResult_SignDecodeErrorZ {
4036         fn drop(&mut self) {
4037                 if self.result_ok {
4038                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
4039                                 let _ = unsafe { Box::from_raw(self.contents.result) };
4040                         }
4041                 } else {
4042                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
4043                                 let _ = unsafe { Box::from_raw(self.contents.err) };
4044                         }
4045                 }
4046         }
4047 }
4048 impl From<crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::Sign, crate::lightning::ln::msgs::DecodeError>> for CResult_SignDecodeErrorZ {
4049         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::Sign, crate::lightning::ln::msgs::DecodeError>) -> Self {
4050                 let contents = if o.result_ok {
4051                         let result = unsafe { o.contents.result };
4052                         unsafe { o.contents.result = std::ptr::null_mut() };
4053                         CResult_SignDecodeErrorZPtr { result }
4054                 } else {
4055                         let err = unsafe { o.contents.err };
4056                         unsafe { o.contents.err = std::ptr::null_mut(); }
4057                         CResult_SignDecodeErrorZPtr { err }
4058                 };
4059                 Self {
4060                         contents,
4061                         result_ok: o.result_ok,
4062                 }
4063         }
4064 }
4065 impl Clone for CResult_SignDecodeErrorZ {
4066         fn clone(&self) -> Self {
4067                 if self.result_ok {
4068                         Self { result_ok: true, contents: CResult_SignDecodeErrorZPtr {
4069                                 result: Box::into_raw(Box::new(<crate::lightning::chain::keysinterface::Sign>::clone(unsafe { &*self.contents.result })))
4070                         } }
4071                 } else {
4072                         Self { result_ok: false, contents: CResult_SignDecodeErrorZPtr {
4073                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
4074                         } }
4075                 }
4076         }
4077 }
4078 #[no_mangle]
4079 /// Creates a new CResult_SignDecodeErrorZ which has the same data as `orig`
4080 /// but with all dynamically-allocated buffers duplicated in new buffers.
4081 pub extern "C" fn CResult_SignDecodeErrorZ_clone(orig: &CResult_SignDecodeErrorZ) -> CResult_SignDecodeErrorZ { Clone::clone(&orig) }
4082 #[repr(C)]
4083 /// A dynamically-allocated array of u8s of arbitrary size.
4084 /// This corresponds to std::vector in C++
4085 pub struct CVec_u8Z {
4086         /// The elements in the array.
4087         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4088         pub data: *mut u8,
4089         /// The number of elements pointed to by `data`.
4090         pub datalen: usize
4091 }
4092 impl CVec_u8Z {
4093         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<u8> {
4094                 if self.datalen == 0 { return Vec::new(); }
4095                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
4096                 self.data = std::ptr::null_mut();
4097                 self.datalen = 0;
4098                 ret
4099         }
4100         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[u8] {
4101                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
4102         }
4103 }
4104 impl From<Vec<u8>> for CVec_u8Z {
4105         fn from(v: Vec<u8>) -> Self {
4106                 let datalen = v.len();
4107                 let data = Box::into_raw(v.into_boxed_slice());
4108                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
4109         }
4110 }
4111 #[no_mangle]
4112 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
4113 pub extern "C" fn CVec_u8Z_free(_res: CVec_u8Z) { }
4114 impl Drop for CVec_u8Z {
4115         fn drop(&mut self) {
4116                 if self.datalen == 0 { return; }
4117                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
4118         }
4119 }
4120 impl Clone for CVec_u8Z {
4121         fn clone(&self) -> Self {
4122                 let mut res = Vec::new();
4123                 if self.datalen == 0 { return Self::from(res); }
4124                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
4125                 Self::from(res)
4126         }
4127 }
4128 #[repr(C)]
4129 /// The contents of CResult_RecoverableSignatureNoneZ
4130 pub union CResult_RecoverableSignatureNoneZPtr {
4131         /// A pointer to the contents in the success state.
4132         /// Reading from this pointer when `result_ok` is not set is undefined.
4133         pub result: *mut crate::c_types::RecoverableSignature,
4134         /// Note that this value is always NULL, as there are no contents in the Err variant
4135         pub err: *mut std::ffi::c_void,
4136 }
4137 #[repr(C)]
4138 /// A CResult_RecoverableSignatureNoneZ represents the result of a fallible operation,
4139 /// containing a crate::c_types::RecoverableSignature on success and a () on failure.
4140 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4141 pub struct CResult_RecoverableSignatureNoneZ {
4142         /// The contents of this CResult_RecoverableSignatureNoneZ, accessible via either
4143         /// `err` or `result` depending on the state of `result_ok`.
4144         pub contents: CResult_RecoverableSignatureNoneZPtr,
4145         /// Whether this CResult_RecoverableSignatureNoneZ represents a success state.
4146         pub result_ok: bool,
4147 }
4148 #[no_mangle]
4149 /// Creates a new CResult_RecoverableSignatureNoneZ in the success state.
4150 pub extern "C" fn CResult_RecoverableSignatureNoneZ_ok(o: crate::c_types::RecoverableSignature) -> CResult_RecoverableSignatureNoneZ {
4151         CResult_RecoverableSignatureNoneZ {
4152                 contents: CResult_RecoverableSignatureNoneZPtr {
4153                         result: Box::into_raw(Box::new(o)),
4154                 },
4155                 result_ok: true,
4156         }
4157 }
4158 #[no_mangle]
4159 /// Creates a new CResult_RecoverableSignatureNoneZ in the error state.
4160 pub extern "C" fn CResult_RecoverableSignatureNoneZ_err() -> CResult_RecoverableSignatureNoneZ {
4161         CResult_RecoverableSignatureNoneZ {
4162                 contents: CResult_RecoverableSignatureNoneZPtr {
4163                         err: std::ptr::null_mut(),
4164                 },
4165                 result_ok: false,
4166         }
4167 }
4168 #[no_mangle]
4169 /// Frees any resources used by the CResult_RecoverableSignatureNoneZ.
4170 pub extern "C" fn CResult_RecoverableSignatureNoneZ_free(_res: CResult_RecoverableSignatureNoneZ) { }
4171 impl Drop for CResult_RecoverableSignatureNoneZ {
4172         fn drop(&mut self) {
4173                 if self.result_ok {
4174                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
4175                                 let _ = unsafe { Box::from_raw(self.contents.result) };
4176                         }
4177                 } else {
4178                 }
4179         }
4180 }
4181 impl From<crate::c_types::CResultTempl<crate::c_types::RecoverableSignature, ()>> for CResult_RecoverableSignatureNoneZ {
4182         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::RecoverableSignature, ()>) -> Self {
4183                 let contents = if o.result_ok {
4184                         let result = unsafe { o.contents.result };
4185                         unsafe { o.contents.result = std::ptr::null_mut() };
4186                         CResult_RecoverableSignatureNoneZPtr { result }
4187                 } else {
4188                         let _ = unsafe { Box::from_raw(o.contents.err) };
4189                         o.contents.err = std::ptr::null_mut();
4190                         CResult_RecoverableSignatureNoneZPtr { err: std::ptr::null_mut() }
4191                 };
4192                 Self {
4193                         contents,
4194                         result_ok: o.result_ok,
4195                 }
4196         }
4197 }
4198 impl Clone for CResult_RecoverableSignatureNoneZ {
4199         fn clone(&self) -> Self {
4200                 if self.result_ok {
4201                         Self { result_ok: true, contents: CResult_RecoverableSignatureNoneZPtr {
4202                                 result: Box::into_raw(Box::new(<crate::c_types::RecoverableSignature>::clone(unsafe { &*self.contents.result })))
4203                         } }
4204                 } else {
4205                         Self { result_ok: false, contents: CResult_RecoverableSignatureNoneZPtr {
4206                                 err: std::ptr::null_mut()
4207                         } }
4208                 }
4209         }
4210 }
4211 #[no_mangle]
4212 /// Creates a new CResult_RecoverableSignatureNoneZ which has the same data as `orig`
4213 /// but with all dynamically-allocated buffers duplicated in new buffers.
4214 pub extern "C" fn CResult_RecoverableSignatureNoneZ_clone(orig: &CResult_RecoverableSignatureNoneZ) -> CResult_RecoverableSignatureNoneZ { Clone::clone(&orig) }
4215 #[repr(C)]
4216 /// A dynamically-allocated array of crate::c_types::derived::CVec_u8Zs of arbitrary size.
4217 /// This corresponds to std::vector in C++
4218 pub struct CVec_CVec_u8ZZ {
4219         /// The elements in the array.
4220         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4221         pub data: *mut crate::c_types::derived::CVec_u8Z,
4222         /// The number of elements pointed to by `data`.
4223         pub datalen: usize
4224 }
4225 impl CVec_CVec_u8ZZ {
4226         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::CVec_u8Z> {
4227                 if self.datalen == 0 { return Vec::new(); }
4228                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
4229                 self.data = std::ptr::null_mut();
4230                 self.datalen = 0;
4231                 ret
4232         }
4233         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::CVec_u8Z] {
4234                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
4235         }
4236 }
4237 impl From<Vec<crate::c_types::derived::CVec_u8Z>> for CVec_CVec_u8ZZ {
4238         fn from(v: Vec<crate::c_types::derived::CVec_u8Z>) -> Self {
4239                 let datalen = v.len();
4240                 let data = Box::into_raw(v.into_boxed_slice());
4241                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
4242         }
4243 }
4244 #[no_mangle]
4245 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
4246 pub extern "C" fn CVec_CVec_u8ZZ_free(_res: CVec_CVec_u8ZZ) { }
4247 impl Drop for CVec_CVec_u8ZZ {
4248         fn drop(&mut self) {
4249                 if self.datalen == 0 { return; }
4250                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
4251         }
4252 }
4253 impl Clone for CVec_CVec_u8ZZ {
4254         fn clone(&self) -> Self {
4255                 let mut res = Vec::new();
4256                 if self.datalen == 0 { return Self::from(res); }
4257                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
4258                 Self::from(res)
4259         }
4260 }
4261 #[repr(C)]
4262 /// The contents of CResult_CVec_CVec_u8ZZNoneZ
4263 pub union CResult_CVec_CVec_u8ZZNoneZPtr {
4264         /// A pointer to the contents in the success state.
4265         /// Reading from this pointer when `result_ok` is not set is undefined.
4266         pub result: *mut crate::c_types::derived::CVec_CVec_u8ZZ,
4267         /// Note that this value is always NULL, as there are no contents in the Err variant
4268         pub err: *mut std::ffi::c_void,
4269 }
4270 #[repr(C)]
4271 /// A CResult_CVec_CVec_u8ZZNoneZ represents the result of a fallible operation,
4272 /// containing a crate::c_types::derived::CVec_CVec_u8ZZ on success and a () on failure.
4273 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4274 pub struct CResult_CVec_CVec_u8ZZNoneZ {
4275         /// The contents of this CResult_CVec_CVec_u8ZZNoneZ, accessible via either
4276         /// `err` or `result` depending on the state of `result_ok`.
4277         pub contents: CResult_CVec_CVec_u8ZZNoneZPtr,
4278         /// Whether this CResult_CVec_CVec_u8ZZNoneZ represents a success state.
4279         pub result_ok: bool,
4280 }
4281 #[no_mangle]
4282 /// Creates a new CResult_CVec_CVec_u8ZZNoneZ in the success state.
4283 pub extern "C" fn CResult_CVec_CVec_u8ZZNoneZ_ok(o: crate::c_types::derived::CVec_CVec_u8ZZ) -> CResult_CVec_CVec_u8ZZNoneZ {
4284         CResult_CVec_CVec_u8ZZNoneZ {
4285                 contents: CResult_CVec_CVec_u8ZZNoneZPtr {
4286                         result: Box::into_raw(Box::new(o)),
4287                 },
4288                 result_ok: true,
4289         }
4290 }
4291 #[no_mangle]
4292 /// Creates a new CResult_CVec_CVec_u8ZZNoneZ in the error state.
4293 pub extern "C" fn CResult_CVec_CVec_u8ZZNoneZ_err() -> CResult_CVec_CVec_u8ZZNoneZ {
4294         CResult_CVec_CVec_u8ZZNoneZ {
4295                 contents: CResult_CVec_CVec_u8ZZNoneZPtr {
4296                         err: std::ptr::null_mut(),
4297                 },
4298                 result_ok: false,
4299         }
4300 }
4301 #[no_mangle]
4302 /// Frees any resources used by the CResult_CVec_CVec_u8ZZNoneZ.
4303 pub extern "C" fn CResult_CVec_CVec_u8ZZNoneZ_free(_res: CResult_CVec_CVec_u8ZZNoneZ) { }
4304 impl Drop for CResult_CVec_CVec_u8ZZNoneZ {
4305         fn drop(&mut self) {
4306                 if self.result_ok {
4307                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
4308                                 let _ = unsafe { Box::from_raw(self.contents.result) };
4309                         }
4310                 } else {
4311                 }
4312         }
4313 }
4314 impl From<crate::c_types::CResultTempl<crate::c_types::derived::CVec_CVec_u8ZZ, ()>> for CResult_CVec_CVec_u8ZZNoneZ {
4315         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CVec_CVec_u8ZZ, ()>) -> Self {
4316                 let contents = if o.result_ok {
4317                         let result = unsafe { o.contents.result };
4318                         unsafe { o.contents.result = std::ptr::null_mut() };
4319                         CResult_CVec_CVec_u8ZZNoneZPtr { result }
4320                 } else {
4321                         let _ = unsafe { Box::from_raw(o.contents.err) };
4322                         o.contents.err = std::ptr::null_mut();
4323                         CResult_CVec_CVec_u8ZZNoneZPtr { err: std::ptr::null_mut() }
4324                 };
4325                 Self {
4326                         contents,
4327                         result_ok: o.result_ok,
4328                 }
4329         }
4330 }
4331 impl Clone for CResult_CVec_CVec_u8ZZNoneZ {
4332         fn clone(&self) -> Self {
4333                 if self.result_ok {
4334                         Self { result_ok: true, contents: CResult_CVec_CVec_u8ZZNoneZPtr {
4335                                 result: Box::into_raw(Box::new(<crate::c_types::derived::CVec_CVec_u8ZZ>::clone(unsafe { &*self.contents.result })))
4336                         } }
4337                 } else {
4338                         Self { result_ok: false, contents: CResult_CVec_CVec_u8ZZNoneZPtr {
4339                                 err: std::ptr::null_mut()
4340                         } }
4341                 }
4342         }
4343 }
4344 #[no_mangle]
4345 /// Creates a new CResult_CVec_CVec_u8ZZNoneZ which has the same data as `orig`
4346 /// but with all dynamically-allocated buffers duplicated in new buffers.
4347 pub extern "C" fn CResult_CVec_CVec_u8ZZNoneZ_clone(orig: &CResult_CVec_CVec_u8ZZNoneZ) -> CResult_CVec_CVec_u8ZZNoneZ { Clone::clone(&orig) }
4348 #[repr(C)]
4349 /// The contents of CResult_InMemorySignerDecodeErrorZ
4350 pub union CResult_InMemorySignerDecodeErrorZPtr {
4351         /// A pointer to the contents in the success state.
4352         /// Reading from this pointer when `result_ok` is not set is undefined.
4353         pub result: *mut crate::lightning::chain::keysinterface::InMemorySigner,
4354         /// A pointer to the contents in the error state.
4355         /// Reading from this pointer when `result_ok` is set is undefined.
4356         pub err: *mut crate::lightning::ln::msgs::DecodeError,
4357 }
4358 #[repr(C)]
4359 /// A CResult_InMemorySignerDecodeErrorZ represents the result of a fallible operation,
4360 /// containing a crate::lightning::chain::keysinterface::InMemorySigner on success and a crate::lightning::ln::msgs::DecodeError on failure.
4361 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4362 pub struct CResult_InMemorySignerDecodeErrorZ {
4363         /// The contents of this CResult_InMemorySignerDecodeErrorZ, accessible via either
4364         /// `err` or `result` depending on the state of `result_ok`.
4365         pub contents: CResult_InMemorySignerDecodeErrorZPtr,
4366         /// Whether this CResult_InMemorySignerDecodeErrorZ represents a success state.
4367         pub result_ok: bool,
4368 }
4369 #[no_mangle]
4370 /// Creates a new CResult_InMemorySignerDecodeErrorZ in the success state.
4371 pub extern "C" fn CResult_InMemorySignerDecodeErrorZ_ok(o: crate::lightning::chain::keysinterface::InMemorySigner) -> CResult_InMemorySignerDecodeErrorZ {
4372         CResult_InMemorySignerDecodeErrorZ {
4373                 contents: CResult_InMemorySignerDecodeErrorZPtr {
4374                         result: Box::into_raw(Box::new(o)),
4375                 },
4376                 result_ok: true,
4377         }
4378 }
4379 #[no_mangle]
4380 /// Creates a new CResult_InMemorySignerDecodeErrorZ in the error state.
4381 pub extern "C" fn CResult_InMemorySignerDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_InMemorySignerDecodeErrorZ {
4382         CResult_InMemorySignerDecodeErrorZ {
4383                 contents: CResult_InMemorySignerDecodeErrorZPtr {
4384                         err: Box::into_raw(Box::new(e)),
4385                 },
4386                 result_ok: false,
4387         }
4388 }
4389 #[no_mangle]
4390 /// Frees any resources used by the CResult_InMemorySignerDecodeErrorZ.
4391 pub extern "C" fn CResult_InMemorySignerDecodeErrorZ_free(_res: CResult_InMemorySignerDecodeErrorZ) { }
4392 impl Drop for CResult_InMemorySignerDecodeErrorZ {
4393         fn drop(&mut self) {
4394                 if self.result_ok {
4395                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
4396                                 let _ = unsafe { Box::from_raw(self.contents.result) };
4397                         }
4398                 } else {
4399                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
4400                                 let _ = unsafe { Box::from_raw(self.contents.err) };
4401                         }
4402                 }
4403         }
4404 }
4405 impl From<crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::InMemorySigner, crate::lightning::ln::msgs::DecodeError>> for CResult_InMemorySignerDecodeErrorZ {
4406         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::InMemorySigner, crate::lightning::ln::msgs::DecodeError>) -> Self {
4407                 let contents = if o.result_ok {
4408                         let result = unsafe { o.contents.result };
4409                         unsafe { o.contents.result = std::ptr::null_mut() };
4410                         CResult_InMemorySignerDecodeErrorZPtr { result }
4411                 } else {
4412                         let err = unsafe { o.contents.err };
4413                         unsafe { o.contents.err = std::ptr::null_mut(); }
4414                         CResult_InMemorySignerDecodeErrorZPtr { err }
4415                 };
4416                 Self {
4417                         contents,
4418                         result_ok: o.result_ok,
4419                 }
4420         }
4421 }
4422 impl Clone for CResult_InMemorySignerDecodeErrorZ {
4423         fn clone(&self) -> Self {
4424                 if self.result_ok {
4425                         Self { result_ok: true, contents: CResult_InMemorySignerDecodeErrorZPtr {
4426                                 result: Box::into_raw(Box::new(<crate::lightning::chain::keysinterface::InMemorySigner>::clone(unsafe { &*self.contents.result })))
4427                         } }
4428                 } else {
4429                         Self { result_ok: false, contents: CResult_InMemorySignerDecodeErrorZPtr {
4430                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
4431                         } }
4432                 }
4433         }
4434 }
4435 #[no_mangle]
4436 /// Creates a new CResult_InMemorySignerDecodeErrorZ which has the same data as `orig`
4437 /// but with all dynamically-allocated buffers duplicated in new buffers.
4438 pub extern "C" fn CResult_InMemorySignerDecodeErrorZ_clone(orig: &CResult_InMemorySignerDecodeErrorZ) -> CResult_InMemorySignerDecodeErrorZ { Clone::clone(&orig) }
4439 #[repr(C)]
4440 /// A dynamically-allocated array of crate::c_types::TxOuts of arbitrary size.
4441 /// This corresponds to std::vector in C++
4442 pub struct CVec_TxOutZ {
4443         /// The elements in the array.
4444         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4445         pub data: *mut crate::c_types::TxOut,
4446         /// The number of elements pointed to by `data`.
4447         pub datalen: usize
4448 }
4449 impl CVec_TxOutZ {
4450         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::TxOut> {
4451                 if self.datalen == 0 { return Vec::new(); }
4452                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
4453                 self.data = std::ptr::null_mut();
4454                 self.datalen = 0;
4455                 ret
4456         }
4457         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::TxOut] {
4458                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
4459         }
4460 }
4461 impl From<Vec<crate::c_types::TxOut>> for CVec_TxOutZ {
4462         fn from(v: Vec<crate::c_types::TxOut>) -> Self {
4463                 let datalen = v.len();
4464                 let data = Box::into_raw(v.into_boxed_slice());
4465                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
4466         }
4467 }
4468 #[no_mangle]
4469 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
4470 pub extern "C" fn CVec_TxOutZ_free(_res: CVec_TxOutZ) { }
4471 impl Drop for CVec_TxOutZ {
4472         fn drop(&mut self) {
4473                 if self.datalen == 0 { return; }
4474                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
4475         }
4476 }
4477 impl Clone for CVec_TxOutZ {
4478         fn clone(&self) -> Self {
4479                 let mut res = Vec::new();
4480                 if self.datalen == 0 { return Self::from(res); }
4481                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
4482                 Self::from(res)
4483         }
4484 }
4485 #[repr(C)]
4486 /// The contents of CResult_TransactionNoneZ
4487 pub union CResult_TransactionNoneZPtr {
4488         /// A pointer to the contents in the success state.
4489         /// Reading from this pointer when `result_ok` is not set is undefined.
4490         pub result: *mut crate::c_types::Transaction,
4491         /// Note that this value is always NULL, as there are no contents in the Err variant
4492         pub err: *mut std::ffi::c_void,
4493 }
4494 #[repr(C)]
4495 /// A CResult_TransactionNoneZ represents the result of a fallible operation,
4496 /// containing a crate::c_types::Transaction on success and a () on failure.
4497 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4498 pub struct CResult_TransactionNoneZ {
4499         /// The contents of this CResult_TransactionNoneZ, accessible via either
4500         /// `err` or `result` depending on the state of `result_ok`.
4501         pub contents: CResult_TransactionNoneZPtr,
4502         /// Whether this CResult_TransactionNoneZ represents a success state.
4503         pub result_ok: bool,
4504 }
4505 #[no_mangle]
4506 /// Creates a new CResult_TransactionNoneZ in the success state.
4507 pub extern "C" fn CResult_TransactionNoneZ_ok(o: crate::c_types::Transaction) -> CResult_TransactionNoneZ {
4508         CResult_TransactionNoneZ {
4509                 contents: CResult_TransactionNoneZPtr {
4510                         result: Box::into_raw(Box::new(o)),
4511                 },
4512                 result_ok: true,
4513         }
4514 }
4515 #[no_mangle]
4516 /// Creates a new CResult_TransactionNoneZ in the error state.
4517 pub extern "C" fn CResult_TransactionNoneZ_err() -> CResult_TransactionNoneZ {
4518         CResult_TransactionNoneZ {
4519                 contents: CResult_TransactionNoneZPtr {
4520                         err: std::ptr::null_mut(),
4521                 },
4522                 result_ok: false,
4523         }
4524 }
4525 #[no_mangle]
4526 /// Frees any resources used by the CResult_TransactionNoneZ.
4527 pub extern "C" fn CResult_TransactionNoneZ_free(_res: CResult_TransactionNoneZ) { }
4528 impl Drop for CResult_TransactionNoneZ {
4529         fn drop(&mut self) {
4530                 if self.result_ok {
4531                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
4532                                 let _ = unsafe { Box::from_raw(self.contents.result) };
4533                         }
4534                 } else {
4535                 }
4536         }
4537 }
4538 impl From<crate::c_types::CResultTempl<crate::c_types::Transaction, ()>> for CResult_TransactionNoneZ {
4539         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::Transaction, ()>) -> Self {
4540                 let contents = if o.result_ok {
4541                         let result = unsafe { o.contents.result };
4542                         unsafe { o.contents.result = std::ptr::null_mut() };
4543                         CResult_TransactionNoneZPtr { result }
4544                 } else {
4545                         let _ = unsafe { Box::from_raw(o.contents.err) };
4546                         o.contents.err = std::ptr::null_mut();
4547                         CResult_TransactionNoneZPtr { err: std::ptr::null_mut() }
4548                 };
4549                 Self {
4550                         contents,
4551                         result_ok: o.result_ok,
4552                 }
4553         }
4554 }
4555 impl Clone for CResult_TransactionNoneZ {
4556         fn clone(&self) -> Self {
4557                 if self.result_ok {
4558                         Self { result_ok: true, contents: CResult_TransactionNoneZPtr {
4559                                 result: Box::into_raw(Box::new(<crate::c_types::Transaction>::clone(unsafe { &*self.contents.result })))
4560                         } }
4561                 } else {
4562                         Self { result_ok: false, contents: CResult_TransactionNoneZPtr {
4563                                 err: std::ptr::null_mut()
4564                         } }
4565                 }
4566         }
4567 }
4568 #[no_mangle]
4569 /// Creates a new CResult_TransactionNoneZ which has the same data as `orig`
4570 /// but with all dynamically-allocated buffers duplicated in new buffers.
4571 pub extern "C" fn CResult_TransactionNoneZ_clone(orig: &CResult_TransactionNoneZ) -> CResult_TransactionNoneZ { Clone::clone(&orig) }
4572 #[repr(C)]
4573 /// A tuple of 2 elements. See the individual fields for the types contained.
4574 pub struct C2Tuple_BlockHashChannelMonitorZ {
4575         /// The element at position 0
4576         pub a: crate::c_types::ThirtyTwoBytes,
4577         /// The element at position 1
4578         pub b: crate::lightning::chain::channelmonitor::ChannelMonitor,
4579 }
4580 impl From<(crate::c_types::ThirtyTwoBytes, crate::lightning::chain::channelmonitor::ChannelMonitor)> for C2Tuple_BlockHashChannelMonitorZ {
4581         fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::lightning::chain::channelmonitor::ChannelMonitor)) -> Self {
4582                 Self {
4583                         a: tup.0,
4584                         b: tup.1,
4585                 }
4586         }
4587 }
4588 impl C2Tuple_BlockHashChannelMonitorZ {
4589         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::lightning::chain::channelmonitor::ChannelMonitor) {
4590                 (self.a, self.b)
4591         }
4592 }
4593 /// Creates a new C2Tuple_BlockHashChannelMonitorZ from the contained elements.
4594 #[no_mangle]
4595 pub extern "C" fn C2Tuple_BlockHashChannelMonitorZ_new(a: crate::c_types::ThirtyTwoBytes, b: crate::lightning::chain::channelmonitor::ChannelMonitor) -> C2Tuple_BlockHashChannelMonitorZ {
4596         C2Tuple_BlockHashChannelMonitorZ { a, b, }
4597 }
4598
4599 #[no_mangle]
4600 /// Frees any resources used by the C2Tuple_BlockHashChannelMonitorZ.
4601 pub extern "C" fn C2Tuple_BlockHashChannelMonitorZ_free(_res: C2Tuple_BlockHashChannelMonitorZ) { }
4602 #[repr(C)]
4603 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZs of arbitrary size.
4604 /// This corresponds to std::vector in C++
4605 pub struct CVec_C2Tuple_BlockHashChannelMonitorZZ {
4606         /// The elements in the array.
4607         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4608         pub data: *mut crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ,
4609         /// The number of elements pointed to by `data`.
4610         pub datalen: usize
4611 }
4612 impl CVec_C2Tuple_BlockHashChannelMonitorZZ {
4613         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ> {
4614                 if self.datalen == 0 { return Vec::new(); }
4615                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
4616                 self.data = std::ptr::null_mut();
4617                 self.datalen = 0;
4618                 ret
4619         }
4620         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ] {
4621                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
4622         }
4623 }
4624 impl From<Vec<crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ>> for CVec_C2Tuple_BlockHashChannelMonitorZZ {
4625         fn from(v: Vec<crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ>) -> Self {
4626                 let datalen = v.len();
4627                 let data = Box::into_raw(v.into_boxed_slice());
4628                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
4629         }
4630 }
4631 #[no_mangle]
4632 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
4633 pub extern "C" fn CVec_C2Tuple_BlockHashChannelMonitorZZ_free(_res: CVec_C2Tuple_BlockHashChannelMonitorZZ) { }
4634 impl Drop for CVec_C2Tuple_BlockHashChannelMonitorZZ {
4635         fn drop(&mut self) {
4636                 if self.datalen == 0 { return; }
4637                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
4638         }
4639 }
4640 #[repr(C)]
4641 /// The contents of CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ
4642 pub union CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr {
4643         /// A pointer to the contents in the success state.
4644         /// Reading from this pointer when `result_ok` is not set is undefined.
4645         pub result: *mut crate::c_types::derived::CVec_C2Tuple_BlockHashChannelMonitorZZ,
4646         /// A pointer to the contents in the error state.
4647         /// Reading from this pointer when `result_ok` is set is undefined.
4648         pub err: *mut crate::c_types::IOError,
4649 }
4650 #[repr(C)]
4651 /// A CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ represents the result of a fallible operation,
4652 /// containing a crate::c_types::derived::CVec_C2Tuple_BlockHashChannelMonitorZZ on success and a crate::c_types::IOError on failure.
4653 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4654 pub struct CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
4655         /// The contents of this CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ, accessible via either
4656         /// `err` or `result` depending on the state of `result_ok`.
4657         pub contents: CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr,
4658         /// Whether this CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ represents a success state.
4659         pub result_ok: bool,
4660 }
4661 #[no_mangle]
4662 /// Creates a new CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ in the success state.
4663 pub extern "C" fn CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_ok(o: crate::c_types::derived::CVec_C2Tuple_BlockHashChannelMonitorZZ) -> CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
4664         CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
4665                 contents: CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr {
4666                         result: Box::into_raw(Box::new(o)),
4667                 },
4668                 result_ok: true,
4669         }
4670 }
4671 #[no_mangle]
4672 /// Creates a new CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ in the error state.
4673 pub extern "C" fn CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_err(e: crate::c_types::IOError) -> CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
4674         CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
4675                 contents: CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr {
4676                         err: Box::into_raw(Box::new(e)),
4677                 },
4678                 result_ok: false,
4679         }
4680 }
4681 #[no_mangle]
4682 /// Frees any resources used by the CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ.
4683 pub extern "C" fn CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_free(_res: CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ) { }
4684 impl Drop for CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
4685         fn drop(&mut self) {
4686                 if self.result_ok {
4687                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
4688                                 let _ = unsafe { Box::from_raw(self.contents.result) };
4689                         }
4690                 } else {
4691                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
4692                                 let _ = unsafe { Box::from_raw(self.contents.err) };
4693                         }
4694                 }
4695         }
4696 }
4697 impl From<crate::c_types::CResultTempl<crate::c_types::derived::CVec_C2Tuple_BlockHashChannelMonitorZZ, crate::c_types::IOError>> for CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
4698         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CVec_C2Tuple_BlockHashChannelMonitorZZ, crate::c_types::IOError>) -> Self {
4699                 let contents = if o.result_ok {
4700                         let result = unsafe { o.contents.result };
4701                         unsafe { o.contents.result = std::ptr::null_mut() };
4702                         CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr { result }
4703                 } else {
4704                         let err = unsafe { o.contents.err };
4705                         unsafe { o.contents.err = std::ptr::null_mut(); }
4706                         CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr { err }
4707                 };
4708                 Self {
4709                         contents,
4710                         result_ok: o.result_ok,
4711                 }
4712         }
4713 }
4714 #[repr(C)]
4715 #[derive(Clone)]
4716 /// An enum which can either contain a u16 or not
4717 pub enum COption_u16Z {
4718         /// When we're in this state, this COption_u16Z contains a u16
4719         Some(u16),
4720         /// When we're in this state, this COption_u16Z contains nothing
4721         None
4722 }
4723 impl COption_u16Z {
4724         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
4725                 if let Self::Some(_) = self { true } else { false }
4726         }
4727         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
4728                 !self.is_some()
4729         }
4730         #[allow(unused)] pub(crate) fn take(mut self) -> u16 {
4731                 if let Self::Some(v) = self { v } else { unreachable!() }
4732         }
4733 }
4734 #[no_mangle]
4735 /// Constructs a new COption_u16Z containing a u16
4736 pub extern "C" fn COption_u16Z_some(o: u16) -> COption_u16Z {
4737         COption_u16Z::Some(o)
4738 }
4739 #[no_mangle]
4740 /// Constructs a new COption_u16Z containing nothing
4741 pub extern "C" fn COption_u16Z_none() -> COption_u16Z {
4742         COption_u16Z::None
4743 }
4744 #[no_mangle]
4745 /// Frees any resources associated with the u16, if we are in the Some state
4746 pub extern "C" fn COption_u16Z_free(_res: COption_u16Z) { }
4747 #[no_mangle]
4748 /// Creates a new COption_u16Z which has the same data as `orig`
4749 /// but with all dynamically-allocated buffers duplicated in new buffers.
4750 pub extern "C" fn COption_u16Z_clone(orig: &COption_u16Z) -> COption_u16Z { Clone::clone(&orig) }
4751 #[repr(C)]
4752 /// The contents of CResult_NoneAPIErrorZ
4753 pub union CResult_NoneAPIErrorZPtr {
4754         /// Note that this value is always NULL, as there are no contents in the OK variant
4755         pub result: *mut std::ffi::c_void,
4756         /// A pointer to the contents in the error state.
4757         /// Reading from this pointer when `result_ok` is set is undefined.
4758         pub err: *mut crate::lightning::util::errors::APIError,
4759 }
4760 #[repr(C)]
4761 /// A CResult_NoneAPIErrorZ represents the result of a fallible operation,
4762 /// containing a () on success and a crate::lightning::util::errors::APIError on failure.
4763 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4764 pub struct CResult_NoneAPIErrorZ {
4765         /// The contents of this CResult_NoneAPIErrorZ, accessible via either
4766         /// `err` or `result` depending on the state of `result_ok`.
4767         pub contents: CResult_NoneAPIErrorZPtr,
4768         /// Whether this CResult_NoneAPIErrorZ represents a success state.
4769         pub result_ok: bool,
4770 }
4771 #[no_mangle]
4772 /// Creates a new CResult_NoneAPIErrorZ in the success state.
4773 pub extern "C" fn CResult_NoneAPIErrorZ_ok() -> CResult_NoneAPIErrorZ {
4774         CResult_NoneAPIErrorZ {
4775                 contents: CResult_NoneAPIErrorZPtr {
4776                         result: std::ptr::null_mut(),
4777                 },
4778                 result_ok: true,
4779         }
4780 }
4781 #[no_mangle]
4782 /// Creates a new CResult_NoneAPIErrorZ in the error state.
4783 pub extern "C" fn CResult_NoneAPIErrorZ_err(e: crate::lightning::util::errors::APIError) -> CResult_NoneAPIErrorZ {
4784         CResult_NoneAPIErrorZ {
4785                 contents: CResult_NoneAPIErrorZPtr {
4786                         err: Box::into_raw(Box::new(e)),
4787                 },
4788                 result_ok: false,
4789         }
4790 }
4791 #[no_mangle]
4792 /// Frees any resources used by the CResult_NoneAPIErrorZ.
4793 pub extern "C" fn CResult_NoneAPIErrorZ_free(_res: CResult_NoneAPIErrorZ) { }
4794 impl Drop for CResult_NoneAPIErrorZ {
4795         fn drop(&mut self) {
4796                 if self.result_ok {
4797                 } else {
4798                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
4799                                 let _ = unsafe { Box::from_raw(self.contents.err) };
4800                         }
4801                 }
4802         }
4803 }
4804 impl From<crate::c_types::CResultTempl<(), crate::lightning::util::errors::APIError>> for CResult_NoneAPIErrorZ {
4805         fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::util::errors::APIError>) -> Self {
4806                 let contents = if o.result_ok {
4807                         let _ = unsafe { Box::from_raw(o.contents.result) };
4808                         o.contents.result = std::ptr::null_mut();
4809                         CResult_NoneAPIErrorZPtr { result: std::ptr::null_mut() }
4810                 } else {
4811                         let err = unsafe { o.contents.err };
4812                         unsafe { o.contents.err = std::ptr::null_mut(); }
4813                         CResult_NoneAPIErrorZPtr { err }
4814                 };
4815                 Self {
4816                         contents,
4817                         result_ok: o.result_ok,
4818                 }
4819         }
4820 }
4821 impl Clone for CResult_NoneAPIErrorZ {
4822         fn clone(&self) -> Self {
4823                 if self.result_ok {
4824                         Self { result_ok: true, contents: CResult_NoneAPIErrorZPtr {
4825                                 result: std::ptr::null_mut()
4826                         } }
4827                 } else {
4828                         Self { result_ok: false, contents: CResult_NoneAPIErrorZPtr {
4829                                 err: Box::into_raw(Box::new(<crate::lightning::util::errors::APIError>::clone(unsafe { &*self.contents.err })))
4830                         } }
4831                 }
4832         }
4833 }
4834 #[no_mangle]
4835 /// Creates a new CResult_NoneAPIErrorZ which has the same data as `orig`
4836 /// but with all dynamically-allocated buffers duplicated in new buffers.
4837 pub extern "C" fn CResult_NoneAPIErrorZ_clone(orig: &CResult_NoneAPIErrorZ) -> CResult_NoneAPIErrorZ { Clone::clone(&orig) }
4838 #[repr(C)]
4839 /// A dynamically-allocated array of crate::c_types::derived::CResult_NoneAPIErrorZs of arbitrary size.
4840 /// This corresponds to std::vector in C++
4841 pub struct CVec_CResult_NoneAPIErrorZZ {
4842         /// The elements in the array.
4843         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4844         pub data: *mut crate::c_types::derived::CResult_NoneAPIErrorZ,
4845         /// The number of elements pointed to by `data`.
4846         pub datalen: usize
4847 }
4848 impl CVec_CResult_NoneAPIErrorZZ {
4849         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::CResult_NoneAPIErrorZ> {
4850                 if self.datalen == 0 { return Vec::new(); }
4851                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
4852                 self.data = std::ptr::null_mut();
4853                 self.datalen = 0;
4854                 ret
4855         }
4856         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::CResult_NoneAPIErrorZ] {
4857                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
4858         }
4859 }
4860 impl From<Vec<crate::c_types::derived::CResult_NoneAPIErrorZ>> for CVec_CResult_NoneAPIErrorZZ {
4861         fn from(v: Vec<crate::c_types::derived::CResult_NoneAPIErrorZ>) -> Self {
4862                 let datalen = v.len();
4863                 let data = Box::into_raw(v.into_boxed_slice());
4864                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
4865         }
4866 }
4867 #[no_mangle]
4868 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
4869 pub extern "C" fn CVec_CResult_NoneAPIErrorZZ_free(_res: CVec_CResult_NoneAPIErrorZZ) { }
4870 impl Drop for CVec_CResult_NoneAPIErrorZZ {
4871         fn drop(&mut self) {
4872                 if self.datalen == 0 { return; }
4873                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
4874         }
4875 }
4876 impl Clone for CVec_CResult_NoneAPIErrorZZ {
4877         fn clone(&self) -> Self {
4878                 let mut res = Vec::new();
4879                 if self.datalen == 0 { return Self::from(res); }
4880                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
4881                 Self::from(res)
4882         }
4883 }
4884 #[repr(C)]
4885 /// A dynamically-allocated array of crate::lightning::util::errors::APIErrors of arbitrary size.
4886 /// This corresponds to std::vector in C++
4887 pub struct CVec_APIErrorZ {
4888         /// The elements in the array.
4889         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4890         pub data: *mut crate::lightning::util::errors::APIError,
4891         /// The number of elements pointed to by `data`.
4892         pub datalen: usize
4893 }
4894 impl CVec_APIErrorZ {
4895         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::util::errors::APIError> {
4896                 if self.datalen == 0 { return Vec::new(); }
4897                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
4898                 self.data = std::ptr::null_mut();
4899                 self.datalen = 0;
4900                 ret
4901         }
4902         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::util::errors::APIError] {
4903                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
4904         }
4905 }
4906 impl From<Vec<crate::lightning::util::errors::APIError>> for CVec_APIErrorZ {
4907         fn from(v: Vec<crate::lightning::util::errors::APIError>) -> Self {
4908                 let datalen = v.len();
4909                 let data = Box::into_raw(v.into_boxed_slice());
4910                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
4911         }
4912 }
4913 #[no_mangle]
4914 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
4915 pub extern "C" fn CVec_APIErrorZ_free(_res: CVec_APIErrorZ) { }
4916 impl Drop for CVec_APIErrorZ {
4917         fn drop(&mut self) {
4918                 if self.datalen == 0 { return; }
4919                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
4920         }
4921 }
4922 impl Clone for CVec_APIErrorZ {
4923         fn clone(&self) -> Self {
4924                 let mut res = Vec::new();
4925                 if self.datalen == 0 { return Self::from(res); }
4926                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
4927                 Self::from(res)
4928         }
4929 }
4930 #[repr(C)]
4931 /// The contents of CResult__u832APIErrorZ
4932 pub union CResult__u832APIErrorZPtr {
4933         /// A pointer to the contents in the success state.
4934         /// Reading from this pointer when `result_ok` is not set is undefined.
4935         pub result: *mut crate::c_types::ThirtyTwoBytes,
4936         /// A pointer to the contents in the error state.
4937         /// Reading from this pointer when `result_ok` is set is undefined.
4938         pub err: *mut crate::lightning::util::errors::APIError,
4939 }
4940 #[repr(C)]
4941 /// A CResult__u832APIErrorZ represents the result of a fallible operation,
4942 /// containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning::util::errors::APIError on failure.
4943 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4944 pub struct CResult__u832APIErrorZ {
4945         /// The contents of this CResult__u832APIErrorZ, accessible via either
4946         /// `err` or `result` depending on the state of `result_ok`.
4947         pub contents: CResult__u832APIErrorZPtr,
4948         /// Whether this CResult__u832APIErrorZ represents a success state.
4949         pub result_ok: bool,
4950 }
4951 #[no_mangle]
4952 /// Creates a new CResult__u832APIErrorZ in the success state.
4953 pub extern "C" fn CResult__u832APIErrorZ_ok(o: crate::c_types::ThirtyTwoBytes) -> CResult__u832APIErrorZ {
4954         CResult__u832APIErrorZ {
4955                 contents: CResult__u832APIErrorZPtr {
4956                         result: Box::into_raw(Box::new(o)),
4957                 },
4958                 result_ok: true,
4959         }
4960 }
4961 #[no_mangle]
4962 /// Creates a new CResult__u832APIErrorZ in the error state.
4963 pub extern "C" fn CResult__u832APIErrorZ_err(e: crate::lightning::util::errors::APIError) -> CResult__u832APIErrorZ {
4964         CResult__u832APIErrorZ {
4965                 contents: CResult__u832APIErrorZPtr {
4966                         err: Box::into_raw(Box::new(e)),
4967                 },
4968                 result_ok: false,
4969         }
4970 }
4971 #[no_mangle]
4972 /// Frees any resources used by the CResult__u832APIErrorZ.
4973 pub extern "C" fn CResult__u832APIErrorZ_free(_res: CResult__u832APIErrorZ) { }
4974 impl Drop for CResult__u832APIErrorZ {
4975         fn drop(&mut self) {
4976                 if self.result_ok {
4977                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
4978                                 let _ = unsafe { Box::from_raw(self.contents.result) };
4979                         }
4980                 } else {
4981                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
4982                                 let _ = unsafe { Box::from_raw(self.contents.err) };
4983                         }
4984                 }
4985         }
4986 }
4987 impl From<crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::util::errors::APIError>> for CResult__u832APIErrorZ {
4988         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::util::errors::APIError>) -> Self {
4989                 let contents = if o.result_ok {
4990                         let result = unsafe { o.contents.result };
4991                         unsafe { o.contents.result = std::ptr::null_mut() };
4992                         CResult__u832APIErrorZPtr { result }
4993                 } else {
4994                         let err = unsafe { o.contents.err };
4995                         unsafe { o.contents.err = std::ptr::null_mut(); }
4996                         CResult__u832APIErrorZPtr { err }
4997                 };
4998                 Self {
4999                         contents,
5000                         result_ok: o.result_ok,
5001                 }
5002         }
5003 }
5004 impl Clone for CResult__u832APIErrorZ {
5005         fn clone(&self) -> Self {
5006                 if self.result_ok {
5007                         Self { result_ok: true, contents: CResult__u832APIErrorZPtr {
5008                                 result: Box::into_raw(Box::new(<crate::c_types::ThirtyTwoBytes>::clone(unsafe { &*self.contents.result })))
5009                         } }
5010                 } else {
5011                         Self { result_ok: false, contents: CResult__u832APIErrorZPtr {
5012                                 err: Box::into_raw(Box::new(<crate::lightning::util::errors::APIError>::clone(unsafe { &*self.contents.err })))
5013                         } }
5014                 }
5015         }
5016 }
5017 #[no_mangle]
5018 /// Creates a new CResult__u832APIErrorZ which has the same data as `orig`
5019 /// but with all dynamically-allocated buffers duplicated in new buffers.
5020 pub extern "C" fn CResult__u832APIErrorZ_clone(orig: &CResult__u832APIErrorZ) -> CResult__u832APIErrorZ { Clone::clone(&orig) }
5021 #[repr(C)]
5022 /// The contents of CResult_PaymentIdPaymentSendFailureZ
5023 pub union CResult_PaymentIdPaymentSendFailureZPtr {
5024         /// A pointer to the contents in the success state.
5025         /// Reading from this pointer when `result_ok` is not set is undefined.
5026         pub result: *mut crate::c_types::ThirtyTwoBytes,
5027         /// A pointer to the contents in the error state.
5028         /// Reading from this pointer when `result_ok` is set is undefined.
5029         pub err: *mut crate::lightning::ln::channelmanager::PaymentSendFailure,
5030 }
5031 #[repr(C)]
5032 /// A CResult_PaymentIdPaymentSendFailureZ represents the result of a fallible operation,
5033 /// containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning::ln::channelmanager::PaymentSendFailure on failure.
5034 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5035 pub struct CResult_PaymentIdPaymentSendFailureZ {
5036         /// The contents of this CResult_PaymentIdPaymentSendFailureZ, accessible via either
5037         /// `err` or `result` depending on the state of `result_ok`.
5038         pub contents: CResult_PaymentIdPaymentSendFailureZPtr,
5039         /// Whether this CResult_PaymentIdPaymentSendFailureZ represents a success state.
5040         pub result_ok: bool,
5041 }
5042 #[no_mangle]
5043 /// Creates a new CResult_PaymentIdPaymentSendFailureZ in the success state.
5044 pub extern "C" fn CResult_PaymentIdPaymentSendFailureZ_ok(o: crate::c_types::ThirtyTwoBytes) -> CResult_PaymentIdPaymentSendFailureZ {
5045         CResult_PaymentIdPaymentSendFailureZ {
5046                 contents: CResult_PaymentIdPaymentSendFailureZPtr {
5047                         result: Box::into_raw(Box::new(o)),
5048                 },
5049                 result_ok: true,
5050         }
5051 }
5052 #[no_mangle]
5053 /// Creates a new CResult_PaymentIdPaymentSendFailureZ in the error state.
5054 pub extern "C" fn CResult_PaymentIdPaymentSendFailureZ_err(e: crate::lightning::ln::channelmanager::PaymentSendFailure) -> CResult_PaymentIdPaymentSendFailureZ {
5055         CResult_PaymentIdPaymentSendFailureZ {
5056                 contents: CResult_PaymentIdPaymentSendFailureZPtr {
5057                         err: Box::into_raw(Box::new(e)),
5058                 },
5059                 result_ok: false,
5060         }
5061 }
5062 #[no_mangle]
5063 /// Frees any resources used by the CResult_PaymentIdPaymentSendFailureZ.
5064 pub extern "C" fn CResult_PaymentIdPaymentSendFailureZ_free(_res: CResult_PaymentIdPaymentSendFailureZ) { }
5065 impl Drop for CResult_PaymentIdPaymentSendFailureZ {
5066         fn drop(&mut self) {
5067                 if self.result_ok {
5068                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
5069                                 let _ = unsafe { Box::from_raw(self.contents.result) };
5070                         }
5071                 } else {
5072                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
5073                                 let _ = unsafe { Box::from_raw(self.contents.err) };
5074                         }
5075                 }
5076         }
5077 }
5078 impl From<crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::ln::channelmanager::PaymentSendFailure>> for CResult_PaymentIdPaymentSendFailureZ {
5079         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::ln::channelmanager::PaymentSendFailure>) -> Self {
5080                 let contents = if o.result_ok {
5081                         let result = unsafe { o.contents.result };
5082                         unsafe { o.contents.result = std::ptr::null_mut() };
5083                         CResult_PaymentIdPaymentSendFailureZPtr { result }
5084                 } else {
5085                         let err = unsafe { o.contents.err };
5086                         unsafe { o.contents.err = std::ptr::null_mut(); }
5087                         CResult_PaymentIdPaymentSendFailureZPtr { err }
5088                 };
5089                 Self {
5090                         contents,
5091                         result_ok: o.result_ok,
5092                 }
5093         }
5094 }
5095 impl Clone for CResult_PaymentIdPaymentSendFailureZ {
5096         fn clone(&self) -> Self {
5097                 if self.result_ok {
5098                         Self { result_ok: true, contents: CResult_PaymentIdPaymentSendFailureZPtr {
5099                                 result: Box::into_raw(Box::new(<crate::c_types::ThirtyTwoBytes>::clone(unsafe { &*self.contents.result })))
5100                         } }
5101                 } else {
5102                         Self { result_ok: false, contents: CResult_PaymentIdPaymentSendFailureZPtr {
5103                                 err: Box::into_raw(Box::new(<crate::lightning::ln::channelmanager::PaymentSendFailure>::clone(unsafe { &*self.contents.err })))
5104                         } }
5105                 }
5106         }
5107 }
5108 #[no_mangle]
5109 /// Creates a new CResult_PaymentIdPaymentSendFailureZ which has the same data as `orig`
5110 /// but with all dynamically-allocated buffers duplicated in new buffers.
5111 pub extern "C" fn CResult_PaymentIdPaymentSendFailureZ_clone(orig: &CResult_PaymentIdPaymentSendFailureZ) -> CResult_PaymentIdPaymentSendFailureZ { Clone::clone(&orig) }
5112 #[repr(C)]
5113 /// The contents of CResult_NonePaymentSendFailureZ
5114 pub union CResult_NonePaymentSendFailureZPtr {
5115         /// Note that this value is always NULL, as there are no contents in the OK variant
5116         pub result: *mut std::ffi::c_void,
5117         /// A pointer to the contents in the error state.
5118         /// Reading from this pointer when `result_ok` is set is undefined.
5119         pub err: *mut crate::lightning::ln::channelmanager::PaymentSendFailure,
5120 }
5121 #[repr(C)]
5122 /// A CResult_NonePaymentSendFailureZ represents the result of a fallible operation,
5123 /// containing a () on success and a crate::lightning::ln::channelmanager::PaymentSendFailure on failure.
5124 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5125 pub struct CResult_NonePaymentSendFailureZ {
5126         /// The contents of this CResult_NonePaymentSendFailureZ, accessible via either
5127         /// `err` or `result` depending on the state of `result_ok`.
5128         pub contents: CResult_NonePaymentSendFailureZPtr,
5129         /// Whether this CResult_NonePaymentSendFailureZ represents a success state.
5130         pub result_ok: bool,
5131 }
5132 #[no_mangle]
5133 /// Creates a new CResult_NonePaymentSendFailureZ in the success state.
5134 pub extern "C" fn CResult_NonePaymentSendFailureZ_ok() -> CResult_NonePaymentSendFailureZ {
5135         CResult_NonePaymentSendFailureZ {
5136                 contents: CResult_NonePaymentSendFailureZPtr {
5137                         result: std::ptr::null_mut(),
5138                 },
5139                 result_ok: true,
5140         }
5141 }
5142 #[no_mangle]
5143 /// Creates a new CResult_NonePaymentSendFailureZ in the error state.
5144 pub extern "C" fn CResult_NonePaymentSendFailureZ_err(e: crate::lightning::ln::channelmanager::PaymentSendFailure) -> CResult_NonePaymentSendFailureZ {
5145         CResult_NonePaymentSendFailureZ {
5146                 contents: CResult_NonePaymentSendFailureZPtr {
5147                         err: Box::into_raw(Box::new(e)),
5148                 },
5149                 result_ok: false,
5150         }
5151 }
5152 #[no_mangle]
5153 /// Frees any resources used by the CResult_NonePaymentSendFailureZ.
5154 pub extern "C" fn CResult_NonePaymentSendFailureZ_free(_res: CResult_NonePaymentSendFailureZ) { }
5155 impl Drop for CResult_NonePaymentSendFailureZ {
5156         fn drop(&mut self) {
5157                 if self.result_ok {
5158                 } else {
5159                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
5160                                 let _ = unsafe { Box::from_raw(self.contents.err) };
5161                         }
5162                 }
5163         }
5164 }
5165 impl From<crate::c_types::CResultTempl<(), crate::lightning::ln::channelmanager::PaymentSendFailure>> for CResult_NonePaymentSendFailureZ {
5166         fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::ln::channelmanager::PaymentSendFailure>) -> Self {
5167                 let contents = if o.result_ok {
5168                         let _ = unsafe { Box::from_raw(o.contents.result) };
5169                         o.contents.result = std::ptr::null_mut();
5170                         CResult_NonePaymentSendFailureZPtr { result: std::ptr::null_mut() }
5171                 } else {
5172                         let err = unsafe { o.contents.err };
5173                         unsafe { o.contents.err = std::ptr::null_mut(); }
5174                         CResult_NonePaymentSendFailureZPtr { err }
5175                 };
5176                 Self {
5177                         contents,
5178                         result_ok: o.result_ok,
5179                 }
5180         }
5181 }
5182 impl Clone for CResult_NonePaymentSendFailureZ {
5183         fn clone(&self) -> Self {
5184                 if self.result_ok {
5185                         Self { result_ok: true, contents: CResult_NonePaymentSendFailureZPtr {
5186                                 result: std::ptr::null_mut()
5187                         } }
5188                 } else {
5189                         Self { result_ok: false, contents: CResult_NonePaymentSendFailureZPtr {
5190                                 err: Box::into_raw(Box::new(<crate::lightning::ln::channelmanager::PaymentSendFailure>::clone(unsafe { &*self.contents.err })))
5191                         } }
5192                 }
5193         }
5194 }
5195 #[no_mangle]
5196 /// Creates a new CResult_NonePaymentSendFailureZ which has the same data as `orig`
5197 /// but with all dynamically-allocated buffers duplicated in new buffers.
5198 pub extern "C" fn CResult_NonePaymentSendFailureZ_clone(orig: &CResult_NonePaymentSendFailureZ) -> CResult_NonePaymentSendFailureZ { Clone::clone(&orig) }
5199 #[repr(C)]
5200 /// A tuple of 2 elements. See the individual fields for the types contained.
5201 pub struct C2Tuple_PaymentHashPaymentIdZ {
5202         /// The element at position 0
5203         pub a: crate::c_types::ThirtyTwoBytes,
5204         /// The element at position 1
5205         pub b: crate::c_types::ThirtyTwoBytes,
5206 }
5207 impl From<(crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes)> for C2Tuple_PaymentHashPaymentIdZ {
5208         fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes)) -> Self {
5209                 Self {
5210                         a: tup.0,
5211                         b: tup.1,
5212                 }
5213         }
5214 }
5215 impl C2Tuple_PaymentHashPaymentIdZ {
5216         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes) {
5217                 (self.a, self.b)
5218         }
5219 }
5220 impl Clone for C2Tuple_PaymentHashPaymentIdZ {
5221         fn clone(&self) -> Self {
5222                 Self {
5223                         a: Clone::clone(&self.a),
5224                         b: Clone::clone(&self.b),
5225                 }
5226         }
5227 }
5228 #[no_mangle]
5229 /// Creates a new tuple which has the same data as `orig`
5230 /// but with all dynamically-allocated buffers duplicated in new buffers.
5231 pub extern "C" fn C2Tuple_PaymentHashPaymentIdZ_clone(orig: &C2Tuple_PaymentHashPaymentIdZ) -> C2Tuple_PaymentHashPaymentIdZ { Clone::clone(&orig) }
5232 /// Creates a new C2Tuple_PaymentHashPaymentIdZ from the contained elements.
5233 #[no_mangle]
5234 pub extern "C" fn C2Tuple_PaymentHashPaymentIdZ_new(a: crate::c_types::ThirtyTwoBytes, b: crate::c_types::ThirtyTwoBytes) -> C2Tuple_PaymentHashPaymentIdZ {
5235         C2Tuple_PaymentHashPaymentIdZ { a, b, }
5236 }
5237
5238 #[no_mangle]
5239 /// Frees any resources used by the C2Tuple_PaymentHashPaymentIdZ.
5240 pub extern "C" fn C2Tuple_PaymentHashPaymentIdZ_free(_res: C2Tuple_PaymentHashPaymentIdZ) { }
5241 #[repr(C)]
5242 /// The contents of CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ
5243 pub union CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr {
5244         /// A pointer to the contents in the success state.
5245         /// Reading from this pointer when `result_ok` is not set is undefined.
5246         pub result: *mut crate::c_types::derived::C2Tuple_PaymentHashPaymentIdZ,
5247         /// A pointer to the contents in the error state.
5248         /// Reading from this pointer when `result_ok` is set is undefined.
5249         pub err: *mut crate::lightning::ln::channelmanager::PaymentSendFailure,
5250 }
5251 #[repr(C)]
5252 /// A CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ represents the result of a fallible operation,
5253 /// containing a crate::c_types::derived::C2Tuple_PaymentHashPaymentIdZ on success and a crate::lightning::ln::channelmanager::PaymentSendFailure on failure.
5254 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5255 pub struct CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
5256         /// The contents of this CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ, accessible via either
5257         /// `err` or `result` depending on the state of `result_ok`.
5258         pub contents: CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr,
5259         /// Whether this CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ represents a success state.
5260         pub result_ok: bool,
5261 }
5262 #[no_mangle]
5263 /// Creates a new CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ in the success state.
5264 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_ok(o: crate::c_types::derived::C2Tuple_PaymentHashPaymentIdZ) -> CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
5265         CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
5266                 contents: CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr {
5267                         result: Box::into_raw(Box::new(o)),
5268                 },
5269                 result_ok: true,
5270         }
5271 }
5272 #[no_mangle]
5273 /// Creates a new CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ in the error state.
5274 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_err(e: crate::lightning::ln::channelmanager::PaymentSendFailure) -> CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
5275         CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
5276                 contents: CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr {
5277                         err: Box::into_raw(Box::new(e)),
5278                 },
5279                 result_ok: false,
5280         }
5281 }
5282 #[no_mangle]
5283 /// Frees any resources used by the CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ.
5284 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_free(_res: CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ) { }
5285 impl Drop for CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
5286         fn drop(&mut self) {
5287                 if self.result_ok {
5288                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
5289                                 let _ = unsafe { Box::from_raw(self.contents.result) };
5290                         }
5291                 } else {
5292                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
5293                                 let _ = unsafe { Box::from_raw(self.contents.err) };
5294                         }
5295                 }
5296         }
5297 }
5298 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_PaymentHashPaymentIdZ, crate::lightning::ln::channelmanager::PaymentSendFailure>> for CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
5299         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_PaymentHashPaymentIdZ, crate::lightning::ln::channelmanager::PaymentSendFailure>) -> Self {
5300                 let contents = if o.result_ok {
5301                         let result = unsafe { o.contents.result };
5302                         unsafe { o.contents.result = std::ptr::null_mut() };
5303                         CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr { result }
5304                 } else {
5305                         let err = unsafe { o.contents.err };
5306                         unsafe { o.contents.err = std::ptr::null_mut(); }
5307                         CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr { err }
5308                 };
5309                 Self {
5310                         contents,
5311                         result_ok: o.result_ok,
5312                 }
5313         }
5314 }
5315 impl Clone for CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
5316         fn clone(&self) -> Self {
5317                 if self.result_ok {
5318                         Self { result_ok: true, contents: CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr {
5319                                 result: Box::into_raw(Box::new(<crate::c_types::derived::C2Tuple_PaymentHashPaymentIdZ>::clone(unsafe { &*self.contents.result })))
5320                         } }
5321                 } else {
5322                         Self { result_ok: false, contents: CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr {
5323                                 err: Box::into_raw(Box::new(<crate::lightning::ln::channelmanager::PaymentSendFailure>::clone(unsafe { &*self.contents.err })))
5324                         } }
5325                 }
5326         }
5327 }
5328 #[no_mangle]
5329 /// Creates a new CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ which has the same data as `orig`
5330 /// but with all dynamically-allocated buffers duplicated in new buffers.
5331 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone(orig: &CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ) -> CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ { Clone::clone(&orig) }
5332 #[repr(C)]
5333 /// A dynamically-allocated array of crate::lightning::ln::msgs::NetAddresss of arbitrary size.
5334 /// This corresponds to std::vector in C++
5335 pub struct CVec_NetAddressZ {
5336         /// The elements in the array.
5337         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
5338         pub data: *mut crate::lightning::ln::msgs::NetAddress,
5339         /// The number of elements pointed to by `data`.
5340         pub datalen: usize
5341 }
5342 impl CVec_NetAddressZ {
5343         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::NetAddress> {
5344                 if self.datalen == 0 { return Vec::new(); }
5345                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
5346                 self.data = std::ptr::null_mut();
5347                 self.datalen = 0;
5348                 ret
5349         }
5350         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::NetAddress] {
5351                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
5352         }
5353 }
5354 impl From<Vec<crate::lightning::ln::msgs::NetAddress>> for CVec_NetAddressZ {
5355         fn from(v: Vec<crate::lightning::ln::msgs::NetAddress>) -> Self {
5356                 let datalen = v.len();
5357                 let data = Box::into_raw(v.into_boxed_slice());
5358                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
5359         }
5360 }
5361 #[no_mangle]
5362 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
5363 pub extern "C" fn CVec_NetAddressZ_free(_res: CVec_NetAddressZ) { }
5364 impl Drop for CVec_NetAddressZ {
5365         fn drop(&mut self) {
5366                 if self.datalen == 0 { return; }
5367                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
5368         }
5369 }
5370 impl Clone for CVec_NetAddressZ {
5371         fn clone(&self) -> Self {
5372                 let mut res = Vec::new();
5373                 if self.datalen == 0 { return Self::from(res); }
5374                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
5375                 Self::from(res)
5376         }
5377 }
5378 #[repr(C)]
5379 /// A tuple of 2 elements. See the individual fields for the types contained.
5380 pub struct C2Tuple_PaymentHashPaymentSecretZ {
5381         /// The element at position 0
5382         pub a: crate::c_types::ThirtyTwoBytes,
5383         /// The element at position 1
5384         pub b: crate::c_types::ThirtyTwoBytes,
5385 }
5386 impl From<(crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes)> for C2Tuple_PaymentHashPaymentSecretZ {
5387         fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes)) -> Self {
5388                 Self {
5389                         a: tup.0,
5390                         b: tup.1,
5391                 }
5392         }
5393 }
5394 impl C2Tuple_PaymentHashPaymentSecretZ {
5395         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes) {
5396                 (self.a, self.b)
5397         }
5398 }
5399 impl Clone for C2Tuple_PaymentHashPaymentSecretZ {
5400         fn clone(&self) -> Self {
5401                 Self {
5402                         a: Clone::clone(&self.a),
5403                         b: Clone::clone(&self.b),
5404                 }
5405         }
5406 }
5407 #[no_mangle]
5408 /// Creates a new tuple which has the same data as `orig`
5409 /// but with all dynamically-allocated buffers duplicated in new buffers.
5410 pub extern "C" fn C2Tuple_PaymentHashPaymentSecretZ_clone(orig: &C2Tuple_PaymentHashPaymentSecretZ) -> C2Tuple_PaymentHashPaymentSecretZ { Clone::clone(&orig) }
5411 /// Creates a new C2Tuple_PaymentHashPaymentSecretZ from the contained elements.
5412 #[no_mangle]
5413 pub extern "C" fn C2Tuple_PaymentHashPaymentSecretZ_new(a: crate::c_types::ThirtyTwoBytes, b: crate::c_types::ThirtyTwoBytes) -> C2Tuple_PaymentHashPaymentSecretZ {
5414         C2Tuple_PaymentHashPaymentSecretZ { a, b, }
5415 }
5416
5417 #[no_mangle]
5418 /// Frees any resources used by the C2Tuple_PaymentHashPaymentSecretZ.
5419 pub extern "C" fn C2Tuple_PaymentHashPaymentSecretZ_free(_res: C2Tuple_PaymentHashPaymentSecretZ) { }
5420 #[repr(C)]
5421 /// The contents of CResult_PaymentSecretAPIErrorZ
5422 pub union CResult_PaymentSecretAPIErrorZPtr {
5423         /// A pointer to the contents in the success state.
5424         /// Reading from this pointer when `result_ok` is not set is undefined.
5425         pub result: *mut crate::c_types::ThirtyTwoBytes,
5426         /// A pointer to the contents in the error state.
5427         /// Reading from this pointer when `result_ok` is set is undefined.
5428         pub err: *mut crate::lightning::util::errors::APIError,
5429 }
5430 #[repr(C)]
5431 /// A CResult_PaymentSecretAPIErrorZ represents the result of a fallible operation,
5432 /// containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning::util::errors::APIError on failure.
5433 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5434 pub struct CResult_PaymentSecretAPIErrorZ {
5435         /// The contents of this CResult_PaymentSecretAPIErrorZ, accessible via either
5436         /// `err` or `result` depending on the state of `result_ok`.
5437         pub contents: CResult_PaymentSecretAPIErrorZPtr,
5438         /// Whether this CResult_PaymentSecretAPIErrorZ represents a success state.
5439         pub result_ok: bool,
5440 }
5441 #[no_mangle]
5442 /// Creates a new CResult_PaymentSecretAPIErrorZ in the success state.
5443 pub extern "C" fn CResult_PaymentSecretAPIErrorZ_ok(o: crate::c_types::ThirtyTwoBytes) -> CResult_PaymentSecretAPIErrorZ {
5444         CResult_PaymentSecretAPIErrorZ {
5445                 contents: CResult_PaymentSecretAPIErrorZPtr {
5446                         result: Box::into_raw(Box::new(o)),
5447                 },
5448                 result_ok: true,
5449         }
5450 }
5451 #[no_mangle]
5452 /// Creates a new CResult_PaymentSecretAPIErrorZ in the error state.
5453 pub extern "C" fn CResult_PaymentSecretAPIErrorZ_err(e: crate::lightning::util::errors::APIError) -> CResult_PaymentSecretAPIErrorZ {
5454         CResult_PaymentSecretAPIErrorZ {
5455                 contents: CResult_PaymentSecretAPIErrorZPtr {
5456                         err: Box::into_raw(Box::new(e)),
5457                 },
5458                 result_ok: false,
5459         }
5460 }
5461 #[no_mangle]
5462 /// Frees any resources used by the CResult_PaymentSecretAPIErrorZ.
5463 pub extern "C" fn CResult_PaymentSecretAPIErrorZ_free(_res: CResult_PaymentSecretAPIErrorZ) { }
5464 impl Drop for CResult_PaymentSecretAPIErrorZ {
5465         fn drop(&mut self) {
5466                 if self.result_ok {
5467                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
5468                                 let _ = unsafe { Box::from_raw(self.contents.result) };
5469                         }
5470                 } else {
5471                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
5472                                 let _ = unsafe { Box::from_raw(self.contents.err) };
5473                         }
5474                 }
5475         }
5476 }
5477 impl From<crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::util::errors::APIError>> for CResult_PaymentSecretAPIErrorZ {
5478         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::util::errors::APIError>) -> Self {
5479                 let contents = if o.result_ok {
5480                         let result = unsafe { o.contents.result };
5481                         unsafe { o.contents.result = std::ptr::null_mut() };
5482                         CResult_PaymentSecretAPIErrorZPtr { result }
5483                 } else {
5484                         let err = unsafe { o.contents.err };
5485                         unsafe { o.contents.err = std::ptr::null_mut(); }
5486                         CResult_PaymentSecretAPIErrorZPtr { err }
5487                 };
5488                 Self {
5489                         contents,
5490                         result_ok: o.result_ok,
5491                 }
5492         }
5493 }
5494 impl Clone for CResult_PaymentSecretAPIErrorZ {
5495         fn clone(&self) -> Self {
5496                 if self.result_ok {
5497                         Self { result_ok: true, contents: CResult_PaymentSecretAPIErrorZPtr {
5498                                 result: Box::into_raw(Box::new(<crate::c_types::ThirtyTwoBytes>::clone(unsafe { &*self.contents.result })))
5499                         } }
5500                 } else {
5501                         Self { result_ok: false, contents: CResult_PaymentSecretAPIErrorZPtr {
5502                                 err: Box::into_raw(Box::new(<crate::lightning::util::errors::APIError>::clone(unsafe { &*self.contents.err })))
5503                         } }
5504                 }
5505         }
5506 }
5507 #[no_mangle]
5508 /// Creates a new CResult_PaymentSecretAPIErrorZ which has the same data as `orig`
5509 /// but with all dynamically-allocated buffers duplicated in new buffers.
5510 pub extern "C" fn CResult_PaymentSecretAPIErrorZ_clone(orig: &CResult_PaymentSecretAPIErrorZ) -> CResult_PaymentSecretAPIErrorZ { Clone::clone(&orig) }
5511 #[repr(C)]
5512 /// A dynamically-allocated array of crate::lightning::chain::channelmonitor::ChannelMonitors of arbitrary size.
5513 /// This corresponds to std::vector in C++
5514 pub struct CVec_ChannelMonitorZ {
5515         /// The elements in the array.
5516         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
5517         pub data: *mut crate::lightning::chain::channelmonitor::ChannelMonitor,
5518         /// The number of elements pointed to by `data`.
5519         pub datalen: usize
5520 }
5521 impl CVec_ChannelMonitorZ {
5522         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::chain::channelmonitor::ChannelMonitor> {
5523                 if self.datalen == 0 { return Vec::new(); }
5524                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
5525                 self.data = std::ptr::null_mut();
5526                 self.datalen = 0;
5527                 ret
5528         }
5529         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::chain::channelmonitor::ChannelMonitor] {
5530                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
5531         }
5532 }
5533 impl From<Vec<crate::lightning::chain::channelmonitor::ChannelMonitor>> for CVec_ChannelMonitorZ {
5534         fn from(v: Vec<crate::lightning::chain::channelmonitor::ChannelMonitor>) -> Self {
5535                 let datalen = v.len();
5536                 let data = Box::into_raw(v.into_boxed_slice());
5537                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
5538         }
5539 }
5540 #[no_mangle]
5541 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
5542 pub extern "C" fn CVec_ChannelMonitorZ_free(_res: CVec_ChannelMonitorZ) { }
5543 impl Drop for CVec_ChannelMonitorZ {
5544         fn drop(&mut self) {
5545                 if self.datalen == 0 { return; }
5546                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
5547         }
5548 }
5549 #[repr(C)]
5550 /// A tuple of 2 elements. See the individual fields for the types contained.
5551 pub struct C2Tuple_BlockHashChannelManagerZ {
5552         /// The element at position 0
5553         pub a: crate::c_types::ThirtyTwoBytes,
5554         /// The element at position 1
5555         pub b: crate::lightning::ln::channelmanager::ChannelManager,
5556 }
5557 impl From<(crate::c_types::ThirtyTwoBytes, crate::lightning::ln::channelmanager::ChannelManager)> for C2Tuple_BlockHashChannelManagerZ {
5558         fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::lightning::ln::channelmanager::ChannelManager)) -> Self {
5559                 Self {
5560                         a: tup.0,
5561                         b: tup.1,
5562                 }
5563         }
5564 }
5565 impl C2Tuple_BlockHashChannelManagerZ {
5566         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::lightning::ln::channelmanager::ChannelManager) {
5567                 (self.a, self.b)
5568         }
5569 }
5570 /// Creates a new C2Tuple_BlockHashChannelManagerZ from the contained elements.
5571 #[no_mangle]
5572 pub extern "C" fn C2Tuple_BlockHashChannelManagerZ_new(a: crate::c_types::ThirtyTwoBytes, b: crate::lightning::ln::channelmanager::ChannelManager) -> C2Tuple_BlockHashChannelManagerZ {
5573         C2Tuple_BlockHashChannelManagerZ { a, b, }
5574 }
5575
5576 #[no_mangle]
5577 /// Frees any resources used by the C2Tuple_BlockHashChannelManagerZ.
5578 pub extern "C" fn C2Tuple_BlockHashChannelManagerZ_free(_res: C2Tuple_BlockHashChannelManagerZ) { }
5579 #[repr(C)]
5580 /// The contents of CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ
5581 pub union CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr {
5582         /// A pointer to the contents in the success state.
5583         /// Reading from this pointer when `result_ok` is not set is undefined.
5584         pub result: *mut crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ,
5585         /// A pointer to the contents in the error state.
5586         /// Reading from this pointer when `result_ok` is set is undefined.
5587         pub err: *mut crate::lightning::ln::msgs::DecodeError,
5588 }
5589 #[repr(C)]
5590 /// A CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ represents the result of a fallible operation,
5591 /// containing a crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
5592 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5593 pub struct CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
5594         /// The contents of this CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ, accessible via either
5595         /// `err` or `result` depending on the state of `result_ok`.
5596         pub contents: CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr,
5597         /// Whether this CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ represents a success state.
5598         pub result_ok: bool,
5599 }
5600 #[no_mangle]
5601 /// Creates a new CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ in the success state.
5602 pub extern "C" fn CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_ok(o: crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ) -> CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
5603         CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
5604                 contents: CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr {
5605                         result: Box::into_raw(Box::new(o)),
5606                 },
5607                 result_ok: true,
5608         }
5609 }
5610 #[no_mangle]
5611 /// Creates a new CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ in the error state.
5612 pub extern "C" fn CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
5613         CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
5614                 contents: CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr {
5615                         err: Box::into_raw(Box::new(e)),
5616                 },
5617                 result_ok: false,
5618         }
5619 }
5620 #[no_mangle]
5621 /// Frees any resources used by the CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ.
5622 pub extern "C" fn CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_free(_res: CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ) { }
5623 impl Drop for CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
5624         fn drop(&mut self) {
5625                 if self.result_ok {
5626                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
5627                                 let _ = unsafe { Box::from_raw(self.contents.result) };
5628                         }
5629                 } else {
5630                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
5631                                 let _ = unsafe { Box::from_raw(self.contents.err) };
5632                         }
5633                 }
5634         }
5635 }
5636 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ, crate::lightning::ln::msgs::DecodeError>> for CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
5637         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
5638                 let contents = if o.result_ok {
5639                         let result = unsafe { o.contents.result };
5640                         unsafe { o.contents.result = std::ptr::null_mut() };
5641                         CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr { result }
5642                 } else {
5643                         let err = unsafe { o.contents.err };
5644                         unsafe { o.contents.err = std::ptr::null_mut(); }
5645                         CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr { err }
5646                 };
5647                 Self {
5648                         contents,
5649                         result_ok: o.result_ok,
5650                 }
5651         }
5652 }
5653 #[repr(C)]
5654 /// The contents of CResult_ChannelConfigDecodeErrorZ
5655 pub union CResult_ChannelConfigDecodeErrorZPtr {
5656         /// A pointer to the contents in the success state.
5657         /// Reading from this pointer when `result_ok` is not set is undefined.
5658         pub result: *mut crate::lightning::util::config::ChannelConfig,
5659         /// A pointer to the contents in the error state.
5660         /// Reading from this pointer when `result_ok` is set is undefined.
5661         pub err: *mut crate::lightning::ln::msgs::DecodeError,
5662 }
5663 #[repr(C)]
5664 /// A CResult_ChannelConfigDecodeErrorZ represents the result of a fallible operation,
5665 /// containing a crate::lightning::util::config::ChannelConfig on success and a crate::lightning::ln::msgs::DecodeError on failure.
5666 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5667 pub struct CResult_ChannelConfigDecodeErrorZ {
5668         /// The contents of this CResult_ChannelConfigDecodeErrorZ, accessible via either
5669         /// `err` or `result` depending on the state of `result_ok`.
5670         pub contents: CResult_ChannelConfigDecodeErrorZPtr,
5671         /// Whether this CResult_ChannelConfigDecodeErrorZ represents a success state.
5672         pub result_ok: bool,
5673 }
5674 #[no_mangle]
5675 /// Creates a new CResult_ChannelConfigDecodeErrorZ in the success state.
5676 pub extern "C" fn CResult_ChannelConfigDecodeErrorZ_ok(o: crate::lightning::util::config::ChannelConfig) -> CResult_ChannelConfigDecodeErrorZ {
5677         CResult_ChannelConfigDecodeErrorZ {
5678                 contents: CResult_ChannelConfigDecodeErrorZPtr {
5679                         result: Box::into_raw(Box::new(o)),
5680                 },
5681                 result_ok: true,
5682         }
5683 }
5684 #[no_mangle]
5685 /// Creates a new CResult_ChannelConfigDecodeErrorZ in the error state.
5686 pub extern "C" fn CResult_ChannelConfigDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelConfigDecodeErrorZ {
5687         CResult_ChannelConfigDecodeErrorZ {
5688                 contents: CResult_ChannelConfigDecodeErrorZPtr {
5689                         err: Box::into_raw(Box::new(e)),
5690                 },
5691                 result_ok: false,
5692         }
5693 }
5694 #[no_mangle]
5695 /// Frees any resources used by the CResult_ChannelConfigDecodeErrorZ.
5696 pub extern "C" fn CResult_ChannelConfigDecodeErrorZ_free(_res: CResult_ChannelConfigDecodeErrorZ) { }
5697 impl Drop for CResult_ChannelConfigDecodeErrorZ {
5698         fn drop(&mut self) {
5699                 if self.result_ok {
5700                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
5701                                 let _ = unsafe { Box::from_raw(self.contents.result) };
5702                         }
5703                 } else {
5704                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
5705                                 let _ = unsafe { Box::from_raw(self.contents.err) };
5706                         }
5707                 }
5708         }
5709 }
5710 impl From<crate::c_types::CResultTempl<crate::lightning::util::config::ChannelConfig, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelConfigDecodeErrorZ {
5711         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::util::config::ChannelConfig, crate::lightning::ln::msgs::DecodeError>) -> Self {
5712                 let contents = if o.result_ok {
5713                         let result = unsafe { o.contents.result };
5714                         unsafe { o.contents.result = std::ptr::null_mut() };
5715                         CResult_ChannelConfigDecodeErrorZPtr { result }
5716                 } else {
5717                         let err = unsafe { o.contents.err };
5718                         unsafe { o.contents.err = std::ptr::null_mut(); }
5719                         CResult_ChannelConfigDecodeErrorZPtr { err }
5720                 };
5721                 Self {
5722                         contents,
5723                         result_ok: o.result_ok,
5724                 }
5725         }
5726 }
5727 impl Clone for CResult_ChannelConfigDecodeErrorZ {
5728         fn clone(&self) -> Self {
5729                 if self.result_ok {
5730                         Self { result_ok: true, contents: CResult_ChannelConfigDecodeErrorZPtr {
5731                                 result: Box::into_raw(Box::new(<crate::lightning::util::config::ChannelConfig>::clone(unsafe { &*self.contents.result })))
5732                         } }
5733                 } else {
5734                         Self { result_ok: false, contents: CResult_ChannelConfigDecodeErrorZPtr {
5735                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
5736                         } }
5737                 }
5738         }
5739 }
5740 #[no_mangle]
5741 /// Creates a new CResult_ChannelConfigDecodeErrorZ which has the same data as `orig`
5742 /// but with all dynamically-allocated buffers duplicated in new buffers.
5743 pub extern "C" fn CResult_ChannelConfigDecodeErrorZ_clone(orig: &CResult_ChannelConfigDecodeErrorZ) -> CResult_ChannelConfigDecodeErrorZ { Clone::clone(&orig) }
5744 #[repr(C)]
5745 /// The contents of CResult_OutPointDecodeErrorZ
5746 pub union CResult_OutPointDecodeErrorZPtr {
5747         /// A pointer to the contents in the success state.
5748         /// Reading from this pointer when `result_ok` is not set is undefined.
5749         pub result: *mut crate::lightning::chain::transaction::OutPoint,
5750         /// A pointer to the contents in the error state.
5751         /// Reading from this pointer when `result_ok` is set is undefined.
5752         pub err: *mut crate::lightning::ln::msgs::DecodeError,
5753 }
5754 #[repr(C)]
5755 /// A CResult_OutPointDecodeErrorZ represents the result of a fallible operation,
5756 /// containing a crate::lightning::chain::transaction::OutPoint on success and a crate::lightning::ln::msgs::DecodeError on failure.
5757 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5758 pub struct CResult_OutPointDecodeErrorZ {
5759         /// The contents of this CResult_OutPointDecodeErrorZ, accessible via either
5760         /// `err` or `result` depending on the state of `result_ok`.
5761         pub contents: CResult_OutPointDecodeErrorZPtr,
5762         /// Whether this CResult_OutPointDecodeErrorZ represents a success state.
5763         pub result_ok: bool,
5764 }
5765 #[no_mangle]
5766 /// Creates a new CResult_OutPointDecodeErrorZ in the success state.
5767 pub extern "C" fn CResult_OutPointDecodeErrorZ_ok(o: crate::lightning::chain::transaction::OutPoint) -> CResult_OutPointDecodeErrorZ {
5768         CResult_OutPointDecodeErrorZ {
5769                 contents: CResult_OutPointDecodeErrorZPtr {
5770                         result: Box::into_raw(Box::new(o)),
5771                 },
5772                 result_ok: true,
5773         }
5774 }
5775 #[no_mangle]
5776 /// Creates a new CResult_OutPointDecodeErrorZ in the error state.
5777 pub extern "C" fn CResult_OutPointDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_OutPointDecodeErrorZ {
5778         CResult_OutPointDecodeErrorZ {
5779                 contents: CResult_OutPointDecodeErrorZPtr {
5780                         err: Box::into_raw(Box::new(e)),
5781                 },
5782                 result_ok: false,
5783         }
5784 }
5785 #[no_mangle]
5786 /// Frees any resources used by the CResult_OutPointDecodeErrorZ.
5787 pub extern "C" fn CResult_OutPointDecodeErrorZ_free(_res: CResult_OutPointDecodeErrorZ) { }
5788 impl Drop for CResult_OutPointDecodeErrorZ {
5789         fn drop(&mut self) {
5790                 if self.result_ok {
5791                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
5792                                 let _ = unsafe { Box::from_raw(self.contents.result) };
5793                         }
5794                 } else {
5795                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
5796                                 let _ = unsafe { Box::from_raw(self.contents.err) };
5797                         }
5798                 }
5799         }
5800 }
5801 impl From<crate::c_types::CResultTempl<crate::lightning::chain::transaction::OutPoint, crate::lightning::ln::msgs::DecodeError>> for CResult_OutPointDecodeErrorZ {
5802         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::transaction::OutPoint, crate::lightning::ln::msgs::DecodeError>) -> Self {
5803                 let contents = if o.result_ok {
5804                         let result = unsafe { o.contents.result };
5805                         unsafe { o.contents.result = std::ptr::null_mut() };
5806                         CResult_OutPointDecodeErrorZPtr { result }
5807                 } else {
5808                         let err = unsafe { o.contents.err };
5809                         unsafe { o.contents.err = std::ptr::null_mut(); }
5810                         CResult_OutPointDecodeErrorZPtr { err }
5811                 };
5812                 Self {
5813                         contents,
5814                         result_ok: o.result_ok,
5815                 }
5816         }
5817 }
5818 impl Clone for CResult_OutPointDecodeErrorZ {
5819         fn clone(&self) -> Self {
5820                 if self.result_ok {
5821                         Self { result_ok: true, contents: CResult_OutPointDecodeErrorZPtr {
5822                                 result: Box::into_raw(Box::new(<crate::lightning::chain::transaction::OutPoint>::clone(unsafe { &*self.contents.result })))
5823                         } }
5824                 } else {
5825                         Self { result_ok: false, contents: CResult_OutPointDecodeErrorZPtr {
5826                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
5827                         } }
5828                 }
5829         }
5830 }
5831 #[no_mangle]
5832 /// Creates a new CResult_OutPointDecodeErrorZ which has the same data as `orig`
5833 /// but with all dynamically-allocated buffers duplicated in new buffers.
5834 pub extern "C" fn CResult_OutPointDecodeErrorZ_clone(orig: &CResult_OutPointDecodeErrorZ) -> CResult_OutPointDecodeErrorZ { Clone::clone(&orig) }
5835 #[repr(C)]
5836 /// An enum which can either contain a crate::lightning::ln::wire::Type or not
5837 pub enum COption_TypeZ {
5838         /// When we're in this state, this COption_TypeZ contains a crate::lightning::ln::wire::Type
5839         Some(crate::lightning::ln::wire::Type),
5840         /// When we're in this state, this COption_TypeZ contains nothing
5841         None
5842 }
5843 impl COption_TypeZ {
5844         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
5845                 if let Self::Some(_) = self { true } else { false }
5846         }
5847         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
5848                 !self.is_some()
5849         }
5850         #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::ln::wire::Type {
5851                 if let Self::Some(v) = self { v } else { unreachable!() }
5852         }
5853 }
5854 #[no_mangle]
5855 /// Constructs a new COption_TypeZ containing a crate::lightning::ln::wire::Type
5856 pub extern "C" fn COption_TypeZ_some(o: crate::lightning::ln::wire::Type) -> COption_TypeZ {
5857         COption_TypeZ::Some(o)
5858 }
5859 #[no_mangle]
5860 /// Constructs a new COption_TypeZ containing nothing
5861 pub extern "C" fn COption_TypeZ_none() -> COption_TypeZ {
5862         COption_TypeZ::None
5863 }
5864 #[no_mangle]
5865 /// Frees any resources associated with the crate::lightning::ln::wire::Type, if we are in the Some state
5866 pub extern "C" fn COption_TypeZ_free(_res: COption_TypeZ) { }
5867 #[repr(C)]
5868 /// The contents of CResult_COption_TypeZDecodeErrorZ
5869 pub union CResult_COption_TypeZDecodeErrorZPtr {
5870         /// A pointer to the contents in the success state.
5871         /// Reading from this pointer when `result_ok` is not set is undefined.
5872         pub result: *mut crate::c_types::derived::COption_TypeZ,
5873         /// A pointer to the contents in the error state.
5874         /// Reading from this pointer when `result_ok` is set is undefined.
5875         pub err: *mut crate::lightning::ln::msgs::DecodeError,
5876 }
5877 #[repr(C)]
5878 /// A CResult_COption_TypeZDecodeErrorZ represents the result of a fallible operation,
5879 /// containing a crate::c_types::derived::COption_TypeZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
5880 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5881 pub struct CResult_COption_TypeZDecodeErrorZ {
5882         /// The contents of this CResult_COption_TypeZDecodeErrorZ, accessible via either
5883         /// `err` or `result` depending on the state of `result_ok`.
5884         pub contents: CResult_COption_TypeZDecodeErrorZPtr,
5885         /// Whether this CResult_COption_TypeZDecodeErrorZ represents a success state.
5886         pub result_ok: bool,
5887 }
5888 #[no_mangle]
5889 /// Creates a new CResult_COption_TypeZDecodeErrorZ in the success state.
5890 pub extern "C" fn CResult_COption_TypeZDecodeErrorZ_ok(o: crate::c_types::derived::COption_TypeZ) -> CResult_COption_TypeZDecodeErrorZ {
5891         CResult_COption_TypeZDecodeErrorZ {
5892                 contents: CResult_COption_TypeZDecodeErrorZPtr {
5893                         result: Box::into_raw(Box::new(o)),
5894                 },
5895                 result_ok: true,
5896         }
5897 }
5898 #[no_mangle]
5899 /// Creates a new CResult_COption_TypeZDecodeErrorZ in the error state.
5900 pub extern "C" fn CResult_COption_TypeZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_TypeZDecodeErrorZ {
5901         CResult_COption_TypeZDecodeErrorZ {
5902                 contents: CResult_COption_TypeZDecodeErrorZPtr {
5903                         err: Box::into_raw(Box::new(e)),
5904                 },
5905                 result_ok: false,
5906         }
5907 }
5908 #[no_mangle]
5909 /// Frees any resources used by the CResult_COption_TypeZDecodeErrorZ.
5910 pub extern "C" fn CResult_COption_TypeZDecodeErrorZ_free(_res: CResult_COption_TypeZDecodeErrorZ) { }
5911 impl Drop for CResult_COption_TypeZDecodeErrorZ {
5912         fn drop(&mut self) {
5913                 if self.result_ok {
5914                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
5915                                 let _ = unsafe { Box::from_raw(self.contents.result) };
5916                         }
5917                 } else {
5918                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
5919                                 let _ = unsafe { Box::from_raw(self.contents.err) };
5920                         }
5921                 }
5922         }
5923 }
5924 impl From<crate::c_types::CResultTempl<crate::c_types::derived::COption_TypeZ, crate::lightning::ln::msgs::DecodeError>> for CResult_COption_TypeZDecodeErrorZ {
5925         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::COption_TypeZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
5926                 let contents = if o.result_ok {
5927                         let result = unsafe { o.contents.result };
5928                         unsafe { o.contents.result = std::ptr::null_mut() };
5929                         CResult_COption_TypeZDecodeErrorZPtr { result }
5930                 } else {
5931                         let err = unsafe { o.contents.err };
5932                         unsafe { o.contents.err = std::ptr::null_mut(); }
5933                         CResult_COption_TypeZDecodeErrorZPtr { err }
5934                 };
5935                 Self {
5936                         contents,
5937                         result_ok: o.result_ok,
5938                 }
5939         }
5940 }
5941 #[repr(C)]
5942 /// The contents of CResult_PaymentIdPaymentErrorZ
5943 pub union CResult_PaymentIdPaymentErrorZPtr {
5944         /// A pointer to the contents in the success state.
5945         /// Reading from this pointer when `result_ok` is not set is undefined.
5946         pub result: *mut crate::c_types::ThirtyTwoBytes,
5947         /// A pointer to the contents in the error state.
5948         /// Reading from this pointer when `result_ok` is set is undefined.
5949         pub err: *mut crate::lightning_invoice::payment::PaymentError,
5950 }
5951 #[repr(C)]
5952 /// A CResult_PaymentIdPaymentErrorZ represents the result of a fallible operation,
5953 /// containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning_invoice::payment::PaymentError on failure.
5954 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5955 pub struct CResult_PaymentIdPaymentErrorZ {
5956         /// The contents of this CResult_PaymentIdPaymentErrorZ, accessible via either
5957         /// `err` or `result` depending on the state of `result_ok`.
5958         pub contents: CResult_PaymentIdPaymentErrorZPtr,
5959         /// Whether this CResult_PaymentIdPaymentErrorZ represents a success state.
5960         pub result_ok: bool,
5961 }
5962 #[no_mangle]
5963 /// Creates a new CResult_PaymentIdPaymentErrorZ in the success state.
5964 pub extern "C" fn CResult_PaymentIdPaymentErrorZ_ok(o: crate::c_types::ThirtyTwoBytes) -> CResult_PaymentIdPaymentErrorZ {
5965         CResult_PaymentIdPaymentErrorZ {
5966                 contents: CResult_PaymentIdPaymentErrorZPtr {
5967                         result: Box::into_raw(Box::new(o)),
5968                 },
5969                 result_ok: true,
5970         }
5971 }
5972 #[no_mangle]
5973 /// Creates a new CResult_PaymentIdPaymentErrorZ in the error state.
5974 pub extern "C" fn CResult_PaymentIdPaymentErrorZ_err(e: crate::lightning_invoice::payment::PaymentError) -> CResult_PaymentIdPaymentErrorZ {
5975         CResult_PaymentIdPaymentErrorZ {
5976                 contents: CResult_PaymentIdPaymentErrorZPtr {
5977                         err: Box::into_raw(Box::new(e)),
5978                 },
5979                 result_ok: false,
5980         }
5981 }
5982 #[no_mangle]
5983 /// Frees any resources used by the CResult_PaymentIdPaymentErrorZ.
5984 pub extern "C" fn CResult_PaymentIdPaymentErrorZ_free(_res: CResult_PaymentIdPaymentErrorZ) { }
5985 impl Drop for CResult_PaymentIdPaymentErrorZ {
5986         fn drop(&mut self) {
5987                 if self.result_ok {
5988                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
5989                                 let _ = unsafe { Box::from_raw(self.contents.result) };
5990                         }
5991                 } else {
5992                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
5993                                 let _ = unsafe { Box::from_raw(self.contents.err) };
5994                         }
5995                 }
5996         }
5997 }
5998 impl From<crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning_invoice::payment::PaymentError>> for CResult_PaymentIdPaymentErrorZ {
5999         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning_invoice::payment::PaymentError>) -> Self {
6000                 let contents = if o.result_ok {
6001                         let result = unsafe { o.contents.result };
6002                         unsafe { o.contents.result = std::ptr::null_mut() };
6003                         CResult_PaymentIdPaymentErrorZPtr { result }
6004                 } else {
6005                         let err = unsafe { o.contents.err };
6006                         unsafe { o.contents.err = std::ptr::null_mut(); }
6007                         CResult_PaymentIdPaymentErrorZPtr { err }
6008                 };
6009                 Self {
6010                         contents,
6011                         result_ok: o.result_ok,
6012                 }
6013         }
6014 }
6015 impl Clone for CResult_PaymentIdPaymentErrorZ {
6016         fn clone(&self) -> Self {
6017                 if self.result_ok {
6018                         Self { result_ok: true, contents: CResult_PaymentIdPaymentErrorZPtr {
6019                                 result: Box::into_raw(Box::new(<crate::c_types::ThirtyTwoBytes>::clone(unsafe { &*self.contents.result })))
6020                         } }
6021                 } else {
6022                         Self { result_ok: false, contents: CResult_PaymentIdPaymentErrorZPtr {
6023                                 err: Box::into_raw(Box::new(<crate::lightning_invoice::payment::PaymentError>::clone(unsafe { &*self.contents.err })))
6024                         } }
6025                 }
6026         }
6027 }
6028 #[no_mangle]
6029 /// Creates a new CResult_PaymentIdPaymentErrorZ which has the same data as `orig`
6030 /// but with all dynamically-allocated buffers duplicated in new buffers.
6031 pub extern "C" fn CResult_PaymentIdPaymentErrorZ_clone(orig: &CResult_PaymentIdPaymentErrorZ) -> CResult_PaymentIdPaymentErrorZ { Clone::clone(&orig) }
6032 #[repr(C)]
6033 /// The contents of CResult_SiPrefixNoneZ
6034 pub union CResult_SiPrefixNoneZPtr {
6035         /// A pointer to the contents in the success state.
6036         /// Reading from this pointer when `result_ok` is not set is undefined.
6037         pub result: *mut crate::lightning_invoice::SiPrefix,
6038         /// Note that this value is always NULL, as there are no contents in the Err variant
6039         pub err: *mut std::ffi::c_void,
6040 }
6041 #[repr(C)]
6042 /// A CResult_SiPrefixNoneZ represents the result of a fallible operation,
6043 /// containing a crate::lightning_invoice::SiPrefix on success and a () on failure.
6044 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6045 pub struct CResult_SiPrefixNoneZ {
6046         /// The contents of this CResult_SiPrefixNoneZ, accessible via either
6047         /// `err` or `result` depending on the state of `result_ok`.
6048         pub contents: CResult_SiPrefixNoneZPtr,
6049         /// Whether this CResult_SiPrefixNoneZ represents a success state.
6050         pub result_ok: bool,
6051 }
6052 #[no_mangle]
6053 /// Creates a new CResult_SiPrefixNoneZ in the success state.
6054 pub extern "C" fn CResult_SiPrefixNoneZ_ok(o: crate::lightning_invoice::SiPrefix) -> CResult_SiPrefixNoneZ {
6055         CResult_SiPrefixNoneZ {
6056                 contents: CResult_SiPrefixNoneZPtr {
6057                         result: Box::into_raw(Box::new(o)),
6058                 },
6059                 result_ok: true,
6060         }
6061 }
6062 #[no_mangle]
6063 /// Creates a new CResult_SiPrefixNoneZ in the error state.
6064 pub extern "C" fn CResult_SiPrefixNoneZ_err() -> CResult_SiPrefixNoneZ {
6065         CResult_SiPrefixNoneZ {
6066                 contents: CResult_SiPrefixNoneZPtr {
6067                         err: std::ptr::null_mut(),
6068                 },
6069                 result_ok: false,
6070         }
6071 }
6072 #[no_mangle]
6073 /// Frees any resources used by the CResult_SiPrefixNoneZ.
6074 pub extern "C" fn CResult_SiPrefixNoneZ_free(_res: CResult_SiPrefixNoneZ) { }
6075 impl Drop for CResult_SiPrefixNoneZ {
6076         fn drop(&mut self) {
6077                 if self.result_ok {
6078                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
6079                                 let _ = unsafe { Box::from_raw(self.contents.result) };
6080                         }
6081                 } else {
6082                 }
6083         }
6084 }
6085 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::SiPrefix, ()>> for CResult_SiPrefixNoneZ {
6086         fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::SiPrefix, ()>) -> Self {
6087                 let contents = if o.result_ok {
6088                         let result = unsafe { o.contents.result };
6089                         unsafe { o.contents.result = std::ptr::null_mut() };
6090                         CResult_SiPrefixNoneZPtr { result }
6091                 } else {
6092                         let _ = unsafe { Box::from_raw(o.contents.err) };
6093                         o.contents.err = std::ptr::null_mut();
6094                         CResult_SiPrefixNoneZPtr { err: std::ptr::null_mut() }
6095                 };
6096                 Self {
6097                         contents,
6098                         result_ok: o.result_ok,
6099                 }
6100         }
6101 }
6102 impl Clone for CResult_SiPrefixNoneZ {
6103         fn clone(&self) -> Self {
6104                 if self.result_ok {
6105                         Self { result_ok: true, contents: CResult_SiPrefixNoneZPtr {
6106                                 result: Box::into_raw(Box::new(<crate::lightning_invoice::SiPrefix>::clone(unsafe { &*self.contents.result })))
6107                         } }
6108                 } else {
6109                         Self { result_ok: false, contents: CResult_SiPrefixNoneZPtr {
6110                                 err: std::ptr::null_mut()
6111                         } }
6112                 }
6113         }
6114 }
6115 #[no_mangle]
6116 /// Creates a new CResult_SiPrefixNoneZ which has the same data as `orig`
6117 /// but with all dynamically-allocated buffers duplicated in new buffers.
6118 pub extern "C" fn CResult_SiPrefixNoneZ_clone(orig: &CResult_SiPrefixNoneZ) -> CResult_SiPrefixNoneZ { Clone::clone(&orig) }
6119 #[repr(C)]
6120 /// The contents of CResult_InvoiceNoneZ
6121 pub union CResult_InvoiceNoneZPtr {
6122         /// A pointer to the contents in the success state.
6123         /// Reading from this pointer when `result_ok` is not set is undefined.
6124         pub result: *mut crate::lightning_invoice::Invoice,
6125         /// Note that this value is always NULL, as there are no contents in the Err variant
6126         pub err: *mut std::ffi::c_void,
6127 }
6128 #[repr(C)]
6129 /// A CResult_InvoiceNoneZ represents the result of a fallible operation,
6130 /// containing a crate::lightning_invoice::Invoice on success and a () on failure.
6131 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6132 pub struct CResult_InvoiceNoneZ {
6133         /// The contents of this CResult_InvoiceNoneZ, accessible via either
6134         /// `err` or `result` depending on the state of `result_ok`.
6135         pub contents: CResult_InvoiceNoneZPtr,
6136         /// Whether this CResult_InvoiceNoneZ represents a success state.
6137         pub result_ok: bool,
6138 }
6139 #[no_mangle]
6140 /// Creates a new CResult_InvoiceNoneZ in the success state.
6141 pub extern "C" fn CResult_InvoiceNoneZ_ok(o: crate::lightning_invoice::Invoice) -> CResult_InvoiceNoneZ {
6142         CResult_InvoiceNoneZ {
6143                 contents: CResult_InvoiceNoneZPtr {
6144                         result: Box::into_raw(Box::new(o)),
6145                 },
6146                 result_ok: true,
6147         }
6148 }
6149 #[no_mangle]
6150 /// Creates a new CResult_InvoiceNoneZ in the error state.
6151 pub extern "C" fn CResult_InvoiceNoneZ_err() -> CResult_InvoiceNoneZ {
6152         CResult_InvoiceNoneZ {
6153                 contents: CResult_InvoiceNoneZPtr {
6154                         err: std::ptr::null_mut(),
6155                 },
6156                 result_ok: false,
6157         }
6158 }
6159 #[no_mangle]
6160 /// Frees any resources used by the CResult_InvoiceNoneZ.
6161 pub extern "C" fn CResult_InvoiceNoneZ_free(_res: CResult_InvoiceNoneZ) { }
6162 impl Drop for CResult_InvoiceNoneZ {
6163         fn drop(&mut self) {
6164                 if self.result_ok {
6165                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
6166                                 let _ = unsafe { Box::from_raw(self.contents.result) };
6167                         }
6168                 } else {
6169                 }
6170         }
6171 }
6172 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::Invoice, ()>> for CResult_InvoiceNoneZ {
6173         fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::Invoice, ()>) -> Self {
6174                 let contents = if o.result_ok {
6175                         let result = unsafe { o.contents.result };
6176                         unsafe { o.contents.result = std::ptr::null_mut() };
6177                         CResult_InvoiceNoneZPtr { result }
6178                 } else {
6179                         let _ = unsafe { Box::from_raw(o.contents.err) };
6180                         o.contents.err = std::ptr::null_mut();
6181                         CResult_InvoiceNoneZPtr { err: std::ptr::null_mut() }
6182                 };
6183                 Self {
6184                         contents,
6185                         result_ok: o.result_ok,
6186                 }
6187         }
6188 }
6189 impl Clone for CResult_InvoiceNoneZ {
6190         fn clone(&self) -> Self {
6191                 if self.result_ok {
6192                         Self { result_ok: true, contents: CResult_InvoiceNoneZPtr {
6193                                 result: Box::into_raw(Box::new(<crate::lightning_invoice::Invoice>::clone(unsafe { &*self.contents.result })))
6194                         } }
6195                 } else {
6196                         Self { result_ok: false, contents: CResult_InvoiceNoneZPtr {
6197                                 err: std::ptr::null_mut()
6198                         } }
6199                 }
6200         }
6201 }
6202 #[no_mangle]
6203 /// Creates a new CResult_InvoiceNoneZ which has the same data as `orig`
6204 /// but with all dynamically-allocated buffers duplicated in new buffers.
6205 pub extern "C" fn CResult_InvoiceNoneZ_clone(orig: &CResult_InvoiceNoneZ) -> CResult_InvoiceNoneZ { Clone::clone(&orig) }
6206 #[repr(C)]
6207 /// The contents of CResult_SignedRawInvoiceNoneZ
6208 pub union CResult_SignedRawInvoiceNoneZPtr {
6209         /// A pointer to the contents in the success state.
6210         /// Reading from this pointer when `result_ok` is not set is undefined.
6211         pub result: *mut crate::lightning_invoice::SignedRawInvoice,
6212         /// Note that this value is always NULL, as there are no contents in the Err variant
6213         pub err: *mut std::ffi::c_void,
6214 }
6215 #[repr(C)]
6216 /// A CResult_SignedRawInvoiceNoneZ represents the result of a fallible operation,
6217 /// containing a crate::lightning_invoice::SignedRawInvoice on success and a () on failure.
6218 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6219 pub struct CResult_SignedRawInvoiceNoneZ {
6220         /// The contents of this CResult_SignedRawInvoiceNoneZ, accessible via either
6221         /// `err` or `result` depending on the state of `result_ok`.
6222         pub contents: CResult_SignedRawInvoiceNoneZPtr,
6223         /// Whether this CResult_SignedRawInvoiceNoneZ represents a success state.
6224         pub result_ok: bool,
6225 }
6226 #[no_mangle]
6227 /// Creates a new CResult_SignedRawInvoiceNoneZ in the success state.
6228 pub extern "C" fn CResult_SignedRawInvoiceNoneZ_ok(o: crate::lightning_invoice::SignedRawInvoice) -> CResult_SignedRawInvoiceNoneZ {
6229         CResult_SignedRawInvoiceNoneZ {
6230                 contents: CResult_SignedRawInvoiceNoneZPtr {
6231                         result: Box::into_raw(Box::new(o)),
6232                 },
6233                 result_ok: true,
6234         }
6235 }
6236 #[no_mangle]
6237 /// Creates a new CResult_SignedRawInvoiceNoneZ in the error state.
6238 pub extern "C" fn CResult_SignedRawInvoiceNoneZ_err() -> CResult_SignedRawInvoiceNoneZ {
6239         CResult_SignedRawInvoiceNoneZ {
6240                 contents: CResult_SignedRawInvoiceNoneZPtr {
6241                         err: std::ptr::null_mut(),
6242                 },
6243                 result_ok: false,
6244         }
6245 }
6246 #[no_mangle]
6247 /// Frees any resources used by the CResult_SignedRawInvoiceNoneZ.
6248 pub extern "C" fn CResult_SignedRawInvoiceNoneZ_free(_res: CResult_SignedRawInvoiceNoneZ) { }
6249 impl Drop for CResult_SignedRawInvoiceNoneZ {
6250         fn drop(&mut self) {
6251                 if self.result_ok {
6252                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
6253                                 let _ = unsafe { Box::from_raw(self.contents.result) };
6254                         }
6255                 } else {
6256                 }
6257         }
6258 }
6259 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::SignedRawInvoice, ()>> for CResult_SignedRawInvoiceNoneZ {
6260         fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::SignedRawInvoice, ()>) -> Self {
6261                 let contents = if o.result_ok {
6262                         let result = unsafe { o.contents.result };
6263                         unsafe { o.contents.result = std::ptr::null_mut() };
6264                         CResult_SignedRawInvoiceNoneZPtr { result }
6265                 } else {
6266                         let _ = unsafe { Box::from_raw(o.contents.err) };
6267                         o.contents.err = std::ptr::null_mut();
6268                         CResult_SignedRawInvoiceNoneZPtr { err: std::ptr::null_mut() }
6269                 };
6270                 Self {
6271                         contents,
6272                         result_ok: o.result_ok,
6273                 }
6274         }
6275 }
6276 impl Clone for CResult_SignedRawInvoiceNoneZ {
6277         fn clone(&self) -> Self {
6278                 if self.result_ok {
6279                         Self { result_ok: true, contents: CResult_SignedRawInvoiceNoneZPtr {
6280                                 result: Box::into_raw(Box::new(<crate::lightning_invoice::SignedRawInvoice>::clone(unsafe { &*self.contents.result })))
6281                         } }
6282                 } else {
6283                         Self { result_ok: false, contents: CResult_SignedRawInvoiceNoneZPtr {
6284                                 err: std::ptr::null_mut()
6285                         } }
6286                 }
6287         }
6288 }
6289 #[no_mangle]
6290 /// Creates a new CResult_SignedRawInvoiceNoneZ which has the same data as `orig`
6291 /// but with all dynamically-allocated buffers duplicated in new buffers.
6292 pub extern "C" fn CResult_SignedRawInvoiceNoneZ_clone(orig: &CResult_SignedRawInvoiceNoneZ) -> CResult_SignedRawInvoiceNoneZ { Clone::clone(&orig) }
6293 #[repr(C)]
6294 /// A tuple of 3 elements. See the individual fields for the types contained.
6295 pub struct C3Tuple_RawInvoice_u832InvoiceSignatureZ {
6296         /// The element at position 0
6297         pub a: crate::lightning_invoice::RawInvoice,
6298         /// The element at position 1
6299         pub b: crate::c_types::ThirtyTwoBytes,
6300         /// The element at position 2
6301         pub c: crate::lightning_invoice::InvoiceSignature,
6302 }
6303 impl From<(crate::lightning_invoice::RawInvoice, crate::c_types::ThirtyTwoBytes, crate::lightning_invoice::InvoiceSignature)> for C3Tuple_RawInvoice_u832InvoiceSignatureZ {
6304         fn from (tup: (crate::lightning_invoice::RawInvoice, crate::c_types::ThirtyTwoBytes, crate::lightning_invoice::InvoiceSignature)) -> Self {
6305                 Self {
6306                         a: tup.0,
6307                         b: tup.1,
6308                         c: tup.2,
6309                 }
6310         }
6311 }
6312 impl C3Tuple_RawInvoice_u832InvoiceSignatureZ {
6313         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::lightning_invoice::RawInvoice, crate::c_types::ThirtyTwoBytes, crate::lightning_invoice::InvoiceSignature) {
6314                 (self.a, self.b, self.c)
6315         }
6316 }
6317 impl Clone for C3Tuple_RawInvoice_u832InvoiceSignatureZ {
6318         fn clone(&self) -> Self {
6319                 Self {
6320                         a: Clone::clone(&self.a),
6321                         b: Clone::clone(&self.b),
6322                         c: Clone::clone(&self.c),
6323                 }
6324         }
6325 }
6326 #[no_mangle]
6327 /// Creates a new tuple which has the same data as `orig`
6328 /// but with all dynamically-allocated buffers duplicated in new buffers.
6329 pub extern "C" fn C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone(orig: &C3Tuple_RawInvoice_u832InvoiceSignatureZ) -> C3Tuple_RawInvoice_u832InvoiceSignatureZ { Clone::clone(&orig) }
6330 /// Creates a new C3Tuple_RawInvoice_u832InvoiceSignatureZ from the contained elements.
6331 #[no_mangle]
6332 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 {
6333         C3Tuple_RawInvoice_u832InvoiceSignatureZ { a, b, c, }
6334 }
6335
6336 #[no_mangle]
6337 /// Frees any resources used by the C3Tuple_RawInvoice_u832InvoiceSignatureZ.
6338 pub extern "C" fn C3Tuple_RawInvoice_u832InvoiceSignatureZ_free(_res: C3Tuple_RawInvoice_u832InvoiceSignatureZ) { }
6339 #[repr(C)]
6340 /// The contents of CResult_PayeePubKeyErrorZ
6341 pub union CResult_PayeePubKeyErrorZPtr {
6342         /// A pointer to the contents in the success state.
6343         /// Reading from this pointer when `result_ok` is not set is undefined.
6344         pub result: *mut crate::lightning_invoice::PayeePubKey,
6345         /// A pointer to the contents in the error state.
6346         /// Reading from this pointer when `result_ok` is set is undefined.
6347         pub err: *mut crate::c_types::Secp256k1Error,
6348 }
6349 #[repr(C)]
6350 /// A CResult_PayeePubKeyErrorZ represents the result of a fallible operation,
6351 /// containing a crate::lightning_invoice::PayeePubKey on success and a crate::c_types::Secp256k1Error on failure.
6352 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6353 pub struct CResult_PayeePubKeyErrorZ {
6354         /// The contents of this CResult_PayeePubKeyErrorZ, accessible via either
6355         /// `err` or `result` depending on the state of `result_ok`.
6356         pub contents: CResult_PayeePubKeyErrorZPtr,
6357         /// Whether this CResult_PayeePubKeyErrorZ represents a success state.
6358         pub result_ok: bool,
6359 }
6360 #[no_mangle]
6361 /// Creates a new CResult_PayeePubKeyErrorZ in the success state.
6362 pub extern "C" fn CResult_PayeePubKeyErrorZ_ok(o: crate::lightning_invoice::PayeePubKey) -> CResult_PayeePubKeyErrorZ {
6363         CResult_PayeePubKeyErrorZ {
6364                 contents: CResult_PayeePubKeyErrorZPtr {
6365                         result: Box::into_raw(Box::new(o)),
6366                 },
6367                 result_ok: true,
6368         }
6369 }
6370 #[no_mangle]
6371 /// Creates a new CResult_PayeePubKeyErrorZ in the error state.
6372 pub extern "C" fn CResult_PayeePubKeyErrorZ_err(e: crate::c_types::Secp256k1Error) -> CResult_PayeePubKeyErrorZ {
6373         CResult_PayeePubKeyErrorZ {
6374                 contents: CResult_PayeePubKeyErrorZPtr {
6375                         err: Box::into_raw(Box::new(e)),
6376                 },
6377                 result_ok: false,
6378         }
6379 }
6380 #[no_mangle]
6381 /// Frees any resources used by the CResult_PayeePubKeyErrorZ.
6382 pub extern "C" fn CResult_PayeePubKeyErrorZ_free(_res: CResult_PayeePubKeyErrorZ) { }
6383 impl Drop for CResult_PayeePubKeyErrorZ {
6384         fn drop(&mut self) {
6385                 if self.result_ok {
6386                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
6387                                 let _ = unsafe { Box::from_raw(self.contents.result) };
6388                         }
6389                 } else {
6390                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
6391                                 let _ = unsafe { Box::from_raw(self.contents.err) };
6392                         }
6393                 }
6394         }
6395 }
6396 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::PayeePubKey, crate::c_types::Secp256k1Error>> for CResult_PayeePubKeyErrorZ {
6397         fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::PayeePubKey, crate::c_types::Secp256k1Error>) -> Self {
6398                 let contents = if o.result_ok {
6399                         let result = unsafe { o.contents.result };
6400                         unsafe { o.contents.result = std::ptr::null_mut() };
6401                         CResult_PayeePubKeyErrorZPtr { result }
6402                 } else {
6403                         let err = unsafe { o.contents.err };
6404                         unsafe { o.contents.err = std::ptr::null_mut(); }
6405                         CResult_PayeePubKeyErrorZPtr { err }
6406                 };
6407                 Self {
6408                         contents,
6409                         result_ok: o.result_ok,
6410                 }
6411         }
6412 }
6413 impl Clone for CResult_PayeePubKeyErrorZ {
6414         fn clone(&self) -> Self {
6415                 if self.result_ok {
6416                         Self { result_ok: true, contents: CResult_PayeePubKeyErrorZPtr {
6417                                 result: Box::into_raw(Box::new(<crate::lightning_invoice::PayeePubKey>::clone(unsafe { &*self.contents.result })))
6418                         } }
6419                 } else {
6420                         Self { result_ok: false, contents: CResult_PayeePubKeyErrorZPtr {
6421                                 err: Box::into_raw(Box::new(<crate::c_types::Secp256k1Error>::clone(unsafe { &*self.contents.err })))
6422                         } }
6423                 }
6424         }
6425 }
6426 #[no_mangle]
6427 /// Creates a new CResult_PayeePubKeyErrorZ which has the same data as `orig`
6428 /// but with all dynamically-allocated buffers duplicated in new buffers.
6429 pub extern "C" fn CResult_PayeePubKeyErrorZ_clone(orig: &CResult_PayeePubKeyErrorZ) -> CResult_PayeePubKeyErrorZ { Clone::clone(&orig) }
6430 #[repr(C)]
6431 /// A dynamically-allocated array of crate::lightning_invoice::PrivateRoutes of arbitrary size.
6432 /// This corresponds to std::vector in C++
6433 pub struct CVec_PrivateRouteZ {
6434         /// The elements in the array.
6435         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
6436         pub data: *mut crate::lightning_invoice::PrivateRoute,
6437         /// The number of elements pointed to by `data`.
6438         pub datalen: usize
6439 }
6440 impl CVec_PrivateRouteZ {
6441         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning_invoice::PrivateRoute> {
6442                 if self.datalen == 0 { return Vec::new(); }
6443                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
6444                 self.data = std::ptr::null_mut();
6445                 self.datalen = 0;
6446                 ret
6447         }
6448         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning_invoice::PrivateRoute] {
6449                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
6450         }
6451 }
6452 impl From<Vec<crate::lightning_invoice::PrivateRoute>> for CVec_PrivateRouteZ {
6453         fn from(v: Vec<crate::lightning_invoice::PrivateRoute>) -> Self {
6454                 let datalen = v.len();
6455                 let data = Box::into_raw(v.into_boxed_slice());
6456                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
6457         }
6458 }
6459 #[no_mangle]
6460 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
6461 pub extern "C" fn CVec_PrivateRouteZ_free(_res: CVec_PrivateRouteZ) { }
6462 impl Drop for CVec_PrivateRouteZ {
6463         fn drop(&mut self) {
6464                 if self.datalen == 0 { return; }
6465                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
6466         }
6467 }
6468 impl Clone for CVec_PrivateRouteZ {
6469         fn clone(&self) -> Self {
6470                 let mut res = Vec::new();
6471                 if self.datalen == 0 { return Self::from(res); }
6472                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
6473                 Self::from(res)
6474         }
6475 }
6476 #[repr(C)]
6477 /// The contents of CResult_PositiveTimestampCreationErrorZ
6478 pub union CResult_PositiveTimestampCreationErrorZPtr {
6479         /// A pointer to the contents in the success state.
6480         /// Reading from this pointer when `result_ok` is not set is undefined.
6481         pub result: *mut crate::lightning_invoice::PositiveTimestamp,
6482         /// A pointer to the contents in the error state.
6483         /// Reading from this pointer when `result_ok` is set is undefined.
6484         pub err: *mut crate::lightning_invoice::CreationError,
6485 }
6486 #[repr(C)]
6487 /// A CResult_PositiveTimestampCreationErrorZ represents the result of a fallible operation,
6488 /// containing a crate::lightning_invoice::PositiveTimestamp on success and a crate::lightning_invoice::CreationError on failure.
6489 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6490 pub struct CResult_PositiveTimestampCreationErrorZ {
6491         /// The contents of this CResult_PositiveTimestampCreationErrorZ, accessible via either
6492         /// `err` or `result` depending on the state of `result_ok`.
6493         pub contents: CResult_PositiveTimestampCreationErrorZPtr,
6494         /// Whether this CResult_PositiveTimestampCreationErrorZ represents a success state.
6495         pub result_ok: bool,
6496 }
6497 #[no_mangle]
6498 /// Creates a new CResult_PositiveTimestampCreationErrorZ in the success state.
6499 pub extern "C" fn CResult_PositiveTimestampCreationErrorZ_ok(o: crate::lightning_invoice::PositiveTimestamp) -> CResult_PositiveTimestampCreationErrorZ {
6500         CResult_PositiveTimestampCreationErrorZ {
6501                 contents: CResult_PositiveTimestampCreationErrorZPtr {
6502                         result: Box::into_raw(Box::new(o)),
6503                 },
6504                 result_ok: true,
6505         }
6506 }
6507 #[no_mangle]
6508 /// Creates a new CResult_PositiveTimestampCreationErrorZ in the error state.
6509 pub extern "C" fn CResult_PositiveTimestampCreationErrorZ_err(e: crate::lightning_invoice::CreationError) -> CResult_PositiveTimestampCreationErrorZ {
6510         CResult_PositiveTimestampCreationErrorZ {
6511                 contents: CResult_PositiveTimestampCreationErrorZPtr {
6512                         err: Box::into_raw(Box::new(e)),
6513                 },
6514                 result_ok: false,
6515         }
6516 }
6517 #[no_mangle]
6518 /// Frees any resources used by the CResult_PositiveTimestampCreationErrorZ.
6519 pub extern "C" fn CResult_PositiveTimestampCreationErrorZ_free(_res: CResult_PositiveTimestampCreationErrorZ) { }
6520 impl Drop for CResult_PositiveTimestampCreationErrorZ {
6521         fn drop(&mut self) {
6522                 if self.result_ok {
6523                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
6524                                 let _ = unsafe { Box::from_raw(self.contents.result) };
6525                         }
6526                 } else {
6527                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
6528                                 let _ = unsafe { Box::from_raw(self.contents.err) };
6529                         }
6530                 }
6531         }
6532 }
6533 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::PositiveTimestamp, crate::lightning_invoice::CreationError>> for CResult_PositiveTimestampCreationErrorZ {
6534         fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::PositiveTimestamp, crate::lightning_invoice::CreationError>) -> Self {
6535                 let contents = if o.result_ok {
6536                         let result = unsafe { o.contents.result };
6537                         unsafe { o.contents.result = std::ptr::null_mut() };
6538                         CResult_PositiveTimestampCreationErrorZPtr { result }
6539                 } else {
6540                         let err = unsafe { o.contents.err };
6541                         unsafe { o.contents.err = std::ptr::null_mut(); }
6542                         CResult_PositiveTimestampCreationErrorZPtr { err }
6543                 };
6544                 Self {
6545                         contents,
6546                         result_ok: o.result_ok,
6547                 }
6548         }
6549 }
6550 impl Clone for CResult_PositiveTimestampCreationErrorZ {
6551         fn clone(&self) -> Self {
6552                 if self.result_ok {
6553                         Self { result_ok: true, contents: CResult_PositiveTimestampCreationErrorZPtr {
6554                                 result: Box::into_raw(Box::new(<crate::lightning_invoice::PositiveTimestamp>::clone(unsafe { &*self.contents.result })))
6555                         } }
6556                 } else {
6557                         Self { result_ok: false, contents: CResult_PositiveTimestampCreationErrorZPtr {
6558                                 err: Box::into_raw(Box::new(<crate::lightning_invoice::CreationError>::clone(unsafe { &*self.contents.err })))
6559                         } }
6560                 }
6561         }
6562 }
6563 #[no_mangle]
6564 /// Creates a new CResult_PositiveTimestampCreationErrorZ which has the same data as `orig`
6565 /// but with all dynamically-allocated buffers duplicated in new buffers.
6566 pub extern "C" fn CResult_PositiveTimestampCreationErrorZ_clone(orig: &CResult_PositiveTimestampCreationErrorZ) -> CResult_PositiveTimestampCreationErrorZ { Clone::clone(&orig) }
6567 #[repr(C)]
6568 /// The contents of CResult_NoneSemanticErrorZ
6569 pub union CResult_NoneSemanticErrorZPtr {
6570         /// Note that this value is always NULL, as there are no contents in the OK variant
6571         pub result: *mut std::ffi::c_void,
6572         /// A pointer to the contents in the error state.
6573         /// Reading from this pointer when `result_ok` is set is undefined.
6574         pub err: *mut crate::lightning_invoice::SemanticError,
6575 }
6576 #[repr(C)]
6577 /// A CResult_NoneSemanticErrorZ represents the result of a fallible operation,
6578 /// containing a () on success and a crate::lightning_invoice::SemanticError on failure.
6579 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6580 pub struct CResult_NoneSemanticErrorZ {
6581         /// The contents of this CResult_NoneSemanticErrorZ, accessible via either
6582         /// `err` or `result` depending on the state of `result_ok`.
6583         pub contents: CResult_NoneSemanticErrorZPtr,
6584         /// Whether this CResult_NoneSemanticErrorZ represents a success state.
6585         pub result_ok: bool,
6586 }
6587 #[no_mangle]
6588 /// Creates a new CResult_NoneSemanticErrorZ in the success state.
6589 pub extern "C" fn CResult_NoneSemanticErrorZ_ok() -> CResult_NoneSemanticErrorZ {
6590         CResult_NoneSemanticErrorZ {
6591                 contents: CResult_NoneSemanticErrorZPtr {
6592                         result: std::ptr::null_mut(),
6593                 },
6594                 result_ok: true,
6595         }
6596 }
6597 #[no_mangle]
6598 /// Creates a new CResult_NoneSemanticErrorZ in the error state.
6599 pub extern "C" fn CResult_NoneSemanticErrorZ_err(e: crate::lightning_invoice::SemanticError) -> CResult_NoneSemanticErrorZ {
6600         CResult_NoneSemanticErrorZ {
6601                 contents: CResult_NoneSemanticErrorZPtr {
6602                         err: Box::into_raw(Box::new(e)),
6603                 },
6604                 result_ok: false,
6605         }
6606 }
6607 #[no_mangle]
6608 /// Frees any resources used by the CResult_NoneSemanticErrorZ.
6609 pub extern "C" fn CResult_NoneSemanticErrorZ_free(_res: CResult_NoneSemanticErrorZ) { }
6610 impl Drop for CResult_NoneSemanticErrorZ {
6611         fn drop(&mut self) {
6612                 if self.result_ok {
6613                 } else {
6614                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
6615                                 let _ = unsafe { Box::from_raw(self.contents.err) };
6616                         }
6617                 }
6618         }
6619 }
6620 impl From<crate::c_types::CResultTempl<(), crate::lightning_invoice::SemanticError>> for CResult_NoneSemanticErrorZ {
6621         fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning_invoice::SemanticError>) -> Self {
6622                 let contents = if o.result_ok {
6623                         let _ = unsafe { Box::from_raw(o.contents.result) };
6624                         o.contents.result = std::ptr::null_mut();
6625                         CResult_NoneSemanticErrorZPtr { result: std::ptr::null_mut() }
6626                 } else {
6627                         let err = unsafe { o.contents.err };
6628                         unsafe { o.contents.err = std::ptr::null_mut(); }
6629                         CResult_NoneSemanticErrorZPtr { err }
6630                 };
6631                 Self {
6632                         contents,
6633                         result_ok: o.result_ok,
6634                 }
6635         }
6636 }
6637 impl Clone for CResult_NoneSemanticErrorZ {
6638         fn clone(&self) -> Self {
6639                 if self.result_ok {
6640                         Self { result_ok: true, contents: CResult_NoneSemanticErrorZPtr {
6641                                 result: std::ptr::null_mut()
6642                         } }
6643                 } else {
6644                         Self { result_ok: false, contents: CResult_NoneSemanticErrorZPtr {
6645                                 err: Box::into_raw(Box::new(<crate::lightning_invoice::SemanticError>::clone(unsafe { &*self.contents.err })))
6646                         } }
6647                 }
6648         }
6649 }
6650 #[no_mangle]
6651 /// Creates a new CResult_NoneSemanticErrorZ which has the same data as `orig`
6652 /// but with all dynamically-allocated buffers duplicated in new buffers.
6653 pub extern "C" fn CResult_NoneSemanticErrorZ_clone(orig: &CResult_NoneSemanticErrorZ) -> CResult_NoneSemanticErrorZ { Clone::clone(&orig) }
6654 #[repr(C)]
6655 /// The contents of CResult_InvoiceSemanticErrorZ
6656 pub union CResult_InvoiceSemanticErrorZPtr {
6657         /// A pointer to the contents in the success state.
6658         /// Reading from this pointer when `result_ok` is not set is undefined.
6659         pub result: *mut crate::lightning_invoice::Invoice,
6660         /// A pointer to the contents in the error state.
6661         /// Reading from this pointer when `result_ok` is set is undefined.
6662         pub err: *mut crate::lightning_invoice::SemanticError,
6663 }
6664 #[repr(C)]
6665 /// A CResult_InvoiceSemanticErrorZ represents the result of a fallible operation,
6666 /// containing a crate::lightning_invoice::Invoice on success and a crate::lightning_invoice::SemanticError on failure.
6667 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6668 pub struct CResult_InvoiceSemanticErrorZ {
6669         /// The contents of this CResult_InvoiceSemanticErrorZ, accessible via either
6670         /// `err` or `result` depending on the state of `result_ok`.
6671         pub contents: CResult_InvoiceSemanticErrorZPtr,
6672         /// Whether this CResult_InvoiceSemanticErrorZ represents a success state.
6673         pub result_ok: bool,
6674 }
6675 #[no_mangle]
6676 /// Creates a new CResult_InvoiceSemanticErrorZ in the success state.
6677 pub extern "C" fn CResult_InvoiceSemanticErrorZ_ok(o: crate::lightning_invoice::Invoice) -> CResult_InvoiceSemanticErrorZ {
6678         CResult_InvoiceSemanticErrorZ {
6679                 contents: CResult_InvoiceSemanticErrorZPtr {
6680                         result: Box::into_raw(Box::new(o)),
6681                 },
6682                 result_ok: true,
6683         }
6684 }
6685 #[no_mangle]
6686 /// Creates a new CResult_InvoiceSemanticErrorZ in the error state.
6687 pub extern "C" fn CResult_InvoiceSemanticErrorZ_err(e: crate::lightning_invoice::SemanticError) -> CResult_InvoiceSemanticErrorZ {
6688         CResult_InvoiceSemanticErrorZ {
6689                 contents: CResult_InvoiceSemanticErrorZPtr {
6690                         err: Box::into_raw(Box::new(e)),
6691                 },
6692                 result_ok: false,
6693         }
6694 }
6695 #[no_mangle]
6696 /// Frees any resources used by the CResult_InvoiceSemanticErrorZ.
6697 pub extern "C" fn CResult_InvoiceSemanticErrorZ_free(_res: CResult_InvoiceSemanticErrorZ) { }
6698 impl Drop for CResult_InvoiceSemanticErrorZ {
6699         fn drop(&mut self) {
6700                 if self.result_ok {
6701                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
6702                                 let _ = unsafe { Box::from_raw(self.contents.result) };
6703                         }
6704                 } else {
6705                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
6706                                 let _ = unsafe { Box::from_raw(self.contents.err) };
6707                         }
6708                 }
6709         }
6710 }
6711 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::Invoice, crate::lightning_invoice::SemanticError>> for CResult_InvoiceSemanticErrorZ {
6712         fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::Invoice, crate::lightning_invoice::SemanticError>) -> Self {
6713                 let contents = if o.result_ok {
6714                         let result = unsafe { o.contents.result };
6715                         unsafe { o.contents.result = std::ptr::null_mut() };
6716                         CResult_InvoiceSemanticErrorZPtr { result }
6717                 } else {
6718                         let err = unsafe { o.contents.err };
6719                         unsafe { o.contents.err = std::ptr::null_mut(); }
6720                         CResult_InvoiceSemanticErrorZPtr { err }
6721                 };
6722                 Self {
6723                         contents,
6724                         result_ok: o.result_ok,
6725                 }
6726         }
6727 }
6728 impl Clone for CResult_InvoiceSemanticErrorZ {
6729         fn clone(&self) -> Self {
6730                 if self.result_ok {
6731                         Self { result_ok: true, contents: CResult_InvoiceSemanticErrorZPtr {
6732                                 result: Box::into_raw(Box::new(<crate::lightning_invoice::Invoice>::clone(unsafe { &*self.contents.result })))
6733                         } }
6734                 } else {
6735                         Self { result_ok: false, contents: CResult_InvoiceSemanticErrorZPtr {
6736                                 err: Box::into_raw(Box::new(<crate::lightning_invoice::SemanticError>::clone(unsafe { &*self.contents.err })))
6737                         } }
6738                 }
6739         }
6740 }
6741 #[no_mangle]
6742 /// Creates a new CResult_InvoiceSemanticErrorZ which has the same data as `orig`
6743 /// but with all dynamically-allocated buffers duplicated in new buffers.
6744 pub extern "C" fn CResult_InvoiceSemanticErrorZ_clone(orig: &CResult_InvoiceSemanticErrorZ) -> CResult_InvoiceSemanticErrorZ { Clone::clone(&orig) }
6745 #[repr(C)]
6746 /// The contents of CResult_DescriptionCreationErrorZ
6747 pub union CResult_DescriptionCreationErrorZPtr {
6748         /// A pointer to the contents in the success state.
6749         /// Reading from this pointer when `result_ok` is not set is undefined.
6750         pub result: *mut crate::lightning_invoice::Description,
6751         /// A pointer to the contents in the error state.
6752         /// Reading from this pointer when `result_ok` is set is undefined.
6753         pub err: *mut crate::lightning_invoice::CreationError,
6754 }
6755 #[repr(C)]
6756 /// A CResult_DescriptionCreationErrorZ represents the result of a fallible operation,
6757 /// containing a crate::lightning_invoice::Description on success and a crate::lightning_invoice::CreationError on failure.
6758 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6759 pub struct CResult_DescriptionCreationErrorZ {
6760         /// The contents of this CResult_DescriptionCreationErrorZ, accessible via either
6761         /// `err` or `result` depending on the state of `result_ok`.
6762         pub contents: CResult_DescriptionCreationErrorZPtr,
6763         /// Whether this CResult_DescriptionCreationErrorZ represents a success state.
6764         pub result_ok: bool,
6765 }
6766 #[no_mangle]
6767 /// Creates a new CResult_DescriptionCreationErrorZ in the success state.
6768 pub extern "C" fn CResult_DescriptionCreationErrorZ_ok(o: crate::lightning_invoice::Description) -> CResult_DescriptionCreationErrorZ {
6769         CResult_DescriptionCreationErrorZ {
6770                 contents: CResult_DescriptionCreationErrorZPtr {
6771                         result: Box::into_raw(Box::new(o)),
6772                 },
6773                 result_ok: true,
6774         }
6775 }
6776 #[no_mangle]
6777 /// Creates a new CResult_DescriptionCreationErrorZ in the error state.
6778 pub extern "C" fn CResult_DescriptionCreationErrorZ_err(e: crate::lightning_invoice::CreationError) -> CResult_DescriptionCreationErrorZ {
6779         CResult_DescriptionCreationErrorZ {
6780                 contents: CResult_DescriptionCreationErrorZPtr {
6781                         err: Box::into_raw(Box::new(e)),
6782                 },
6783                 result_ok: false,
6784         }
6785 }
6786 #[no_mangle]
6787 /// Frees any resources used by the CResult_DescriptionCreationErrorZ.
6788 pub extern "C" fn CResult_DescriptionCreationErrorZ_free(_res: CResult_DescriptionCreationErrorZ) { }
6789 impl Drop for CResult_DescriptionCreationErrorZ {
6790         fn drop(&mut self) {
6791                 if self.result_ok {
6792                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
6793                                 let _ = unsafe { Box::from_raw(self.contents.result) };
6794                         }
6795                 } else {
6796                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
6797                                 let _ = unsafe { Box::from_raw(self.contents.err) };
6798                         }
6799                 }
6800         }
6801 }
6802 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::Description, crate::lightning_invoice::CreationError>> for CResult_DescriptionCreationErrorZ {
6803         fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::Description, crate::lightning_invoice::CreationError>) -> Self {
6804                 let contents = if o.result_ok {
6805                         let result = unsafe { o.contents.result };
6806                         unsafe { o.contents.result = std::ptr::null_mut() };
6807                         CResult_DescriptionCreationErrorZPtr { result }
6808                 } else {
6809                         let err = unsafe { o.contents.err };
6810                         unsafe { o.contents.err = std::ptr::null_mut(); }
6811                         CResult_DescriptionCreationErrorZPtr { err }
6812                 };
6813                 Self {
6814                         contents,
6815                         result_ok: o.result_ok,
6816                 }
6817         }
6818 }
6819 impl Clone for CResult_DescriptionCreationErrorZ {
6820         fn clone(&self) -> Self {
6821                 if self.result_ok {
6822                         Self { result_ok: true, contents: CResult_DescriptionCreationErrorZPtr {
6823                                 result: Box::into_raw(Box::new(<crate::lightning_invoice::Description>::clone(unsafe { &*self.contents.result })))
6824                         } }
6825                 } else {
6826                         Self { result_ok: false, contents: CResult_DescriptionCreationErrorZPtr {
6827                                 err: Box::into_raw(Box::new(<crate::lightning_invoice::CreationError>::clone(unsafe { &*self.contents.err })))
6828                         } }
6829                 }
6830         }
6831 }
6832 #[no_mangle]
6833 /// Creates a new CResult_DescriptionCreationErrorZ which has the same data as `orig`
6834 /// but with all dynamically-allocated buffers duplicated in new buffers.
6835 pub extern "C" fn CResult_DescriptionCreationErrorZ_clone(orig: &CResult_DescriptionCreationErrorZ) -> CResult_DescriptionCreationErrorZ { Clone::clone(&orig) }
6836 #[repr(C)]
6837 /// The contents of CResult_ExpiryTimeCreationErrorZ
6838 pub union CResult_ExpiryTimeCreationErrorZPtr {
6839         /// A pointer to the contents in the success state.
6840         /// Reading from this pointer when `result_ok` is not set is undefined.
6841         pub result: *mut crate::lightning_invoice::ExpiryTime,
6842         /// A pointer to the contents in the error state.
6843         /// Reading from this pointer when `result_ok` is set is undefined.
6844         pub err: *mut crate::lightning_invoice::CreationError,
6845 }
6846 #[repr(C)]
6847 /// A CResult_ExpiryTimeCreationErrorZ represents the result of a fallible operation,
6848 /// containing a crate::lightning_invoice::ExpiryTime on success and a crate::lightning_invoice::CreationError on failure.
6849 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6850 pub struct CResult_ExpiryTimeCreationErrorZ {
6851         /// The contents of this CResult_ExpiryTimeCreationErrorZ, accessible via either
6852         /// `err` or `result` depending on the state of `result_ok`.
6853         pub contents: CResult_ExpiryTimeCreationErrorZPtr,
6854         /// Whether this CResult_ExpiryTimeCreationErrorZ represents a success state.
6855         pub result_ok: bool,
6856 }
6857 #[no_mangle]
6858 /// Creates a new CResult_ExpiryTimeCreationErrorZ in the success state.
6859 pub extern "C" fn CResult_ExpiryTimeCreationErrorZ_ok(o: crate::lightning_invoice::ExpiryTime) -> CResult_ExpiryTimeCreationErrorZ {
6860         CResult_ExpiryTimeCreationErrorZ {
6861                 contents: CResult_ExpiryTimeCreationErrorZPtr {
6862                         result: Box::into_raw(Box::new(o)),
6863                 },
6864                 result_ok: true,
6865         }
6866 }
6867 #[no_mangle]
6868 /// Creates a new CResult_ExpiryTimeCreationErrorZ in the error state.
6869 pub extern "C" fn CResult_ExpiryTimeCreationErrorZ_err(e: crate::lightning_invoice::CreationError) -> CResult_ExpiryTimeCreationErrorZ {
6870         CResult_ExpiryTimeCreationErrorZ {
6871                 contents: CResult_ExpiryTimeCreationErrorZPtr {
6872                         err: Box::into_raw(Box::new(e)),
6873                 },
6874                 result_ok: false,
6875         }
6876 }
6877 #[no_mangle]
6878 /// Frees any resources used by the CResult_ExpiryTimeCreationErrorZ.
6879 pub extern "C" fn CResult_ExpiryTimeCreationErrorZ_free(_res: CResult_ExpiryTimeCreationErrorZ) { }
6880 impl Drop for CResult_ExpiryTimeCreationErrorZ {
6881         fn drop(&mut self) {
6882                 if self.result_ok {
6883                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
6884                                 let _ = unsafe { Box::from_raw(self.contents.result) };
6885                         }
6886                 } else {
6887                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
6888                                 let _ = unsafe { Box::from_raw(self.contents.err) };
6889                         }
6890                 }
6891         }
6892 }
6893 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::ExpiryTime, crate::lightning_invoice::CreationError>> for CResult_ExpiryTimeCreationErrorZ {
6894         fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::ExpiryTime, crate::lightning_invoice::CreationError>) -> Self {
6895                 let contents = if o.result_ok {
6896                         let result = unsafe { o.contents.result };
6897                         unsafe { o.contents.result = std::ptr::null_mut() };
6898                         CResult_ExpiryTimeCreationErrorZPtr { result }
6899                 } else {
6900                         let err = unsafe { o.contents.err };
6901                         unsafe { o.contents.err = std::ptr::null_mut(); }
6902                         CResult_ExpiryTimeCreationErrorZPtr { err }
6903                 };
6904                 Self {
6905                         contents,
6906                         result_ok: o.result_ok,
6907                 }
6908         }
6909 }
6910 impl Clone for CResult_ExpiryTimeCreationErrorZ {
6911         fn clone(&self) -> Self {
6912                 if self.result_ok {
6913                         Self { result_ok: true, contents: CResult_ExpiryTimeCreationErrorZPtr {
6914                                 result: Box::into_raw(Box::new(<crate::lightning_invoice::ExpiryTime>::clone(unsafe { &*self.contents.result })))
6915                         } }
6916                 } else {
6917                         Self { result_ok: false, contents: CResult_ExpiryTimeCreationErrorZPtr {
6918                                 err: Box::into_raw(Box::new(<crate::lightning_invoice::CreationError>::clone(unsafe { &*self.contents.err })))
6919                         } }
6920                 }
6921         }
6922 }
6923 #[no_mangle]
6924 /// Creates a new CResult_ExpiryTimeCreationErrorZ which has the same data as `orig`
6925 /// but with all dynamically-allocated buffers duplicated in new buffers.
6926 pub extern "C" fn CResult_ExpiryTimeCreationErrorZ_clone(orig: &CResult_ExpiryTimeCreationErrorZ) -> CResult_ExpiryTimeCreationErrorZ { Clone::clone(&orig) }
6927 #[repr(C)]
6928 /// The contents of CResult_PrivateRouteCreationErrorZ
6929 pub union CResult_PrivateRouteCreationErrorZPtr {
6930         /// A pointer to the contents in the success state.
6931         /// Reading from this pointer when `result_ok` is not set is undefined.
6932         pub result: *mut crate::lightning_invoice::PrivateRoute,
6933         /// A pointer to the contents in the error state.
6934         /// Reading from this pointer when `result_ok` is set is undefined.
6935         pub err: *mut crate::lightning_invoice::CreationError,
6936 }
6937 #[repr(C)]
6938 /// A CResult_PrivateRouteCreationErrorZ represents the result of a fallible operation,
6939 /// containing a crate::lightning_invoice::PrivateRoute on success and a crate::lightning_invoice::CreationError on failure.
6940 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6941 pub struct CResult_PrivateRouteCreationErrorZ {
6942         /// The contents of this CResult_PrivateRouteCreationErrorZ, accessible via either
6943         /// `err` or `result` depending on the state of `result_ok`.
6944         pub contents: CResult_PrivateRouteCreationErrorZPtr,
6945         /// Whether this CResult_PrivateRouteCreationErrorZ represents a success state.
6946         pub result_ok: bool,
6947 }
6948 #[no_mangle]
6949 /// Creates a new CResult_PrivateRouteCreationErrorZ in the success state.
6950 pub extern "C" fn CResult_PrivateRouteCreationErrorZ_ok(o: crate::lightning_invoice::PrivateRoute) -> CResult_PrivateRouteCreationErrorZ {
6951         CResult_PrivateRouteCreationErrorZ {
6952                 contents: CResult_PrivateRouteCreationErrorZPtr {
6953                         result: Box::into_raw(Box::new(o)),
6954                 },
6955                 result_ok: true,
6956         }
6957 }
6958 #[no_mangle]
6959 /// Creates a new CResult_PrivateRouteCreationErrorZ in the error state.
6960 pub extern "C" fn CResult_PrivateRouteCreationErrorZ_err(e: crate::lightning_invoice::CreationError) -> CResult_PrivateRouteCreationErrorZ {
6961         CResult_PrivateRouteCreationErrorZ {
6962                 contents: CResult_PrivateRouteCreationErrorZPtr {
6963                         err: Box::into_raw(Box::new(e)),
6964                 },
6965                 result_ok: false,
6966         }
6967 }
6968 #[no_mangle]
6969 /// Frees any resources used by the CResult_PrivateRouteCreationErrorZ.
6970 pub extern "C" fn CResult_PrivateRouteCreationErrorZ_free(_res: CResult_PrivateRouteCreationErrorZ) { }
6971 impl Drop for CResult_PrivateRouteCreationErrorZ {
6972         fn drop(&mut self) {
6973                 if self.result_ok {
6974                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
6975                                 let _ = unsafe { Box::from_raw(self.contents.result) };
6976                         }
6977                 } else {
6978                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
6979                                 let _ = unsafe { Box::from_raw(self.contents.err) };
6980                         }
6981                 }
6982         }
6983 }
6984 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::PrivateRoute, crate::lightning_invoice::CreationError>> for CResult_PrivateRouteCreationErrorZ {
6985         fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::PrivateRoute, crate::lightning_invoice::CreationError>) -> Self {
6986                 let contents = if o.result_ok {
6987                         let result = unsafe { o.contents.result };
6988                         unsafe { o.contents.result = std::ptr::null_mut() };
6989                         CResult_PrivateRouteCreationErrorZPtr { result }
6990                 } else {
6991                         let err = unsafe { o.contents.err };
6992                         unsafe { o.contents.err = std::ptr::null_mut(); }
6993                         CResult_PrivateRouteCreationErrorZPtr { err }
6994                 };
6995                 Self {
6996                         contents,
6997                         result_ok: o.result_ok,
6998                 }
6999         }
7000 }
7001 impl Clone for CResult_PrivateRouteCreationErrorZ {
7002         fn clone(&self) -> Self {
7003                 if self.result_ok {
7004                         Self { result_ok: true, contents: CResult_PrivateRouteCreationErrorZPtr {
7005                                 result: Box::into_raw(Box::new(<crate::lightning_invoice::PrivateRoute>::clone(unsafe { &*self.contents.result })))
7006                         } }
7007                 } else {
7008                         Self { result_ok: false, contents: CResult_PrivateRouteCreationErrorZPtr {
7009                                 err: Box::into_raw(Box::new(<crate::lightning_invoice::CreationError>::clone(unsafe { &*self.contents.err })))
7010                         } }
7011                 }
7012         }
7013 }
7014 #[no_mangle]
7015 /// Creates a new CResult_PrivateRouteCreationErrorZ which has the same data as `orig`
7016 /// but with all dynamically-allocated buffers duplicated in new buffers.
7017 pub extern "C" fn CResult_PrivateRouteCreationErrorZ_clone(orig: &CResult_PrivateRouteCreationErrorZ) -> CResult_PrivateRouteCreationErrorZ { Clone::clone(&orig) }
7018 #[repr(C)]
7019 /// The contents of CResult_StringErrorZ
7020 pub union CResult_StringErrorZPtr {
7021         /// A pointer to the contents in the success state.
7022         /// Reading from this pointer when `result_ok` is not set is undefined.
7023         pub result: *mut crate::c_types::Str,
7024         /// A pointer to the contents in the error state.
7025         /// Reading from this pointer when `result_ok` is set is undefined.
7026         pub err: *mut crate::c_types::Secp256k1Error,
7027 }
7028 #[repr(C)]
7029 /// A CResult_StringErrorZ represents the result of a fallible operation,
7030 /// containing a crate::c_types::Str on success and a crate::c_types::Secp256k1Error on failure.
7031 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7032 pub struct CResult_StringErrorZ {
7033         /// The contents of this CResult_StringErrorZ, accessible via either
7034         /// `err` or `result` depending on the state of `result_ok`.
7035         pub contents: CResult_StringErrorZPtr,
7036         /// Whether this CResult_StringErrorZ represents a success state.
7037         pub result_ok: bool,
7038 }
7039 #[no_mangle]
7040 /// Creates a new CResult_StringErrorZ in the success state.
7041 pub extern "C" fn CResult_StringErrorZ_ok(o: crate::c_types::Str) -> CResult_StringErrorZ {
7042         CResult_StringErrorZ {
7043                 contents: CResult_StringErrorZPtr {
7044                         result: Box::into_raw(Box::new(o)),
7045                 },
7046                 result_ok: true,
7047         }
7048 }
7049 #[no_mangle]
7050 /// Creates a new CResult_StringErrorZ in the error state.
7051 pub extern "C" fn CResult_StringErrorZ_err(e: crate::c_types::Secp256k1Error) -> CResult_StringErrorZ {
7052         CResult_StringErrorZ {
7053                 contents: CResult_StringErrorZPtr {
7054                         err: Box::into_raw(Box::new(e)),
7055                 },
7056                 result_ok: false,
7057         }
7058 }
7059 #[no_mangle]
7060 /// Frees any resources used by the CResult_StringErrorZ.
7061 pub extern "C" fn CResult_StringErrorZ_free(_res: CResult_StringErrorZ) { }
7062 impl Drop for CResult_StringErrorZ {
7063         fn drop(&mut self) {
7064                 if self.result_ok {
7065                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
7066                                 let _ = unsafe { Box::from_raw(self.contents.result) };
7067                         }
7068                 } else {
7069                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
7070                                 let _ = unsafe { Box::from_raw(self.contents.err) };
7071                         }
7072                 }
7073         }
7074 }
7075 impl From<crate::c_types::CResultTempl<crate::c_types::Str, crate::c_types::Secp256k1Error>> for CResult_StringErrorZ {
7076         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::Str, crate::c_types::Secp256k1Error>) -> Self {
7077                 let contents = if o.result_ok {
7078                         let result = unsafe { o.contents.result };
7079                         unsafe { o.contents.result = std::ptr::null_mut() };
7080                         CResult_StringErrorZPtr { result }
7081                 } else {
7082                         let err = unsafe { o.contents.err };
7083                         unsafe { o.contents.err = std::ptr::null_mut(); }
7084                         CResult_StringErrorZPtr { err }
7085                 };
7086                 Self {
7087                         contents,
7088                         result_ok: o.result_ok,
7089                 }
7090         }
7091 }
7092 #[repr(C)]
7093 /// The contents of CResult_ChannelMonitorUpdateDecodeErrorZ
7094 pub union CResult_ChannelMonitorUpdateDecodeErrorZPtr {
7095         /// A pointer to the contents in the success state.
7096         /// Reading from this pointer when `result_ok` is not set is undefined.
7097         pub result: *mut crate::lightning::chain::channelmonitor::ChannelMonitorUpdate,
7098         /// A pointer to the contents in the error state.
7099         /// Reading from this pointer when `result_ok` is set is undefined.
7100         pub err: *mut crate::lightning::ln::msgs::DecodeError,
7101 }
7102 #[repr(C)]
7103 /// A CResult_ChannelMonitorUpdateDecodeErrorZ represents the result of a fallible operation,
7104 /// containing a crate::lightning::chain::channelmonitor::ChannelMonitorUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
7105 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7106 pub struct CResult_ChannelMonitorUpdateDecodeErrorZ {
7107         /// The contents of this CResult_ChannelMonitorUpdateDecodeErrorZ, accessible via either
7108         /// `err` or `result` depending on the state of `result_ok`.
7109         pub contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr,
7110         /// Whether this CResult_ChannelMonitorUpdateDecodeErrorZ represents a success state.
7111         pub result_ok: bool,
7112 }
7113 #[no_mangle]
7114 /// Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ in the success state.
7115 pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_ok(o: crate::lightning::chain::channelmonitor::ChannelMonitorUpdate) -> CResult_ChannelMonitorUpdateDecodeErrorZ {
7116         CResult_ChannelMonitorUpdateDecodeErrorZ {
7117                 contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr {
7118                         result: Box::into_raw(Box::new(o)),
7119                 },
7120                 result_ok: true,
7121         }
7122 }
7123 #[no_mangle]
7124 /// Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ in the error state.
7125 pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelMonitorUpdateDecodeErrorZ {
7126         CResult_ChannelMonitorUpdateDecodeErrorZ {
7127                 contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr {
7128                         err: Box::into_raw(Box::new(e)),
7129                 },
7130                 result_ok: false,
7131         }
7132 }
7133 #[no_mangle]
7134 /// Frees any resources used by the CResult_ChannelMonitorUpdateDecodeErrorZ.
7135 pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_free(_res: CResult_ChannelMonitorUpdateDecodeErrorZ) { }
7136 impl Drop for CResult_ChannelMonitorUpdateDecodeErrorZ {
7137         fn drop(&mut self) {
7138                 if self.result_ok {
7139                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
7140                                 let _ = unsafe { Box::from_raw(self.contents.result) };
7141                         }
7142                 } else {
7143                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
7144                                 let _ = unsafe { Box::from_raw(self.contents.err) };
7145                         }
7146                 }
7147         }
7148 }
7149 impl From<crate::c_types::CResultTempl<crate::lightning::chain::channelmonitor::ChannelMonitorUpdate, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelMonitorUpdateDecodeErrorZ {
7150         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::channelmonitor::ChannelMonitorUpdate, crate::lightning::ln::msgs::DecodeError>) -> Self {
7151                 let contents = if o.result_ok {
7152                         let result = unsafe { o.contents.result };
7153                         unsafe { o.contents.result = std::ptr::null_mut() };
7154                         CResult_ChannelMonitorUpdateDecodeErrorZPtr { result }
7155                 } else {
7156                         let err = unsafe { o.contents.err };
7157                         unsafe { o.contents.err = std::ptr::null_mut(); }
7158                         CResult_ChannelMonitorUpdateDecodeErrorZPtr { err }
7159                 };
7160                 Self {
7161                         contents,
7162                         result_ok: o.result_ok,
7163                 }
7164         }
7165 }
7166 impl Clone for CResult_ChannelMonitorUpdateDecodeErrorZ {
7167         fn clone(&self) -> Self {
7168                 if self.result_ok {
7169                         Self { result_ok: true, contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr {
7170                                 result: Box::into_raw(Box::new(<crate::lightning::chain::channelmonitor::ChannelMonitorUpdate>::clone(unsafe { &*self.contents.result })))
7171                         } }
7172                 } else {
7173                         Self { result_ok: false, contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr {
7174                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
7175                         } }
7176                 }
7177         }
7178 }
7179 #[no_mangle]
7180 /// Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ which has the same data as `orig`
7181 /// but with all dynamically-allocated buffers duplicated in new buffers.
7182 pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_clone(orig: &CResult_ChannelMonitorUpdateDecodeErrorZ) -> CResult_ChannelMonitorUpdateDecodeErrorZ { Clone::clone(&orig) }
7183 #[repr(C)]
7184 /// The contents of CResult_HTLCUpdateDecodeErrorZ
7185 pub union CResult_HTLCUpdateDecodeErrorZPtr {
7186         /// A pointer to the contents in the success state.
7187         /// Reading from this pointer when `result_ok` is not set is undefined.
7188         pub result: *mut crate::lightning::chain::channelmonitor::HTLCUpdate,
7189         /// A pointer to the contents in the error state.
7190         /// Reading from this pointer when `result_ok` is set is undefined.
7191         pub err: *mut crate::lightning::ln::msgs::DecodeError,
7192 }
7193 #[repr(C)]
7194 /// A CResult_HTLCUpdateDecodeErrorZ represents the result of a fallible operation,
7195 /// containing a crate::lightning::chain::channelmonitor::HTLCUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
7196 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7197 pub struct CResult_HTLCUpdateDecodeErrorZ {
7198         /// The contents of this CResult_HTLCUpdateDecodeErrorZ, accessible via either
7199         /// `err` or `result` depending on the state of `result_ok`.
7200         pub contents: CResult_HTLCUpdateDecodeErrorZPtr,
7201         /// Whether this CResult_HTLCUpdateDecodeErrorZ represents a success state.
7202         pub result_ok: bool,
7203 }
7204 #[no_mangle]
7205 /// Creates a new CResult_HTLCUpdateDecodeErrorZ in the success state.
7206 pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_ok(o: crate::lightning::chain::channelmonitor::HTLCUpdate) -> CResult_HTLCUpdateDecodeErrorZ {
7207         CResult_HTLCUpdateDecodeErrorZ {
7208                 contents: CResult_HTLCUpdateDecodeErrorZPtr {
7209                         result: Box::into_raw(Box::new(o)),
7210                 },
7211                 result_ok: true,
7212         }
7213 }
7214 #[no_mangle]
7215 /// Creates a new CResult_HTLCUpdateDecodeErrorZ in the error state.
7216 pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_HTLCUpdateDecodeErrorZ {
7217         CResult_HTLCUpdateDecodeErrorZ {
7218                 contents: CResult_HTLCUpdateDecodeErrorZPtr {
7219                         err: Box::into_raw(Box::new(e)),
7220                 },
7221                 result_ok: false,
7222         }
7223 }
7224 #[no_mangle]
7225 /// Frees any resources used by the CResult_HTLCUpdateDecodeErrorZ.
7226 pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_free(_res: CResult_HTLCUpdateDecodeErrorZ) { }
7227 impl Drop for CResult_HTLCUpdateDecodeErrorZ {
7228         fn drop(&mut self) {
7229                 if self.result_ok {
7230                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
7231                                 let _ = unsafe { Box::from_raw(self.contents.result) };
7232                         }
7233                 } else {
7234                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
7235                                 let _ = unsafe { Box::from_raw(self.contents.err) };
7236                         }
7237                 }
7238         }
7239 }
7240 impl From<crate::c_types::CResultTempl<crate::lightning::chain::channelmonitor::HTLCUpdate, crate::lightning::ln::msgs::DecodeError>> for CResult_HTLCUpdateDecodeErrorZ {
7241         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::channelmonitor::HTLCUpdate, crate::lightning::ln::msgs::DecodeError>) -> Self {
7242                 let contents = if o.result_ok {
7243                         let result = unsafe { o.contents.result };
7244                         unsafe { o.contents.result = std::ptr::null_mut() };
7245                         CResult_HTLCUpdateDecodeErrorZPtr { result }
7246                 } else {
7247                         let err = unsafe { o.contents.err };
7248                         unsafe { o.contents.err = std::ptr::null_mut(); }
7249                         CResult_HTLCUpdateDecodeErrorZPtr { err }
7250                 };
7251                 Self {
7252                         contents,
7253                         result_ok: o.result_ok,
7254                 }
7255         }
7256 }
7257 impl Clone for CResult_HTLCUpdateDecodeErrorZ {
7258         fn clone(&self) -> Self {
7259                 if self.result_ok {
7260                         Self { result_ok: true, contents: CResult_HTLCUpdateDecodeErrorZPtr {
7261                                 result: Box::into_raw(Box::new(<crate::lightning::chain::channelmonitor::HTLCUpdate>::clone(unsafe { &*self.contents.result })))
7262                         } }
7263                 } else {
7264                         Self { result_ok: false, contents: CResult_HTLCUpdateDecodeErrorZPtr {
7265                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
7266                         } }
7267                 }
7268         }
7269 }
7270 #[no_mangle]
7271 /// Creates a new CResult_HTLCUpdateDecodeErrorZ which has the same data as `orig`
7272 /// but with all dynamically-allocated buffers duplicated in new buffers.
7273 pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_clone(orig: &CResult_HTLCUpdateDecodeErrorZ) -> CResult_HTLCUpdateDecodeErrorZ { Clone::clone(&orig) }
7274 #[repr(C)]
7275 /// The contents of CResult_NoneMonitorUpdateErrorZ
7276 pub union CResult_NoneMonitorUpdateErrorZPtr {
7277         /// Note that this value is always NULL, as there are no contents in the OK variant
7278         pub result: *mut std::ffi::c_void,
7279         /// A pointer to the contents in the error state.
7280         /// Reading from this pointer when `result_ok` is set is undefined.
7281         pub err: *mut crate::lightning::chain::channelmonitor::MonitorUpdateError,
7282 }
7283 #[repr(C)]
7284 /// A CResult_NoneMonitorUpdateErrorZ represents the result of a fallible operation,
7285 /// containing a () on success and a crate::lightning::chain::channelmonitor::MonitorUpdateError on failure.
7286 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7287 pub struct CResult_NoneMonitorUpdateErrorZ {
7288         /// The contents of this CResult_NoneMonitorUpdateErrorZ, accessible via either
7289         /// `err` or `result` depending on the state of `result_ok`.
7290         pub contents: CResult_NoneMonitorUpdateErrorZPtr,
7291         /// Whether this CResult_NoneMonitorUpdateErrorZ represents a success state.
7292         pub result_ok: bool,
7293 }
7294 #[no_mangle]
7295 /// Creates a new CResult_NoneMonitorUpdateErrorZ in the success state.
7296 pub extern "C" fn CResult_NoneMonitorUpdateErrorZ_ok() -> CResult_NoneMonitorUpdateErrorZ {
7297         CResult_NoneMonitorUpdateErrorZ {
7298                 contents: CResult_NoneMonitorUpdateErrorZPtr {
7299                         result: std::ptr::null_mut(),
7300                 },
7301                 result_ok: true,
7302         }
7303 }
7304 #[no_mangle]
7305 /// Creates a new CResult_NoneMonitorUpdateErrorZ in the error state.
7306 pub extern "C" fn CResult_NoneMonitorUpdateErrorZ_err(e: crate::lightning::chain::channelmonitor::MonitorUpdateError) -> CResult_NoneMonitorUpdateErrorZ {
7307         CResult_NoneMonitorUpdateErrorZ {
7308                 contents: CResult_NoneMonitorUpdateErrorZPtr {
7309                         err: Box::into_raw(Box::new(e)),
7310                 },
7311                 result_ok: false,
7312         }
7313 }
7314 #[no_mangle]
7315 /// Frees any resources used by the CResult_NoneMonitorUpdateErrorZ.
7316 pub extern "C" fn CResult_NoneMonitorUpdateErrorZ_free(_res: CResult_NoneMonitorUpdateErrorZ) { }
7317 impl Drop for CResult_NoneMonitorUpdateErrorZ {
7318         fn drop(&mut self) {
7319                 if self.result_ok {
7320                 } else {
7321                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
7322                                 let _ = unsafe { Box::from_raw(self.contents.err) };
7323                         }
7324                 }
7325         }
7326 }
7327 impl From<crate::c_types::CResultTempl<(), crate::lightning::chain::channelmonitor::MonitorUpdateError>> for CResult_NoneMonitorUpdateErrorZ {
7328         fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::chain::channelmonitor::MonitorUpdateError>) -> Self {
7329                 let contents = if o.result_ok {
7330                         let _ = unsafe { Box::from_raw(o.contents.result) };
7331                         o.contents.result = std::ptr::null_mut();
7332                         CResult_NoneMonitorUpdateErrorZPtr { result: std::ptr::null_mut() }
7333                 } else {
7334                         let err = unsafe { o.contents.err };
7335                         unsafe { o.contents.err = std::ptr::null_mut(); }
7336                         CResult_NoneMonitorUpdateErrorZPtr { err }
7337                 };
7338                 Self {
7339                         contents,
7340                         result_ok: o.result_ok,
7341                 }
7342         }
7343 }
7344 impl Clone for CResult_NoneMonitorUpdateErrorZ {
7345         fn clone(&self) -> Self {
7346                 if self.result_ok {
7347                         Self { result_ok: true, contents: CResult_NoneMonitorUpdateErrorZPtr {
7348                                 result: std::ptr::null_mut()
7349                         } }
7350                 } else {
7351                         Self { result_ok: false, contents: CResult_NoneMonitorUpdateErrorZPtr {
7352                                 err: Box::into_raw(Box::new(<crate::lightning::chain::channelmonitor::MonitorUpdateError>::clone(unsafe { &*self.contents.err })))
7353                         } }
7354                 }
7355         }
7356 }
7357 #[no_mangle]
7358 /// Creates a new CResult_NoneMonitorUpdateErrorZ which has the same data as `orig`
7359 /// but with all dynamically-allocated buffers duplicated in new buffers.
7360 pub extern "C" fn CResult_NoneMonitorUpdateErrorZ_clone(orig: &CResult_NoneMonitorUpdateErrorZ) -> CResult_NoneMonitorUpdateErrorZ { Clone::clone(&orig) }
7361 #[repr(C)]
7362 /// A tuple of 2 elements. See the individual fields for the types contained.
7363 pub struct C2Tuple_OutPointScriptZ {
7364         /// The element at position 0
7365         pub a: crate::lightning::chain::transaction::OutPoint,
7366         /// The element at position 1
7367         pub b: crate::c_types::derived::CVec_u8Z,
7368 }
7369 impl From<(crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_u8Z)> for C2Tuple_OutPointScriptZ {
7370         fn from (tup: (crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_u8Z)) -> Self {
7371                 Self {
7372                         a: tup.0,
7373                         b: tup.1,
7374                 }
7375         }
7376 }
7377 impl C2Tuple_OutPointScriptZ {
7378         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_u8Z) {
7379                 (self.a, self.b)
7380         }
7381 }
7382 impl Clone for C2Tuple_OutPointScriptZ {
7383         fn clone(&self) -> Self {
7384                 Self {
7385                         a: Clone::clone(&self.a),
7386                         b: Clone::clone(&self.b),
7387                 }
7388         }
7389 }
7390 #[no_mangle]
7391 /// Creates a new tuple which has the same data as `orig`
7392 /// but with all dynamically-allocated buffers duplicated in new buffers.
7393 pub extern "C" fn C2Tuple_OutPointScriptZ_clone(orig: &C2Tuple_OutPointScriptZ) -> C2Tuple_OutPointScriptZ { Clone::clone(&orig) }
7394 /// Creates a new C2Tuple_OutPointScriptZ from the contained elements.
7395 #[no_mangle]
7396 pub extern "C" fn C2Tuple_OutPointScriptZ_new(a: crate::lightning::chain::transaction::OutPoint, b: crate::c_types::derived::CVec_u8Z) -> C2Tuple_OutPointScriptZ {
7397         C2Tuple_OutPointScriptZ { a, b, }
7398 }
7399
7400 #[no_mangle]
7401 /// Frees any resources used by the C2Tuple_OutPointScriptZ.
7402 pub extern "C" fn C2Tuple_OutPointScriptZ_free(_res: C2Tuple_OutPointScriptZ) { }
7403 #[repr(C)]
7404 /// A tuple of 2 elements. See the individual fields for the types contained.
7405 pub struct C2Tuple_u32ScriptZ {
7406         /// The element at position 0
7407         pub a: u32,
7408         /// The element at position 1
7409         pub b: crate::c_types::derived::CVec_u8Z,
7410 }
7411 impl From<(u32, crate::c_types::derived::CVec_u8Z)> for C2Tuple_u32ScriptZ {
7412         fn from (tup: (u32, crate::c_types::derived::CVec_u8Z)) -> Self {
7413                 Self {
7414                         a: tup.0,
7415                         b: tup.1,
7416                 }
7417         }
7418 }
7419 impl C2Tuple_u32ScriptZ {
7420         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (u32, crate::c_types::derived::CVec_u8Z) {
7421                 (self.a, self.b)
7422         }
7423 }
7424 impl Clone for C2Tuple_u32ScriptZ {
7425         fn clone(&self) -> Self {
7426                 Self {
7427                         a: Clone::clone(&self.a),
7428                         b: Clone::clone(&self.b),
7429                 }
7430         }
7431 }
7432 #[no_mangle]
7433 /// Creates a new tuple which has the same data as `orig`
7434 /// but with all dynamically-allocated buffers duplicated in new buffers.
7435 pub extern "C" fn C2Tuple_u32ScriptZ_clone(orig: &C2Tuple_u32ScriptZ) -> C2Tuple_u32ScriptZ { Clone::clone(&orig) }
7436 /// Creates a new C2Tuple_u32ScriptZ from the contained elements.
7437 #[no_mangle]
7438 pub extern "C" fn C2Tuple_u32ScriptZ_new(a: u32, b: crate::c_types::derived::CVec_u8Z) -> C2Tuple_u32ScriptZ {
7439         C2Tuple_u32ScriptZ { a, b, }
7440 }
7441
7442 #[no_mangle]
7443 /// Frees any resources used by the C2Tuple_u32ScriptZ.
7444 pub extern "C" fn C2Tuple_u32ScriptZ_free(_res: C2Tuple_u32ScriptZ) { }
7445 #[repr(C)]
7446 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_u32ScriptZs of arbitrary size.
7447 /// This corresponds to std::vector in C++
7448 pub struct CVec_C2Tuple_u32ScriptZZ {
7449         /// The elements in the array.
7450         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
7451         pub data: *mut crate::c_types::derived::C2Tuple_u32ScriptZ,
7452         /// The number of elements pointed to by `data`.
7453         pub datalen: usize
7454 }
7455 impl CVec_C2Tuple_u32ScriptZZ {
7456         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_u32ScriptZ> {
7457                 if self.datalen == 0 { return Vec::new(); }
7458                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
7459                 self.data = std::ptr::null_mut();
7460                 self.datalen = 0;
7461                 ret
7462         }
7463         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_u32ScriptZ] {
7464                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
7465         }
7466 }
7467 impl From<Vec<crate::c_types::derived::C2Tuple_u32ScriptZ>> for CVec_C2Tuple_u32ScriptZZ {
7468         fn from(v: Vec<crate::c_types::derived::C2Tuple_u32ScriptZ>) -> Self {
7469                 let datalen = v.len();
7470                 let data = Box::into_raw(v.into_boxed_slice());
7471                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
7472         }
7473 }
7474 #[no_mangle]
7475 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
7476 pub extern "C" fn CVec_C2Tuple_u32ScriptZZ_free(_res: CVec_C2Tuple_u32ScriptZZ) { }
7477 impl Drop for CVec_C2Tuple_u32ScriptZZ {
7478         fn drop(&mut self) {
7479                 if self.datalen == 0 { return; }
7480                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
7481         }
7482 }
7483 impl Clone for CVec_C2Tuple_u32ScriptZZ {
7484         fn clone(&self) -> Self {
7485                 let mut res = Vec::new();
7486                 if self.datalen == 0 { return Self::from(res); }
7487                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
7488                 Self::from(res)
7489         }
7490 }
7491 #[repr(C)]
7492 /// A tuple of 2 elements. See the individual fields for the types contained.
7493 pub struct C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ {
7494         /// The element at position 0
7495         pub a: crate::c_types::ThirtyTwoBytes,
7496         /// The element at position 1
7497         pub b: crate::c_types::derived::CVec_C2Tuple_u32ScriptZZ,
7498 }
7499 impl From<(crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32ScriptZZ)> for C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ {
7500         fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32ScriptZZ)) -> Self {
7501                 Self {
7502                         a: tup.0,
7503                         b: tup.1,
7504                 }
7505         }
7506 }
7507 impl C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ {
7508         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32ScriptZZ) {
7509                 (self.a, self.b)
7510         }
7511 }
7512 impl Clone for C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ {
7513         fn clone(&self) -> Self {
7514                 Self {
7515                         a: Clone::clone(&self.a),
7516                         b: Clone::clone(&self.b),
7517                 }
7518         }
7519 }
7520 #[no_mangle]
7521 /// Creates a new tuple which has the same data as `orig`
7522 /// but with all dynamically-allocated buffers duplicated in new buffers.
7523 pub extern "C" fn C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone(orig: &C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ) -> C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ { Clone::clone(&orig) }
7524 /// Creates a new C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ from the contained elements.
7525 #[no_mangle]
7526 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 {
7527         C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ { a, b, }
7528 }
7529
7530 #[no_mangle]
7531 /// Frees any resources used by the C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ.
7532 pub extern "C" fn C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_free(_res: C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ) { }
7533 #[repr(C)]
7534 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZs of arbitrary size.
7535 /// This corresponds to std::vector in C++
7536 pub struct CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ {
7537         /// The elements in the array.
7538         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
7539         pub data: *mut crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ,
7540         /// The number of elements pointed to by `data`.
7541         pub datalen: usize
7542 }
7543 impl CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ {
7544         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ> {
7545                 if self.datalen == 0 { return Vec::new(); }
7546                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
7547                 self.data = std::ptr::null_mut();
7548                 self.datalen = 0;
7549                 ret
7550         }
7551         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ] {
7552                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
7553         }
7554 }
7555 impl From<Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ>> for CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ {
7556         fn from(v: Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ>) -> Self {
7557                 let datalen = v.len();
7558                 let data = Box::into_raw(v.into_boxed_slice());
7559                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
7560         }
7561 }
7562 #[no_mangle]
7563 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
7564 pub extern "C" fn CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ_free(_res: CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ) { }
7565 impl Drop for CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ {
7566         fn drop(&mut self) {
7567                 if self.datalen == 0 { return; }
7568                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
7569         }
7570 }
7571 impl Clone for CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ {
7572         fn clone(&self) -> Self {
7573                 let mut res = Vec::new();
7574                 if self.datalen == 0 { return Self::from(res); }
7575                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
7576                 Self::from(res)
7577         }
7578 }
7579 #[repr(C)]
7580 /// A dynamically-allocated array of crate::lightning::util::events::Events of arbitrary size.
7581 /// This corresponds to std::vector in C++
7582 pub struct CVec_EventZ {
7583         /// The elements in the array.
7584         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
7585         pub data: *mut crate::lightning::util::events::Event,
7586         /// The number of elements pointed to by `data`.
7587         pub datalen: usize
7588 }
7589 impl CVec_EventZ {
7590         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::util::events::Event> {
7591                 if self.datalen == 0 { return Vec::new(); }
7592                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
7593                 self.data = std::ptr::null_mut();
7594                 self.datalen = 0;
7595                 ret
7596         }
7597         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::util::events::Event] {
7598                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
7599         }
7600 }
7601 impl From<Vec<crate::lightning::util::events::Event>> for CVec_EventZ {
7602         fn from(v: Vec<crate::lightning::util::events::Event>) -> Self {
7603                 let datalen = v.len();
7604                 let data = Box::into_raw(v.into_boxed_slice());
7605                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
7606         }
7607 }
7608 #[no_mangle]
7609 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
7610 pub extern "C" fn CVec_EventZ_free(_res: CVec_EventZ) { }
7611 impl Drop for CVec_EventZ {
7612         fn drop(&mut self) {
7613                 if self.datalen == 0 { return; }
7614                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
7615         }
7616 }
7617 impl Clone for CVec_EventZ {
7618         fn clone(&self) -> Self {
7619                 let mut res = Vec::new();
7620                 if self.datalen == 0 { return Self::from(res); }
7621                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
7622                 Self::from(res)
7623         }
7624 }
7625 #[repr(C)]
7626 /// A dynamically-allocated array of crate::c_types::Transactions of arbitrary size.
7627 /// This corresponds to std::vector in C++
7628 pub struct CVec_TransactionZ {
7629         /// The elements in the array.
7630         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
7631         pub data: *mut crate::c_types::Transaction,
7632         /// The number of elements pointed to by `data`.
7633         pub datalen: usize
7634 }
7635 impl CVec_TransactionZ {
7636         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::Transaction> {
7637                 if self.datalen == 0 { return Vec::new(); }
7638                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
7639                 self.data = std::ptr::null_mut();
7640                 self.datalen = 0;
7641                 ret
7642         }
7643         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::Transaction] {
7644                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
7645         }
7646 }
7647 impl From<Vec<crate::c_types::Transaction>> for CVec_TransactionZ {
7648         fn from(v: Vec<crate::c_types::Transaction>) -> Self {
7649                 let datalen = v.len();
7650                 let data = Box::into_raw(v.into_boxed_slice());
7651                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
7652         }
7653 }
7654 #[no_mangle]
7655 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
7656 pub extern "C" fn CVec_TransactionZ_free(_res: CVec_TransactionZ) { }
7657 impl Drop for CVec_TransactionZ {
7658         fn drop(&mut self) {
7659                 if self.datalen == 0 { return; }
7660                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
7661         }
7662 }
7663 impl Clone for CVec_TransactionZ {
7664         fn clone(&self) -> Self {
7665                 let mut res = Vec::new();
7666                 if self.datalen == 0 { return Self::from(res); }
7667                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
7668                 Self::from(res)
7669         }
7670 }
7671 #[repr(C)]
7672 /// A tuple of 2 elements. See the individual fields for the types contained.
7673 pub struct C2Tuple_u32TxOutZ {
7674         /// The element at position 0
7675         pub a: u32,
7676         /// The element at position 1
7677         pub b: crate::c_types::TxOut,
7678 }
7679 impl From<(u32, crate::c_types::TxOut)> for C2Tuple_u32TxOutZ {
7680         fn from (tup: (u32, crate::c_types::TxOut)) -> Self {
7681                 Self {
7682                         a: tup.0,
7683                         b: tup.1,
7684                 }
7685         }
7686 }
7687 impl C2Tuple_u32TxOutZ {
7688         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (u32, crate::c_types::TxOut) {
7689                 (self.a, self.b)
7690         }
7691 }
7692 impl Clone for C2Tuple_u32TxOutZ {
7693         fn clone(&self) -> Self {
7694                 Self {
7695                         a: Clone::clone(&self.a),
7696                         b: Clone::clone(&self.b),
7697                 }
7698         }
7699 }
7700 #[no_mangle]
7701 /// Creates a new tuple which has the same data as `orig`
7702 /// but with all dynamically-allocated buffers duplicated in new buffers.
7703 pub extern "C" fn C2Tuple_u32TxOutZ_clone(orig: &C2Tuple_u32TxOutZ) -> C2Tuple_u32TxOutZ { Clone::clone(&orig) }
7704 /// Creates a new C2Tuple_u32TxOutZ from the contained elements.
7705 #[no_mangle]
7706 pub extern "C" fn C2Tuple_u32TxOutZ_new(a: u32, b: crate::c_types::TxOut) -> C2Tuple_u32TxOutZ {
7707         C2Tuple_u32TxOutZ { a, b, }
7708 }
7709
7710 #[no_mangle]
7711 /// Frees any resources used by the C2Tuple_u32TxOutZ.
7712 pub extern "C" fn C2Tuple_u32TxOutZ_free(_res: C2Tuple_u32TxOutZ) { }
7713 #[repr(C)]
7714 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_u32TxOutZs of arbitrary size.
7715 /// This corresponds to std::vector in C++
7716 pub struct CVec_C2Tuple_u32TxOutZZ {
7717         /// The elements in the array.
7718         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
7719         pub data: *mut crate::c_types::derived::C2Tuple_u32TxOutZ,
7720         /// The number of elements pointed to by `data`.
7721         pub datalen: usize
7722 }
7723 impl CVec_C2Tuple_u32TxOutZZ {
7724         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_u32TxOutZ> {
7725                 if self.datalen == 0 { return Vec::new(); }
7726                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
7727                 self.data = std::ptr::null_mut();
7728                 self.datalen = 0;
7729                 ret
7730         }
7731         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_u32TxOutZ] {
7732                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
7733         }
7734 }
7735 impl From<Vec<crate::c_types::derived::C2Tuple_u32TxOutZ>> for CVec_C2Tuple_u32TxOutZZ {
7736         fn from(v: Vec<crate::c_types::derived::C2Tuple_u32TxOutZ>) -> Self {
7737                 let datalen = v.len();
7738                 let data = Box::into_raw(v.into_boxed_slice());
7739                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
7740         }
7741 }
7742 #[no_mangle]
7743 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
7744 pub extern "C" fn CVec_C2Tuple_u32TxOutZZ_free(_res: CVec_C2Tuple_u32TxOutZZ) { }
7745 impl Drop for CVec_C2Tuple_u32TxOutZZ {
7746         fn drop(&mut self) {
7747                 if self.datalen == 0 { return; }
7748                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
7749         }
7750 }
7751 impl Clone for CVec_C2Tuple_u32TxOutZZ {
7752         fn clone(&self) -> Self {
7753                 let mut res = Vec::new();
7754                 if self.datalen == 0 { return Self::from(res); }
7755                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
7756                 Self::from(res)
7757         }
7758 }
7759 #[repr(C)]
7760 /// A tuple of 2 elements. See the individual fields for the types contained.
7761 pub struct C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ {
7762         /// The element at position 0
7763         pub a: crate::c_types::ThirtyTwoBytes,
7764         /// The element at position 1
7765         pub b: crate::c_types::derived::CVec_C2Tuple_u32TxOutZZ,
7766 }
7767 impl From<(crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32TxOutZZ)> for C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ {
7768         fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32TxOutZZ)) -> Self {
7769                 Self {
7770                         a: tup.0,
7771                         b: tup.1,
7772                 }
7773         }
7774 }
7775 impl C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ {
7776         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32TxOutZZ) {
7777                 (self.a, self.b)
7778         }
7779 }
7780 impl Clone for C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ {
7781         fn clone(&self) -> Self {
7782                 Self {
7783                         a: Clone::clone(&self.a),
7784                         b: Clone::clone(&self.b),
7785                 }
7786         }
7787 }
7788 #[no_mangle]
7789 /// Creates a new tuple which has the same data as `orig`
7790 /// but with all dynamically-allocated buffers duplicated in new buffers.
7791 pub extern "C" fn C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone(orig: &C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ) -> C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ { Clone::clone(&orig) }
7792 /// Creates a new C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ from the contained elements.
7793 #[no_mangle]
7794 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 {
7795         C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ { a, b, }
7796 }
7797
7798 #[no_mangle]
7799 /// Frees any resources used by the C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ.
7800 pub extern "C" fn C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_free(_res: C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ) { }
7801 #[repr(C)]
7802 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZs of arbitrary size.
7803 /// This corresponds to std::vector in C++
7804 pub struct CVec_TransactionOutputsZ {
7805         /// The elements in the array.
7806         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
7807         pub data: *mut crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ,
7808         /// The number of elements pointed to by `data`.
7809         pub datalen: usize
7810 }
7811 impl CVec_TransactionOutputsZ {
7812         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ> {
7813                 if self.datalen == 0 { return Vec::new(); }
7814                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
7815                 self.data = std::ptr::null_mut();
7816                 self.datalen = 0;
7817                 ret
7818         }
7819         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ] {
7820                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
7821         }
7822 }
7823 impl From<Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ>> for CVec_TransactionOutputsZ {
7824         fn from(v: Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ>) -> Self {
7825                 let datalen = v.len();
7826                 let data = Box::into_raw(v.into_boxed_slice());
7827                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
7828         }
7829 }
7830 #[no_mangle]
7831 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
7832 pub extern "C" fn CVec_TransactionOutputsZ_free(_res: CVec_TransactionOutputsZ) { }
7833 impl Drop for CVec_TransactionOutputsZ {
7834         fn drop(&mut self) {
7835                 if self.datalen == 0 { return; }
7836                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
7837         }
7838 }
7839 impl Clone for CVec_TransactionOutputsZ {
7840         fn clone(&self) -> Self {
7841                 let mut res = Vec::new();
7842                 if self.datalen == 0 { return Self::from(res); }
7843                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
7844                 Self::from(res)
7845         }
7846 }
7847 #[repr(C)]
7848 /// A dynamically-allocated array of crate::lightning::chain::channelmonitor::Balances of arbitrary size.
7849 /// This corresponds to std::vector in C++
7850 pub struct CVec_BalanceZ {
7851         /// The elements in the array.
7852         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
7853         pub data: *mut crate::lightning::chain::channelmonitor::Balance,
7854         /// The number of elements pointed to by `data`.
7855         pub datalen: usize
7856 }
7857 impl CVec_BalanceZ {
7858         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::chain::channelmonitor::Balance> {
7859                 if self.datalen == 0 { return Vec::new(); }
7860                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
7861                 self.data = std::ptr::null_mut();
7862                 self.datalen = 0;
7863                 ret
7864         }
7865         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::chain::channelmonitor::Balance] {
7866                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
7867         }
7868 }
7869 impl From<Vec<crate::lightning::chain::channelmonitor::Balance>> for CVec_BalanceZ {
7870         fn from(v: Vec<crate::lightning::chain::channelmonitor::Balance>) -> Self {
7871                 let datalen = v.len();
7872                 let data = Box::into_raw(v.into_boxed_slice());
7873                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
7874         }
7875 }
7876 #[no_mangle]
7877 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
7878 pub extern "C" fn CVec_BalanceZ_free(_res: CVec_BalanceZ) { }
7879 impl Drop for CVec_BalanceZ {
7880         fn drop(&mut self) {
7881                 if self.datalen == 0 { return; }
7882                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
7883         }
7884 }
7885 impl Clone for CVec_BalanceZ {
7886         fn clone(&self) -> Self {
7887                 let mut res = Vec::new();
7888                 if self.datalen == 0 { return Self::from(res); }
7889                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
7890                 Self::from(res)
7891         }
7892 }
7893 #[repr(C)]
7894 /// The contents of CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ
7895 pub union CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr {
7896         /// A pointer to the contents in the success state.
7897         /// Reading from this pointer when `result_ok` is not set is undefined.
7898         pub result: *mut crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ,
7899         /// A pointer to the contents in the error state.
7900         /// Reading from this pointer when `result_ok` is set is undefined.
7901         pub err: *mut crate::lightning::ln::msgs::DecodeError,
7902 }
7903 #[repr(C)]
7904 /// A CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ represents the result of a fallible operation,
7905 /// containing a crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
7906 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7907 pub struct CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
7908         /// The contents of this CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ, accessible via either
7909         /// `err` or `result` depending on the state of `result_ok`.
7910         pub contents: CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr,
7911         /// Whether this CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ represents a success state.
7912         pub result_ok: bool,
7913 }
7914 #[no_mangle]
7915 /// Creates a new CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ in the success state.
7916 pub extern "C" fn CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_ok(o: crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ) -> CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
7917         CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
7918                 contents: CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr {
7919                         result: Box::into_raw(Box::new(o)),
7920                 },
7921                 result_ok: true,
7922         }
7923 }
7924 #[no_mangle]
7925 /// Creates a new CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ in the error state.
7926 pub extern "C" fn CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
7927         CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
7928                 contents: CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr {
7929                         err: Box::into_raw(Box::new(e)),
7930                 },
7931                 result_ok: false,
7932         }
7933 }
7934 #[no_mangle]
7935 /// Frees any resources used by the CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ.
7936 pub extern "C" fn CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_free(_res: CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ) { }
7937 impl Drop for CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
7938         fn drop(&mut self) {
7939                 if self.result_ok {
7940                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
7941                                 let _ = unsafe { Box::from_raw(self.contents.result) };
7942                         }
7943                 } else {
7944                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
7945                                 let _ = unsafe { Box::from_raw(self.contents.err) };
7946                         }
7947                 }
7948         }
7949 }
7950 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ, crate::lightning::ln::msgs::DecodeError>> for CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
7951         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
7952                 let contents = if o.result_ok {
7953                         let result = unsafe { o.contents.result };
7954                         unsafe { o.contents.result = std::ptr::null_mut() };
7955                         CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr { result }
7956                 } else {
7957                         let err = unsafe { o.contents.err };
7958                         unsafe { o.contents.err = std::ptr::null_mut(); }
7959                         CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr { err }
7960                 };
7961                 Self {
7962                         contents,
7963                         result_ok: o.result_ok,
7964                 }
7965         }
7966 }
7967 #[repr(C)]
7968 /// The contents of CResult_NoneLightningErrorZ
7969 pub union CResult_NoneLightningErrorZPtr {
7970         /// Note that this value is always NULL, as there are no contents in the OK variant
7971         pub result: *mut std::ffi::c_void,
7972         /// A pointer to the contents in the error state.
7973         /// Reading from this pointer when `result_ok` is set is undefined.
7974         pub err: *mut crate::lightning::ln::msgs::LightningError,
7975 }
7976 #[repr(C)]
7977 /// A CResult_NoneLightningErrorZ represents the result of a fallible operation,
7978 /// containing a () on success and a crate::lightning::ln::msgs::LightningError on failure.
7979 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7980 pub struct CResult_NoneLightningErrorZ {
7981         /// The contents of this CResult_NoneLightningErrorZ, accessible via either
7982         /// `err` or `result` depending on the state of `result_ok`.
7983         pub contents: CResult_NoneLightningErrorZPtr,
7984         /// Whether this CResult_NoneLightningErrorZ represents a success state.
7985         pub result_ok: bool,
7986 }
7987 #[no_mangle]
7988 /// Creates a new CResult_NoneLightningErrorZ in the success state.
7989 pub extern "C" fn CResult_NoneLightningErrorZ_ok() -> CResult_NoneLightningErrorZ {
7990         CResult_NoneLightningErrorZ {
7991                 contents: CResult_NoneLightningErrorZPtr {
7992                         result: std::ptr::null_mut(),
7993                 },
7994                 result_ok: true,
7995         }
7996 }
7997 #[no_mangle]
7998 /// Creates a new CResult_NoneLightningErrorZ in the error state.
7999 pub extern "C" fn CResult_NoneLightningErrorZ_err(e: crate::lightning::ln::msgs::LightningError) -> CResult_NoneLightningErrorZ {
8000         CResult_NoneLightningErrorZ {
8001                 contents: CResult_NoneLightningErrorZPtr {
8002                         err: Box::into_raw(Box::new(e)),
8003                 },
8004                 result_ok: false,
8005         }
8006 }
8007 #[no_mangle]
8008 /// Frees any resources used by the CResult_NoneLightningErrorZ.
8009 pub extern "C" fn CResult_NoneLightningErrorZ_free(_res: CResult_NoneLightningErrorZ) { }
8010 impl Drop for CResult_NoneLightningErrorZ {
8011         fn drop(&mut self) {
8012                 if self.result_ok {
8013                 } else {
8014                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
8015                                 let _ = unsafe { Box::from_raw(self.contents.err) };
8016                         }
8017                 }
8018         }
8019 }
8020 impl From<crate::c_types::CResultTempl<(), crate::lightning::ln::msgs::LightningError>> for CResult_NoneLightningErrorZ {
8021         fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::ln::msgs::LightningError>) -> Self {
8022                 let contents = if o.result_ok {
8023                         let _ = unsafe { Box::from_raw(o.contents.result) };
8024                         o.contents.result = std::ptr::null_mut();
8025                         CResult_NoneLightningErrorZPtr { result: std::ptr::null_mut() }
8026                 } else {
8027                         let err = unsafe { o.contents.err };
8028                         unsafe { o.contents.err = std::ptr::null_mut(); }
8029                         CResult_NoneLightningErrorZPtr { err }
8030                 };
8031                 Self {
8032                         contents,
8033                         result_ok: o.result_ok,
8034                 }
8035         }
8036 }
8037 impl Clone for CResult_NoneLightningErrorZ {
8038         fn clone(&self) -> Self {
8039                 if self.result_ok {
8040                         Self { result_ok: true, contents: CResult_NoneLightningErrorZPtr {
8041                                 result: std::ptr::null_mut()
8042                         } }
8043                 } else {
8044                         Self { result_ok: false, contents: CResult_NoneLightningErrorZPtr {
8045                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::LightningError>::clone(unsafe { &*self.contents.err })))
8046                         } }
8047                 }
8048         }
8049 }
8050 #[no_mangle]
8051 /// Creates a new CResult_NoneLightningErrorZ which has the same data as `orig`
8052 /// but with all dynamically-allocated buffers duplicated in new buffers.
8053 pub extern "C" fn CResult_NoneLightningErrorZ_clone(orig: &CResult_NoneLightningErrorZ) -> CResult_NoneLightningErrorZ { Clone::clone(&orig) }
8054 #[repr(C)]
8055 /// A tuple of 2 elements. See the individual fields for the types contained.
8056 pub struct C2Tuple_PublicKeyTypeZ {
8057         /// The element at position 0
8058         pub a: crate::c_types::PublicKey,
8059         /// The element at position 1
8060         pub b: crate::lightning::ln::wire::Type,
8061 }
8062 impl From<(crate::c_types::PublicKey, crate::lightning::ln::wire::Type)> for C2Tuple_PublicKeyTypeZ {
8063         fn from (tup: (crate::c_types::PublicKey, crate::lightning::ln::wire::Type)) -> Self {
8064                 Self {
8065                         a: tup.0,
8066                         b: tup.1,
8067                 }
8068         }
8069 }
8070 impl C2Tuple_PublicKeyTypeZ {
8071         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::PublicKey, crate::lightning::ln::wire::Type) {
8072                 (self.a, self.b)
8073         }
8074 }
8075 /// Creates a new C2Tuple_PublicKeyTypeZ from the contained elements.
8076 #[no_mangle]
8077 pub extern "C" fn C2Tuple_PublicKeyTypeZ_new(a: crate::c_types::PublicKey, b: crate::lightning::ln::wire::Type) -> C2Tuple_PublicKeyTypeZ {
8078         C2Tuple_PublicKeyTypeZ { a, b, }
8079 }
8080
8081 #[no_mangle]
8082 /// Frees any resources used by the C2Tuple_PublicKeyTypeZ.
8083 pub extern "C" fn C2Tuple_PublicKeyTypeZ_free(_res: C2Tuple_PublicKeyTypeZ) { }
8084 #[repr(C)]
8085 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_PublicKeyTypeZs of arbitrary size.
8086 /// This corresponds to std::vector in C++
8087 pub struct CVec_C2Tuple_PublicKeyTypeZZ {
8088         /// The elements in the array.
8089         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
8090         pub data: *mut crate::c_types::derived::C2Tuple_PublicKeyTypeZ,
8091         /// The number of elements pointed to by `data`.
8092         pub datalen: usize
8093 }
8094 impl CVec_C2Tuple_PublicKeyTypeZZ {
8095         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_PublicKeyTypeZ> {
8096                 if self.datalen == 0 { return Vec::new(); }
8097                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
8098                 self.data = std::ptr::null_mut();
8099                 self.datalen = 0;
8100                 ret
8101         }
8102         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_PublicKeyTypeZ] {
8103                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
8104         }
8105 }
8106 impl From<Vec<crate::c_types::derived::C2Tuple_PublicKeyTypeZ>> for CVec_C2Tuple_PublicKeyTypeZZ {
8107         fn from(v: Vec<crate::c_types::derived::C2Tuple_PublicKeyTypeZ>) -> Self {
8108                 let datalen = v.len();
8109                 let data = Box::into_raw(v.into_boxed_slice());
8110                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
8111         }
8112 }
8113 #[no_mangle]
8114 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
8115 pub extern "C" fn CVec_C2Tuple_PublicKeyTypeZZ_free(_res: CVec_C2Tuple_PublicKeyTypeZZ) { }
8116 impl Drop for CVec_C2Tuple_PublicKeyTypeZZ {
8117         fn drop(&mut self) {
8118                 if self.datalen == 0 { return; }
8119                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
8120         }
8121 }
8122 #[repr(C)]
8123 /// The contents of CResult_boolLightningErrorZ
8124 pub union CResult_boolLightningErrorZPtr {
8125         /// A pointer to the contents in the success state.
8126         /// Reading from this pointer when `result_ok` is not set is undefined.
8127         pub result: *mut bool,
8128         /// A pointer to the contents in the error state.
8129         /// Reading from this pointer when `result_ok` is set is undefined.
8130         pub err: *mut crate::lightning::ln::msgs::LightningError,
8131 }
8132 #[repr(C)]
8133 /// A CResult_boolLightningErrorZ represents the result of a fallible operation,
8134 /// containing a bool on success and a crate::lightning::ln::msgs::LightningError on failure.
8135 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8136 pub struct CResult_boolLightningErrorZ {
8137         /// The contents of this CResult_boolLightningErrorZ, accessible via either
8138         /// `err` or `result` depending on the state of `result_ok`.
8139         pub contents: CResult_boolLightningErrorZPtr,
8140         /// Whether this CResult_boolLightningErrorZ represents a success state.
8141         pub result_ok: bool,
8142 }
8143 #[no_mangle]
8144 /// Creates a new CResult_boolLightningErrorZ in the success state.
8145 pub extern "C" fn CResult_boolLightningErrorZ_ok(o: bool) -> CResult_boolLightningErrorZ {
8146         CResult_boolLightningErrorZ {
8147                 contents: CResult_boolLightningErrorZPtr {
8148                         result: Box::into_raw(Box::new(o)),
8149                 },
8150                 result_ok: true,
8151         }
8152 }
8153 #[no_mangle]
8154 /// Creates a new CResult_boolLightningErrorZ in the error state.
8155 pub extern "C" fn CResult_boolLightningErrorZ_err(e: crate::lightning::ln::msgs::LightningError) -> CResult_boolLightningErrorZ {
8156         CResult_boolLightningErrorZ {
8157                 contents: CResult_boolLightningErrorZPtr {
8158                         err: Box::into_raw(Box::new(e)),
8159                 },
8160                 result_ok: false,
8161         }
8162 }
8163 #[no_mangle]
8164 /// Frees any resources used by the CResult_boolLightningErrorZ.
8165 pub extern "C" fn CResult_boolLightningErrorZ_free(_res: CResult_boolLightningErrorZ) { }
8166 impl Drop for CResult_boolLightningErrorZ {
8167         fn drop(&mut self) {
8168                 if self.result_ok {
8169                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
8170                                 let _ = unsafe { Box::from_raw(self.contents.result) };
8171                         }
8172                 } else {
8173                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
8174                                 let _ = unsafe { Box::from_raw(self.contents.err) };
8175                         }
8176                 }
8177         }
8178 }
8179 impl From<crate::c_types::CResultTempl<bool, crate::lightning::ln::msgs::LightningError>> for CResult_boolLightningErrorZ {
8180         fn from(mut o: crate::c_types::CResultTempl<bool, crate::lightning::ln::msgs::LightningError>) -> Self {
8181                 let contents = if o.result_ok {
8182                         let result = unsafe { o.contents.result };
8183                         unsafe { o.contents.result = std::ptr::null_mut() };
8184                         CResult_boolLightningErrorZPtr { result }
8185                 } else {
8186                         let err = unsafe { o.contents.err };
8187                         unsafe { o.contents.err = std::ptr::null_mut(); }
8188                         CResult_boolLightningErrorZPtr { err }
8189                 };
8190                 Self {
8191                         contents,
8192                         result_ok: o.result_ok,
8193                 }
8194         }
8195 }
8196 impl Clone for CResult_boolLightningErrorZ {
8197         fn clone(&self) -> Self {
8198                 if self.result_ok {
8199                         Self { result_ok: true, contents: CResult_boolLightningErrorZPtr {
8200                                 result: Box::into_raw(Box::new(<bool>::clone(unsafe { &*self.contents.result })))
8201                         } }
8202                 } else {
8203                         Self { result_ok: false, contents: CResult_boolLightningErrorZPtr {
8204                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::LightningError>::clone(unsafe { &*self.contents.err })))
8205                         } }
8206                 }
8207         }
8208 }
8209 #[no_mangle]
8210 /// Creates a new CResult_boolLightningErrorZ which has the same data as `orig`
8211 /// but with all dynamically-allocated buffers duplicated in new buffers.
8212 pub extern "C" fn CResult_boolLightningErrorZ_clone(orig: &CResult_boolLightningErrorZ) -> CResult_boolLightningErrorZ { Clone::clone(&orig) }
8213 #[repr(C)]
8214 /// A tuple of 3 elements. See the individual fields for the types contained.
8215 pub struct C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
8216         /// The element at position 0
8217         pub a: crate::lightning::ln::msgs::ChannelAnnouncement,
8218         /// The element at position 1
8219         pub b: crate::lightning::ln::msgs::ChannelUpdate,
8220         /// The element at position 2
8221         pub c: crate::lightning::ln::msgs::ChannelUpdate,
8222 }
8223 impl From<(crate::lightning::ln::msgs::ChannelAnnouncement, crate::lightning::ln::msgs::ChannelUpdate, crate::lightning::ln::msgs::ChannelUpdate)> for C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
8224         fn from (tup: (crate::lightning::ln::msgs::ChannelAnnouncement, crate::lightning::ln::msgs::ChannelUpdate, crate::lightning::ln::msgs::ChannelUpdate)) -> Self {
8225                 Self {
8226                         a: tup.0,
8227                         b: tup.1,
8228                         c: tup.2,
8229                 }
8230         }
8231 }
8232 impl C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
8233         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::lightning::ln::msgs::ChannelAnnouncement, crate::lightning::ln::msgs::ChannelUpdate, crate::lightning::ln::msgs::ChannelUpdate) {
8234                 (self.a, self.b, self.c)
8235         }
8236 }
8237 impl Clone for C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
8238         fn clone(&self) -> Self {
8239                 Self {
8240                         a: Clone::clone(&self.a),
8241                         b: Clone::clone(&self.b),
8242                         c: Clone::clone(&self.c),
8243                 }
8244         }
8245 }
8246 #[no_mangle]
8247 /// Creates a new tuple which has the same data as `orig`
8248 /// but with all dynamically-allocated buffers duplicated in new buffers.
8249 pub extern "C" fn C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(orig: &C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ) -> C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ { Clone::clone(&orig) }
8250 /// Creates a new C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ from the contained elements.
8251 #[no_mangle]
8252 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 {
8253         C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ { a, b, c, }
8254 }
8255
8256 #[no_mangle]
8257 /// Frees any resources used by the C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ.
8258 pub extern "C" fn C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free(_res: C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ) { }
8259 #[repr(C)]
8260 /// A dynamically-allocated array of crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZs of arbitrary size.
8261 /// This corresponds to std::vector in C++
8262 pub struct CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
8263         /// The elements in the array.
8264         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
8265         pub data: *mut crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ,
8266         /// The number of elements pointed to by `data`.
8267         pub datalen: usize
8268 }
8269 impl CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
8270         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ> {
8271                 if self.datalen == 0 { return Vec::new(); }
8272                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
8273                 self.data = std::ptr::null_mut();
8274                 self.datalen = 0;
8275                 ret
8276         }
8277         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ] {
8278                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
8279         }
8280 }
8281 impl From<Vec<crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ>> for CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
8282         fn from(v: Vec<crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ>) -> Self {
8283                 let datalen = v.len();
8284                 let data = Box::into_raw(v.into_boxed_slice());
8285                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
8286         }
8287 }
8288 #[no_mangle]
8289 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
8290 pub extern "C" fn CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free(_res: CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ) { }
8291 impl Drop for CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
8292         fn drop(&mut self) {
8293                 if self.datalen == 0 { return; }
8294                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
8295         }
8296 }
8297 impl Clone for CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
8298         fn clone(&self) -> Self {
8299                 let mut res = Vec::new();
8300                 if self.datalen == 0 { return Self::from(res); }
8301                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
8302                 Self::from(res)
8303         }
8304 }
8305 #[repr(C)]
8306 /// A dynamically-allocated array of crate::lightning::ln::msgs::NodeAnnouncements of arbitrary size.
8307 /// This corresponds to std::vector in C++
8308 pub struct CVec_NodeAnnouncementZ {
8309         /// The elements in the array.
8310         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
8311         pub data: *mut crate::lightning::ln::msgs::NodeAnnouncement,
8312         /// The number of elements pointed to by `data`.
8313         pub datalen: usize
8314 }
8315 impl CVec_NodeAnnouncementZ {
8316         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::NodeAnnouncement> {
8317                 if self.datalen == 0 { return Vec::new(); }
8318                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
8319                 self.data = std::ptr::null_mut();
8320                 self.datalen = 0;
8321                 ret
8322         }
8323         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::NodeAnnouncement] {
8324                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
8325         }
8326 }
8327 impl From<Vec<crate::lightning::ln::msgs::NodeAnnouncement>> for CVec_NodeAnnouncementZ {
8328         fn from(v: Vec<crate::lightning::ln::msgs::NodeAnnouncement>) -> Self {
8329                 let datalen = v.len();
8330                 let data = Box::into_raw(v.into_boxed_slice());
8331                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
8332         }
8333 }
8334 #[no_mangle]
8335 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
8336 pub extern "C" fn CVec_NodeAnnouncementZ_free(_res: CVec_NodeAnnouncementZ) { }
8337 impl Drop for CVec_NodeAnnouncementZ {
8338         fn drop(&mut self) {
8339                 if self.datalen == 0 { return; }
8340                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
8341         }
8342 }
8343 impl Clone for CVec_NodeAnnouncementZ {
8344         fn clone(&self) -> Self {
8345                 let mut res = Vec::new();
8346                 if self.datalen == 0 { return Self::from(res); }
8347                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
8348                 Self::from(res)
8349         }
8350 }
8351 #[repr(C)]
8352 /// A dynamically-allocated array of crate::c_types::PublicKeys of arbitrary size.
8353 /// This corresponds to std::vector in C++
8354 pub struct CVec_PublicKeyZ {
8355         /// The elements in the array.
8356         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
8357         pub data: *mut crate::c_types::PublicKey,
8358         /// The number of elements pointed to by `data`.
8359         pub datalen: usize
8360 }
8361 impl CVec_PublicKeyZ {
8362         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::PublicKey> {
8363                 if self.datalen == 0 { return Vec::new(); }
8364                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
8365                 self.data = std::ptr::null_mut();
8366                 self.datalen = 0;
8367                 ret
8368         }
8369         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::PublicKey] {
8370                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
8371         }
8372 }
8373 impl From<Vec<crate::c_types::PublicKey>> for CVec_PublicKeyZ {
8374         fn from(v: Vec<crate::c_types::PublicKey>) -> Self {
8375                 let datalen = v.len();
8376                 let data = Box::into_raw(v.into_boxed_slice());
8377                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
8378         }
8379 }
8380 #[no_mangle]
8381 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
8382 pub extern "C" fn CVec_PublicKeyZ_free(_res: CVec_PublicKeyZ) { }
8383 impl Drop for CVec_PublicKeyZ {
8384         fn drop(&mut self) {
8385                 if self.datalen == 0 { return; }
8386                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
8387         }
8388 }
8389 impl Clone for CVec_PublicKeyZ {
8390         fn clone(&self) -> Self {
8391                 let mut res = Vec::new();
8392                 if self.datalen == 0 { return Self::from(res); }
8393                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
8394                 Self::from(res)
8395         }
8396 }
8397 #[repr(C)]
8398 /// The contents of CResult_CVec_u8ZPeerHandleErrorZ
8399 pub union CResult_CVec_u8ZPeerHandleErrorZPtr {
8400         /// A pointer to the contents in the success state.
8401         /// Reading from this pointer when `result_ok` is not set is undefined.
8402         pub result: *mut crate::c_types::derived::CVec_u8Z,
8403         /// A pointer to the contents in the error state.
8404         /// Reading from this pointer when `result_ok` is set is undefined.
8405         pub err: *mut crate::lightning::ln::peer_handler::PeerHandleError,
8406 }
8407 #[repr(C)]
8408 /// A CResult_CVec_u8ZPeerHandleErrorZ represents the result of a fallible operation,
8409 /// containing a crate::c_types::derived::CVec_u8Z on success and a crate::lightning::ln::peer_handler::PeerHandleError on failure.
8410 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8411 pub struct CResult_CVec_u8ZPeerHandleErrorZ {
8412         /// The contents of this CResult_CVec_u8ZPeerHandleErrorZ, accessible via either
8413         /// `err` or `result` depending on the state of `result_ok`.
8414         pub contents: CResult_CVec_u8ZPeerHandleErrorZPtr,
8415         /// Whether this CResult_CVec_u8ZPeerHandleErrorZ represents a success state.
8416         pub result_ok: bool,
8417 }
8418 #[no_mangle]
8419 /// Creates a new CResult_CVec_u8ZPeerHandleErrorZ in the success state.
8420 pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_ok(o: crate::c_types::derived::CVec_u8Z) -> CResult_CVec_u8ZPeerHandleErrorZ {
8421         CResult_CVec_u8ZPeerHandleErrorZ {
8422                 contents: CResult_CVec_u8ZPeerHandleErrorZPtr {
8423                         result: Box::into_raw(Box::new(o)),
8424                 },
8425                 result_ok: true,
8426         }
8427 }
8428 #[no_mangle]
8429 /// Creates a new CResult_CVec_u8ZPeerHandleErrorZ in the error state.
8430 pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_err(e: crate::lightning::ln::peer_handler::PeerHandleError) -> CResult_CVec_u8ZPeerHandleErrorZ {
8431         CResult_CVec_u8ZPeerHandleErrorZ {
8432                 contents: CResult_CVec_u8ZPeerHandleErrorZPtr {
8433                         err: Box::into_raw(Box::new(e)),
8434                 },
8435                 result_ok: false,
8436         }
8437 }
8438 #[no_mangle]
8439 /// Frees any resources used by the CResult_CVec_u8ZPeerHandleErrorZ.
8440 pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_free(_res: CResult_CVec_u8ZPeerHandleErrorZ) { }
8441 impl Drop for CResult_CVec_u8ZPeerHandleErrorZ {
8442         fn drop(&mut self) {
8443                 if self.result_ok {
8444                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
8445                                 let _ = unsafe { Box::from_raw(self.contents.result) };
8446                         }
8447                 } else {
8448                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
8449                                 let _ = unsafe { Box::from_raw(self.contents.err) };
8450                         }
8451                 }
8452         }
8453 }
8454 impl From<crate::c_types::CResultTempl<crate::c_types::derived::CVec_u8Z, crate::lightning::ln::peer_handler::PeerHandleError>> for CResult_CVec_u8ZPeerHandleErrorZ {
8455         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CVec_u8Z, crate::lightning::ln::peer_handler::PeerHandleError>) -> Self {
8456                 let contents = if o.result_ok {
8457                         let result = unsafe { o.contents.result };
8458                         unsafe { o.contents.result = std::ptr::null_mut() };
8459                         CResult_CVec_u8ZPeerHandleErrorZPtr { result }
8460                 } else {
8461                         let err = unsafe { o.contents.err };
8462                         unsafe { o.contents.err = std::ptr::null_mut(); }
8463                         CResult_CVec_u8ZPeerHandleErrorZPtr { err }
8464                 };
8465                 Self {
8466                         contents,
8467                         result_ok: o.result_ok,
8468                 }
8469         }
8470 }
8471 impl Clone for CResult_CVec_u8ZPeerHandleErrorZ {
8472         fn clone(&self) -> Self {
8473                 if self.result_ok {
8474                         Self { result_ok: true, contents: CResult_CVec_u8ZPeerHandleErrorZPtr {
8475                                 result: Box::into_raw(Box::new(<crate::c_types::derived::CVec_u8Z>::clone(unsafe { &*self.contents.result })))
8476                         } }
8477                 } else {
8478                         Self { result_ok: false, contents: CResult_CVec_u8ZPeerHandleErrorZPtr {
8479                                 err: Box::into_raw(Box::new(<crate::lightning::ln::peer_handler::PeerHandleError>::clone(unsafe { &*self.contents.err })))
8480                         } }
8481                 }
8482         }
8483 }
8484 #[no_mangle]
8485 /// Creates a new CResult_CVec_u8ZPeerHandleErrorZ which has the same data as `orig`
8486 /// but with all dynamically-allocated buffers duplicated in new buffers.
8487 pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_clone(orig: &CResult_CVec_u8ZPeerHandleErrorZ) -> CResult_CVec_u8ZPeerHandleErrorZ { Clone::clone(&orig) }
8488 #[repr(C)]
8489 /// The contents of CResult_NonePeerHandleErrorZ
8490 pub union CResult_NonePeerHandleErrorZPtr {
8491         /// Note that this value is always NULL, as there are no contents in the OK variant
8492         pub result: *mut std::ffi::c_void,
8493         /// A pointer to the contents in the error state.
8494         /// Reading from this pointer when `result_ok` is set is undefined.
8495         pub err: *mut crate::lightning::ln::peer_handler::PeerHandleError,
8496 }
8497 #[repr(C)]
8498 /// A CResult_NonePeerHandleErrorZ represents the result of a fallible operation,
8499 /// containing a () on success and a crate::lightning::ln::peer_handler::PeerHandleError on failure.
8500 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8501 pub struct CResult_NonePeerHandleErrorZ {
8502         /// The contents of this CResult_NonePeerHandleErrorZ, accessible via either
8503         /// `err` or `result` depending on the state of `result_ok`.
8504         pub contents: CResult_NonePeerHandleErrorZPtr,
8505         /// Whether this CResult_NonePeerHandleErrorZ represents a success state.
8506         pub result_ok: bool,
8507 }
8508 #[no_mangle]
8509 /// Creates a new CResult_NonePeerHandleErrorZ in the success state.
8510 pub extern "C" fn CResult_NonePeerHandleErrorZ_ok() -> CResult_NonePeerHandleErrorZ {
8511         CResult_NonePeerHandleErrorZ {
8512                 contents: CResult_NonePeerHandleErrorZPtr {
8513                         result: std::ptr::null_mut(),
8514                 },
8515                 result_ok: true,
8516         }
8517 }
8518 #[no_mangle]
8519 /// Creates a new CResult_NonePeerHandleErrorZ in the error state.
8520 pub extern "C" fn CResult_NonePeerHandleErrorZ_err(e: crate::lightning::ln::peer_handler::PeerHandleError) -> CResult_NonePeerHandleErrorZ {
8521         CResult_NonePeerHandleErrorZ {
8522                 contents: CResult_NonePeerHandleErrorZPtr {
8523                         err: Box::into_raw(Box::new(e)),
8524                 },
8525                 result_ok: false,
8526         }
8527 }
8528 #[no_mangle]
8529 /// Frees any resources used by the CResult_NonePeerHandleErrorZ.
8530 pub extern "C" fn CResult_NonePeerHandleErrorZ_free(_res: CResult_NonePeerHandleErrorZ) { }
8531 impl Drop for CResult_NonePeerHandleErrorZ {
8532         fn drop(&mut self) {
8533                 if self.result_ok {
8534                 } else {
8535                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
8536                                 let _ = unsafe { Box::from_raw(self.contents.err) };
8537                         }
8538                 }
8539         }
8540 }
8541 impl From<crate::c_types::CResultTempl<(), crate::lightning::ln::peer_handler::PeerHandleError>> for CResult_NonePeerHandleErrorZ {
8542         fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::ln::peer_handler::PeerHandleError>) -> Self {
8543                 let contents = if o.result_ok {
8544                         let _ = unsafe { Box::from_raw(o.contents.result) };
8545                         o.contents.result = std::ptr::null_mut();
8546                         CResult_NonePeerHandleErrorZPtr { result: std::ptr::null_mut() }
8547                 } else {
8548                         let err = unsafe { o.contents.err };
8549                         unsafe { o.contents.err = std::ptr::null_mut(); }
8550                         CResult_NonePeerHandleErrorZPtr { err }
8551                 };
8552                 Self {
8553                         contents,
8554                         result_ok: o.result_ok,
8555                 }
8556         }
8557 }
8558 impl Clone for CResult_NonePeerHandleErrorZ {
8559         fn clone(&self) -> Self {
8560                 if self.result_ok {
8561                         Self { result_ok: true, contents: CResult_NonePeerHandleErrorZPtr {
8562                                 result: std::ptr::null_mut()
8563                         } }
8564                 } else {
8565                         Self { result_ok: false, contents: CResult_NonePeerHandleErrorZPtr {
8566                                 err: Box::into_raw(Box::new(<crate::lightning::ln::peer_handler::PeerHandleError>::clone(unsafe { &*self.contents.err })))
8567                         } }
8568                 }
8569         }
8570 }
8571 #[no_mangle]
8572 /// Creates a new CResult_NonePeerHandleErrorZ which has the same data as `orig`
8573 /// but with all dynamically-allocated buffers duplicated in new buffers.
8574 pub extern "C" fn CResult_NonePeerHandleErrorZ_clone(orig: &CResult_NonePeerHandleErrorZ) -> CResult_NonePeerHandleErrorZ { Clone::clone(&orig) }
8575 #[repr(C)]
8576 /// The contents of CResult_boolPeerHandleErrorZ
8577 pub union CResult_boolPeerHandleErrorZPtr {
8578         /// A pointer to the contents in the success state.
8579         /// Reading from this pointer when `result_ok` is not set is undefined.
8580         pub result: *mut bool,
8581         /// A pointer to the contents in the error state.
8582         /// Reading from this pointer when `result_ok` is set is undefined.
8583         pub err: *mut crate::lightning::ln::peer_handler::PeerHandleError,
8584 }
8585 #[repr(C)]
8586 /// A CResult_boolPeerHandleErrorZ represents the result of a fallible operation,
8587 /// containing a bool on success and a crate::lightning::ln::peer_handler::PeerHandleError on failure.
8588 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8589 pub struct CResult_boolPeerHandleErrorZ {
8590         /// The contents of this CResult_boolPeerHandleErrorZ, accessible via either
8591         /// `err` or `result` depending on the state of `result_ok`.
8592         pub contents: CResult_boolPeerHandleErrorZPtr,
8593         /// Whether this CResult_boolPeerHandleErrorZ represents a success state.
8594         pub result_ok: bool,
8595 }
8596 #[no_mangle]
8597 /// Creates a new CResult_boolPeerHandleErrorZ in the success state.
8598 pub extern "C" fn CResult_boolPeerHandleErrorZ_ok(o: bool) -> CResult_boolPeerHandleErrorZ {
8599         CResult_boolPeerHandleErrorZ {
8600                 contents: CResult_boolPeerHandleErrorZPtr {
8601                         result: Box::into_raw(Box::new(o)),
8602                 },
8603                 result_ok: true,
8604         }
8605 }
8606 #[no_mangle]
8607 /// Creates a new CResult_boolPeerHandleErrorZ in the error state.
8608 pub extern "C" fn CResult_boolPeerHandleErrorZ_err(e: crate::lightning::ln::peer_handler::PeerHandleError) -> CResult_boolPeerHandleErrorZ {
8609         CResult_boolPeerHandleErrorZ {
8610                 contents: CResult_boolPeerHandleErrorZPtr {
8611                         err: Box::into_raw(Box::new(e)),
8612                 },
8613                 result_ok: false,
8614         }
8615 }
8616 #[no_mangle]
8617 /// Frees any resources used by the CResult_boolPeerHandleErrorZ.
8618 pub extern "C" fn CResult_boolPeerHandleErrorZ_free(_res: CResult_boolPeerHandleErrorZ) { }
8619 impl Drop for CResult_boolPeerHandleErrorZ {
8620         fn drop(&mut self) {
8621                 if self.result_ok {
8622                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
8623                                 let _ = unsafe { Box::from_raw(self.contents.result) };
8624                         }
8625                 } else {
8626                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
8627                                 let _ = unsafe { Box::from_raw(self.contents.err) };
8628                         }
8629                 }
8630         }
8631 }
8632 impl From<crate::c_types::CResultTempl<bool, crate::lightning::ln::peer_handler::PeerHandleError>> for CResult_boolPeerHandleErrorZ {
8633         fn from(mut o: crate::c_types::CResultTempl<bool, crate::lightning::ln::peer_handler::PeerHandleError>) -> Self {
8634                 let contents = if o.result_ok {
8635                         let result = unsafe { o.contents.result };
8636                         unsafe { o.contents.result = std::ptr::null_mut() };
8637                         CResult_boolPeerHandleErrorZPtr { result }
8638                 } else {
8639                         let err = unsafe { o.contents.err };
8640                         unsafe { o.contents.err = std::ptr::null_mut(); }
8641                         CResult_boolPeerHandleErrorZPtr { err }
8642                 };
8643                 Self {
8644                         contents,
8645                         result_ok: o.result_ok,
8646                 }
8647         }
8648 }
8649 impl Clone for CResult_boolPeerHandleErrorZ {
8650         fn clone(&self) -> Self {
8651                 if self.result_ok {
8652                         Self { result_ok: true, contents: CResult_boolPeerHandleErrorZPtr {
8653                                 result: Box::into_raw(Box::new(<bool>::clone(unsafe { &*self.contents.result })))
8654                         } }
8655                 } else {
8656                         Self { result_ok: false, contents: CResult_boolPeerHandleErrorZPtr {
8657                                 err: Box::into_raw(Box::new(<crate::lightning::ln::peer_handler::PeerHandleError>::clone(unsafe { &*self.contents.err })))
8658                         } }
8659                 }
8660         }
8661 }
8662 #[no_mangle]
8663 /// Creates a new CResult_boolPeerHandleErrorZ which has the same data as `orig`
8664 /// but with all dynamically-allocated buffers duplicated in new buffers.
8665 pub extern "C" fn CResult_boolPeerHandleErrorZ_clone(orig: &CResult_boolPeerHandleErrorZ) -> CResult_boolPeerHandleErrorZ { Clone::clone(&orig) }
8666 #[repr(C)]
8667 /// The contents of CResult_NodeIdDecodeErrorZ
8668 pub union CResult_NodeIdDecodeErrorZPtr {
8669         /// A pointer to the contents in the success state.
8670         /// Reading from this pointer when `result_ok` is not set is undefined.
8671         pub result: *mut crate::lightning::routing::network_graph::NodeId,
8672         /// A pointer to the contents in the error state.
8673         /// Reading from this pointer when `result_ok` is set is undefined.
8674         pub err: *mut crate::lightning::ln::msgs::DecodeError,
8675 }
8676 #[repr(C)]
8677 /// A CResult_NodeIdDecodeErrorZ represents the result of a fallible operation,
8678 /// containing a crate::lightning::routing::network_graph::NodeId on success and a crate::lightning::ln::msgs::DecodeError on failure.
8679 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8680 pub struct CResult_NodeIdDecodeErrorZ {
8681         /// The contents of this CResult_NodeIdDecodeErrorZ, accessible via either
8682         /// `err` or `result` depending on the state of `result_ok`.
8683         pub contents: CResult_NodeIdDecodeErrorZPtr,
8684         /// Whether this CResult_NodeIdDecodeErrorZ represents a success state.
8685         pub result_ok: bool,
8686 }
8687 #[no_mangle]
8688 /// Creates a new CResult_NodeIdDecodeErrorZ in the success state.
8689 pub extern "C" fn CResult_NodeIdDecodeErrorZ_ok(o: crate::lightning::routing::network_graph::NodeId) -> CResult_NodeIdDecodeErrorZ {
8690         CResult_NodeIdDecodeErrorZ {
8691                 contents: CResult_NodeIdDecodeErrorZPtr {
8692                         result: Box::into_raw(Box::new(o)),
8693                 },
8694                 result_ok: true,
8695         }
8696 }
8697 #[no_mangle]
8698 /// Creates a new CResult_NodeIdDecodeErrorZ in the error state.
8699 pub extern "C" fn CResult_NodeIdDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeIdDecodeErrorZ {
8700         CResult_NodeIdDecodeErrorZ {
8701                 contents: CResult_NodeIdDecodeErrorZPtr {
8702                         err: Box::into_raw(Box::new(e)),
8703                 },
8704                 result_ok: false,
8705         }
8706 }
8707 #[no_mangle]
8708 /// Frees any resources used by the CResult_NodeIdDecodeErrorZ.
8709 pub extern "C" fn CResult_NodeIdDecodeErrorZ_free(_res: CResult_NodeIdDecodeErrorZ) { }
8710 impl Drop for CResult_NodeIdDecodeErrorZ {
8711         fn drop(&mut self) {
8712                 if self.result_ok {
8713                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
8714                                 let _ = unsafe { Box::from_raw(self.contents.result) };
8715                         }
8716                 } else {
8717                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
8718                                 let _ = unsafe { Box::from_raw(self.contents.err) };
8719                         }
8720                 }
8721         }
8722 }
8723 impl From<crate::c_types::CResultTempl<crate::lightning::routing::network_graph::NodeId, crate::lightning::ln::msgs::DecodeError>> for CResult_NodeIdDecodeErrorZ {
8724         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::network_graph::NodeId, crate::lightning::ln::msgs::DecodeError>) -> Self {
8725                 let contents = if o.result_ok {
8726                         let result = unsafe { o.contents.result };
8727                         unsafe { o.contents.result = std::ptr::null_mut() };
8728                         CResult_NodeIdDecodeErrorZPtr { result }
8729                 } else {
8730                         let err = unsafe { o.contents.err };
8731                         unsafe { o.contents.err = std::ptr::null_mut(); }
8732                         CResult_NodeIdDecodeErrorZPtr { err }
8733                 };
8734                 Self {
8735                         contents,
8736                         result_ok: o.result_ok,
8737                 }
8738         }
8739 }
8740 impl Clone for CResult_NodeIdDecodeErrorZ {
8741         fn clone(&self) -> Self {
8742                 if self.result_ok {
8743                         Self { result_ok: true, contents: CResult_NodeIdDecodeErrorZPtr {
8744                                 result: Box::into_raw(Box::new(<crate::lightning::routing::network_graph::NodeId>::clone(unsafe { &*self.contents.result })))
8745                         } }
8746                 } else {
8747                         Self { result_ok: false, contents: CResult_NodeIdDecodeErrorZPtr {
8748                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
8749                         } }
8750                 }
8751         }
8752 }
8753 #[no_mangle]
8754 /// Creates a new CResult_NodeIdDecodeErrorZ which has the same data as `orig`
8755 /// but with all dynamically-allocated buffers duplicated in new buffers.
8756 pub extern "C" fn CResult_NodeIdDecodeErrorZ_clone(orig: &CResult_NodeIdDecodeErrorZ) -> CResult_NodeIdDecodeErrorZ { Clone::clone(&orig) }
8757 #[repr(C)]
8758 /// An enum which can either contain a crate::lightning::chain::Access or not
8759 pub enum COption_AccessZ {
8760         /// When we're in this state, this COption_AccessZ contains a crate::lightning::chain::Access
8761         Some(crate::lightning::chain::Access),
8762         /// When we're in this state, this COption_AccessZ contains nothing
8763         None
8764 }
8765 impl COption_AccessZ {
8766         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
8767                 if let Self::Some(_) = self { true } else { false }
8768         }
8769         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
8770                 !self.is_some()
8771         }
8772         #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::chain::Access {
8773                 if let Self::Some(v) = self { v } else { unreachable!() }
8774         }
8775 }
8776 #[no_mangle]
8777 /// Constructs a new COption_AccessZ containing a crate::lightning::chain::Access
8778 pub extern "C" fn COption_AccessZ_some(o: crate::lightning::chain::Access) -> COption_AccessZ {
8779         COption_AccessZ::Some(o)
8780 }
8781 #[no_mangle]
8782 /// Constructs a new COption_AccessZ containing nothing
8783 pub extern "C" fn COption_AccessZ_none() -> COption_AccessZ {
8784         COption_AccessZ::None
8785 }
8786 #[no_mangle]
8787 /// Frees any resources associated with the crate::lightning::chain::Access, if we are in the Some state
8788 pub extern "C" fn COption_AccessZ_free(_res: COption_AccessZ) { }
8789 #[repr(C)]
8790 /// The contents of CResult_DirectionalChannelInfoDecodeErrorZ
8791 pub union CResult_DirectionalChannelInfoDecodeErrorZPtr {
8792         /// A pointer to the contents in the success state.
8793         /// Reading from this pointer when `result_ok` is not set is undefined.
8794         pub result: *mut crate::lightning::routing::network_graph::DirectionalChannelInfo,
8795         /// A pointer to the contents in the error state.
8796         /// Reading from this pointer when `result_ok` is set is undefined.
8797         pub err: *mut crate::lightning::ln::msgs::DecodeError,
8798 }
8799 #[repr(C)]
8800 /// A CResult_DirectionalChannelInfoDecodeErrorZ represents the result of a fallible operation,
8801 /// containing a crate::lightning::routing::network_graph::DirectionalChannelInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
8802 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8803 pub struct CResult_DirectionalChannelInfoDecodeErrorZ {
8804         /// The contents of this CResult_DirectionalChannelInfoDecodeErrorZ, accessible via either
8805         /// `err` or `result` depending on the state of `result_ok`.
8806         pub contents: CResult_DirectionalChannelInfoDecodeErrorZPtr,
8807         /// Whether this CResult_DirectionalChannelInfoDecodeErrorZ represents a success state.
8808         pub result_ok: bool,
8809 }
8810 #[no_mangle]
8811 /// Creates a new CResult_DirectionalChannelInfoDecodeErrorZ in the success state.
8812 pub extern "C" fn CResult_DirectionalChannelInfoDecodeErrorZ_ok(o: crate::lightning::routing::network_graph::DirectionalChannelInfo) -> CResult_DirectionalChannelInfoDecodeErrorZ {
8813         CResult_DirectionalChannelInfoDecodeErrorZ {
8814                 contents: CResult_DirectionalChannelInfoDecodeErrorZPtr {
8815                         result: Box::into_raw(Box::new(o)),
8816                 },
8817                 result_ok: true,
8818         }
8819 }
8820 #[no_mangle]
8821 /// Creates a new CResult_DirectionalChannelInfoDecodeErrorZ in the error state.
8822 pub extern "C" fn CResult_DirectionalChannelInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_DirectionalChannelInfoDecodeErrorZ {
8823         CResult_DirectionalChannelInfoDecodeErrorZ {
8824                 contents: CResult_DirectionalChannelInfoDecodeErrorZPtr {
8825                         err: Box::into_raw(Box::new(e)),
8826                 },
8827                 result_ok: false,
8828         }
8829 }
8830 #[no_mangle]
8831 /// Frees any resources used by the CResult_DirectionalChannelInfoDecodeErrorZ.
8832 pub extern "C" fn CResult_DirectionalChannelInfoDecodeErrorZ_free(_res: CResult_DirectionalChannelInfoDecodeErrorZ) { }
8833 impl Drop for CResult_DirectionalChannelInfoDecodeErrorZ {
8834         fn drop(&mut self) {
8835                 if self.result_ok {
8836                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
8837                                 let _ = unsafe { Box::from_raw(self.contents.result) };
8838                         }
8839                 } else {
8840                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
8841                                 let _ = unsafe { Box::from_raw(self.contents.err) };
8842                         }
8843                 }
8844         }
8845 }
8846 impl From<crate::c_types::CResultTempl<crate::lightning::routing::network_graph::DirectionalChannelInfo, crate::lightning::ln::msgs::DecodeError>> for CResult_DirectionalChannelInfoDecodeErrorZ {
8847         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::network_graph::DirectionalChannelInfo, crate::lightning::ln::msgs::DecodeError>) -> Self {
8848                 let contents = if o.result_ok {
8849                         let result = unsafe { o.contents.result };
8850                         unsafe { o.contents.result = std::ptr::null_mut() };
8851                         CResult_DirectionalChannelInfoDecodeErrorZPtr { result }
8852                 } else {
8853                         let err = unsafe { o.contents.err };
8854                         unsafe { o.contents.err = std::ptr::null_mut(); }
8855                         CResult_DirectionalChannelInfoDecodeErrorZPtr { err }
8856                 };
8857                 Self {
8858                         contents,
8859                         result_ok: o.result_ok,
8860                 }
8861         }
8862 }
8863 impl Clone for CResult_DirectionalChannelInfoDecodeErrorZ {
8864         fn clone(&self) -> Self {
8865                 if self.result_ok {
8866                         Self { result_ok: true, contents: CResult_DirectionalChannelInfoDecodeErrorZPtr {
8867                                 result: Box::into_raw(Box::new(<crate::lightning::routing::network_graph::DirectionalChannelInfo>::clone(unsafe { &*self.contents.result })))
8868                         } }
8869                 } else {
8870                         Self { result_ok: false, contents: CResult_DirectionalChannelInfoDecodeErrorZPtr {
8871                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
8872                         } }
8873                 }
8874         }
8875 }
8876 #[no_mangle]
8877 /// Creates a new CResult_DirectionalChannelInfoDecodeErrorZ which has the same data as `orig`
8878 /// but with all dynamically-allocated buffers duplicated in new buffers.
8879 pub extern "C" fn CResult_DirectionalChannelInfoDecodeErrorZ_clone(orig: &CResult_DirectionalChannelInfoDecodeErrorZ) -> CResult_DirectionalChannelInfoDecodeErrorZ { Clone::clone(&orig) }
8880 #[repr(C)]
8881 /// The contents of CResult_ChannelInfoDecodeErrorZ
8882 pub union CResult_ChannelInfoDecodeErrorZPtr {
8883         /// A pointer to the contents in the success state.
8884         /// Reading from this pointer when `result_ok` is not set is undefined.
8885         pub result: *mut crate::lightning::routing::network_graph::ChannelInfo,
8886         /// A pointer to the contents in the error state.
8887         /// Reading from this pointer when `result_ok` is set is undefined.
8888         pub err: *mut crate::lightning::ln::msgs::DecodeError,
8889 }
8890 #[repr(C)]
8891 /// A CResult_ChannelInfoDecodeErrorZ represents the result of a fallible operation,
8892 /// containing a crate::lightning::routing::network_graph::ChannelInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
8893 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8894 pub struct CResult_ChannelInfoDecodeErrorZ {
8895         /// The contents of this CResult_ChannelInfoDecodeErrorZ, accessible via either
8896         /// `err` or `result` depending on the state of `result_ok`.
8897         pub contents: CResult_ChannelInfoDecodeErrorZPtr,
8898         /// Whether this CResult_ChannelInfoDecodeErrorZ represents a success state.
8899         pub result_ok: bool,
8900 }
8901 #[no_mangle]
8902 /// Creates a new CResult_ChannelInfoDecodeErrorZ in the success state.
8903 pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_ok(o: crate::lightning::routing::network_graph::ChannelInfo) -> CResult_ChannelInfoDecodeErrorZ {
8904         CResult_ChannelInfoDecodeErrorZ {
8905                 contents: CResult_ChannelInfoDecodeErrorZPtr {
8906                         result: Box::into_raw(Box::new(o)),
8907                 },
8908                 result_ok: true,
8909         }
8910 }
8911 #[no_mangle]
8912 /// Creates a new CResult_ChannelInfoDecodeErrorZ in the error state.
8913 pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelInfoDecodeErrorZ {
8914         CResult_ChannelInfoDecodeErrorZ {
8915                 contents: CResult_ChannelInfoDecodeErrorZPtr {
8916                         err: Box::into_raw(Box::new(e)),
8917                 },
8918                 result_ok: false,
8919         }
8920 }
8921 #[no_mangle]
8922 /// Frees any resources used by the CResult_ChannelInfoDecodeErrorZ.
8923 pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_free(_res: CResult_ChannelInfoDecodeErrorZ) { }
8924 impl Drop for CResult_ChannelInfoDecodeErrorZ {
8925         fn drop(&mut self) {
8926                 if self.result_ok {
8927                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
8928                                 let _ = unsafe { Box::from_raw(self.contents.result) };
8929                         }
8930                 } else {
8931                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
8932                                 let _ = unsafe { Box::from_raw(self.contents.err) };
8933                         }
8934                 }
8935         }
8936 }
8937 impl From<crate::c_types::CResultTempl<crate::lightning::routing::network_graph::ChannelInfo, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelInfoDecodeErrorZ {
8938         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::network_graph::ChannelInfo, crate::lightning::ln::msgs::DecodeError>) -> Self {
8939                 let contents = if o.result_ok {
8940                         let result = unsafe { o.contents.result };
8941                         unsafe { o.contents.result = std::ptr::null_mut() };
8942                         CResult_ChannelInfoDecodeErrorZPtr { result }
8943                 } else {
8944                         let err = unsafe { o.contents.err };
8945                         unsafe { o.contents.err = std::ptr::null_mut(); }
8946                         CResult_ChannelInfoDecodeErrorZPtr { err }
8947                 };
8948                 Self {
8949                         contents,
8950                         result_ok: o.result_ok,
8951                 }
8952         }
8953 }
8954 impl Clone for CResult_ChannelInfoDecodeErrorZ {
8955         fn clone(&self) -> Self {
8956                 if self.result_ok {
8957                         Self { result_ok: true, contents: CResult_ChannelInfoDecodeErrorZPtr {
8958                                 result: Box::into_raw(Box::new(<crate::lightning::routing::network_graph::ChannelInfo>::clone(unsafe { &*self.contents.result })))
8959                         } }
8960                 } else {
8961                         Self { result_ok: false, contents: CResult_ChannelInfoDecodeErrorZPtr {
8962                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
8963                         } }
8964                 }
8965         }
8966 }
8967 #[no_mangle]
8968 /// Creates a new CResult_ChannelInfoDecodeErrorZ which has the same data as `orig`
8969 /// but with all dynamically-allocated buffers duplicated in new buffers.
8970 pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_clone(orig: &CResult_ChannelInfoDecodeErrorZ) -> CResult_ChannelInfoDecodeErrorZ { Clone::clone(&orig) }
8971 #[repr(C)]
8972 /// The contents of CResult_RoutingFeesDecodeErrorZ
8973 pub union CResult_RoutingFeesDecodeErrorZPtr {
8974         /// A pointer to the contents in the success state.
8975         /// Reading from this pointer when `result_ok` is not set is undefined.
8976         pub result: *mut crate::lightning::routing::network_graph::RoutingFees,
8977         /// A pointer to the contents in the error state.
8978         /// Reading from this pointer when `result_ok` is set is undefined.
8979         pub err: *mut crate::lightning::ln::msgs::DecodeError,
8980 }
8981 #[repr(C)]
8982 /// A CResult_RoutingFeesDecodeErrorZ represents the result of a fallible operation,
8983 /// containing a crate::lightning::routing::network_graph::RoutingFees on success and a crate::lightning::ln::msgs::DecodeError on failure.
8984 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8985 pub struct CResult_RoutingFeesDecodeErrorZ {
8986         /// The contents of this CResult_RoutingFeesDecodeErrorZ, accessible via either
8987         /// `err` or `result` depending on the state of `result_ok`.
8988         pub contents: CResult_RoutingFeesDecodeErrorZPtr,
8989         /// Whether this CResult_RoutingFeesDecodeErrorZ represents a success state.
8990         pub result_ok: bool,
8991 }
8992 #[no_mangle]
8993 /// Creates a new CResult_RoutingFeesDecodeErrorZ in the success state.
8994 pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_ok(o: crate::lightning::routing::network_graph::RoutingFees) -> CResult_RoutingFeesDecodeErrorZ {
8995         CResult_RoutingFeesDecodeErrorZ {
8996                 contents: CResult_RoutingFeesDecodeErrorZPtr {
8997                         result: Box::into_raw(Box::new(o)),
8998                 },
8999                 result_ok: true,
9000         }
9001 }
9002 #[no_mangle]
9003 /// Creates a new CResult_RoutingFeesDecodeErrorZ in the error state.
9004 pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RoutingFeesDecodeErrorZ {
9005         CResult_RoutingFeesDecodeErrorZ {
9006                 contents: CResult_RoutingFeesDecodeErrorZPtr {
9007                         err: Box::into_raw(Box::new(e)),
9008                 },
9009                 result_ok: false,
9010         }
9011 }
9012 #[no_mangle]
9013 /// Frees any resources used by the CResult_RoutingFeesDecodeErrorZ.
9014 pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_free(_res: CResult_RoutingFeesDecodeErrorZ) { }
9015 impl Drop for CResult_RoutingFeesDecodeErrorZ {
9016         fn drop(&mut self) {
9017                 if self.result_ok {
9018                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
9019                                 let _ = unsafe { Box::from_raw(self.contents.result) };
9020                         }
9021                 } else {
9022                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
9023                                 let _ = unsafe { Box::from_raw(self.contents.err) };
9024                         }
9025                 }
9026         }
9027 }
9028 impl From<crate::c_types::CResultTempl<crate::lightning::routing::network_graph::RoutingFees, crate::lightning::ln::msgs::DecodeError>> for CResult_RoutingFeesDecodeErrorZ {
9029         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::network_graph::RoutingFees, crate::lightning::ln::msgs::DecodeError>) -> Self {
9030                 let contents = if o.result_ok {
9031                         let result = unsafe { o.contents.result };
9032                         unsafe { o.contents.result = std::ptr::null_mut() };
9033                         CResult_RoutingFeesDecodeErrorZPtr { result }
9034                 } else {
9035                         let err = unsafe { o.contents.err };
9036                         unsafe { o.contents.err = std::ptr::null_mut(); }
9037                         CResult_RoutingFeesDecodeErrorZPtr { err }
9038                 };
9039                 Self {
9040                         contents,
9041                         result_ok: o.result_ok,
9042                 }
9043         }
9044 }
9045 impl Clone for CResult_RoutingFeesDecodeErrorZ {
9046         fn clone(&self) -> Self {
9047                 if self.result_ok {
9048                         Self { result_ok: true, contents: CResult_RoutingFeesDecodeErrorZPtr {
9049                                 result: Box::into_raw(Box::new(<crate::lightning::routing::network_graph::RoutingFees>::clone(unsafe { &*self.contents.result })))
9050                         } }
9051                 } else {
9052                         Self { result_ok: false, contents: CResult_RoutingFeesDecodeErrorZPtr {
9053                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
9054                         } }
9055                 }
9056         }
9057 }
9058 #[no_mangle]
9059 /// Creates a new CResult_RoutingFeesDecodeErrorZ which has the same data as `orig`
9060 /// but with all dynamically-allocated buffers duplicated in new buffers.
9061 pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_clone(orig: &CResult_RoutingFeesDecodeErrorZ) -> CResult_RoutingFeesDecodeErrorZ { Clone::clone(&orig) }
9062 #[repr(C)]
9063 /// The contents of CResult_NodeAnnouncementInfoDecodeErrorZ
9064 pub union CResult_NodeAnnouncementInfoDecodeErrorZPtr {
9065         /// A pointer to the contents in the success state.
9066         /// Reading from this pointer when `result_ok` is not set is undefined.
9067         pub result: *mut crate::lightning::routing::network_graph::NodeAnnouncementInfo,
9068         /// A pointer to the contents in the error state.
9069         /// Reading from this pointer when `result_ok` is set is undefined.
9070         pub err: *mut crate::lightning::ln::msgs::DecodeError,
9071 }
9072 #[repr(C)]
9073 /// A CResult_NodeAnnouncementInfoDecodeErrorZ represents the result of a fallible operation,
9074 /// containing a crate::lightning::routing::network_graph::NodeAnnouncementInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
9075 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9076 pub struct CResult_NodeAnnouncementInfoDecodeErrorZ {
9077         /// The contents of this CResult_NodeAnnouncementInfoDecodeErrorZ, accessible via either
9078         /// `err` or `result` depending on the state of `result_ok`.
9079         pub contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr,
9080         /// Whether this CResult_NodeAnnouncementInfoDecodeErrorZ represents a success state.
9081         pub result_ok: bool,
9082 }
9083 #[no_mangle]
9084 /// Creates a new CResult_NodeAnnouncementInfoDecodeErrorZ in the success state.
9085 pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_ok(o: crate::lightning::routing::network_graph::NodeAnnouncementInfo) -> CResult_NodeAnnouncementInfoDecodeErrorZ {
9086         CResult_NodeAnnouncementInfoDecodeErrorZ {
9087                 contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr {
9088                         result: Box::into_raw(Box::new(o)),
9089                 },
9090                 result_ok: true,
9091         }
9092 }
9093 #[no_mangle]
9094 /// Creates a new CResult_NodeAnnouncementInfoDecodeErrorZ in the error state.
9095 pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeAnnouncementInfoDecodeErrorZ {
9096         CResult_NodeAnnouncementInfoDecodeErrorZ {
9097                 contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr {
9098                         err: Box::into_raw(Box::new(e)),
9099                 },
9100                 result_ok: false,
9101         }
9102 }
9103 #[no_mangle]
9104 /// Frees any resources used by the CResult_NodeAnnouncementInfoDecodeErrorZ.
9105 pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_free(_res: CResult_NodeAnnouncementInfoDecodeErrorZ) { }
9106 impl Drop for CResult_NodeAnnouncementInfoDecodeErrorZ {
9107         fn drop(&mut self) {
9108                 if self.result_ok {
9109                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
9110                                 let _ = unsafe { Box::from_raw(self.contents.result) };
9111                         }
9112                 } else {
9113                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
9114                                 let _ = unsafe { Box::from_raw(self.contents.err) };
9115                         }
9116                 }
9117         }
9118 }
9119 impl From<crate::c_types::CResultTempl<crate::lightning::routing::network_graph::NodeAnnouncementInfo, crate::lightning::ln::msgs::DecodeError>> for CResult_NodeAnnouncementInfoDecodeErrorZ {
9120         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::network_graph::NodeAnnouncementInfo, crate::lightning::ln::msgs::DecodeError>) -> Self {
9121                 let contents = if o.result_ok {
9122                         let result = unsafe { o.contents.result };
9123                         unsafe { o.contents.result = std::ptr::null_mut() };
9124                         CResult_NodeAnnouncementInfoDecodeErrorZPtr { result }
9125                 } else {
9126                         let err = unsafe { o.contents.err };
9127                         unsafe { o.contents.err = std::ptr::null_mut(); }
9128                         CResult_NodeAnnouncementInfoDecodeErrorZPtr { err }
9129                 };
9130                 Self {
9131                         contents,
9132                         result_ok: o.result_ok,
9133                 }
9134         }
9135 }
9136 impl Clone for CResult_NodeAnnouncementInfoDecodeErrorZ {
9137         fn clone(&self) -> Self {
9138                 if self.result_ok {
9139                         Self { result_ok: true, contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr {
9140                                 result: Box::into_raw(Box::new(<crate::lightning::routing::network_graph::NodeAnnouncementInfo>::clone(unsafe { &*self.contents.result })))
9141                         } }
9142                 } else {
9143                         Self { result_ok: false, contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr {
9144                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
9145                         } }
9146                 }
9147         }
9148 }
9149 #[no_mangle]
9150 /// Creates a new CResult_NodeAnnouncementInfoDecodeErrorZ which has the same data as `orig`
9151 /// but with all dynamically-allocated buffers duplicated in new buffers.
9152 pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_clone(orig: &CResult_NodeAnnouncementInfoDecodeErrorZ) -> CResult_NodeAnnouncementInfoDecodeErrorZ { Clone::clone(&orig) }
9153 #[repr(C)]
9154 /// A dynamically-allocated array of u64s of arbitrary size.
9155 /// This corresponds to std::vector in C++
9156 pub struct CVec_u64Z {
9157         /// The elements in the array.
9158         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
9159         pub data: *mut u64,
9160         /// The number of elements pointed to by `data`.
9161         pub datalen: usize
9162 }
9163 impl CVec_u64Z {
9164         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<u64> {
9165                 if self.datalen == 0 { return Vec::new(); }
9166                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
9167                 self.data = std::ptr::null_mut();
9168                 self.datalen = 0;
9169                 ret
9170         }
9171         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[u64] {
9172                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
9173         }
9174 }
9175 impl From<Vec<u64>> for CVec_u64Z {
9176         fn from(v: Vec<u64>) -> Self {
9177                 let datalen = v.len();
9178                 let data = Box::into_raw(v.into_boxed_slice());
9179                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
9180         }
9181 }
9182 #[no_mangle]
9183 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
9184 pub extern "C" fn CVec_u64Z_free(_res: CVec_u64Z) { }
9185 impl Drop for CVec_u64Z {
9186         fn drop(&mut self) {
9187                 if self.datalen == 0 { return; }
9188                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
9189         }
9190 }
9191 impl Clone for CVec_u64Z {
9192         fn clone(&self) -> Self {
9193                 let mut res = Vec::new();
9194                 if self.datalen == 0 { return Self::from(res); }
9195                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
9196                 Self::from(res)
9197         }
9198 }
9199 #[repr(C)]
9200 /// The contents of CResult_NodeInfoDecodeErrorZ
9201 pub union CResult_NodeInfoDecodeErrorZPtr {
9202         /// A pointer to the contents in the success state.
9203         /// Reading from this pointer when `result_ok` is not set is undefined.
9204         pub result: *mut crate::lightning::routing::network_graph::NodeInfo,
9205         /// A pointer to the contents in the error state.
9206         /// Reading from this pointer when `result_ok` is set is undefined.
9207         pub err: *mut crate::lightning::ln::msgs::DecodeError,
9208 }
9209 #[repr(C)]
9210 /// A CResult_NodeInfoDecodeErrorZ represents the result of a fallible operation,
9211 /// containing a crate::lightning::routing::network_graph::NodeInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
9212 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9213 pub struct CResult_NodeInfoDecodeErrorZ {
9214         /// The contents of this CResult_NodeInfoDecodeErrorZ, accessible via either
9215         /// `err` or `result` depending on the state of `result_ok`.
9216         pub contents: CResult_NodeInfoDecodeErrorZPtr,
9217         /// Whether this CResult_NodeInfoDecodeErrorZ represents a success state.
9218         pub result_ok: bool,
9219 }
9220 #[no_mangle]
9221 /// Creates a new CResult_NodeInfoDecodeErrorZ in the success state.
9222 pub extern "C" fn CResult_NodeInfoDecodeErrorZ_ok(o: crate::lightning::routing::network_graph::NodeInfo) -> CResult_NodeInfoDecodeErrorZ {
9223         CResult_NodeInfoDecodeErrorZ {
9224                 contents: CResult_NodeInfoDecodeErrorZPtr {
9225                         result: Box::into_raw(Box::new(o)),
9226                 },
9227                 result_ok: true,
9228         }
9229 }
9230 #[no_mangle]
9231 /// Creates a new CResult_NodeInfoDecodeErrorZ in the error state.
9232 pub extern "C" fn CResult_NodeInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeInfoDecodeErrorZ {
9233         CResult_NodeInfoDecodeErrorZ {
9234                 contents: CResult_NodeInfoDecodeErrorZPtr {
9235                         err: Box::into_raw(Box::new(e)),
9236                 },
9237                 result_ok: false,
9238         }
9239 }
9240 #[no_mangle]
9241 /// Frees any resources used by the CResult_NodeInfoDecodeErrorZ.
9242 pub extern "C" fn CResult_NodeInfoDecodeErrorZ_free(_res: CResult_NodeInfoDecodeErrorZ) { }
9243 impl Drop for CResult_NodeInfoDecodeErrorZ {
9244         fn drop(&mut self) {
9245                 if self.result_ok {
9246                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
9247                                 let _ = unsafe { Box::from_raw(self.contents.result) };
9248                         }
9249                 } else {
9250                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
9251                                 let _ = unsafe { Box::from_raw(self.contents.err) };
9252                         }
9253                 }
9254         }
9255 }
9256 impl From<crate::c_types::CResultTempl<crate::lightning::routing::network_graph::NodeInfo, crate::lightning::ln::msgs::DecodeError>> for CResult_NodeInfoDecodeErrorZ {
9257         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::network_graph::NodeInfo, crate::lightning::ln::msgs::DecodeError>) -> Self {
9258                 let contents = if o.result_ok {
9259                         let result = unsafe { o.contents.result };
9260                         unsafe { o.contents.result = std::ptr::null_mut() };
9261                         CResult_NodeInfoDecodeErrorZPtr { result }
9262                 } else {
9263                         let err = unsafe { o.contents.err };
9264                         unsafe { o.contents.err = std::ptr::null_mut(); }
9265                         CResult_NodeInfoDecodeErrorZPtr { err }
9266                 };
9267                 Self {
9268                         contents,
9269                         result_ok: o.result_ok,
9270                 }
9271         }
9272 }
9273 impl Clone for CResult_NodeInfoDecodeErrorZ {
9274         fn clone(&self) -> Self {
9275                 if self.result_ok {
9276                         Self { result_ok: true, contents: CResult_NodeInfoDecodeErrorZPtr {
9277                                 result: Box::into_raw(Box::new(<crate::lightning::routing::network_graph::NodeInfo>::clone(unsafe { &*self.contents.result })))
9278                         } }
9279                 } else {
9280                         Self { result_ok: false, contents: CResult_NodeInfoDecodeErrorZPtr {
9281                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
9282                         } }
9283                 }
9284         }
9285 }
9286 #[no_mangle]
9287 /// Creates a new CResult_NodeInfoDecodeErrorZ which has the same data as `orig`
9288 /// but with all dynamically-allocated buffers duplicated in new buffers.
9289 pub extern "C" fn CResult_NodeInfoDecodeErrorZ_clone(orig: &CResult_NodeInfoDecodeErrorZ) -> CResult_NodeInfoDecodeErrorZ { Clone::clone(&orig) }
9290 #[repr(C)]
9291 /// The contents of CResult_NetworkGraphDecodeErrorZ
9292 pub union CResult_NetworkGraphDecodeErrorZPtr {
9293         /// A pointer to the contents in the success state.
9294         /// Reading from this pointer when `result_ok` is not set is undefined.
9295         pub result: *mut crate::lightning::routing::network_graph::NetworkGraph,
9296         /// A pointer to the contents in the error state.
9297         /// Reading from this pointer when `result_ok` is set is undefined.
9298         pub err: *mut crate::lightning::ln::msgs::DecodeError,
9299 }
9300 #[repr(C)]
9301 /// A CResult_NetworkGraphDecodeErrorZ represents the result of a fallible operation,
9302 /// containing a crate::lightning::routing::network_graph::NetworkGraph on success and a crate::lightning::ln::msgs::DecodeError on failure.
9303 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9304 pub struct CResult_NetworkGraphDecodeErrorZ {
9305         /// The contents of this CResult_NetworkGraphDecodeErrorZ, accessible via either
9306         /// `err` or `result` depending on the state of `result_ok`.
9307         pub contents: CResult_NetworkGraphDecodeErrorZPtr,
9308         /// Whether this CResult_NetworkGraphDecodeErrorZ represents a success state.
9309         pub result_ok: bool,
9310 }
9311 #[no_mangle]
9312 /// Creates a new CResult_NetworkGraphDecodeErrorZ in the success state.
9313 pub extern "C" fn CResult_NetworkGraphDecodeErrorZ_ok(o: crate::lightning::routing::network_graph::NetworkGraph) -> CResult_NetworkGraphDecodeErrorZ {
9314         CResult_NetworkGraphDecodeErrorZ {
9315                 contents: CResult_NetworkGraphDecodeErrorZPtr {
9316                         result: Box::into_raw(Box::new(o)),
9317                 },
9318                 result_ok: true,
9319         }
9320 }
9321 #[no_mangle]
9322 /// Creates a new CResult_NetworkGraphDecodeErrorZ in the error state.
9323 pub extern "C" fn CResult_NetworkGraphDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NetworkGraphDecodeErrorZ {
9324         CResult_NetworkGraphDecodeErrorZ {
9325                 contents: CResult_NetworkGraphDecodeErrorZPtr {
9326                         err: Box::into_raw(Box::new(e)),
9327                 },
9328                 result_ok: false,
9329         }
9330 }
9331 #[no_mangle]
9332 /// Frees any resources used by the CResult_NetworkGraphDecodeErrorZ.
9333 pub extern "C" fn CResult_NetworkGraphDecodeErrorZ_free(_res: CResult_NetworkGraphDecodeErrorZ) { }
9334 impl Drop for CResult_NetworkGraphDecodeErrorZ {
9335         fn drop(&mut self) {
9336                 if self.result_ok {
9337                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
9338                                 let _ = unsafe { Box::from_raw(self.contents.result) };
9339                         }
9340                 } else {
9341                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
9342                                 let _ = unsafe { Box::from_raw(self.contents.err) };
9343                         }
9344                 }
9345         }
9346 }
9347 impl From<crate::c_types::CResultTempl<crate::lightning::routing::network_graph::NetworkGraph, crate::lightning::ln::msgs::DecodeError>> for CResult_NetworkGraphDecodeErrorZ {
9348         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::network_graph::NetworkGraph, crate::lightning::ln::msgs::DecodeError>) -> Self {
9349                 let contents = if o.result_ok {
9350                         let result = unsafe { o.contents.result };
9351                         unsafe { o.contents.result = std::ptr::null_mut() };
9352                         CResult_NetworkGraphDecodeErrorZPtr { result }
9353                 } else {
9354                         let err = unsafe { o.contents.err };
9355                         unsafe { o.contents.err = std::ptr::null_mut(); }
9356                         CResult_NetworkGraphDecodeErrorZPtr { err }
9357                 };
9358                 Self {
9359                         contents,
9360                         result_ok: o.result_ok,
9361                 }
9362         }
9363 }
9364 impl Clone for CResult_NetworkGraphDecodeErrorZ {
9365         fn clone(&self) -> Self {
9366                 if self.result_ok {
9367                         Self { result_ok: true, contents: CResult_NetworkGraphDecodeErrorZPtr {
9368                                 result: Box::into_raw(Box::new(<crate::lightning::routing::network_graph::NetworkGraph>::clone(unsafe { &*self.contents.result })))
9369                         } }
9370                 } else {
9371                         Self { result_ok: false, contents: CResult_NetworkGraphDecodeErrorZPtr {
9372                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
9373                         } }
9374                 }
9375         }
9376 }
9377 #[no_mangle]
9378 /// Creates a new CResult_NetworkGraphDecodeErrorZ which has the same data as `orig`
9379 /// but with all dynamically-allocated buffers duplicated in new buffers.
9380 pub extern "C" fn CResult_NetworkGraphDecodeErrorZ_clone(orig: &CResult_NetworkGraphDecodeErrorZ) -> CResult_NetworkGraphDecodeErrorZ { Clone::clone(&orig) }
9381 #[repr(C)]
9382 #[derive(Clone)]
9383 /// An enum which can either contain a crate::c_types::derived::CVec_NetAddressZ or not
9384 pub enum COption_CVec_NetAddressZZ {
9385         /// When we're in this state, this COption_CVec_NetAddressZZ contains a crate::c_types::derived::CVec_NetAddressZ
9386         Some(crate::c_types::derived::CVec_NetAddressZ),
9387         /// When we're in this state, this COption_CVec_NetAddressZZ contains nothing
9388         None
9389 }
9390 impl COption_CVec_NetAddressZZ {
9391         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
9392                 if let Self::Some(_) = self { true } else { false }
9393         }
9394         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
9395                 !self.is_some()
9396         }
9397         #[allow(unused)] pub(crate) fn take(mut self) -> crate::c_types::derived::CVec_NetAddressZ {
9398                 if let Self::Some(v) = self { v } else { unreachable!() }
9399         }
9400 }
9401 #[no_mangle]
9402 /// Constructs a new COption_CVec_NetAddressZZ containing a crate::c_types::derived::CVec_NetAddressZ
9403 pub extern "C" fn COption_CVec_NetAddressZZ_some(o: crate::c_types::derived::CVec_NetAddressZ) -> COption_CVec_NetAddressZZ {
9404         COption_CVec_NetAddressZZ::Some(o)
9405 }
9406 #[no_mangle]
9407 /// Constructs a new COption_CVec_NetAddressZZ containing nothing
9408 pub extern "C" fn COption_CVec_NetAddressZZ_none() -> COption_CVec_NetAddressZZ {
9409         COption_CVec_NetAddressZZ::None
9410 }
9411 #[no_mangle]
9412 /// Frees any resources associated with the crate::c_types::derived::CVec_NetAddressZ, if we are in the Some state
9413 pub extern "C" fn COption_CVec_NetAddressZZ_free(_res: COption_CVec_NetAddressZZ) { }
9414 #[no_mangle]
9415 /// Creates a new COption_CVec_NetAddressZZ which has the same data as `orig`
9416 /// but with all dynamically-allocated buffers duplicated in new buffers.
9417 pub extern "C" fn COption_CVec_NetAddressZZ_clone(orig: &COption_CVec_NetAddressZZ) -> COption_CVec_NetAddressZZ { Clone::clone(&orig) }
9418 #[repr(C)]
9419 /// The contents of CResult_NetAddressDecodeErrorZ
9420 pub union CResult_NetAddressDecodeErrorZPtr {
9421         /// A pointer to the contents in the success state.
9422         /// Reading from this pointer when `result_ok` is not set is undefined.
9423         pub result: *mut crate::lightning::ln::msgs::NetAddress,
9424         /// A pointer to the contents in the error state.
9425         /// Reading from this pointer when `result_ok` is set is undefined.
9426         pub err: *mut crate::lightning::ln::msgs::DecodeError,
9427 }
9428 #[repr(C)]
9429 /// A CResult_NetAddressDecodeErrorZ represents the result of a fallible operation,
9430 /// containing a crate::lightning::ln::msgs::NetAddress on success and a crate::lightning::ln::msgs::DecodeError on failure.
9431 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9432 pub struct CResult_NetAddressDecodeErrorZ {
9433         /// The contents of this CResult_NetAddressDecodeErrorZ, accessible via either
9434         /// `err` or `result` depending on the state of `result_ok`.
9435         pub contents: CResult_NetAddressDecodeErrorZPtr,
9436         /// Whether this CResult_NetAddressDecodeErrorZ represents a success state.
9437         pub result_ok: bool,
9438 }
9439 #[no_mangle]
9440 /// Creates a new CResult_NetAddressDecodeErrorZ in the success state.
9441 pub extern "C" fn CResult_NetAddressDecodeErrorZ_ok(o: crate::lightning::ln::msgs::NetAddress) -> CResult_NetAddressDecodeErrorZ {
9442         CResult_NetAddressDecodeErrorZ {
9443                 contents: CResult_NetAddressDecodeErrorZPtr {
9444                         result: Box::into_raw(Box::new(o)),
9445                 },
9446                 result_ok: true,
9447         }
9448 }
9449 #[no_mangle]
9450 /// Creates a new CResult_NetAddressDecodeErrorZ in the error state.
9451 pub extern "C" fn CResult_NetAddressDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NetAddressDecodeErrorZ {
9452         CResult_NetAddressDecodeErrorZ {
9453                 contents: CResult_NetAddressDecodeErrorZPtr {
9454                         err: Box::into_raw(Box::new(e)),
9455                 },
9456                 result_ok: false,
9457         }
9458 }
9459 #[no_mangle]
9460 /// Frees any resources used by the CResult_NetAddressDecodeErrorZ.
9461 pub extern "C" fn CResult_NetAddressDecodeErrorZ_free(_res: CResult_NetAddressDecodeErrorZ) { }
9462 impl Drop for CResult_NetAddressDecodeErrorZ {
9463         fn drop(&mut self) {
9464                 if self.result_ok {
9465                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
9466                                 let _ = unsafe { Box::from_raw(self.contents.result) };
9467                         }
9468                 } else {
9469                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
9470                                 let _ = unsafe { Box::from_raw(self.contents.err) };
9471                         }
9472                 }
9473         }
9474 }
9475 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::NetAddress, crate::lightning::ln::msgs::DecodeError>> for CResult_NetAddressDecodeErrorZ {
9476         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::NetAddress, crate::lightning::ln::msgs::DecodeError>) -> Self {
9477                 let contents = if o.result_ok {
9478                         let result = unsafe { o.contents.result };
9479                         unsafe { o.contents.result = std::ptr::null_mut() };
9480                         CResult_NetAddressDecodeErrorZPtr { result }
9481                 } else {
9482                         let err = unsafe { o.contents.err };
9483                         unsafe { o.contents.err = std::ptr::null_mut(); }
9484                         CResult_NetAddressDecodeErrorZPtr { err }
9485                 };
9486                 Self {
9487                         contents,
9488                         result_ok: o.result_ok,
9489                 }
9490         }
9491 }
9492 impl Clone for CResult_NetAddressDecodeErrorZ {
9493         fn clone(&self) -> Self {
9494                 if self.result_ok {
9495                         Self { result_ok: true, contents: CResult_NetAddressDecodeErrorZPtr {
9496                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::NetAddress>::clone(unsafe { &*self.contents.result })))
9497                         } }
9498                 } else {
9499                         Self { result_ok: false, contents: CResult_NetAddressDecodeErrorZPtr {
9500                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
9501                         } }
9502                 }
9503         }
9504 }
9505 #[no_mangle]
9506 /// Creates a new CResult_NetAddressDecodeErrorZ which has the same data as `orig`
9507 /// but with all dynamically-allocated buffers duplicated in new buffers.
9508 pub extern "C" fn CResult_NetAddressDecodeErrorZ_clone(orig: &CResult_NetAddressDecodeErrorZ) -> CResult_NetAddressDecodeErrorZ { Clone::clone(&orig) }
9509 #[repr(C)]
9510 /// A dynamically-allocated array of crate::lightning::ln::msgs::UpdateAddHTLCs of arbitrary size.
9511 /// This corresponds to std::vector in C++
9512 pub struct CVec_UpdateAddHTLCZ {
9513         /// The elements in the array.
9514         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
9515         pub data: *mut crate::lightning::ln::msgs::UpdateAddHTLC,
9516         /// The number of elements pointed to by `data`.
9517         pub datalen: usize
9518 }
9519 impl CVec_UpdateAddHTLCZ {
9520         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::UpdateAddHTLC> {
9521                 if self.datalen == 0 { return Vec::new(); }
9522                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
9523                 self.data = std::ptr::null_mut();
9524                 self.datalen = 0;
9525                 ret
9526         }
9527         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::UpdateAddHTLC] {
9528                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
9529         }
9530 }
9531 impl From<Vec<crate::lightning::ln::msgs::UpdateAddHTLC>> for CVec_UpdateAddHTLCZ {
9532         fn from(v: Vec<crate::lightning::ln::msgs::UpdateAddHTLC>) -> Self {
9533                 let datalen = v.len();
9534                 let data = Box::into_raw(v.into_boxed_slice());
9535                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
9536         }
9537 }
9538 #[no_mangle]
9539 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
9540 pub extern "C" fn CVec_UpdateAddHTLCZ_free(_res: CVec_UpdateAddHTLCZ) { }
9541 impl Drop for CVec_UpdateAddHTLCZ {
9542         fn drop(&mut self) {
9543                 if self.datalen == 0 { return; }
9544                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
9545         }
9546 }
9547 impl Clone for CVec_UpdateAddHTLCZ {
9548         fn clone(&self) -> Self {
9549                 let mut res = Vec::new();
9550                 if self.datalen == 0 { return Self::from(res); }
9551                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
9552                 Self::from(res)
9553         }
9554 }
9555 #[repr(C)]
9556 /// A dynamically-allocated array of crate::lightning::ln::msgs::UpdateFulfillHTLCs of arbitrary size.
9557 /// This corresponds to std::vector in C++
9558 pub struct CVec_UpdateFulfillHTLCZ {
9559         /// The elements in the array.
9560         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
9561         pub data: *mut crate::lightning::ln::msgs::UpdateFulfillHTLC,
9562         /// The number of elements pointed to by `data`.
9563         pub datalen: usize
9564 }
9565 impl CVec_UpdateFulfillHTLCZ {
9566         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::UpdateFulfillHTLC> {
9567                 if self.datalen == 0 { return Vec::new(); }
9568                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
9569                 self.data = std::ptr::null_mut();
9570                 self.datalen = 0;
9571                 ret
9572         }
9573         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::UpdateFulfillHTLC] {
9574                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
9575         }
9576 }
9577 impl From<Vec<crate::lightning::ln::msgs::UpdateFulfillHTLC>> for CVec_UpdateFulfillHTLCZ {
9578         fn from(v: Vec<crate::lightning::ln::msgs::UpdateFulfillHTLC>) -> Self {
9579                 let datalen = v.len();
9580                 let data = Box::into_raw(v.into_boxed_slice());
9581                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
9582         }
9583 }
9584 #[no_mangle]
9585 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
9586 pub extern "C" fn CVec_UpdateFulfillHTLCZ_free(_res: CVec_UpdateFulfillHTLCZ) { }
9587 impl Drop for CVec_UpdateFulfillHTLCZ {
9588         fn drop(&mut self) {
9589                 if self.datalen == 0 { return; }
9590                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
9591         }
9592 }
9593 impl Clone for CVec_UpdateFulfillHTLCZ {
9594         fn clone(&self) -> Self {
9595                 let mut res = Vec::new();
9596                 if self.datalen == 0 { return Self::from(res); }
9597                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
9598                 Self::from(res)
9599         }
9600 }
9601 #[repr(C)]
9602 /// A dynamically-allocated array of crate::lightning::ln::msgs::UpdateFailHTLCs of arbitrary size.
9603 /// This corresponds to std::vector in C++
9604 pub struct CVec_UpdateFailHTLCZ {
9605         /// The elements in the array.
9606         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
9607         pub data: *mut crate::lightning::ln::msgs::UpdateFailHTLC,
9608         /// The number of elements pointed to by `data`.
9609         pub datalen: usize
9610 }
9611 impl CVec_UpdateFailHTLCZ {
9612         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::UpdateFailHTLC> {
9613                 if self.datalen == 0 { return Vec::new(); }
9614                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
9615                 self.data = std::ptr::null_mut();
9616                 self.datalen = 0;
9617                 ret
9618         }
9619         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::UpdateFailHTLC] {
9620                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
9621         }
9622 }
9623 impl From<Vec<crate::lightning::ln::msgs::UpdateFailHTLC>> for CVec_UpdateFailHTLCZ {
9624         fn from(v: Vec<crate::lightning::ln::msgs::UpdateFailHTLC>) -> Self {
9625                 let datalen = v.len();
9626                 let data = Box::into_raw(v.into_boxed_slice());
9627                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
9628         }
9629 }
9630 #[no_mangle]
9631 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
9632 pub extern "C" fn CVec_UpdateFailHTLCZ_free(_res: CVec_UpdateFailHTLCZ) { }
9633 impl Drop for CVec_UpdateFailHTLCZ {
9634         fn drop(&mut self) {
9635                 if self.datalen == 0 { return; }
9636                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
9637         }
9638 }
9639 impl Clone for CVec_UpdateFailHTLCZ {
9640         fn clone(&self) -> Self {
9641                 let mut res = Vec::new();
9642                 if self.datalen == 0 { return Self::from(res); }
9643                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
9644                 Self::from(res)
9645         }
9646 }
9647 #[repr(C)]
9648 /// A dynamically-allocated array of crate::lightning::ln::msgs::UpdateFailMalformedHTLCs of arbitrary size.
9649 /// This corresponds to std::vector in C++
9650 pub struct CVec_UpdateFailMalformedHTLCZ {
9651         /// The elements in the array.
9652         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
9653         pub data: *mut crate::lightning::ln::msgs::UpdateFailMalformedHTLC,
9654         /// The number of elements pointed to by `data`.
9655         pub datalen: usize
9656 }
9657 impl CVec_UpdateFailMalformedHTLCZ {
9658         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::UpdateFailMalformedHTLC> {
9659                 if self.datalen == 0 { return Vec::new(); }
9660                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
9661                 self.data = std::ptr::null_mut();
9662                 self.datalen = 0;
9663                 ret
9664         }
9665         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::UpdateFailMalformedHTLC] {
9666                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
9667         }
9668 }
9669 impl From<Vec<crate::lightning::ln::msgs::UpdateFailMalformedHTLC>> for CVec_UpdateFailMalformedHTLCZ {
9670         fn from(v: Vec<crate::lightning::ln::msgs::UpdateFailMalformedHTLC>) -> Self {
9671                 let datalen = v.len();
9672                 let data = Box::into_raw(v.into_boxed_slice());
9673                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
9674         }
9675 }
9676 #[no_mangle]
9677 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
9678 pub extern "C" fn CVec_UpdateFailMalformedHTLCZ_free(_res: CVec_UpdateFailMalformedHTLCZ) { }
9679 impl Drop for CVec_UpdateFailMalformedHTLCZ {
9680         fn drop(&mut self) {
9681                 if self.datalen == 0 { return; }
9682                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
9683         }
9684 }
9685 impl Clone for CVec_UpdateFailMalformedHTLCZ {
9686         fn clone(&self) -> Self {
9687                 let mut res = Vec::new();
9688                 if self.datalen == 0 { return Self::from(res); }
9689                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
9690                 Self::from(res)
9691         }
9692 }
9693 #[repr(C)]
9694 /// The contents of CResult_AcceptChannelDecodeErrorZ
9695 pub union CResult_AcceptChannelDecodeErrorZPtr {
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::AcceptChannel,
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_AcceptChannelDecodeErrorZ represents the result of a fallible operation,
9705 /// containing a crate::lightning::ln::msgs::AcceptChannel 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_AcceptChannelDecodeErrorZ {
9708         /// The contents of this CResult_AcceptChannelDecodeErrorZ, accessible via either
9709         /// `err` or `result` depending on the state of `result_ok`.
9710         pub contents: CResult_AcceptChannelDecodeErrorZPtr,
9711         /// Whether this CResult_AcceptChannelDecodeErrorZ represents a success state.
9712         pub result_ok: bool,
9713 }
9714 #[no_mangle]
9715 /// Creates a new CResult_AcceptChannelDecodeErrorZ in the success state.
9716 pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_ok(o: crate::lightning::ln::msgs::AcceptChannel) -> CResult_AcceptChannelDecodeErrorZ {
9717         CResult_AcceptChannelDecodeErrorZ {
9718                 contents: CResult_AcceptChannelDecodeErrorZPtr {
9719                         result: Box::into_raw(Box::new(o)),
9720                 },
9721                 result_ok: true,
9722         }
9723 }
9724 #[no_mangle]
9725 /// Creates a new CResult_AcceptChannelDecodeErrorZ in the error state.
9726 pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_AcceptChannelDecodeErrorZ {
9727         CResult_AcceptChannelDecodeErrorZ {
9728                 contents: CResult_AcceptChannelDecodeErrorZPtr {
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_AcceptChannelDecodeErrorZ.
9736 pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_free(_res: CResult_AcceptChannelDecodeErrorZ) { }
9737 impl Drop for CResult_AcceptChannelDecodeErrorZ {
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::AcceptChannel, crate::lightning::ln::msgs::DecodeError>> for CResult_AcceptChannelDecodeErrorZ {
9751         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::AcceptChannel, 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_AcceptChannelDecodeErrorZPtr { result }
9756                 } else {
9757                         let err = unsafe { o.contents.err };
9758                         unsafe { o.contents.err = std::ptr::null_mut(); }
9759                         CResult_AcceptChannelDecodeErrorZPtr { err }
9760                 };
9761                 Self {
9762                         contents,
9763                         result_ok: o.result_ok,
9764                 }
9765         }
9766 }
9767 impl Clone for CResult_AcceptChannelDecodeErrorZ {
9768         fn clone(&self) -> Self {
9769                 if self.result_ok {
9770                         Self { result_ok: true, contents: CResult_AcceptChannelDecodeErrorZPtr {
9771                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::AcceptChannel>::clone(unsafe { &*self.contents.result })))
9772                         } }
9773                 } else {
9774                         Self { result_ok: false, contents: CResult_AcceptChannelDecodeErrorZPtr {
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_AcceptChannelDecodeErrorZ which has the same data as `orig`
9782 /// but with all dynamically-allocated buffers duplicated in new buffers.
9783 pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_clone(orig: &CResult_AcceptChannelDecodeErrorZ) -> CResult_AcceptChannelDecodeErrorZ { Clone::clone(&orig) }
9784 #[repr(C)]
9785 /// The contents of CResult_AnnouncementSignaturesDecodeErrorZ
9786 pub union CResult_AnnouncementSignaturesDecodeErrorZPtr {
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::AnnouncementSignatures,
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_AnnouncementSignaturesDecodeErrorZ represents the result of a fallible operation,
9796 /// containing a crate::lightning::ln::msgs::AnnouncementSignatures 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_AnnouncementSignaturesDecodeErrorZ {
9799         /// The contents of this CResult_AnnouncementSignaturesDecodeErrorZ, accessible via either
9800         /// `err` or `result` depending on the state of `result_ok`.
9801         pub contents: CResult_AnnouncementSignaturesDecodeErrorZPtr,
9802         /// Whether this CResult_AnnouncementSignaturesDecodeErrorZ represents a success state.
9803         pub result_ok: bool,
9804 }
9805 #[no_mangle]
9806 /// Creates a new CResult_AnnouncementSignaturesDecodeErrorZ in the success state.
9807 pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_ok(o: crate::lightning::ln::msgs::AnnouncementSignatures) -> CResult_AnnouncementSignaturesDecodeErrorZ {
9808         CResult_AnnouncementSignaturesDecodeErrorZ {
9809                 contents: CResult_AnnouncementSignaturesDecodeErrorZPtr {
9810                         result: Box::into_raw(Box::new(o)),
9811                 },
9812                 result_ok: true,
9813         }
9814 }
9815 #[no_mangle]
9816 /// Creates a new CResult_AnnouncementSignaturesDecodeErrorZ in the error state.
9817 pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_AnnouncementSignaturesDecodeErrorZ {
9818         CResult_AnnouncementSignaturesDecodeErrorZ {
9819                 contents: CResult_AnnouncementSignaturesDecodeErrorZPtr {
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_AnnouncementSignaturesDecodeErrorZ.
9827 pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_free(_res: CResult_AnnouncementSignaturesDecodeErrorZ) { }
9828 impl Drop for CResult_AnnouncementSignaturesDecodeErrorZ {
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::AnnouncementSignatures, crate::lightning::ln::msgs::DecodeError>> for CResult_AnnouncementSignaturesDecodeErrorZ {
9842         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::AnnouncementSignatures, 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_AnnouncementSignaturesDecodeErrorZPtr { result }
9847                 } else {
9848                         let err = unsafe { o.contents.err };
9849                         unsafe { o.contents.err = std::ptr::null_mut(); }
9850                         CResult_AnnouncementSignaturesDecodeErrorZPtr { err }
9851                 };
9852                 Self {
9853                         contents,
9854                         result_ok: o.result_ok,
9855                 }
9856         }
9857 }
9858 impl Clone for CResult_AnnouncementSignaturesDecodeErrorZ {
9859         fn clone(&self) -> Self {
9860                 if self.result_ok {
9861                         Self { result_ok: true, contents: CResult_AnnouncementSignaturesDecodeErrorZPtr {
9862                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::AnnouncementSignatures>::clone(unsafe { &*self.contents.result })))
9863                         } }
9864                 } else {
9865                         Self { result_ok: false, contents: CResult_AnnouncementSignaturesDecodeErrorZPtr {
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_AnnouncementSignaturesDecodeErrorZ which has the same data as `orig`
9873 /// but with all dynamically-allocated buffers duplicated in new buffers.
9874 pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_clone(orig: &CResult_AnnouncementSignaturesDecodeErrorZ) -> CResult_AnnouncementSignaturesDecodeErrorZ { Clone::clone(&orig) }
9875 #[repr(C)]
9876 /// The contents of CResult_ChannelReestablishDecodeErrorZ
9877 pub union CResult_ChannelReestablishDecodeErrorZPtr {
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::ChannelReestablish,
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_ChannelReestablishDecodeErrorZ represents the result of a fallible operation,
9887 /// containing a crate::lightning::ln::msgs::ChannelReestablish 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_ChannelReestablishDecodeErrorZ {
9890         /// The contents of this CResult_ChannelReestablishDecodeErrorZ, accessible via either
9891         /// `err` or `result` depending on the state of `result_ok`.
9892         pub contents: CResult_ChannelReestablishDecodeErrorZPtr,
9893         /// Whether this CResult_ChannelReestablishDecodeErrorZ represents a success state.
9894         pub result_ok: bool,
9895 }
9896 #[no_mangle]
9897 /// Creates a new CResult_ChannelReestablishDecodeErrorZ in the success state.
9898 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ChannelReestablish) -> CResult_ChannelReestablishDecodeErrorZ {
9899         CResult_ChannelReestablishDecodeErrorZ {
9900                 contents: CResult_ChannelReestablishDecodeErrorZPtr {
9901                         result: Box::into_raw(Box::new(o)),
9902                 },
9903                 result_ok: true,
9904         }
9905 }
9906 #[no_mangle]
9907 /// Creates a new CResult_ChannelReestablishDecodeErrorZ in the error state.
9908 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelReestablishDecodeErrorZ {
9909         CResult_ChannelReestablishDecodeErrorZ {
9910                 contents: CResult_ChannelReestablishDecodeErrorZPtr {
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_ChannelReestablishDecodeErrorZ.
9918 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_free(_res: CResult_ChannelReestablishDecodeErrorZ) { }
9919 impl Drop for CResult_ChannelReestablishDecodeErrorZ {
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::ChannelReestablish, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelReestablishDecodeErrorZ {
9933         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelReestablish, 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_ChannelReestablishDecodeErrorZPtr { result }
9938                 } else {
9939                         let err = unsafe { o.contents.err };
9940                         unsafe { o.contents.err = std::ptr::null_mut(); }
9941                         CResult_ChannelReestablishDecodeErrorZPtr { err }
9942                 };
9943                 Self {
9944                         contents,
9945                         result_ok: o.result_ok,
9946                 }
9947         }
9948 }
9949 impl Clone for CResult_ChannelReestablishDecodeErrorZ {
9950         fn clone(&self) -> Self {
9951                 if self.result_ok {
9952                         Self { result_ok: true, contents: CResult_ChannelReestablishDecodeErrorZPtr {
9953                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ChannelReestablish>::clone(unsafe { &*self.contents.result })))
9954                         } }
9955                 } else {
9956                         Self { result_ok: false, contents: CResult_ChannelReestablishDecodeErrorZPtr {
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_ChannelReestablishDecodeErrorZ which has the same data as `orig`
9964 /// but with all dynamically-allocated buffers duplicated in new buffers.
9965 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_clone(orig: &CResult_ChannelReestablishDecodeErrorZ) -> CResult_ChannelReestablishDecodeErrorZ { Clone::clone(&orig) }
9966 #[repr(C)]
9967 /// The contents of CResult_ClosingSignedDecodeErrorZ
9968 pub union CResult_ClosingSignedDecodeErrorZPtr {
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::ClosingSigned,
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_ClosingSignedDecodeErrorZ represents the result of a fallible operation,
9978 /// containing a crate::lightning::ln::msgs::ClosingSigned 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_ClosingSignedDecodeErrorZ {
9981         /// The contents of this CResult_ClosingSignedDecodeErrorZ, accessible via either
9982         /// `err` or `result` depending on the state of `result_ok`.
9983         pub contents: CResult_ClosingSignedDecodeErrorZPtr,
9984         /// Whether this CResult_ClosingSignedDecodeErrorZ represents a success state.
9985         pub result_ok: bool,
9986 }
9987 #[no_mangle]
9988 /// Creates a new CResult_ClosingSignedDecodeErrorZ in the success state.
9989 pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ClosingSigned) -> CResult_ClosingSignedDecodeErrorZ {
9990         CResult_ClosingSignedDecodeErrorZ {
9991                 contents: CResult_ClosingSignedDecodeErrorZPtr {
9992                         result: Box::into_raw(Box::new(o)),
9993                 },
9994                 result_ok: true,
9995         }
9996 }
9997 #[no_mangle]
9998 /// Creates a new CResult_ClosingSignedDecodeErrorZ in the error state.
9999 pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ClosingSignedDecodeErrorZ {
10000         CResult_ClosingSignedDecodeErrorZ {
10001                 contents: CResult_ClosingSignedDecodeErrorZPtr {
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_ClosingSignedDecodeErrorZ.
10009 pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_free(_res: CResult_ClosingSignedDecodeErrorZ) { }
10010 impl Drop for CResult_ClosingSignedDecodeErrorZ {
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::ClosingSigned, crate::lightning::ln::msgs::DecodeError>> for CResult_ClosingSignedDecodeErrorZ {
10024         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ClosingSigned, 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_ClosingSignedDecodeErrorZPtr { result }
10029                 } else {
10030                         let err = unsafe { o.contents.err };
10031                         unsafe { o.contents.err = std::ptr::null_mut(); }
10032                         CResult_ClosingSignedDecodeErrorZPtr { err }
10033                 };
10034                 Self {
10035                         contents,
10036                         result_ok: o.result_ok,
10037                 }
10038         }
10039 }
10040 impl Clone for CResult_ClosingSignedDecodeErrorZ {
10041         fn clone(&self) -> Self {
10042                 if self.result_ok {
10043                         Self { result_ok: true, contents: CResult_ClosingSignedDecodeErrorZPtr {
10044                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ClosingSigned>::clone(unsafe { &*self.contents.result })))
10045                         } }
10046                 } else {
10047                         Self { result_ok: false, contents: CResult_ClosingSignedDecodeErrorZPtr {
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_ClosingSignedDecodeErrorZ which has the same data as `orig`
10055 /// but with all dynamically-allocated buffers duplicated in new buffers.
10056 pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_clone(orig: &CResult_ClosingSignedDecodeErrorZ) -> CResult_ClosingSignedDecodeErrorZ { Clone::clone(&orig) }
10057 #[repr(C)]
10058 /// The contents of CResult_ClosingSignedFeeRangeDecodeErrorZ
10059 pub union CResult_ClosingSignedFeeRangeDecodeErrorZPtr {
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::ClosingSignedFeeRange,
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_ClosingSignedFeeRangeDecodeErrorZ represents the result of a fallible operation,
10069 /// containing a crate::lightning::ln::msgs::ClosingSignedFeeRange 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_ClosingSignedFeeRangeDecodeErrorZ {
10072         /// The contents of this CResult_ClosingSignedFeeRangeDecodeErrorZ, accessible via either
10073         /// `err` or `result` depending on the state of `result_ok`.
10074         pub contents: CResult_ClosingSignedFeeRangeDecodeErrorZPtr,
10075         /// Whether this CResult_ClosingSignedFeeRangeDecodeErrorZ represents a success state.
10076         pub result_ok: bool,
10077 }
10078 #[no_mangle]
10079 /// Creates a new CResult_ClosingSignedFeeRangeDecodeErrorZ in the success state.
10080 pub extern "C" fn CResult_ClosingSignedFeeRangeDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ClosingSignedFeeRange) -> CResult_ClosingSignedFeeRangeDecodeErrorZ {
10081         CResult_ClosingSignedFeeRangeDecodeErrorZ {
10082                 contents: CResult_ClosingSignedFeeRangeDecodeErrorZPtr {
10083                         result: Box::into_raw(Box::new(o)),
10084                 },
10085                 result_ok: true,
10086         }
10087 }
10088 #[no_mangle]
10089 /// Creates a new CResult_ClosingSignedFeeRangeDecodeErrorZ in the error state.
10090 pub extern "C" fn CResult_ClosingSignedFeeRangeDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ClosingSignedFeeRangeDecodeErrorZ {
10091         CResult_ClosingSignedFeeRangeDecodeErrorZ {
10092                 contents: CResult_ClosingSignedFeeRangeDecodeErrorZPtr {
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_ClosingSignedFeeRangeDecodeErrorZ.
10100 pub extern "C" fn CResult_ClosingSignedFeeRangeDecodeErrorZ_free(_res: CResult_ClosingSignedFeeRangeDecodeErrorZ) { }
10101 impl Drop for CResult_ClosingSignedFeeRangeDecodeErrorZ {
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::ClosingSignedFeeRange, crate::lightning::ln::msgs::DecodeError>> for CResult_ClosingSignedFeeRangeDecodeErrorZ {
10115         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ClosingSignedFeeRange, 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_ClosingSignedFeeRangeDecodeErrorZPtr { result }
10120                 } else {
10121                         let err = unsafe { o.contents.err };
10122                         unsafe { o.contents.err = std::ptr::null_mut(); }
10123                         CResult_ClosingSignedFeeRangeDecodeErrorZPtr { err }
10124                 };
10125                 Self {
10126                         contents,
10127                         result_ok: o.result_ok,
10128                 }
10129         }
10130 }
10131 impl Clone for CResult_ClosingSignedFeeRangeDecodeErrorZ {
10132         fn clone(&self) -> Self {
10133                 if self.result_ok {
10134                         Self { result_ok: true, contents: CResult_ClosingSignedFeeRangeDecodeErrorZPtr {
10135                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ClosingSignedFeeRange>::clone(unsafe { &*self.contents.result })))
10136                         } }
10137                 } else {
10138                         Self { result_ok: false, contents: CResult_ClosingSignedFeeRangeDecodeErrorZPtr {
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_ClosingSignedFeeRangeDecodeErrorZ which has the same data as `orig`
10146 /// but with all dynamically-allocated buffers duplicated in new buffers.
10147 pub extern "C" fn CResult_ClosingSignedFeeRangeDecodeErrorZ_clone(orig: &CResult_ClosingSignedFeeRangeDecodeErrorZ) -> CResult_ClosingSignedFeeRangeDecodeErrorZ { Clone::clone(&orig) }
10148 #[repr(C)]
10149 /// The contents of CResult_CommitmentSignedDecodeErrorZ
10150 pub union CResult_CommitmentSignedDecodeErrorZPtr {
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::CommitmentSigned,
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_CommitmentSignedDecodeErrorZ represents the result of a fallible operation,
10160 /// containing a crate::lightning::ln::msgs::CommitmentSigned 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_CommitmentSignedDecodeErrorZ {
10163         /// The contents of this CResult_CommitmentSignedDecodeErrorZ, accessible via either
10164         /// `err` or `result` depending on the state of `result_ok`.
10165         pub contents: CResult_CommitmentSignedDecodeErrorZPtr,
10166         /// Whether this CResult_CommitmentSignedDecodeErrorZ represents a success state.
10167         pub result_ok: bool,
10168 }
10169 #[no_mangle]
10170 /// Creates a new CResult_CommitmentSignedDecodeErrorZ in the success state.
10171 pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_ok(o: crate::lightning::ln::msgs::CommitmentSigned) -> CResult_CommitmentSignedDecodeErrorZ {
10172         CResult_CommitmentSignedDecodeErrorZ {
10173                 contents: CResult_CommitmentSignedDecodeErrorZPtr {
10174                         result: Box::into_raw(Box::new(o)),
10175                 },
10176                 result_ok: true,
10177         }
10178 }
10179 #[no_mangle]
10180 /// Creates a new CResult_CommitmentSignedDecodeErrorZ in the error state.
10181 pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_CommitmentSignedDecodeErrorZ {
10182         CResult_CommitmentSignedDecodeErrorZ {
10183                 contents: CResult_CommitmentSignedDecodeErrorZPtr {
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_CommitmentSignedDecodeErrorZ.
10191 pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_free(_res: CResult_CommitmentSignedDecodeErrorZ) { }
10192 impl Drop for CResult_CommitmentSignedDecodeErrorZ {
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::CommitmentSigned, crate::lightning::ln::msgs::DecodeError>> for CResult_CommitmentSignedDecodeErrorZ {
10206         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::CommitmentSigned, 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_CommitmentSignedDecodeErrorZPtr { result }
10211                 } else {
10212                         let err = unsafe { o.contents.err };
10213                         unsafe { o.contents.err = std::ptr::null_mut(); }
10214                         CResult_CommitmentSignedDecodeErrorZPtr { err }
10215                 };
10216                 Self {
10217                         contents,
10218                         result_ok: o.result_ok,
10219                 }
10220         }
10221 }
10222 impl Clone for CResult_CommitmentSignedDecodeErrorZ {
10223         fn clone(&self) -> Self {
10224                 if self.result_ok {
10225                         Self { result_ok: true, contents: CResult_CommitmentSignedDecodeErrorZPtr {
10226                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::CommitmentSigned>::clone(unsafe { &*self.contents.result })))
10227                         } }
10228                 } else {
10229                         Self { result_ok: false, contents: CResult_CommitmentSignedDecodeErrorZPtr {
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_CommitmentSignedDecodeErrorZ which has the same data as `orig`
10237 /// but with all dynamically-allocated buffers duplicated in new buffers.
10238 pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_clone(orig: &CResult_CommitmentSignedDecodeErrorZ) -> CResult_CommitmentSignedDecodeErrorZ { Clone::clone(&orig) }
10239 #[repr(C)]
10240 /// The contents of CResult_FundingCreatedDecodeErrorZ
10241 pub union CResult_FundingCreatedDecodeErrorZPtr {
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::FundingCreated,
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_FundingCreatedDecodeErrorZ represents the result of a fallible operation,
10251 /// containing a crate::lightning::ln::msgs::FundingCreated 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_FundingCreatedDecodeErrorZ {
10254         /// The contents of this CResult_FundingCreatedDecodeErrorZ, accessible via either
10255         /// `err` or `result` depending on the state of `result_ok`.
10256         pub contents: CResult_FundingCreatedDecodeErrorZPtr,
10257         /// Whether this CResult_FundingCreatedDecodeErrorZ represents a success state.
10258         pub result_ok: bool,
10259 }
10260 #[no_mangle]
10261 /// Creates a new CResult_FundingCreatedDecodeErrorZ in the success state.
10262 pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_ok(o: crate::lightning::ln::msgs::FundingCreated) -> CResult_FundingCreatedDecodeErrorZ {
10263         CResult_FundingCreatedDecodeErrorZ {
10264                 contents: CResult_FundingCreatedDecodeErrorZPtr {
10265                         result: Box::into_raw(Box::new(o)),
10266                 },
10267                 result_ok: true,
10268         }
10269 }
10270 #[no_mangle]
10271 /// Creates a new CResult_FundingCreatedDecodeErrorZ in the error state.
10272 pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_FundingCreatedDecodeErrorZ {
10273         CResult_FundingCreatedDecodeErrorZ {
10274                 contents: CResult_FundingCreatedDecodeErrorZPtr {
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_FundingCreatedDecodeErrorZ.
10282 pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_free(_res: CResult_FundingCreatedDecodeErrorZ) { }
10283 impl Drop for CResult_FundingCreatedDecodeErrorZ {
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::FundingCreated, crate::lightning::ln::msgs::DecodeError>> for CResult_FundingCreatedDecodeErrorZ {
10297         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::FundingCreated, 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_FundingCreatedDecodeErrorZPtr { result }
10302                 } else {
10303                         let err = unsafe { o.contents.err };
10304                         unsafe { o.contents.err = std::ptr::null_mut(); }
10305                         CResult_FundingCreatedDecodeErrorZPtr { err }
10306                 };
10307                 Self {
10308                         contents,
10309                         result_ok: o.result_ok,
10310                 }
10311         }
10312 }
10313 impl Clone for CResult_FundingCreatedDecodeErrorZ {
10314         fn clone(&self) -> Self {
10315                 if self.result_ok {
10316                         Self { result_ok: true, contents: CResult_FundingCreatedDecodeErrorZPtr {
10317                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::FundingCreated>::clone(unsafe { &*self.contents.result })))
10318                         } }
10319                 } else {
10320                         Self { result_ok: false, contents: CResult_FundingCreatedDecodeErrorZPtr {
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_FundingCreatedDecodeErrorZ which has the same data as `orig`
10328 /// but with all dynamically-allocated buffers duplicated in new buffers.
10329 pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_clone(orig: &CResult_FundingCreatedDecodeErrorZ) -> CResult_FundingCreatedDecodeErrorZ { Clone::clone(&orig) }
10330 #[repr(C)]
10331 /// The contents of CResult_FundingSignedDecodeErrorZ
10332 pub union CResult_FundingSignedDecodeErrorZPtr {
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::FundingSigned,
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_FundingSignedDecodeErrorZ represents the result of a fallible operation,
10342 /// containing a crate::lightning::ln::msgs::FundingSigned 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_FundingSignedDecodeErrorZ {
10345         /// The contents of this CResult_FundingSignedDecodeErrorZ, accessible via either
10346         /// `err` or `result` depending on the state of `result_ok`.
10347         pub contents: CResult_FundingSignedDecodeErrorZPtr,
10348         /// Whether this CResult_FundingSignedDecodeErrorZ represents a success state.
10349         pub result_ok: bool,
10350 }
10351 #[no_mangle]
10352 /// Creates a new CResult_FundingSignedDecodeErrorZ in the success state.
10353 pub extern "C" fn CResult_FundingSignedDecodeErrorZ_ok(o: crate::lightning::ln::msgs::FundingSigned) -> CResult_FundingSignedDecodeErrorZ {
10354         CResult_FundingSignedDecodeErrorZ {
10355                 contents: CResult_FundingSignedDecodeErrorZPtr {
10356                         result: Box::into_raw(Box::new(o)),
10357                 },
10358                 result_ok: true,
10359         }
10360 }
10361 #[no_mangle]
10362 /// Creates a new CResult_FundingSignedDecodeErrorZ in the error state.
10363 pub extern "C" fn CResult_FundingSignedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_FundingSignedDecodeErrorZ {
10364         CResult_FundingSignedDecodeErrorZ {
10365                 contents: CResult_FundingSignedDecodeErrorZPtr {
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_FundingSignedDecodeErrorZ.
10373 pub extern "C" fn CResult_FundingSignedDecodeErrorZ_free(_res: CResult_FundingSignedDecodeErrorZ) { }
10374 impl Drop for CResult_FundingSignedDecodeErrorZ {
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::FundingSigned, crate::lightning::ln::msgs::DecodeError>> for CResult_FundingSignedDecodeErrorZ {
10388         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::FundingSigned, 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_FundingSignedDecodeErrorZPtr { result }
10393                 } else {
10394                         let err = unsafe { o.contents.err };
10395                         unsafe { o.contents.err = std::ptr::null_mut(); }
10396                         CResult_FundingSignedDecodeErrorZPtr { err }
10397                 };
10398                 Self {
10399                         contents,
10400                         result_ok: o.result_ok,
10401                 }
10402         }
10403 }
10404 impl Clone for CResult_FundingSignedDecodeErrorZ {
10405         fn clone(&self) -> Self {
10406                 if self.result_ok {
10407                         Self { result_ok: true, contents: CResult_FundingSignedDecodeErrorZPtr {
10408                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::FundingSigned>::clone(unsafe { &*self.contents.result })))
10409                         } }
10410                 } else {
10411                         Self { result_ok: false, contents: CResult_FundingSignedDecodeErrorZPtr {
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_FundingSignedDecodeErrorZ which has the same data as `orig`
10419 /// but with all dynamically-allocated buffers duplicated in new buffers.
10420 pub extern "C" fn CResult_FundingSignedDecodeErrorZ_clone(orig: &CResult_FundingSignedDecodeErrorZ) -> CResult_FundingSignedDecodeErrorZ { Clone::clone(&orig) }
10421 #[repr(C)]
10422 /// The contents of CResult_FundingLockedDecodeErrorZ
10423 pub union CResult_FundingLockedDecodeErrorZPtr {
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::FundingLocked,
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_FundingLockedDecodeErrorZ represents the result of a fallible operation,
10433 /// containing a crate::lightning::ln::msgs::FundingLocked 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_FundingLockedDecodeErrorZ {
10436         /// The contents of this CResult_FundingLockedDecodeErrorZ, accessible via either
10437         /// `err` or `result` depending on the state of `result_ok`.
10438         pub contents: CResult_FundingLockedDecodeErrorZPtr,
10439         /// Whether this CResult_FundingLockedDecodeErrorZ represents a success state.
10440         pub result_ok: bool,
10441 }
10442 #[no_mangle]
10443 /// Creates a new CResult_FundingLockedDecodeErrorZ in the success state.
10444 pub extern "C" fn CResult_FundingLockedDecodeErrorZ_ok(o: crate::lightning::ln::msgs::FundingLocked) -> CResult_FundingLockedDecodeErrorZ {
10445         CResult_FundingLockedDecodeErrorZ {
10446                 contents: CResult_FundingLockedDecodeErrorZPtr {
10447                         result: Box::into_raw(Box::new(o)),
10448                 },
10449                 result_ok: true,
10450         }
10451 }
10452 #[no_mangle]
10453 /// Creates a new CResult_FundingLockedDecodeErrorZ in the error state.
10454 pub extern "C" fn CResult_FundingLockedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_FundingLockedDecodeErrorZ {
10455         CResult_FundingLockedDecodeErrorZ {
10456                 contents: CResult_FundingLockedDecodeErrorZPtr {
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_FundingLockedDecodeErrorZ.
10464 pub extern "C" fn CResult_FundingLockedDecodeErrorZ_free(_res: CResult_FundingLockedDecodeErrorZ) { }
10465 impl Drop for CResult_FundingLockedDecodeErrorZ {
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::FundingLocked, crate::lightning::ln::msgs::DecodeError>> for CResult_FundingLockedDecodeErrorZ {
10479         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::FundingLocked, 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_FundingLockedDecodeErrorZPtr { result }
10484                 } else {
10485                         let err = unsafe { o.contents.err };
10486                         unsafe { o.contents.err = std::ptr::null_mut(); }
10487                         CResult_FundingLockedDecodeErrorZPtr { err }
10488                 };
10489                 Self {
10490                         contents,
10491                         result_ok: o.result_ok,
10492                 }
10493         }
10494 }
10495 impl Clone for CResult_FundingLockedDecodeErrorZ {
10496         fn clone(&self) -> Self {
10497                 if self.result_ok {
10498                         Self { result_ok: true, contents: CResult_FundingLockedDecodeErrorZPtr {
10499                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::FundingLocked>::clone(unsafe { &*self.contents.result })))
10500                         } }
10501                 } else {
10502                         Self { result_ok: false, contents: CResult_FundingLockedDecodeErrorZPtr {
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_FundingLockedDecodeErrorZ which has the same data as `orig`
10510 /// but with all dynamically-allocated buffers duplicated in new buffers.
10511 pub extern "C" fn CResult_FundingLockedDecodeErrorZ_clone(orig: &CResult_FundingLockedDecodeErrorZ) -> CResult_FundingLockedDecodeErrorZ { Clone::clone(&orig) }
10512 #[repr(C)]
10513 /// The contents of CResult_InitDecodeErrorZ
10514 pub union CResult_InitDecodeErrorZPtr {
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::Init,
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_InitDecodeErrorZ represents the result of a fallible operation,
10524 /// containing a crate::lightning::ln::msgs::Init 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_InitDecodeErrorZ {
10527         /// The contents of this CResult_InitDecodeErrorZ, accessible via either
10528         /// `err` or `result` depending on the state of `result_ok`.
10529         pub contents: CResult_InitDecodeErrorZPtr,
10530         /// Whether this CResult_InitDecodeErrorZ represents a success state.
10531         pub result_ok: bool,
10532 }
10533 #[no_mangle]
10534 /// Creates a new CResult_InitDecodeErrorZ in the success state.
10535 pub extern "C" fn CResult_InitDecodeErrorZ_ok(o: crate::lightning::ln::msgs::Init) -> CResult_InitDecodeErrorZ {
10536         CResult_InitDecodeErrorZ {
10537                 contents: CResult_InitDecodeErrorZPtr {
10538                         result: Box::into_raw(Box::new(o)),
10539                 },
10540                 result_ok: true,
10541         }
10542 }
10543 #[no_mangle]
10544 /// Creates a new CResult_InitDecodeErrorZ in the error state.
10545 pub extern "C" fn CResult_InitDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_InitDecodeErrorZ {
10546         CResult_InitDecodeErrorZ {
10547                 contents: CResult_InitDecodeErrorZPtr {
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_InitDecodeErrorZ.
10555 pub extern "C" fn CResult_InitDecodeErrorZ_free(_res: CResult_InitDecodeErrorZ) { }
10556 impl Drop for CResult_InitDecodeErrorZ {
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::Init, crate::lightning::ln::msgs::DecodeError>> for CResult_InitDecodeErrorZ {
10570         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::Init, 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_InitDecodeErrorZPtr { result }
10575                 } else {
10576                         let err = unsafe { o.contents.err };
10577                         unsafe { o.contents.err = std::ptr::null_mut(); }
10578                         CResult_InitDecodeErrorZPtr { err }
10579                 };
10580                 Self {
10581                         contents,
10582                         result_ok: o.result_ok,
10583                 }
10584         }
10585 }
10586 impl Clone for CResult_InitDecodeErrorZ {
10587         fn clone(&self) -> Self {
10588                 if self.result_ok {
10589                         Self { result_ok: true, contents: CResult_InitDecodeErrorZPtr {
10590                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::Init>::clone(unsafe { &*self.contents.result })))
10591                         } }
10592                 } else {
10593                         Self { result_ok: false, contents: CResult_InitDecodeErrorZPtr {
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_InitDecodeErrorZ which has the same data as `orig`
10601 /// but with all dynamically-allocated buffers duplicated in new buffers.
10602 pub extern "C" fn CResult_InitDecodeErrorZ_clone(orig: &CResult_InitDecodeErrorZ) -> CResult_InitDecodeErrorZ { Clone::clone(&orig) }
10603 #[repr(C)]
10604 /// The contents of CResult_OpenChannelDecodeErrorZ
10605 pub union CResult_OpenChannelDecodeErrorZPtr {
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::OpenChannel,
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_OpenChannelDecodeErrorZ represents the result of a fallible operation,
10615 /// containing a crate::lightning::ln::msgs::OpenChannel 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_OpenChannelDecodeErrorZ {
10618         /// The contents of this CResult_OpenChannelDecodeErrorZ, accessible via either
10619         /// `err` or `result` depending on the state of `result_ok`.
10620         pub contents: CResult_OpenChannelDecodeErrorZPtr,
10621         /// Whether this CResult_OpenChannelDecodeErrorZ represents a success state.
10622         pub result_ok: bool,
10623 }
10624 #[no_mangle]
10625 /// Creates a new CResult_OpenChannelDecodeErrorZ in the success state.
10626 pub extern "C" fn CResult_OpenChannelDecodeErrorZ_ok(o: crate::lightning::ln::msgs::OpenChannel) -> CResult_OpenChannelDecodeErrorZ {
10627         CResult_OpenChannelDecodeErrorZ {
10628                 contents: CResult_OpenChannelDecodeErrorZPtr {
10629                         result: Box::into_raw(Box::new(o)),
10630                 },
10631                 result_ok: true,
10632         }
10633 }
10634 #[no_mangle]
10635 /// Creates a new CResult_OpenChannelDecodeErrorZ in the error state.
10636 pub extern "C" fn CResult_OpenChannelDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_OpenChannelDecodeErrorZ {
10637         CResult_OpenChannelDecodeErrorZ {
10638                 contents: CResult_OpenChannelDecodeErrorZPtr {
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_OpenChannelDecodeErrorZ.
10646 pub extern "C" fn CResult_OpenChannelDecodeErrorZ_free(_res: CResult_OpenChannelDecodeErrorZ) { }
10647 impl Drop for CResult_OpenChannelDecodeErrorZ {
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::OpenChannel, crate::lightning::ln::msgs::DecodeError>> for CResult_OpenChannelDecodeErrorZ {
10661         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::OpenChannel, 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_OpenChannelDecodeErrorZPtr { result }
10666                 } else {
10667                         let err = unsafe { o.contents.err };
10668                         unsafe { o.contents.err = std::ptr::null_mut(); }
10669                         CResult_OpenChannelDecodeErrorZPtr { err }
10670                 };
10671                 Self {
10672                         contents,
10673                         result_ok: o.result_ok,
10674                 }
10675         }
10676 }
10677 impl Clone for CResult_OpenChannelDecodeErrorZ {
10678         fn clone(&self) -> Self {
10679                 if self.result_ok {
10680                         Self { result_ok: true, contents: CResult_OpenChannelDecodeErrorZPtr {
10681                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::OpenChannel>::clone(unsafe { &*self.contents.result })))
10682                         } }
10683                 } else {
10684                         Self { result_ok: false, contents: CResult_OpenChannelDecodeErrorZPtr {
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_OpenChannelDecodeErrorZ which has the same data as `orig`
10692 /// but with all dynamically-allocated buffers duplicated in new buffers.
10693 pub extern "C" fn CResult_OpenChannelDecodeErrorZ_clone(orig: &CResult_OpenChannelDecodeErrorZ) -> CResult_OpenChannelDecodeErrorZ { Clone::clone(&orig) }
10694 #[repr(C)]
10695 /// The contents of CResult_RevokeAndACKDecodeErrorZ
10696 pub union CResult_RevokeAndACKDecodeErrorZPtr {
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::RevokeAndACK,
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_RevokeAndACKDecodeErrorZ represents the result of a fallible operation,
10706 /// containing a crate::lightning::ln::msgs::RevokeAndACK 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_RevokeAndACKDecodeErrorZ {
10709         /// The contents of this CResult_RevokeAndACKDecodeErrorZ, accessible via either
10710         /// `err` or `result` depending on the state of `result_ok`.
10711         pub contents: CResult_RevokeAndACKDecodeErrorZPtr,
10712         /// Whether this CResult_RevokeAndACKDecodeErrorZ represents a success state.
10713         pub result_ok: bool,
10714 }
10715 #[no_mangle]
10716 /// Creates a new CResult_RevokeAndACKDecodeErrorZ in the success state.
10717 pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_ok(o: crate::lightning::ln::msgs::RevokeAndACK) -> CResult_RevokeAndACKDecodeErrorZ {
10718         CResult_RevokeAndACKDecodeErrorZ {
10719                 contents: CResult_RevokeAndACKDecodeErrorZPtr {
10720                         result: Box::into_raw(Box::new(o)),
10721                 },
10722                 result_ok: true,
10723         }
10724 }
10725 #[no_mangle]
10726 /// Creates a new CResult_RevokeAndACKDecodeErrorZ in the error state.
10727 pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RevokeAndACKDecodeErrorZ {
10728         CResult_RevokeAndACKDecodeErrorZ {
10729                 contents: CResult_RevokeAndACKDecodeErrorZPtr {
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_RevokeAndACKDecodeErrorZ.
10737 pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_free(_res: CResult_RevokeAndACKDecodeErrorZ) { }
10738 impl Drop for CResult_RevokeAndACKDecodeErrorZ {
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::RevokeAndACK, crate::lightning::ln::msgs::DecodeError>> for CResult_RevokeAndACKDecodeErrorZ {
10752         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::RevokeAndACK, 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_RevokeAndACKDecodeErrorZPtr { result }
10757                 } else {
10758                         let err = unsafe { o.contents.err };
10759                         unsafe { o.contents.err = std::ptr::null_mut(); }
10760                         CResult_RevokeAndACKDecodeErrorZPtr { err }
10761                 };
10762                 Self {
10763                         contents,
10764                         result_ok: o.result_ok,
10765                 }
10766         }
10767 }
10768 impl Clone for CResult_RevokeAndACKDecodeErrorZ {
10769         fn clone(&self) -> Self {
10770                 if self.result_ok {
10771                         Self { result_ok: true, contents: CResult_RevokeAndACKDecodeErrorZPtr {
10772                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::RevokeAndACK>::clone(unsafe { &*self.contents.result })))
10773                         } }
10774                 } else {
10775                         Self { result_ok: false, contents: CResult_RevokeAndACKDecodeErrorZPtr {
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_RevokeAndACKDecodeErrorZ which has the same data as `orig`
10783 /// but with all dynamically-allocated buffers duplicated in new buffers.
10784 pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_clone(orig: &CResult_RevokeAndACKDecodeErrorZ) -> CResult_RevokeAndACKDecodeErrorZ { Clone::clone(&orig) }
10785 #[repr(C)]
10786 /// The contents of CResult_ShutdownDecodeErrorZ
10787 pub union CResult_ShutdownDecodeErrorZPtr {
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::Shutdown,
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_ShutdownDecodeErrorZ represents the result of a fallible operation,
10797 /// containing a crate::lightning::ln::msgs::Shutdown 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_ShutdownDecodeErrorZ {
10800         /// The contents of this CResult_ShutdownDecodeErrorZ, accessible via either
10801         /// `err` or `result` depending on the state of `result_ok`.
10802         pub contents: CResult_ShutdownDecodeErrorZPtr,
10803         /// Whether this CResult_ShutdownDecodeErrorZ represents a success state.
10804         pub result_ok: bool,
10805 }
10806 #[no_mangle]
10807 /// Creates a new CResult_ShutdownDecodeErrorZ in the success state.
10808 pub extern "C" fn CResult_ShutdownDecodeErrorZ_ok(o: crate::lightning::ln::msgs::Shutdown) -> CResult_ShutdownDecodeErrorZ {
10809         CResult_ShutdownDecodeErrorZ {
10810                 contents: CResult_ShutdownDecodeErrorZPtr {
10811                         result: Box::into_raw(Box::new(o)),
10812                 },
10813                 result_ok: true,
10814         }
10815 }
10816 #[no_mangle]
10817 /// Creates a new CResult_ShutdownDecodeErrorZ in the error state.
10818 pub extern "C" fn CResult_ShutdownDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ShutdownDecodeErrorZ {
10819         CResult_ShutdownDecodeErrorZ {
10820                 contents: CResult_ShutdownDecodeErrorZPtr {
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_ShutdownDecodeErrorZ.
10828 pub extern "C" fn CResult_ShutdownDecodeErrorZ_free(_res: CResult_ShutdownDecodeErrorZ) { }
10829 impl Drop for CResult_ShutdownDecodeErrorZ {
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::Shutdown, crate::lightning::ln::msgs::DecodeError>> for CResult_ShutdownDecodeErrorZ {
10843         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::Shutdown, 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_ShutdownDecodeErrorZPtr { result }
10848                 } else {
10849                         let err = unsafe { o.contents.err };
10850                         unsafe { o.contents.err = std::ptr::null_mut(); }
10851                         CResult_ShutdownDecodeErrorZPtr { err }
10852                 };
10853                 Self {
10854                         contents,
10855                         result_ok: o.result_ok,
10856                 }
10857         }
10858 }
10859 impl Clone for CResult_ShutdownDecodeErrorZ {
10860         fn clone(&self) -> Self {
10861                 if self.result_ok {
10862                         Self { result_ok: true, contents: CResult_ShutdownDecodeErrorZPtr {
10863                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::Shutdown>::clone(unsafe { &*self.contents.result })))
10864                         } }
10865                 } else {
10866                         Self { result_ok: false, contents: CResult_ShutdownDecodeErrorZPtr {
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_ShutdownDecodeErrorZ which has the same data as `orig`
10874 /// but with all dynamically-allocated buffers duplicated in new buffers.
10875 pub extern "C" fn CResult_ShutdownDecodeErrorZ_clone(orig: &CResult_ShutdownDecodeErrorZ) -> CResult_ShutdownDecodeErrorZ { Clone::clone(&orig) }
10876 #[repr(C)]
10877 /// The contents of CResult_UpdateFailHTLCDecodeErrorZ
10878 pub union CResult_UpdateFailHTLCDecodeErrorZPtr {
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::UpdateFailHTLC,
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_UpdateFailHTLCDecodeErrorZ represents the result of a fallible operation,
10888 /// containing a crate::lightning::ln::msgs::UpdateFailHTLC 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_UpdateFailHTLCDecodeErrorZ {
10891         /// The contents of this CResult_UpdateFailHTLCDecodeErrorZ, accessible via either
10892         /// `err` or `result` depending on the state of `result_ok`.
10893         pub contents: CResult_UpdateFailHTLCDecodeErrorZPtr,
10894         /// Whether this CResult_UpdateFailHTLCDecodeErrorZ represents a success state.
10895         pub result_ok: bool,
10896 }
10897 #[no_mangle]
10898 /// Creates a new CResult_UpdateFailHTLCDecodeErrorZ in the success state.
10899 pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateFailHTLC) -> CResult_UpdateFailHTLCDecodeErrorZ {
10900         CResult_UpdateFailHTLCDecodeErrorZ {
10901                 contents: CResult_UpdateFailHTLCDecodeErrorZPtr {
10902                         result: Box::into_raw(Box::new(o)),
10903                 },
10904                 result_ok: true,
10905         }
10906 }
10907 #[no_mangle]
10908 /// Creates a new CResult_UpdateFailHTLCDecodeErrorZ in the error state.
10909 pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateFailHTLCDecodeErrorZ {
10910         CResult_UpdateFailHTLCDecodeErrorZ {
10911                 contents: CResult_UpdateFailHTLCDecodeErrorZPtr {
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_UpdateFailHTLCDecodeErrorZ.
10919 pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_free(_res: CResult_UpdateFailHTLCDecodeErrorZ) { }
10920 impl Drop for CResult_UpdateFailHTLCDecodeErrorZ {
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::UpdateFailHTLC, crate::lightning::ln::msgs::DecodeError>> for CResult_UpdateFailHTLCDecodeErrorZ {
10934         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFailHTLC, 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_UpdateFailHTLCDecodeErrorZPtr { result }
10939                 } else {
10940                         let err = unsafe { o.contents.err };
10941                         unsafe { o.contents.err = std::ptr::null_mut(); }
10942                         CResult_UpdateFailHTLCDecodeErrorZPtr { err }
10943                 };
10944                 Self {
10945                         contents,
10946                         result_ok: o.result_ok,
10947                 }
10948         }
10949 }
10950 impl Clone for CResult_UpdateFailHTLCDecodeErrorZ {
10951         fn clone(&self) -> Self {
10952                 if self.result_ok {
10953                         Self { result_ok: true, contents: CResult_UpdateFailHTLCDecodeErrorZPtr {
10954                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UpdateFailHTLC>::clone(unsafe { &*self.contents.result })))
10955                         } }
10956                 } else {
10957                         Self { result_ok: false, contents: CResult_UpdateFailHTLCDecodeErrorZPtr {
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_UpdateFailHTLCDecodeErrorZ which has the same data as `orig`
10965 /// but with all dynamically-allocated buffers duplicated in new buffers.
10966 pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_clone(orig: &CResult_UpdateFailHTLCDecodeErrorZ) -> CResult_UpdateFailHTLCDecodeErrorZ { Clone::clone(&orig) }
10967 #[repr(C)]
10968 /// The contents of CResult_UpdateFailMalformedHTLCDecodeErrorZ
10969 pub union CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
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::UpdateFailMalformedHTLC,
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_UpdateFailMalformedHTLCDecodeErrorZ represents the result of a fallible operation,
10979 /// containing a crate::lightning::ln::msgs::UpdateFailMalformedHTLC 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_UpdateFailMalformedHTLCDecodeErrorZ {
10982         /// The contents of this CResult_UpdateFailMalformedHTLCDecodeErrorZ, accessible via either
10983         /// `err` or `result` depending on the state of `result_ok`.
10984         pub contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr,
10985         /// Whether this CResult_UpdateFailMalformedHTLCDecodeErrorZ represents a success state.
10986         pub result_ok: bool,
10987 }
10988 #[no_mangle]
10989 /// Creates a new CResult_UpdateFailMalformedHTLCDecodeErrorZ in the success state.
10990 pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateFailMalformedHTLC) -> CResult_UpdateFailMalformedHTLCDecodeErrorZ {
10991         CResult_UpdateFailMalformedHTLCDecodeErrorZ {
10992                 contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
10993                         result: Box::into_raw(Box::new(o)),
10994                 },
10995                 result_ok: true,
10996         }
10997 }
10998 #[no_mangle]
10999 /// Creates a new CResult_UpdateFailMalformedHTLCDecodeErrorZ in the error state.
11000 pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateFailMalformedHTLCDecodeErrorZ {
11001         CResult_UpdateFailMalformedHTLCDecodeErrorZ {
11002                 contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
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_UpdateFailMalformedHTLCDecodeErrorZ.
11010 pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_free(_res: CResult_UpdateFailMalformedHTLCDecodeErrorZ) { }
11011 impl Drop for CResult_UpdateFailMalformedHTLCDecodeErrorZ {
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::UpdateFailMalformedHTLC, crate::lightning::ln::msgs::DecodeError>> for CResult_UpdateFailMalformedHTLCDecodeErrorZ {
11025         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFailMalformedHTLC, 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_UpdateFailMalformedHTLCDecodeErrorZPtr { result }
11030                 } else {
11031                         let err = unsafe { o.contents.err };
11032                         unsafe { o.contents.err = std::ptr::null_mut(); }
11033                         CResult_UpdateFailMalformedHTLCDecodeErrorZPtr { err }
11034                 };
11035                 Self {
11036                         contents,
11037                         result_ok: o.result_ok,
11038                 }
11039         }
11040 }
11041 impl Clone for CResult_UpdateFailMalformedHTLCDecodeErrorZ {
11042         fn clone(&self) -> Self {
11043                 if self.result_ok {
11044                         Self { result_ok: true, contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
11045                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UpdateFailMalformedHTLC>::clone(unsafe { &*self.contents.result })))
11046                         } }
11047                 } else {
11048                         Self { result_ok: false, contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
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_UpdateFailMalformedHTLCDecodeErrorZ which has the same data as `orig`
11056 /// but with all dynamically-allocated buffers duplicated in new buffers.
11057 pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone(orig: &CResult_UpdateFailMalformedHTLCDecodeErrorZ) -> CResult_UpdateFailMalformedHTLCDecodeErrorZ { Clone::clone(&orig) }
11058 #[repr(C)]
11059 /// The contents of CResult_UpdateFeeDecodeErrorZ
11060 pub union CResult_UpdateFeeDecodeErrorZPtr {
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::UpdateFee,
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_UpdateFeeDecodeErrorZ represents the result of a fallible operation,
11070 /// containing a crate::lightning::ln::msgs::UpdateFee 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_UpdateFeeDecodeErrorZ {
11073         /// The contents of this CResult_UpdateFeeDecodeErrorZ, accessible via either
11074         /// `err` or `result` depending on the state of `result_ok`.
11075         pub contents: CResult_UpdateFeeDecodeErrorZPtr,
11076         /// Whether this CResult_UpdateFeeDecodeErrorZ represents a success state.
11077         pub result_ok: bool,
11078 }
11079 #[no_mangle]
11080 /// Creates a new CResult_UpdateFeeDecodeErrorZ in the success state.
11081 pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateFee) -> CResult_UpdateFeeDecodeErrorZ {
11082         CResult_UpdateFeeDecodeErrorZ {
11083                 contents: CResult_UpdateFeeDecodeErrorZPtr {
11084                         result: Box::into_raw(Box::new(o)),
11085                 },
11086                 result_ok: true,
11087         }
11088 }
11089 #[no_mangle]
11090 /// Creates a new CResult_UpdateFeeDecodeErrorZ in the error state.
11091 pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateFeeDecodeErrorZ {
11092         CResult_UpdateFeeDecodeErrorZ {
11093                 contents: CResult_UpdateFeeDecodeErrorZPtr {
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_UpdateFeeDecodeErrorZ.
11101 pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_free(_res: CResult_UpdateFeeDecodeErrorZ) { }
11102 impl Drop for CResult_UpdateFeeDecodeErrorZ {
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::UpdateFee, crate::lightning::ln::msgs::DecodeError>> for CResult_UpdateFeeDecodeErrorZ {
11116         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFee, 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_UpdateFeeDecodeErrorZPtr { result }
11121                 } else {
11122                         let err = unsafe { o.contents.err };
11123                         unsafe { o.contents.err = std::ptr::null_mut(); }
11124                         CResult_UpdateFeeDecodeErrorZPtr { err }
11125                 };
11126                 Self {
11127                         contents,
11128                         result_ok: o.result_ok,
11129                 }
11130         }
11131 }
11132 impl Clone for CResult_UpdateFeeDecodeErrorZ {
11133         fn clone(&self) -> Self {
11134                 if self.result_ok {
11135                         Self { result_ok: true, contents: CResult_UpdateFeeDecodeErrorZPtr {
11136                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UpdateFee>::clone(unsafe { &*self.contents.result })))
11137                         } }
11138                 } else {
11139                         Self { result_ok: false, contents: CResult_UpdateFeeDecodeErrorZPtr {
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_UpdateFeeDecodeErrorZ which has the same data as `orig`
11147 /// but with all dynamically-allocated buffers duplicated in new buffers.
11148 pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_clone(orig: &CResult_UpdateFeeDecodeErrorZ) -> CResult_UpdateFeeDecodeErrorZ { Clone::clone(&orig) }
11149 #[repr(C)]
11150 /// The contents of CResult_UpdateFulfillHTLCDecodeErrorZ
11151 pub union CResult_UpdateFulfillHTLCDecodeErrorZPtr {
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::UpdateFulfillHTLC,
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_UpdateFulfillHTLCDecodeErrorZ represents the result of a fallible operation,
11161 /// containing a crate::lightning::ln::msgs::UpdateFulfillHTLC 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_UpdateFulfillHTLCDecodeErrorZ {
11164         /// The contents of this CResult_UpdateFulfillHTLCDecodeErrorZ, accessible via either
11165         /// `err` or `result` depending on the state of `result_ok`.
11166         pub contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr,
11167         /// Whether this CResult_UpdateFulfillHTLCDecodeErrorZ represents a success state.
11168         pub result_ok: bool,
11169 }
11170 #[no_mangle]
11171 /// Creates a new CResult_UpdateFulfillHTLCDecodeErrorZ in the success state.
11172 pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateFulfillHTLC) -> CResult_UpdateFulfillHTLCDecodeErrorZ {
11173         CResult_UpdateFulfillHTLCDecodeErrorZ {
11174                 contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr {
11175                         result: Box::into_raw(Box::new(o)),
11176                 },
11177                 result_ok: true,
11178         }
11179 }
11180 #[no_mangle]
11181 /// Creates a new CResult_UpdateFulfillHTLCDecodeErrorZ in the error state.
11182 pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateFulfillHTLCDecodeErrorZ {
11183         CResult_UpdateFulfillHTLCDecodeErrorZ {
11184                 contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr {
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_UpdateFulfillHTLCDecodeErrorZ.
11192 pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_free(_res: CResult_UpdateFulfillHTLCDecodeErrorZ) { }
11193 impl Drop for CResult_UpdateFulfillHTLCDecodeErrorZ {
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::UpdateFulfillHTLC, crate::lightning::ln::msgs::DecodeError>> for CResult_UpdateFulfillHTLCDecodeErrorZ {
11207         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFulfillHTLC, 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_UpdateFulfillHTLCDecodeErrorZPtr { result }
11212                 } else {
11213                         let err = unsafe { o.contents.err };
11214                         unsafe { o.contents.err = std::ptr::null_mut(); }
11215                         CResult_UpdateFulfillHTLCDecodeErrorZPtr { err }
11216                 };
11217                 Self {
11218                         contents,
11219                         result_ok: o.result_ok,
11220                 }
11221         }
11222 }
11223 impl Clone for CResult_UpdateFulfillHTLCDecodeErrorZ {
11224         fn clone(&self) -> Self {
11225                 if self.result_ok {
11226                         Self { result_ok: true, contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr {
11227                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UpdateFulfillHTLC>::clone(unsafe { &*self.contents.result })))
11228                         } }
11229                 } else {
11230                         Self { result_ok: false, contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr {
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_UpdateFulfillHTLCDecodeErrorZ which has the same data as `orig`
11238 /// but with all dynamically-allocated buffers duplicated in new buffers.
11239 pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_clone(orig: &CResult_UpdateFulfillHTLCDecodeErrorZ) -> CResult_UpdateFulfillHTLCDecodeErrorZ { Clone::clone(&orig) }
11240 #[repr(C)]
11241 /// The contents of CResult_UpdateAddHTLCDecodeErrorZ
11242 pub union CResult_UpdateAddHTLCDecodeErrorZPtr {
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::UpdateAddHTLC,
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_UpdateAddHTLCDecodeErrorZ represents the result of a fallible operation,
11252 /// containing a crate::lightning::ln::msgs::UpdateAddHTLC 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_UpdateAddHTLCDecodeErrorZ {
11255         /// The contents of this CResult_UpdateAddHTLCDecodeErrorZ, accessible via either
11256         /// `err` or `result` depending on the state of `result_ok`.
11257         pub contents: CResult_UpdateAddHTLCDecodeErrorZPtr,
11258         /// Whether this CResult_UpdateAddHTLCDecodeErrorZ represents a success state.
11259         pub result_ok: bool,
11260 }
11261 #[no_mangle]
11262 /// Creates a new CResult_UpdateAddHTLCDecodeErrorZ in the success state.
11263 pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateAddHTLC) -> CResult_UpdateAddHTLCDecodeErrorZ {
11264         CResult_UpdateAddHTLCDecodeErrorZ {
11265                 contents: CResult_UpdateAddHTLCDecodeErrorZPtr {
11266                         result: Box::into_raw(Box::new(o)),
11267                 },
11268                 result_ok: true,
11269         }
11270 }
11271 #[no_mangle]
11272 /// Creates a new CResult_UpdateAddHTLCDecodeErrorZ in the error state.
11273 pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateAddHTLCDecodeErrorZ {
11274         CResult_UpdateAddHTLCDecodeErrorZ {
11275                 contents: CResult_UpdateAddHTLCDecodeErrorZPtr {
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_UpdateAddHTLCDecodeErrorZ.
11283 pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_free(_res: CResult_UpdateAddHTLCDecodeErrorZ) { }
11284 impl Drop for CResult_UpdateAddHTLCDecodeErrorZ {
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::UpdateAddHTLC, crate::lightning::ln::msgs::DecodeError>> for CResult_UpdateAddHTLCDecodeErrorZ {
11298         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateAddHTLC, 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_UpdateAddHTLCDecodeErrorZPtr { result }
11303                 } else {
11304                         let err = unsafe { o.contents.err };
11305                         unsafe { o.contents.err = std::ptr::null_mut(); }
11306                         CResult_UpdateAddHTLCDecodeErrorZPtr { err }
11307                 };
11308                 Self {
11309                         contents,
11310                         result_ok: o.result_ok,
11311                 }
11312         }
11313 }
11314 impl Clone for CResult_UpdateAddHTLCDecodeErrorZ {
11315         fn clone(&self) -> Self {
11316                 if self.result_ok {
11317                         Self { result_ok: true, contents: CResult_UpdateAddHTLCDecodeErrorZPtr {
11318                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UpdateAddHTLC>::clone(unsafe { &*self.contents.result })))
11319                         } }
11320                 } else {
11321                         Self { result_ok: false, contents: CResult_UpdateAddHTLCDecodeErrorZPtr {
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_UpdateAddHTLCDecodeErrorZ which has the same data as `orig`
11329 /// but with all dynamically-allocated buffers duplicated in new buffers.
11330 pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_clone(orig: &CResult_UpdateAddHTLCDecodeErrorZ) -> CResult_UpdateAddHTLCDecodeErrorZ { Clone::clone(&orig) }
11331 #[repr(C)]
11332 /// The contents of CResult_PingDecodeErrorZ
11333 pub union CResult_PingDecodeErrorZPtr {
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::Ping,
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_PingDecodeErrorZ represents the result of a fallible operation,
11343 /// containing a crate::lightning::ln::msgs::Ping 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_PingDecodeErrorZ {
11346         /// The contents of this CResult_PingDecodeErrorZ, accessible via either
11347         /// `err` or `result` depending on the state of `result_ok`.
11348         pub contents: CResult_PingDecodeErrorZPtr,
11349         /// Whether this CResult_PingDecodeErrorZ represents a success state.
11350         pub result_ok: bool,
11351 }
11352 #[no_mangle]
11353 /// Creates a new CResult_PingDecodeErrorZ in the success state.
11354 pub extern "C" fn CResult_PingDecodeErrorZ_ok(o: crate::lightning::ln::msgs::Ping) -> CResult_PingDecodeErrorZ {
11355         CResult_PingDecodeErrorZ {
11356                 contents: CResult_PingDecodeErrorZPtr {
11357                         result: Box::into_raw(Box::new(o)),
11358                 },
11359                 result_ok: true,
11360         }
11361 }
11362 #[no_mangle]
11363 /// Creates a new CResult_PingDecodeErrorZ in the error state.
11364 pub extern "C" fn CResult_PingDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_PingDecodeErrorZ {
11365         CResult_PingDecodeErrorZ {
11366                 contents: CResult_PingDecodeErrorZPtr {
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_PingDecodeErrorZ.
11374 pub extern "C" fn CResult_PingDecodeErrorZ_free(_res: CResult_PingDecodeErrorZ) { }
11375 impl Drop for CResult_PingDecodeErrorZ {
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::Ping, crate::lightning::ln::msgs::DecodeError>> for CResult_PingDecodeErrorZ {
11389         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::Ping, 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_PingDecodeErrorZPtr { result }
11394                 } else {
11395                         let err = unsafe { o.contents.err };
11396                         unsafe { o.contents.err = std::ptr::null_mut(); }
11397                         CResult_PingDecodeErrorZPtr { err }
11398                 };
11399                 Self {
11400                         contents,
11401                         result_ok: o.result_ok,
11402                 }
11403         }
11404 }
11405 impl Clone for CResult_PingDecodeErrorZ {
11406         fn clone(&self) -> Self {
11407                 if self.result_ok {
11408                         Self { result_ok: true, contents: CResult_PingDecodeErrorZPtr {
11409                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::Ping>::clone(unsafe { &*self.contents.result })))
11410                         } }
11411                 } else {
11412                         Self { result_ok: false, contents: CResult_PingDecodeErrorZPtr {
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_PingDecodeErrorZ which has the same data as `orig`
11420 /// but with all dynamically-allocated buffers duplicated in new buffers.
11421 pub extern "C" fn CResult_PingDecodeErrorZ_clone(orig: &CResult_PingDecodeErrorZ) -> CResult_PingDecodeErrorZ { Clone::clone(&orig) }
11422 #[repr(C)]
11423 /// The contents of CResult_PongDecodeErrorZ
11424 pub union CResult_PongDecodeErrorZPtr {
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::Pong,
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_PongDecodeErrorZ represents the result of a fallible operation,
11434 /// containing a crate::lightning::ln::msgs::Pong 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_PongDecodeErrorZ {
11437         /// The contents of this CResult_PongDecodeErrorZ, accessible via either
11438         /// `err` or `result` depending on the state of `result_ok`.
11439         pub contents: CResult_PongDecodeErrorZPtr,
11440         /// Whether this CResult_PongDecodeErrorZ represents a success state.
11441         pub result_ok: bool,
11442 }
11443 #[no_mangle]
11444 /// Creates a new CResult_PongDecodeErrorZ in the success state.
11445 pub extern "C" fn CResult_PongDecodeErrorZ_ok(o: crate::lightning::ln::msgs::Pong) -> CResult_PongDecodeErrorZ {
11446         CResult_PongDecodeErrorZ {
11447                 contents: CResult_PongDecodeErrorZPtr {
11448                         result: Box::into_raw(Box::new(o)),
11449                 },
11450                 result_ok: true,
11451         }
11452 }
11453 #[no_mangle]
11454 /// Creates a new CResult_PongDecodeErrorZ in the error state.
11455 pub extern "C" fn CResult_PongDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_PongDecodeErrorZ {
11456         CResult_PongDecodeErrorZ {
11457                 contents: CResult_PongDecodeErrorZPtr {
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_PongDecodeErrorZ.
11465 pub extern "C" fn CResult_PongDecodeErrorZ_free(_res: CResult_PongDecodeErrorZ) { }
11466 impl Drop for CResult_PongDecodeErrorZ {
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::Pong, crate::lightning::ln::msgs::DecodeError>> for CResult_PongDecodeErrorZ {
11480         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::Pong, 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_PongDecodeErrorZPtr { result }
11485                 } else {
11486                         let err = unsafe { o.contents.err };
11487                         unsafe { o.contents.err = std::ptr::null_mut(); }
11488                         CResult_PongDecodeErrorZPtr { err }
11489                 };
11490                 Self {
11491                         contents,
11492                         result_ok: o.result_ok,
11493                 }
11494         }
11495 }
11496 impl Clone for CResult_PongDecodeErrorZ {
11497         fn clone(&self) -> Self {
11498                 if self.result_ok {
11499                         Self { result_ok: true, contents: CResult_PongDecodeErrorZPtr {
11500                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::Pong>::clone(unsafe { &*self.contents.result })))
11501                         } }
11502                 } else {
11503                         Self { result_ok: false, contents: CResult_PongDecodeErrorZPtr {
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_PongDecodeErrorZ which has the same data as `orig`
11511 /// but with all dynamically-allocated buffers duplicated in new buffers.
11512 pub extern "C" fn CResult_PongDecodeErrorZ_clone(orig: &CResult_PongDecodeErrorZ) -> CResult_PongDecodeErrorZ { Clone::clone(&orig) }
11513 #[repr(C)]
11514 /// The contents of CResult_UnsignedChannelAnnouncementDecodeErrorZ
11515 pub union CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
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::UnsignedChannelAnnouncement,
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_UnsignedChannelAnnouncementDecodeErrorZ represents the result of a fallible operation,
11525 /// containing a crate::lightning::ln::msgs::UnsignedChannelAnnouncement 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_UnsignedChannelAnnouncementDecodeErrorZ {
11528         /// The contents of this CResult_UnsignedChannelAnnouncementDecodeErrorZ, accessible via either
11529         /// `err` or `result` depending on the state of `result_ok`.
11530         pub contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr,
11531         /// Whether this CResult_UnsignedChannelAnnouncementDecodeErrorZ represents a success state.
11532         pub result_ok: bool,
11533 }
11534 #[no_mangle]
11535 /// Creates a new CResult_UnsignedChannelAnnouncementDecodeErrorZ in the success state.
11536 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UnsignedChannelAnnouncement) -> CResult_UnsignedChannelAnnouncementDecodeErrorZ {
11537         CResult_UnsignedChannelAnnouncementDecodeErrorZ {
11538                 contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
11539                         result: Box::into_raw(Box::new(o)),
11540                 },
11541                 result_ok: true,
11542         }
11543 }
11544 #[no_mangle]
11545 /// Creates a new CResult_UnsignedChannelAnnouncementDecodeErrorZ in the error state.
11546 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UnsignedChannelAnnouncementDecodeErrorZ {
11547         CResult_UnsignedChannelAnnouncementDecodeErrorZ {
11548                 contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
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_UnsignedChannelAnnouncementDecodeErrorZ.
11556 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_free(_res: CResult_UnsignedChannelAnnouncementDecodeErrorZ) { }
11557 impl Drop for CResult_UnsignedChannelAnnouncementDecodeErrorZ {
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::UnsignedChannelAnnouncement, crate::lightning::ln::msgs::DecodeError>> for CResult_UnsignedChannelAnnouncementDecodeErrorZ {
11571         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedChannelAnnouncement, 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_UnsignedChannelAnnouncementDecodeErrorZPtr { result }
11576                 } else {
11577                         let err = unsafe { o.contents.err };
11578                         unsafe { o.contents.err = std::ptr::null_mut(); }
11579                         CResult_UnsignedChannelAnnouncementDecodeErrorZPtr { err }
11580                 };
11581                 Self {
11582                         contents,
11583                         result_ok: o.result_ok,
11584                 }
11585         }
11586 }
11587 impl Clone for CResult_UnsignedChannelAnnouncementDecodeErrorZ {
11588         fn clone(&self) -> Self {
11589                 if self.result_ok {
11590                         Self { result_ok: true, contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
11591                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UnsignedChannelAnnouncement>::clone(unsafe { &*self.contents.result })))
11592                         } }
11593                 } else {
11594                         Self { result_ok: false, contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
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_UnsignedChannelAnnouncementDecodeErrorZ which has the same data as `orig`
11602 /// but with all dynamically-allocated buffers duplicated in new buffers.
11603 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone(orig: &CResult_UnsignedChannelAnnouncementDecodeErrorZ) -> CResult_UnsignedChannelAnnouncementDecodeErrorZ { Clone::clone(&orig) }
11604 #[repr(C)]
11605 /// The contents of CResult_ChannelAnnouncementDecodeErrorZ
11606 pub union CResult_ChannelAnnouncementDecodeErrorZPtr {
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::ChannelAnnouncement,
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_ChannelAnnouncementDecodeErrorZ represents the result of a fallible operation,
11616 /// containing a crate::lightning::ln::msgs::ChannelAnnouncement 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_ChannelAnnouncementDecodeErrorZ {
11619         /// The contents of this CResult_ChannelAnnouncementDecodeErrorZ, accessible via either
11620         /// `err` or `result` depending on the state of `result_ok`.
11621         pub contents: CResult_ChannelAnnouncementDecodeErrorZPtr,
11622         /// Whether this CResult_ChannelAnnouncementDecodeErrorZ represents a success state.
11623         pub result_ok: bool,
11624 }
11625 #[no_mangle]
11626 /// Creates a new CResult_ChannelAnnouncementDecodeErrorZ in the success state.
11627 pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ChannelAnnouncement) -> CResult_ChannelAnnouncementDecodeErrorZ {
11628         CResult_ChannelAnnouncementDecodeErrorZ {
11629                 contents: CResult_ChannelAnnouncementDecodeErrorZPtr {
11630                         result: Box::into_raw(Box::new(o)),
11631                 },
11632                 result_ok: true,
11633         }
11634 }
11635 #[no_mangle]
11636 /// Creates a new CResult_ChannelAnnouncementDecodeErrorZ in the error state.
11637 pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelAnnouncementDecodeErrorZ {
11638         CResult_ChannelAnnouncementDecodeErrorZ {
11639                 contents: CResult_ChannelAnnouncementDecodeErrorZPtr {
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_ChannelAnnouncementDecodeErrorZ.
11647 pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_free(_res: CResult_ChannelAnnouncementDecodeErrorZ) { }
11648 impl Drop for CResult_ChannelAnnouncementDecodeErrorZ {
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::ChannelAnnouncement, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelAnnouncementDecodeErrorZ {
11662         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelAnnouncement, 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_ChannelAnnouncementDecodeErrorZPtr { result }
11667                 } else {
11668                         let err = unsafe { o.contents.err };
11669                         unsafe { o.contents.err = std::ptr::null_mut(); }
11670                         CResult_ChannelAnnouncementDecodeErrorZPtr { err }
11671                 };
11672                 Self {
11673                         contents,
11674                         result_ok: o.result_ok,
11675                 }
11676         }
11677 }
11678 impl Clone for CResult_ChannelAnnouncementDecodeErrorZ {
11679         fn clone(&self) -> Self {
11680                 if self.result_ok {
11681                         Self { result_ok: true, contents: CResult_ChannelAnnouncementDecodeErrorZPtr {
11682                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ChannelAnnouncement>::clone(unsafe { &*self.contents.result })))
11683                         } }
11684                 } else {
11685                         Self { result_ok: false, contents: CResult_ChannelAnnouncementDecodeErrorZPtr {
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_ChannelAnnouncementDecodeErrorZ which has the same data as `orig`
11693 /// but with all dynamically-allocated buffers duplicated in new buffers.
11694 pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_clone(orig: &CResult_ChannelAnnouncementDecodeErrorZ) -> CResult_ChannelAnnouncementDecodeErrorZ { Clone::clone(&orig) }
11695 #[repr(C)]
11696 /// The contents of CResult_UnsignedChannelUpdateDecodeErrorZ
11697 pub union CResult_UnsignedChannelUpdateDecodeErrorZPtr {
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::UnsignedChannelUpdate,
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_UnsignedChannelUpdateDecodeErrorZ represents the result of a fallible operation,
11707 /// containing a crate::lightning::ln::msgs::UnsignedChannelUpdate 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_UnsignedChannelUpdateDecodeErrorZ {
11710         /// The contents of this CResult_UnsignedChannelUpdateDecodeErrorZ, accessible via either
11711         /// `err` or `result` depending on the state of `result_ok`.
11712         pub contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr,
11713         /// Whether this CResult_UnsignedChannelUpdateDecodeErrorZ represents a success state.
11714         pub result_ok: bool,
11715 }
11716 #[no_mangle]
11717 /// Creates a new CResult_UnsignedChannelUpdateDecodeErrorZ in the success state.
11718 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UnsignedChannelUpdate) -> CResult_UnsignedChannelUpdateDecodeErrorZ {
11719         CResult_UnsignedChannelUpdateDecodeErrorZ {
11720                 contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr {
11721                         result: Box::into_raw(Box::new(o)),
11722                 },
11723                 result_ok: true,
11724         }
11725 }
11726 #[no_mangle]
11727 /// Creates a new CResult_UnsignedChannelUpdateDecodeErrorZ in the error state.
11728 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UnsignedChannelUpdateDecodeErrorZ {
11729         CResult_UnsignedChannelUpdateDecodeErrorZ {
11730                 contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr {
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_UnsignedChannelUpdateDecodeErrorZ.
11738 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_free(_res: CResult_UnsignedChannelUpdateDecodeErrorZ) { }
11739 impl Drop for CResult_UnsignedChannelUpdateDecodeErrorZ {
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::UnsignedChannelUpdate, crate::lightning::ln::msgs::DecodeError>> for CResult_UnsignedChannelUpdateDecodeErrorZ {
11753         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedChannelUpdate, 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_UnsignedChannelUpdateDecodeErrorZPtr { result }
11758                 } else {
11759                         let err = unsafe { o.contents.err };
11760                         unsafe { o.contents.err = std::ptr::null_mut(); }
11761                         CResult_UnsignedChannelUpdateDecodeErrorZPtr { err }
11762                 };
11763                 Self {
11764                         contents,
11765                         result_ok: o.result_ok,
11766                 }
11767         }
11768 }
11769 impl Clone for CResult_UnsignedChannelUpdateDecodeErrorZ {
11770         fn clone(&self) -> Self {
11771                 if self.result_ok {
11772                         Self { result_ok: true, contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr {
11773                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UnsignedChannelUpdate>::clone(unsafe { &*self.contents.result })))
11774                         } }
11775                 } else {
11776                         Self { result_ok: false, contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr {
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_UnsignedChannelUpdateDecodeErrorZ which has the same data as `orig`
11784 /// but with all dynamically-allocated buffers duplicated in new buffers.
11785 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_clone(orig: &CResult_UnsignedChannelUpdateDecodeErrorZ) -> CResult_UnsignedChannelUpdateDecodeErrorZ { Clone::clone(&orig) }
11786 #[repr(C)]
11787 /// The contents of CResult_ChannelUpdateDecodeErrorZ
11788 pub union CResult_ChannelUpdateDecodeErrorZPtr {
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::ln::msgs::ChannelUpdate,
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::ln::msgs::DecodeError,
11795 }
11796 #[repr(C)]
11797 /// A CResult_ChannelUpdateDecodeErrorZ represents the result of a fallible operation,
11798 /// containing a crate::lightning::ln::msgs::ChannelUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
11799 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11800 pub struct CResult_ChannelUpdateDecodeErrorZ {
11801         /// The contents of this CResult_ChannelUpdateDecodeErrorZ, accessible via either
11802         /// `err` or `result` depending on the state of `result_ok`.
11803         pub contents: CResult_ChannelUpdateDecodeErrorZPtr,
11804         /// Whether this CResult_ChannelUpdateDecodeErrorZ represents a success state.
11805         pub result_ok: bool,
11806 }
11807 #[no_mangle]
11808 /// Creates a new CResult_ChannelUpdateDecodeErrorZ in the success state.
11809 pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ChannelUpdate) -> CResult_ChannelUpdateDecodeErrorZ {
11810         CResult_ChannelUpdateDecodeErrorZ {
11811                 contents: CResult_ChannelUpdateDecodeErrorZPtr {
11812                         result: Box::into_raw(Box::new(o)),
11813                 },
11814                 result_ok: true,
11815         }
11816 }
11817 #[no_mangle]
11818 /// Creates a new CResult_ChannelUpdateDecodeErrorZ in the error state.
11819 pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelUpdateDecodeErrorZ {
11820         CResult_ChannelUpdateDecodeErrorZ {
11821                 contents: CResult_ChannelUpdateDecodeErrorZPtr {
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_ChannelUpdateDecodeErrorZ.
11829 pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_free(_res: CResult_ChannelUpdateDecodeErrorZ) { }
11830 impl Drop for CResult_ChannelUpdateDecodeErrorZ {
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::ln::msgs::ChannelUpdate, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelUpdateDecodeErrorZ {
11844         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelUpdate, crate::lightning::ln::msgs::DecodeError>) -> 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_ChannelUpdateDecodeErrorZPtr { result }
11849                 } else {
11850                         let err = unsafe { o.contents.err };
11851                         unsafe { o.contents.err = std::ptr::null_mut(); }
11852                         CResult_ChannelUpdateDecodeErrorZPtr { err }
11853                 };
11854                 Self {
11855                         contents,
11856                         result_ok: o.result_ok,
11857                 }
11858         }
11859 }
11860 impl Clone for CResult_ChannelUpdateDecodeErrorZ {
11861         fn clone(&self) -> Self {
11862                 if self.result_ok {
11863                         Self { result_ok: true, contents: CResult_ChannelUpdateDecodeErrorZPtr {
11864                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ChannelUpdate>::clone(unsafe { &*self.contents.result })))
11865                         } }
11866                 } else {
11867                         Self { result_ok: false, contents: CResult_ChannelUpdateDecodeErrorZPtr {
11868                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
11869                         } }
11870                 }
11871         }
11872 }
11873 #[no_mangle]
11874 /// Creates a new CResult_ChannelUpdateDecodeErrorZ which has the same data as `orig`
11875 /// but with all dynamically-allocated buffers duplicated in new buffers.
11876 pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_clone(orig: &CResult_ChannelUpdateDecodeErrorZ) -> CResult_ChannelUpdateDecodeErrorZ { Clone::clone(&orig) }
11877 #[repr(C)]
11878 /// The contents of CResult_ErrorMessageDecodeErrorZ
11879 pub union CResult_ErrorMessageDecodeErrorZPtr {
11880         /// A pointer to the contents in the success state.
11881         /// Reading from this pointer when `result_ok` is not set is undefined.
11882         pub result: *mut crate::lightning::ln::msgs::ErrorMessage,
11883         /// A pointer to the contents in the error state.
11884         /// Reading from this pointer when `result_ok` is set is undefined.
11885         pub err: *mut crate::lightning::ln::msgs::DecodeError,
11886 }
11887 #[repr(C)]
11888 /// A CResult_ErrorMessageDecodeErrorZ represents the result of a fallible operation,
11889 /// containing a crate::lightning::ln::msgs::ErrorMessage on success and a crate::lightning::ln::msgs::DecodeError on failure.
11890 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11891 pub struct CResult_ErrorMessageDecodeErrorZ {
11892         /// The contents of this CResult_ErrorMessageDecodeErrorZ, accessible via either
11893         /// `err` or `result` depending on the state of `result_ok`.
11894         pub contents: CResult_ErrorMessageDecodeErrorZPtr,
11895         /// Whether this CResult_ErrorMessageDecodeErrorZ represents a success state.
11896         pub result_ok: bool,
11897 }
11898 #[no_mangle]
11899 /// Creates a new CResult_ErrorMessageDecodeErrorZ in the success state.
11900 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ErrorMessage) -> CResult_ErrorMessageDecodeErrorZ {
11901         CResult_ErrorMessageDecodeErrorZ {
11902                 contents: CResult_ErrorMessageDecodeErrorZPtr {
11903                         result: Box::into_raw(Box::new(o)),
11904                 },
11905                 result_ok: true,
11906         }
11907 }
11908 #[no_mangle]
11909 /// Creates a new CResult_ErrorMessageDecodeErrorZ in the error state.
11910 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ErrorMessageDecodeErrorZ {
11911         CResult_ErrorMessageDecodeErrorZ {
11912                 contents: CResult_ErrorMessageDecodeErrorZPtr {
11913                         err: Box::into_raw(Box::new(e)),
11914                 },
11915                 result_ok: false,
11916         }
11917 }
11918 #[no_mangle]
11919 /// Frees any resources used by the CResult_ErrorMessageDecodeErrorZ.
11920 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_free(_res: CResult_ErrorMessageDecodeErrorZ) { }
11921 impl Drop for CResult_ErrorMessageDecodeErrorZ {
11922         fn drop(&mut self) {
11923                 if self.result_ok {
11924                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
11925                                 let _ = unsafe { Box::from_raw(self.contents.result) };
11926                         }
11927                 } else {
11928                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
11929                                 let _ = unsafe { Box::from_raw(self.contents.err) };
11930                         }
11931                 }
11932         }
11933 }
11934 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ErrorMessage, crate::lightning::ln::msgs::DecodeError>> for CResult_ErrorMessageDecodeErrorZ {
11935         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ErrorMessage, crate::lightning::ln::msgs::DecodeError>) -> Self {
11936                 let contents = if o.result_ok {
11937                         let result = unsafe { o.contents.result };
11938                         unsafe { o.contents.result = std::ptr::null_mut() };
11939                         CResult_ErrorMessageDecodeErrorZPtr { result }
11940                 } else {
11941                         let err = unsafe { o.contents.err };
11942                         unsafe { o.contents.err = std::ptr::null_mut(); }
11943                         CResult_ErrorMessageDecodeErrorZPtr { err }
11944                 };
11945                 Self {
11946                         contents,
11947                         result_ok: o.result_ok,
11948                 }
11949         }
11950 }
11951 impl Clone for CResult_ErrorMessageDecodeErrorZ {
11952         fn clone(&self) -> Self {
11953                 if self.result_ok {
11954                         Self { result_ok: true, contents: CResult_ErrorMessageDecodeErrorZPtr {
11955                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ErrorMessage>::clone(unsafe { &*self.contents.result })))
11956                         } }
11957                 } else {
11958                         Self { result_ok: false, contents: CResult_ErrorMessageDecodeErrorZPtr {
11959                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
11960                         } }
11961                 }
11962         }
11963 }
11964 #[no_mangle]
11965 /// Creates a new CResult_ErrorMessageDecodeErrorZ which has the same data as `orig`
11966 /// but with all dynamically-allocated buffers duplicated in new buffers.
11967 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_clone(orig: &CResult_ErrorMessageDecodeErrorZ) -> CResult_ErrorMessageDecodeErrorZ { Clone::clone(&orig) }
11968 #[repr(C)]
11969 /// The contents of CResult_UnsignedNodeAnnouncementDecodeErrorZ
11970 pub union CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
11971         /// A pointer to the contents in the success state.
11972         /// Reading from this pointer when `result_ok` is not set is undefined.
11973         pub result: *mut crate::lightning::ln::msgs::UnsignedNodeAnnouncement,
11974         /// A pointer to the contents in the error state.
11975         /// Reading from this pointer when `result_ok` is set is undefined.
11976         pub err: *mut crate::lightning::ln::msgs::DecodeError,
11977 }
11978 #[repr(C)]
11979 /// A CResult_UnsignedNodeAnnouncementDecodeErrorZ represents the result of a fallible operation,
11980 /// containing a crate::lightning::ln::msgs::UnsignedNodeAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
11981 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11982 pub struct CResult_UnsignedNodeAnnouncementDecodeErrorZ {
11983         /// The contents of this CResult_UnsignedNodeAnnouncementDecodeErrorZ, accessible via either
11984         /// `err` or `result` depending on the state of `result_ok`.
11985         pub contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr,
11986         /// Whether this CResult_UnsignedNodeAnnouncementDecodeErrorZ represents a success state.
11987         pub result_ok: bool,
11988 }
11989 #[no_mangle]
11990 /// Creates a new CResult_UnsignedNodeAnnouncementDecodeErrorZ in the success state.
11991 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UnsignedNodeAnnouncement) -> CResult_UnsignedNodeAnnouncementDecodeErrorZ {
11992         CResult_UnsignedNodeAnnouncementDecodeErrorZ {
11993                 contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
11994                         result: Box::into_raw(Box::new(o)),
11995                 },
11996                 result_ok: true,
11997         }
11998 }
11999 #[no_mangle]
12000 /// Creates a new CResult_UnsignedNodeAnnouncementDecodeErrorZ in the error state.
12001 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UnsignedNodeAnnouncementDecodeErrorZ {
12002         CResult_UnsignedNodeAnnouncementDecodeErrorZ {
12003                 contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
12004                         err: Box::into_raw(Box::new(e)),
12005                 },
12006                 result_ok: false,
12007         }
12008 }
12009 #[no_mangle]
12010 /// Frees any resources used by the CResult_UnsignedNodeAnnouncementDecodeErrorZ.
12011 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_free(_res: CResult_UnsignedNodeAnnouncementDecodeErrorZ) { }
12012 impl Drop for CResult_UnsignedNodeAnnouncementDecodeErrorZ {
12013         fn drop(&mut self) {
12014                 if self.result_ok {
12015                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
12016                                 let _ = unsafe { Box::from_raw(self.contents.result) };
12017                         }
12018                 } else {
12019                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
12020                                 let _ = unsafe { Box::from_raw(self.contents.err) };
12021                         }
12022                 }
12023         }
12024 }
12025 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedNodeAnnouncement, crate::lightning::ln::msgs::DecodeError>> for CResult_UnsignedNodeAnnouncementDecodeErrorZ {
12026         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedNodeAnnouncement, crate::lightning::ln::msgs::DecodeError>) -> Self {
12027                 let contents = if o.result_ok {
12028                         let result = unsafe { o.contents.result };
12029                         unsafe { o.contents.result = std::ptr::null_mut() };
12030                         CResult_UnsignedNodeAnnouncementDecodeErrorZPtr { result }
12031                 } else {
12032                         let err = unsafe { o.contents.err };
12033                         unsafe { o.contents.err = std::ptr::null_mut(); }
12034                         CResult_UnsignedNodeAnnouncementDecodeErrorZPtr { err }
12035                 };
12036                 Self {
12037                         contents,
12038                         result_ok: o.result_ok,
12039                 }
12040         }
12041 }
12042 impl Clone for CResult_UnsignedNodeAnnouncementDecodeErrorZ {
12043         fn clone(&self) -> Self {
12044                 if self.result_ok {
12045                         Self { result_ok: true, contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
12046                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UnsignedNodeAnnouncement>::clone(unsafe { &*self.contents.result })))
12047                         } }
12048                 } else {
12049                         Self { result_ok: false, contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
12050                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
12051                         } }
12052                 }
12053         }
12054 }
12055 #[no_mangle]
12056 /// Creates a new CResult_UnsignedNodeAnnouncementDecodeErrorZ which has the same data as `orig`
12057 /// but with all dynamically-allocated buffers duplicated in new buffers.
12058 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone(orig: &CResult_UnsignedNodeAnnouncementDecodeErrorZ) -> CResult_UnsignedNodeAnnouncementDecodeErrorZ { Clone::clone(&orig) }
12059 #[repr(C)]
12060 /// The contents of CResult_NodeAnnouncementDecodeErrorZ
12061 pub union CResult_NodeAnnouncementDecodeErrorZPtr {
12062         /// A pointer to the contents in the success state.
12063         /// Reading from this pointer when `result_ok` is not set is undefined.
12064         pub result: *mut crate::lightning::ln::msgs::NodeAnnouncement,
12065         /// A pointer to the contents in the error state.
12066         /// Reading from this pointer when `result_ok` is set is undefined.
12067         pub err: *mut crate::lightning::ln::msgs::DecodeError,
12068 }
12069 #[repr(C)]
12070 /// A CResult_NodeAnnouncementDecodeErrorZ represents the result of a fallible operation,
12071 /// containing a crate::lightning::ln::msgs::NodeAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
12072 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12073 pub struct CResult_NodeAnnouncementDecodeErrorZ {
12074         /// The contents of this CResult_NodeAnnouncementDecodeErrorZ, accessible via either
12075         /// `err` or `result` depending on the state of `result_ok`.
12076         pub contents: CResult_NodeAnnouncementDecodeErrorZPtr,
12077         /// Whether this CResult_NodeAnnouncementDecodeErrorZ represents a success state.
12078         pub result_ok: bool,
12079 }
12080 #[no_mangle]
12081 /// Creates a new CResult_NodeAnnouncementDecodeErrorZ in the success state.
12082 pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_ok(o: crate::lightning::ln::msgs::NodeAnnouncement) -> CResult_NodeAnnouncementDecodeErrorZ {
12083         CResult_NodeAnnouncementDecodeErrorZ {
12084                 contents: CResult_NodeAnnouncementDecodeErrorZPtr {
12085                         result: Box::into_raw(Box::new(o)),
12086                 },
12087                 result_ok: true,
12088         }
12089 }
12090 #[no_mangle]
12091 /// Creates a new CResult_NodeAnnouncementDecodeErrorZ in the error state.
12092 pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeAnnouncementDecodeErrorZ {
12093         CResult_NodeAnnouncementDecodeErrorZ {
12094                 contents: CResult_NodeAnnouncementDecodeErrorZPtr {
12095                         err: Box::into_raw(Box::new(e)),
12096                 },
12097                 result_ok: false,
12098         }
12099 }
12100 #[no_mangle]
12101 /// Frees any resources used by the CResult_NodeAnnouncementDecodeErrorZ.
12102 pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_free(_res: CResult_NodeAnnouncementDecodeErrorZ) { }
12103 impl Drop for CResult_NodeAnnouncementDecodeErrorZ {
12104         fn drop(&mut self) {
12105                 if self.result_ok {
12106                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
12107                                 let _ = unsafe { Box::from_raw(self.contents.result) };
12108                         }
12109                 } else {
12110                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
12111                                 let _ = unsafe { Box::from_raw(self.contents.err) };
12112                         }
12113                 }
12114         }
12115 }
12116 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::NodeAnnouncement, crate::lightning::ln::msgs::DecodeError>> for CResult_NodeAnnouncementDecodeErrorZ {
12117         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::NodeAnnouncement, crate::lightning::ln::msgs::DecodeError>) -> Self {
12118                 let contents = if o.result_ok {
12119                         let result = unsafe { o.contents.result };
12120                         unsafe { o.contents.result = std::ptr::null_mut() };
12121                         CResult_NodeAnnouncementDecodeErrorZPtr { result }
12122                 } else {
12123                         let err = unsafe { o.contents.err };
12124                         unsafe { o.contents.err = std::ptr::null_mut(); }
12125                         CResult_NodeAnnouncementDecodeErrorZPtr { err }
12126                 };
12127                 Self {
12128                         contents,
12129                         result_ok: o.result_ok,
12130                 }
12131         }
12132 }
12133 impl Clone for CResult_NodeAnnouncementDecodeErrorZ {
12134         fn clone(&self) -> Self {
12135                 if self.result_ok {
12136                         Self { result_ok: true, contents: CResult_NodeAnnouncementDecodeErrorZPtr {
12137                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::NodeAnnouncement>::clone(unsafe { &*self.contents.result })))
12138                         } }
12139                 } else {
12140                         Self { result_ok: false, contents: CResult_NodeAnnouncementDecodeErrorZPtr {
12141                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
12142                         } }
12143                 }
12144         }
12145 }
12146 #[no_mangle]
12147 /// Creates a new CResult_NodeAnnouncementDecodeErrorZ which has the same data as `orig`
12148 /// but with all dynamically-allocated buffers duplicated in new buffers.
12149 pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_clone(orig: &CResult_NodeAnnouncementDecodeErrorZ) -> CResult_NodeAnnouncementDecodeErrorZ { Clone::clone(&orig) }
12150 #[repr(C)]
12151 /// The contents of CResult_QueryShortChannelIdsDecodeErrorZ
12152 pub union CResult_QueryShortChannelIdsDecodeErrorZPtr {
12153         /// A pointer to the contents in the success state.
12154         /// Reading from this pointer when `result_ok` is not set is undefined.
12155         pub result: *mut crate::lightning::ln::msgs::QueryShortChannelIds,
12156         /// A pointer to the contents in the error state.
12157         /// Reading from this pointer when `result_ok` is set is undefined.
12158         pub err: *mut crate::lightning::ln::msgs::DecodeError,
12159 }
12160 #[repr(C)]
12161 /// A CResult_QueryShortChannelIdsDecodeErrorZ represents the result of a fallible operation,
12162 /// containing a crate::lightning::ln::msgs::QueryShortChannelIds on success and a crate::lightning::ln::msgs::DecodeError on failure.
12163 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12164 pub struct CResult_QueryShortChannelIdsDecodeErrorZ {
12165         /// The contents of this CResult_QueryShortChannelIdsDecodeErrorZ, accessible via either
12166         /// `err` or `result` depending on the state of `result_ok`.
12167         pub contents: CResult_QueryShortChannelIdsDecodeErrorZPtr,
12168         /// Whether this CResult_QueryShortChannelIdsDecodeErrorZ represents a success state.
12169         pub result_ok: bool,
12170 }
12171 #[no_mangle]
12172 /// Creates a new CResult_QueryShortChannelIdsDecodeErrorZ in the success state.
12173 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_ok(o: crate::lightning::ln::msgs::QueryShortChannelIds) -> CResult_QueryShortChannelIdsDecodeErrorZ {
12174         CResult_QueryShortChannelIdsDecodeErrorZ {
12175                 contents: CResult_QueryShortChannelIdsDecodeErrorZPtr {
12176                         result: Box::into_raw(Box::new(o)),
12177                 },
12178                 result_ok: true,
12179         }
12180 }
12181 #[no_mangle]
12182 /// Creates a new CResult_QueryShortChannelIdsDecodeErrorZ in the error state.
12183 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_QueryShortChannelIdsDecodeErrorZ {
12184         CResult_QueryShortChannelIdsDecodeErrorZ {
12185                 contents: CResult_QueryShortChannelIdsDecodeErrorZPtr {
12186                         err: Box::into_raw(Box::new(e)),
12187                 },
12188                 result_ok: false,
12189         }
12190 }
12191 #[no_mangle]
12192 /// Frees any resources used by the CResult_QueryShortChannelIdsDecodeErrorZ.
12193 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_free(_res: CResult_QueryShortChannelIdsDecodeErrorZ) { }
12194 impl Drop for CResult_QueryShortChannelIdsDecodeErrorZ {
12195         fn drop(&mut self) {
12196                 if self.result_ok {
12197                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
12198                                 let _ = unsafe { Box::from_raw(self.contents.result) };
12199                         }
12200                 } else {
12201                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
12202                                 let _ = unsafe { Box::from_raw(self.contents.err) };
12203                         }
12204                 }
12205         }
12206 }
12207 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::QueryShortChannelIds, crate::lightning::ln::msgs::DecodeError>> for CResult_QueryShortChannelIdsDecodeErrorZ {
12208         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::QueryShortChannelIds, crate::lightning::ln::msgs::DecodeError>) -> Self {
12209                 let contents = if o.result_ok {
12210                         let result = unsafe { o.contents.result };
12211                         unsafe { o.contents.result = std::ptr::null_mut() };
12212                         CResult_QueryShortChannelIdsDecodeErrorZPtr { result }
12213                 } else {
12214                         let err = unsafe { o.contents.err };
12215                         unsafe { o.contents.err = std::ptr::null_mut(); }
12216                         CResult_QueryShortChannelIdsDecodeErrorZPtr { err }
12217                 };
12218                 Self {
12219                         contents,
12220                         result_ok: o.result_ok,
12221                 }
12222         }
12223 }
12224 impl Clone for CResult_QueryShortChannelIdsDecodeErrorZ {
12225         fn clone(&self) -> Self {
12226                 if self.result_ok {
12227                         Self { result_ok: true, contents: CResult_QueryShortChannelIdsDecodeErrorZPtr {
12228                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::QueryShortChannelIds>::clone(unsafe { &*self.contents.result })))
12229                         } }
12230                 } else {
12231                         Self { result_ok: false, contents: CResult_QueryShortChannelIdsDecodeErrorZPtr {
12232                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
12233                         } }
12234                 }
12235         }
12236 }
12237 #[no_mangle]
12238 /// Creates a new CResult_QueryShortChannelIdsDecodeErrorZ which has the same data as `orig`
12239 /// but with all dynamically-allocated buffers duplicated in new buffers.
12240 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_clone(orig: &CResult_QueryShortChannelIdsDecodeErrorZ) -> CResult_QueryShortChannelIdsDecodeErrorZ { Clone::clone(&orig) }
12241 #[repr(C)]
12242 /// The contents of CResult_ReplyShortChannelIdsEndDecodeErrorZ
12243 pub union CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
12244         /// A pointer to the contents in the success state.
12245         /// Reading from this pointer when `result_ok` is not set is undefined.
12246         pub result: *mut crate::lightning::ln::msgs::ReplyShortChannelIdsEnd,
12247         /// A pointer to the contents in the error state.
12248         /// Reading from this pointer when `result_ok` is set is undefined.
12249         pub err: *mut crate::lightning::ln::msgs::DecodeError,
12250 }
12251 #[repr(C)]
12252 /// A CResult_ReplyShortChannelIdsEndDecodeErrorZ represents the result of a fallible operation,
12253 /// containing a crate::lightning::ln::msgs::ReplyShortChannelIdsEnd on success and a crate::lightning::ln::msgs::DecodeError on failure.
12254 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12255 pub struct CResult_ReplyShortChannelIdsEndDecodeErrorZ {
12256         /// The contents of this CResult_ReplyShortChannelIdsEndDecodeErrorZ, accessible via either
12257         /// `err` or `result` depending on the state of `result_ok`.
12258         pub contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr,
12259         /// Whether this CResult_ReplyShortChannelIdsEndDecodeErrorZ represents a success state.
12260         pub result_ok: bool,
12261 }
12262 #[no_mangle]
12263 /// Creates a new CResult_ReplyShortChannelIdsEndDecodeErrorZ in the success state.
12264 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ReplyShortChannelIdsEnd) -> CResult_ReplyShortChannelIdsEndDecodeErrorZ {
12265         CResult_ReplyShortChannelIdsEndDecodeErrorZ {
12266                 contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
12267                         result: Box::into_raw(Box::new(o)),
12268                 },
12269                 result_ok: true,
12270         }
12271 }
12272 #[no_mangle]
12273 /// Creates a new CResult_ReplyShortChannelIdsEndDecodeErrorZ in the error state.
12274 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ReplyShortChannelIdsEndDecodeErrorZ {
12275         CResult_ReplyShortChannelIdsEndDecodeErrorZ {
12276                 contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
12277                         err: Box::into_raw(Box::new(e)),
12278                 },
12279                 result_ok: false,
12280         }
12281 }
12282 #[no_mangle]
12283 /// Frees any resources used by the CResult_ReplyShortChannelIdsEndDecodeErrorZ.
12284 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_free(_res: CResult_ReplyShortChannelIdsEndDecodeErrorZ) { }
12285 impl Drop for CResult_ReplyShortChannelIdsEndDecodeErrorZ {
12286         fn drop(&mut self) {
12287                 if self.result_ok {
12288                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
12289                                 let _ = unsafe { Box::from_raw(self.contents.result) };
12290                         }
12291                 } else {
12292                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
12293                                 let _ = unsafe { Box::from_raw(self.contents.err) };
12294                         }
12295                 }
12296         }
12297 }
12298 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ReplyShortChannelIdsEnd, crate::lightning::ln::msgs::DecodeError>> for CResult_ReplyShortChannelIdsEndDecodeErrorZ {
12299         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ReplyShortChannelIdsEnd, crate::lightning::ln::msgs::DecodeError>) -> Self {
12300                 let contents = if o.result_ok {
12301                         let result = unsafe { o.contents.result };
12302                         unsafe { o.contents.result = std::ptr::null_mut() };
12303                         CResult_ReplyShortChannelIdsEndDecodeErrorZPtr { result }
12304                 } else {
12305                         let err = unsafe { o.contents.err };
12306                         unsafe { o.contents.err = std::ptr::null_mut(); }
12307                         CResult_ReplyShortChannelIdsEndDecodeErrorZPtr { err }
12308                 };
12309                 Self {
12310                         contents,
12311                         result_ok: o.result_ok,
12312                 }
12313         }
12314 }
12315 impl Clone for CResult_ReplyShortChannelIdsEndDecodeErrorZ {
12316         fn clone(&self) -> Self {
12317                 if self.result_ok {
12318                         Self { result_ok: true, contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
12319                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ReplyShortChannelIdsEnd>::clone(unsafe { &*self.contents.result })))
12320                         } }
12321                 } else {
12322                         Self { result_ok: false, contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
12323                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
12324                         } }
12325                 }
12326         }
12327 }
12328 #[no_mangle]
12329 /// Creates a new CResult_ReplyShortChannelIdsEndDecodeErrorZ which has the same data as `orig`
12330 /// but with all dynamically-allocated buffers duplicated in new buffers.
12331 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone(orig: &CResult_ReplyShortChannelIdsEndDecodeErrorZ) -> CResult_ReplyShortChannelIdsEndDecodeErrorZ { Clone::clone(&orig) }
12332 #[repr(C)]
12333 /// The contents of CResult_QueryChannelRangeDecodeErrorZ
12334 pub union CResult_QueryChannelRangeDecodeErrorZPtr {
12335         /// A pointer to the contents in the success state.
12336         /// Reading from this pointer when `result_ok` is not set is undefined.
12337         pub result: *mut crate::lightning::ln::msgs::QueryChannelRange,
12338         /// A pointer to the contents in the error state.
12339         /// Reading from this pointer when `result_ok` is set is undefined.
12340         pub err: *mut crate::lightning::ln::msgs::DecodeError,
12341 }
12342 #[repr(C)]
12343 /// A CResult_QueryChannelRangeDecodeErrorZ represents the result of a fallible operation,
12344 /// containing a crate::lightning::ln::msgs::QueryChannelRange on success and a crate::lightning::ln::msgs::DecodeError on failure.
12345 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12346 pub struct CResult_QueryChannelRangeDecodeErrorZ {
12347         /// The contents of this CResult_QueryChannelRangeDecodeErrorZ, accessible via either
12348         /// `err` or `result` depending on the state of `result_ok`.
12349         pub contents: CResult_QueryChannelRangeDecodeErrorZPtr,
12350         /// Whether this CResult_QueryChannelRangeDecodeErrorZ represents a success state.
12351         pub result_ok: bool,
12352 }
12353 #[no_mangle]
12354 /// Creates a new CResult_QueryChannelRangeDecodeErrorZ in the success state.
12355 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_ok(o: crate::lightning::ln::msgs::QueryChannelRange) -> CResult_QueryChannelRangeDecodeErrorZ {
12356         CResult_QueryChannelRangeDecodeErrorZ {
12357                 contents: CResult_QueryChannelRangeDecodeErrorZPtr {
12358                         result: Box::into_raw(Box::new(o)),
12359                 },
12360                 result_ok: true,
12361         }
12362 }
12363 #[no_mangle]
12364 /// Creates a new CResult_QueryChannelRangeDecodeErrorZ in the error state.
12365 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_QueryChannelRangeDecodeErrorZ {
12366         CResult_QueryChannelRangeDecodeErrorZ {
12367                 contents: CResult_QueryChannelRangeDecodeErrorZPtr {
12368                         err: Box::into_raw(Box::new(e)),
12369                 },
12370                 result_ok: false,
12371         }
12372 }
12373 #[no_mangle]
12374 /// Frees any resources used by the CResult_QueryChannelRangeDecodeErrorZ.
12375 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_free(_res: CResult_QueryChannelRangeDecodeErrorZ) { }
12376 impl Drop for CResult_QueryChannelRangeDecodeErrorZ {
12377         fn drop(&mut self) {
12378                 if self.result_ok {
12379                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
12380                                 let _ = unsafe { Box::from_raw(self.contents.result) };
12381                         }
12382                 } else {
12383                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
12384                                 let _ = unsafe { Box::from_raw(self.contents.err) };
12385                         }
12386                 }
12387         }
12388 }
12389 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::QueryChannelRange, crate::lightning::ln::msgs::DecodeError>> for CResult_QueryChannelRangeDecodeErrorZ {
12390         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::QueryChannelRange, crate::lightning::ln::msgs::DecodeError>) -> Self {
12391                 let contents = if o.result_ok {
12392                         let result = unsafe { o.contents.result };
12393                         unsafe { o.contents.result = std::ptr::null_mut() };
12394                         CResult_QueryChannelRangeDecodeErrorZPtr { result }
12395                 } else {
12396                         let err = unsafe { o.contents.err };
12397                         unsafe { o.contents.err = std::ptr::null_mut(); }
12398                         CResult_QueryChannelRangeDecodeErrorZPtr { err }
12399                 };
12400                 Self {
12401                         contents,
12402                         result_ok: o.result_ok,
12403                 }
12404         }
12405 }
12406 impl Clone for CResult_QueryChannelRangeDecodeErrorZ {
12407         fn clone(&self) -> Self {
12408                 if self.result_ok {
12409                         Self { result_ok: true, contents: CResult_QueryChannelRangeDecodeErrorZPtr {
12410                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::QueryChannelRange>::clone(unsafe { &*self.contents.result })))
12411                         } }
12412                 } else {
12413                         Self { result_ok: false, contents: CResult_QueryChannelRangeDecodeErrorZPtr {
12414                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
12415                         } }
12416                 }
12417         }
12418 }
12419 #[no_mangle]
12420 /// Creates a new CResult_QueryChannelRangeDecodeErrorZ which has the same data as `orig`
12421 /// but with all dynamically-allocated buffers duplicated in new buffers.
12422 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_clone(orig: &CResult_QueryChannelRangeDecodeErrorZ) -> CResult_QueryChannelRangeDecodeErrorZ { Clone::clone(&orig) }
12423 #[repr(C)]
12424 /// The contents of CResult_ReplyChannelRangeDecodeErrorZ
12425 pub union CResult_ReplyChannelRangeDecodeErrorZPtr {
12426         /// A pointer to the contents in the success state.
12427         /// Reading from this pointer when `result_ok` is not set is undefined.
12428         pub result: *mut crate::lightning::ln::msgs::ReplyChannelRange,
12429         /// A pointer to the contents in the error state.
12430         /// Reading from this pointer when `result_ok` is set is undefined.
12431         pub err: *mut crate::lightning::ln::msgs::DecodeError,
12432 }
12433 #[repr(C)]
12434 /// A CResult_ReplyChannelRangeDecodeErrorZ represents the result of a fallible operation,
12435 /// containing a crate::lightning::ln::msgs::ReplyChannelRange on success and a crate::lightning::ln::msgs::DecodeError on failure.
12436 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12437 pub struct CResult_ReplyChannelRangeDecodeErrorZ {
12438         /// The contents of this CResult_ReplyChannelRangeDecodeErrorZ, accessible via either
12439         /// `err` or `result` depending on the state of `result_ok`.
12440         pub contents: CResult_ReplyChannelRangeDecodeErrorZPtr,
12441         /// Whether this CResult_ReplyChannelRangeDecodeErrorZ represents a success state.
12442         pub result_ok: bool,
12443 }
12444 #[no_mangle]
12445 /// Creates a new CResult_ReplyChannelRangeDecodeErrorZ in the success state.
12446 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ReplyChannelRange) -> CResult_ReplyChannelRangeDecodeErrorZ {
12447         CResult_ReplyChannelRangeDecodeErrorZ {
12448                 contents: CResult_ReplyChannelRangeDecodeErrorZPtr {
12449                         result: Box::into_raw(Box::new(o)),
12450                 },
12451                 result_ok: true,
12452         }
12453 }
12454 #[no_mangle]
12455 /// Creates a new CResult_ReplyChannelRangeDecodeErrorZ in the error state.
12456 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ReplyChannelRangeDecodeErrorZ {
12457         CResult_ReplyChannelRangeDecodeErrorZ {
12458                 contents: CResult_ReplyChannelRangeDecodeErrorZPtr {
12459                         err: Box::into_raw(Box::new(e)),
12460                 },
12461                 result_ok: false,
12462         }
12463 }
12464 #[no_mangle]
12465 /// Frees any resources used by the CResult_ReplyChannelRangeDecodeErrorZ.
12466 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_free(_res: CResult_ReplyChannelRangeDecodeErrorZ) { }
12467 impl Drop for CResult_ReplyChannelRangeDecodeErrorZ {
12468         fn drop(&mut self) {
12469                 if self.result_ok {
12470                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
12471                                 let _ = unsafe { Box::from_raw(self.contents.result) };
12472                         }
12473                 } else {
12474                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
12475                                 let _ = unsafe { Box::from_raw(self.contents.err) };
12476                         }
12477                 }
12478         }
12479 }
12480 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ReplyChannelRange, crate::lightning::ln::msgs::DecodeError>> for CResult_ReplyChannelRangeDecodeErrorZ {
12481         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ReplyChannelRange, crate::lightning::ln::msgs::DecodeError>) -> Self {
12482                 let contents = if o.result_ok {
12483                         let result = unsafe { o.contents.result };
12484                         unsafe { o.contents.result = std::ptr::null_mut() };
12485                         CResult_ReplyChannelRangeDecodeErrorZPtr { result }
12486                 } else {
12487                         let err = unsafe { o.contents.err };
12488                         unsafe { o.contents.err = std::ptr::null_mut(); }
12489                         CResult_ReplyChannelRangeDecodeErrorZPtr { err }
12490                 };
12491                 Self {
12492                         contents,
12493                         result_ok: o.result_ok,
12494                 }
12495         }
12496 }
12497 impl Clone for CResult_ReplyChannelRangeDecodeErrorZ {
12498         fn clone(&self) -> Self {
12499                 if self.result_ok {
12500                         Self { result_ok: true, contents: CResult_ReplyChannelRangeDecodeErrorZPtr {
12501                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ReplyChannelRange>::clone(unsafe { &*self.contents.result })))
12502                         } }
12503                 } else {
12504                         Self { result_ok: false, contents: CResult_ReplyChannelRangeDecodeErrorZPtr {
12505                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
12506                         } }
12507                 }
12508         }
12509 }
12510 #[no_mangle]
12511 /// Creates a new CResult_ReplyChannelRangeDecodeErrorZ which has the same data as `orig`
12512 /// but with all dynamically-allocated buffers duplicated in new buffers.
12513 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_clone(orig: &CResult_ReplyChannelRangeDecodeErrorZ) -> CResult_ReplyChannelRangeDecodeErrorZ { Clone::clone(&orig) }
12514 #[repr(C)]
12515 /// The contents of CResult_GossipTimestampFilterDecodeErrorZ
12516 pub union CResult_GossipTimestampFilterDecodeErrorZPtr {
12517         /// A pointer to the contents in the success state.
12518         /// Reading from this pointer when `result_ok` is not set is undefined.
12519         pub result: *mut crate::lightning::ln::msgs::GossipTimestampFilter,
12520         /// A pointer to the contents in the error state.
12521         /// Reading from this pointer when `result_ok` is set is undefined.
12522         pub err: *mut crate::lightning::ln::msgs::DecodeError,
12523 }
12524 #[repr(C)]
12525 /// A CResult_GossipTimestampFilterDecodeErrorZ represents the result of a fallible operation,
12526 /// containing a crate::lightning::ln::msgs::GossipTimestampFilter on success and a crate::lightning::ln::msgs::DecodeError on failure.
12527 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12528 pub struct CResult_GossipTimestampFilterDecodeErrorZ {
12529         /// The contents of this CResult_GossipTimestampFilterDecodeErrorZ, accessible via either
12530         /// `err` or `result` depending on the state of `result_ok`.
12531         pub contents: CResult_GossipTimestampFilterDecodeErrorZPtr,
12532         /// Whether this CResult_GossipTimestampFilterDecodeErrorZ represents a success state.
12533         pub result_ok: bool,
12534 }
12535 #[no_mangle]
12536 /// Creates a new CResult_GossipTimestampFilterDecodeErrorZ in the success state.
12537 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_ok(o: crate::lightning::ln::msgs::GossipTimestampFilter) -> CResult_GossipTimestampFilterDecodeErrorZ {
12538         CResult_GossipTimestampFilterDecodeErrorZ {
12539                 contents: CResult_GossipTimestampFilterDecodeErrorZPtr {
12540                         result: Box::into_raw(Box::new(o)),
12541                 },
12542                 result_ok: true,
12543         }
12544 }
12545 #[no_mangle]
12546 /// Creates a new CResult_GossipTimestampFilterDecodeErrorZ in the error state.
12547 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_GossipTimestampFilterDecodeErrorZ {
12548         CResult_GossipTimestampFilterDecodeErrorZ {
12549                 contents: CResult_GossipTimestampFilterDecodeErrorZPtr {
12550                         err: Box::into_raw(Box::new(e)),
12551                 },
12552                 result_ok: false,
12553         }
12554 }
12555 #[no_mangle]
12556 /// Frees any resources used by the CResult_GossipTimestampFilterDecodeErrorZ.
12557 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_free(_res: CResult_GossipTimestampFilterDecodeErrorZ) { }
12558 impl Drop for CResult_GossipTimestampFilterDecodeErrorZ {
12559         fn drop(&mut self) {
12560                 if self.result_ok {
12561                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
12562                                 let _ = unsafe { Box::from_raw(self.contents.result) };
12563                         }
12564                 } else {
12565                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
12566                                 let _ = unsafe { Box::from_raw(self.contents.err) };
12567                         }
12568                 }
12569         }
12570 }
12571 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::GossipTimestampFilter, crate::lightning::ln::msgs::DecodeError>> for CResult_GossipTimestampFilterDecodeErrorZ {
12572         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::GossipTimestampFilter, crate::lightning::ln::msgs::DecodeError>) -> Self {
12573                 let contents = if o.result_ok {
12574                         let result = unsafe { o.contents.result };
12575                         unsafe { o.contents.result = std::ptr::null_mut() };
12576                         CResult_GossipTimestampFilterDecodeErrorZPtr { result }
12577                 } else {
12578                         let err = unsafe { o.contents.err };
12579                         unsafe { o.contents.err = std::ptr::null_mut(); }
12580                         CResult_GossipTimestampFilterDecodeErrorZPtr { err }
12581                 };
12582                 Self {
12583                         contents,
12584                         result_ok: o.result_ok,
12585                 }
12586         }
12587 }
12588 impl Clone for CResult_GossipTimestampFilterDecodeErrorZ {
12589         fn clone(&self) -> Self {
12590                 if self.result_ok {
12591                         Self { result_ok: true, contents: CResult_GossipTimestampFilterDecodeErrorZPtr {
12592                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::GossipTimestampFilter>::clone(unsafe { &*self.contents.result })))
12593                         } }
12594                 } else {
12595                         Self { result_ok: false, contents: CResult_GossipTimestampFilterDecodeErrorZPtr {
12596                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
12597                         } }
12598                 }
12599         }
12600 }
12601 #[no_mangle]
12602 /// Creates a new CResult_GossipTimestampFilterDecodeErrorZ which has the same data as `orig`
12603 /// but with all dynamically-allocated buffers duplicated in new buffers.
12604 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_clone(orig: &CResult_GossipTimestampFilterDecodeErrorZ) -> CResult_GossipTimestampFilterDecodeErrorZ { Clone::clone(&orig) }
12605 #[repr(C)]
12606 /// The contents of CResult_InvoiceSignOrCreationErrorZ
12607 pub union CResult_InvoiceSignOrCreationErrorZPtr {
12608         /// A pointer to the contents in the success state.
12609         /// Reading from this pointer when `result_ok` is not set is undefined.
12610         pub result: *mut crate::lightning_invoice::Invoice,
12611         /// A pointer to the contents in the error state.
12612         /// Reading from this pointer when `result_ok` is set is undefined.
12613         pub err: *mut crate::lightning_invoice::SignOrCreationError,
12614 }
12615 #[repr(C)]
12616 /// A CResult_InvoiceSignOrCreationErrorZ represents the result of a fallible operation,
12617 /// containing a crate::lightning_invoice::Invoice on success and a crate::lightning_invoice::SignOrCreationError on failure.
12618 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12619 pub struct CResult_InvoiceSignOrCreationErrorZ {
12620         /// The contents of this CResult_InvoiceSignOrCreationErrorZ, accessible via either
12621         /// `err` or `result` depending on the state of `result_ok`.
12622         pub contents: CResult_InvoiceSignOrCreationErrorZPtr,
12623         /// Whether this CResult_InvoiceSignOrCreationErrorZ represents a success state.
12624         pub result_ok: bool,
12625 }
12626 #[no_mangle]
12627 /// Creates a new CResult_InvoiceSignOrCreationErrorZ in the success state.
12628 pub extern "C" fn CResult_InvoiceSignOrCreationErrorZ_ok(o: crate::lightning_invoice::Invoice) -> CResult_InvoiceSignOrCreationErrorZ {
12629         CResult_InvoiceSignOrCreationErrorZ {
12630                 contents: CResult_InvoiceSignOrCreationErrorZPtr {
12631                         result: Box::into_raw(Box::new(o)),
12632                 },
12633                 result_ok: true,
12634         }
12635 }
12636 #[no_mangle]
12637 /// Creates a new CResult_InvoiceSignOrCreationErrorZ in the error state.
12638 pub extern "C" fn CResult_InvoiceSignOrCreationErrorZ_err(e: crate::lightning_invoice::SignOrCreationError) -> CResult_InvoiceSignOrCreationErrorZ {
12639         CResult_InvoiceSignOrCreationErrorZ {
12640                 contents: CResult_InvoiceSignOrCreationErrorZPtr {
12641                         err: Box::into_raw(Box::new(e)),
12642                 },
12643                 result_ok: false,
12644         }
12645 }
12646 #[no_mangle]
12647 /// Frees any resources used by the CResult_InvoiceSignOrCreationErrorZ.
12648 pub extern "C" fn CResult_InvoiceSignOrCreationErrorZ_free(_res: CResult_InvoiceSignOrCreationErrorZ) { }
12649 impl Drop for CResult_InvoiceSignOrCreationErrorZ {
12650         fn drop(&mut self) {
12651                 if self.result_ok {
12652                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
12653                                 let _ = unsafe { Box::from_raw(self.contents.result) };
12654                         }
12655                 } else {
12656                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
12657                                 let _ = unsafe { Box::from_raw(self.contents.err) };
12658                         }
12659                 }
12660         }
12661 }
12662 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::Invoice, crate::lightning_invoice::SignOrCreationError>> for CResult_InvoiceSignOrCreationErrorZ {
12663         fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::Invoice, crate::lightning_invoice::SignOrCreationError>) -> Self {
12664                 let contents = if o.result_ok {
12665                         let result = unsafe { o.contents.result };
12666                         unsafe { o.contents.result = std::ptr::null_mut() };
12667                         CResult_InvoiceSignOrCreationErrorZPtr { result }
12668                 } else {
12669                         let err = unsafe { o.contents.err };
12670                         unsafe { o.contents.err = std::ptr::null_mut(); }
12671                         CResult_InvoiceSignOrCreationErrorZPtr { err }
12672                 };
12673                 Self {
12674                         contents,
12675                         result_ok: o.result_ok,
12676                 }
12677         }
12678 }
12679 impl Clone for CResult_InvoiceSignOrCreationErrorZ {
12680         fn clone(&self) -> Self {
12681                 if self.result_ok {
12682                         Self { result_ok: true, contents: CResult_InvoiceSignOrCreationErrorZPtr {
12683                                 result: Box::into_raw(Box::new(<crate::lightning_invoice::Invoice>::clone(unsafe { &*self.contents.result })))
12684                         } }
12685                 } else {
12686                         Self { result_ok: false, contents: CResult_InvoiceSignOrCreationErrorZPtr {
12687                                 err: Box::into_raw(Box::new(<crate::lightning_invoice::SignOrCreationError>::clone(unsafe { &*self.contents.err })))
12688                         } }
12689                 }
12690         }
12691 }
12692 #[no_mangle]
12693 /// Creates a new CResult_InvoiceSignOrCreationErrorZ which has the same data as `orig`
12694 /// but with all dynamically-allocated buffers duplicated in new buffers.
12695 pub extern "C" fn CResult_InvoiceSignOrCreationErrorZ_clone(orig: &CResult_InvoiceSignOrCreationErrorZ) -> CResult_InvoiceSignOrCreationErrorZ { Clone::clone(&orig) }
12696 #[repr(C)]
12697 /// An enum which can either contain a crate::lightning::chain::Filter or not
12698 pub enum COption_FilterZ {
12699         /// When we're in this state, this COption_FilterZ contains a crate::lightning::chain::Filter
12700         Some(crate::lightning::chain::Filter),
12701         /// When we're in this state, this COption_FilterZ contains nothing
12702         None
12703 }
12704 impl COption_FilterZ {
12705         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
12706                 if let Self::Some(_) = self { true } else { false }
12707         }
12708         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
12709                 !self.is_some()
12710         }
12711         #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::chain::Filter {
12712                 if let Self::Some(v) = self { v } else { unreachable!() }
12713         }
12714 }
12715 #[no_mangle]
12716 /// Constructs a new COption_FilterZ containing a crate::lightning::chain::Filter
12717 pub extern "C" fn COption_FilterZ_some(o: crate::lightning::chain::Filter) -> COption_FilterZ {
12718         COption_FilterZ::Some(o)
12719 }
12720 #[no_mangle]
12721 /// Constructs a new COption_FilterZ containing nothing
12722 pub extern "C" fn COption_FilterZ_none() -> COption_FilterZ {
12723         COption_FilterZ::None
12724 }
12725 #[no_mangle]
12726 /// Frees any resources associated with the crate::lightning::chain::Filter, if we are in the Some state
12727 pub extern "C" fn COption_FilterZ_free(_res: COption_FilterZ) { }
12728 #[repr(C)]
12729 /// The contents of CResult_LockedChannelMonitorNoneZ
12730 pub union CResult_LockedChannelMonitorNoneZPtr {
12731         /// A pointer to the contents in the success state.
12732         /// Reading from this pointer when `result_ok` is not set is undefined.
12733         pub result: *mut crate::lightning::chain::chainmonitor::LockedChannelMonitor,
12734         /// Note that this value is always NULL, as there are no contents in the Err variant
12735         pub err: *mut std::ffi::c_void,
12736 }
12737 #[repr(C)]
12738 /// A CResult_LockedChannelMonitorNoneZ represents the result of a fallible operation,
12739 /// containing a crate::lightning::chain::chainmonitor::LockedChannelMonitor on success and a () on failure.
12740 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12741 pub struct CResult_LockedChannelMonitorNoneZ {
12742         /// The contents of this CResult_LockedChannelMonitorNoneZ, accessible via either
12743         /// `err` or `result` depending on the state of `result_ok`.
12744         pub contents: CResult_LockedChannelMonitorNoneZPtr,
12745         /// Whether this CResult_LockedChannelMonitorNoneZ represents a success state.
12746         pub result_ok: bool,
12747 }
12748 #[no_mangle]
12749 /// Creates a new CResult_LockedChannelMonitorNoneZ in the success state.
12750 pub extern "C" fn CResult_LockedChannelMonitorNoneZ_ok(o: crate::lightning::chain::chainmonitor::LockedChannelMonitor) -> CResult_LockedChannelMonitorNoneZ {
12751         CResult_LockedChannelMonitorNoneZ {
12752                 contents: CResult_LockedChannelMonitorNoneZPtr {
12753                         result: Box::into_raw(Box::new(o)),
12754                 },
12755                 result_ok: true,
12756         }
12757 }
12758 #[no_mangle]
12759 /// Creates a new CResult_LockedChannelMonitorNoneZ in the error state.
12760 pub extern "C" fn CResult_LockedChannelMonitorNoneZ_err() -> CResult_LockedChannelMonitorNoneZ {
12761         CResult_LockedChannelMonitorNoneZ {
12762                 contents: CResult_LockedChannelMonitorNoneZPtr {
12763                         err: std::ptr::null_mut(),
12764                 },
12765                 result_ok: false,
12766         }
12767 }
12768 #[no_mangle]
12769 /// Frees any resources used by the CResult_LockedChannelMonitorNoneZ.
12770 pub extern "C" fn CResult_LockedChannelMonitorNoneZ_free(_res: CResult_LockedChannelMonitorNoneZ) { }
12771 impl Drop for CResult_LockedChannelMonitorNoneZ {
12772         fn drop(&mut self) {
12773                 if self.result_ok {
12774                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
12775                                 let _ = unsafe { Box::from_raw(self.contents.result) };
12776                         }
12777                 } else {
12778                 }
12779         }
12780 }
12781 impl From<crate::c_types::CResultTempl<crate::lightning::chain::chainmonitor::LockedChannelMonitor, ()>> for CResult_LockedChannelMonitorNoneZ {
12782         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::chainmonitor::LockedChannelMonitor, ()>) -> Self {
12783                 let contents = if o.result_ok {
12784                         let result = unsafe { o.contents.result };
12785                         unsafe { o.contents.result = std::ptr::null_mut() };
12786                         CResult_LockedChannelMonitorNoneZPtr { result }
12787                 } else {
12788                         let _ = unsafe { Box::from_raw(o.contents.err) };
12789                         o.contents.err = std::ptr::null_mut();
12790                         CResult_LockedChannelMonitorNoneZPtr { err: std::ptr::null_mut() }
12791                 };
12792                 Self {
12793                         contents,
12794                         result_ok: o.result_ok,
12795                 }
12796         }
12797 }
12798 #[repr(C)]
12799 /// A dynamically-allocated array of crate::lightning::chain::transaction::OutPoints of arbitrary size.
12800 /// This corresponds to std::vector in C++
12801 pub struct CVec_OutPointZ {
12802         /// The elements in the array.
12803         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
12804         pub data: *mut crate::lightning::chain::transaction::OutPoint,
12805         /// The number of elements pointed to by `data`.
12806         pub datalen: usize
12807 }
12808 impl CVec_OutPointZ {
12809         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::chain::transaction::OutPoint> {
12810                 if self.datalen == 0 { return Vec::new(); }
12811                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
12812                 self.data = std::ptr::null_mut();
12813                 self.datalen = 0;
12814                 ret
12815         }
12816         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::chain::transaction::OutPoint] {
12817                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
12818         }
12819 }
12820 impl From<Vec<crate::lightning::chain::transaction::OutPoint>> for CVec_OutPointZ {
12821         fn from(v: Vec<crate::lightning::chain::transaction::OutPoint>) -> Self {
12822                 let datalen = v.len();
12823                 let data = Box::into_raw(v.into_boxed_slice());
12824                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
12825         }
12826 }
12827 #[no_mangle]
12828 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
12829 pub extern "C" fn CVec_OutPointZ_free(_res: CVec_OutPointZ) { }
12830 impl Drop for CVec_OutPointZ {
12831         fn drop(&mut self) {
12832                 if self.datalen == 0 { return; }
12833                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
12834         }
12835 }
12836 impl Clone for CVec_OutPointZ {
12837         fn clone(&self) -> Self {
12838                 let mut res = Vec::new();
12839                 if self.datalen == 0 { return Self::from(res); }
12840                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
12841                 Self::from(res)
12842         }
12843 }