d07f466aee3dd8f4140905ec916550cffd13019c
[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_DelayedPaymentOutputDescriptorDecodeErrorZ
3273 pub union CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr {
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::chain::keysinterface::DelayedPaymentOutputDescriptor,
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_DelayedPaymentOutputDescriptorDecodeErrorZ represents the result of a fallible operation,
3283 /// containing a crate::lightning::chain::keysinterface::DelayedPaymentOutputDescriptor 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_DelayedPaymentOutputDescriptorDecodeErrorZ {
3286         /// The contents of this CResult_DelayedPaymentOutputDescriptorDecodeErrorZ, accessible via either
3287         /// `err` or `result` depending on the state of `result_ok`.
3288         pub contents: CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr,
3289         /// Whether this CResult_DelayedPaymentOutputDescriptorDecodeErrorZ represents a success state.
3290         pub result_ok: bool,
3291 }
3292 #[no_mangle]
3293 /// Creates a new CResult_DelayedPaymentOutputDescriptorDecodeErrorZ in the success state.
3294 pub extern "C" fn CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_ok(o: crate::lightning::chain::keysinterface::DelayedPaymentOutputDescriptor) -> CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
3295         CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
3296                 contents: CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr {
3297                         result: Box::into_raw(Box::new(o)),
3298                 },
3299                 result_ok: true,
3300         }
3301 }
3302 #[no_mangle]
3303 /// Creates a new CResult_DelayedPaymentOutputDescriptorDecodeErrorZ in the error state.
3304 pub extern "C" fn CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
3305         CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
3306                 contents: CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr {
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_DelayedPaymentOutputDescriptorDecodeErrorZ.
3314 pub extern "C" fn CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_free(_res: CResult_DelayedPaymentOutputDescriptorDecodeErrorZ) { }
3315 impl Drop for CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
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::chain::keysinterface::DelayedPaymentOutputDescriptor, crate::lightning::ln::msgs::DecodeError>> for CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
3329         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::DelayedPaymentOutputDescriptor, 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_DelayedPaymentOutputDescriptorDecodeErrorZPtr { result }
3334                 } else {
3335                         let err = unsafe { o.contents.err };
3336                         unsafe { o.contents.err = std::ptr::null_mut(); }
3337                         CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr { err }
3338                 };
3339                 Self {
3340                         contents,
3341                         result_ok: o.result_ok,
3342                 }
3343         }
3344 }
3345 impl Clone for CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
3346         fn clone(&self) -> Self {
3347                 if self.result_ok {
3348                         Self { result_ok: true, contents: CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr {
3349                                 result: Box::into_raw(Box::new(<crate::lightning::chain::keysinterface::DelayedPaymentOutputDescriptor>::clone(unsafe { &*self.contents.result })))
3350                         } }
3351                 } else {
3352                         Self { result_ok: false, contents: CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr {
3353                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
3354                         } }
3355                 }
3356         }
3357 }
3358 #[no_mangle]
3359 /// Creates a new CResult_DelayedPaymentOutputDescriptorDecodeErrorZ which has the same data as `orig`
3360 /// but with all dynamically-allocated buffers duplicated in new buffers.
3361 pub extern "C" fn CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone(orig: &CResult_DelayedPaymentOutputDescriptorDecodeErrorZ) -> CResult_DelayedPaymentOutputDescriptorDecodeErrorZ { Clone::clone(&orig) }
3362 #[repr(C)]
3363 /// The contents of CResult_StaticPaymentOutputDescriptorDecodeErrorZ
3364 pub union CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr {
3365         /// A pointer to the contents in the success state.
3366         /// Reading from this pointer when `result_ok` is not set is undefined.
3367         pub result: *mut crate::lightning::chain::keysinterface::StaticPaymentOutputDescriptor,
3368         /// A pointer to the contents in the error state.
3369         /// Reading from this pointer when `result_ok` is set is undefined.
3370         pub err: *mut crate::lightning::ln::msgs::DecodeError,
3371 }
3372 #[repr(C)]
3373 /// A CResult_StaticPaymentOutputDescriptorDecodeErrorZ represents the result of a fallible operation,
3374 /// containing a crate::lightning::chain::keysinterface::StaticPaymentOutputDescriptor on success and a crate::lightning::ln::msgs::DecodeError on failure.
3375 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3376 pub struct CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
3377         /// The contents of this CResult_StaticPaymentOutputDescriptorDecodeErrorZ, accessible via either
3378         /// `err` or `result` depending on the state of `result_ok`.
3379         pub contents: CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr,
3380         /// Whether this CResult_StaticPaymentOutputDescriptorDecodeErrorZ represents a success state.
3381         pub result_ok: bool,
3382 }
3383 #[no_mangle]
3384 /// Creates a new CResult_StaticPaymentOutputDescriptorDecodeErrorZ in the success state.
3385 pub extern "C" fn CResult_StaticPaymentOutputDescriptorDecodeErrorZ_ok(o: crate::lightning::chain::keysinterface::StaticPaymentOutputDescriptor) -> CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
3386         CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
3387                 contents: CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr {
3388                         result: Box::into_raw(Box::new(o)),
3389                 },
3390                 result_ok: true,
3391         }
3392 }
3393 #[no_mangle]
3394 /// Creates a new CResult_StaticPaymentOutputDescriptorDecodeErrorZ in the error state.
3395 pub extern "C" fn CResult_StaticPaymentOutputDescriptorDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
3396         CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
3397                 contents: CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr {
3398                         err: Box::into_raw(Box::new(e)),
3399                 },
3400                 result_ok: false,
3401         }
3402 }
3403 #[no_mangle]
3404 /// Frees any resources used by the CResult_StaticPaymentOutputDescriptorDecodeErrorZ.
3405 pub extern "C" fn CResult_StaticPaymentOutputDescriptorDecodeErrorZ_free(_res: CResult_StaticPaymentOutputDescriptorDecodeErrorZ) { }
3406 impl Drop for CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
3407         fn drop(&mut self) {
3408                 if self.result_ok {
3409                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
3410                                 let _ = unsafe { Box::from_raw(self.contents.result) };
3411                         }
3412                 } else {
3413                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
3414                                 let _ = unsafe { Box::from_raw(self.contents.err) };
3415                         }
3416                 }
3417         }
3418 }
3419 impl From<crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::StaticPaymentOutputDescriptor, crate::lightning::ln::msgs::DecodeError>> for CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
3420         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::StaticPaymentOutputDescriptor, crate::lightning::ln::msgs::DecodeError>) -> Self {
3421                 let contents = if o.result_ok {
3422                         let result = unsafe { o.contents.result };
3423                         unsafe { o.contents.result = std::ptr::null_mut() };
3424                         CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr { result }
3425                 } else {
3426                         let err = unsafe { o.contents.err };
3427                         unsafe { o.contents.err = std::ptr::null_mut(); }
3428                         CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr { err }
3429                 };
3430                 Self {
3431                         contents,
3432                         result_ok: o.result_ok,
3433                 }
3434         }
3435 }
3436 impl Clone for CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
3437         fn clone(&self) -> Self {
3438                 if self.result_ok {
3439                         Self { result_ok: true, contents: CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr {
3440                                 result: Box::into_raw(Box::new(<crate::lightning::chain::keysinterface::StaticPaymentOutputDescriptor>::clone(unsafe { &*self.contents.result })))
3441                         } }
3442                 } else {
3443                         Self { result_ok: false, contents: CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr {
3444                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
3445                         } }
3446                 }
3447         }
3448 }
3449 #[no_mangle]
3450 /// Creates a new CResult_StaticPaymentOutputDescriptorDecodeErrorZ which has the same data as `orig`
3451 /// but with all dynamically-allocated buffers duplicated in new buffers.
3452 pub extern "C" fn CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone(orig: &CResult_StaticPaymentOutputDescriptorDecodeErrorZ) -> CResult_StaticPaymentOutputDescriptorDecodeErrorZ { Clone::clone(&orig) }
3453 #[repr(C)]
3454 /// The contents of CResult_SpendableOutputDescriptorDecodeErrorZ
3455 pub union CResult_SpendableOutputDescriptorDecodeErrorZPtr {
3456         /// A pointer to the contents in the success state.
3457         /// Reading from this pointer when `result_ok` is not set is undefined.
3458         pub result: *mut crate::lightning::chain::keysinterface::SpendableOutputDescriptor,
3459         /// A pointer to the contents in the error state.
3460         /// Reading from this pointer when `result_ok` is set is undefined.
3461         pub err: *mut crate::lightning::ln::msgs::DecodeError,
3462 }
3463 #[repr(C)]
3464 /// A CResult_SpendableOutputDescriptorDecodeErrorZ represents the result of a fallible operation,
3465 /// containing a crate::lightning::chain::keysinterface::SpendableOutputDescriptor on success and a crate::lightning::ln::msgs::DecodeError on failure.
3466 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3467 pub struct CResult_SpendableOutputDescriptorDecodeErrorZ {
3468         /// The contents of this CResult_SpendableOutputDescriptorDecodeErrorZ, accessible via either
3469         /// `err` or `result` depending on the state of `result_ok`.
3470         pub contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr,
3471         /// Whether this CResult_SpendableOutputDescriptorDecodeErrorZ represents a success state.
3472         pub result_ok: bool,
3473 }
3474 #[no_mangle]
3475 /// Creates a new CResult_SpendableOutputDescriptorDecodeErrorZ in the success state.
3476 pub extern "C" fn CResult_SpendableOutputDescriptorDecodeErrorZ_ok(o: crate::lightning::chain::keysinterface::SpendableOutputDescriptor) -> CResult_SpendableOutputDescriptorDecodeErrorZ {
3477         CResult_SpendableOutputDescriptorDecodeErrorZ {
3478                 contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr {
3479                         result: Box::into_raw(Box::new(o)),
3480                 },
3481                 result_ok: true,
3482         }
3483 }
3484 #[no_mangle]
3485 /// Creates a new CResult_SpendableOutputDescriptorDecodeErrorZ in the error state.
3486 pub extern "C" fn CResult_SpendableOutputDescriptorDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_SpendableOutputDescriptorDecodeErrorZ {
3487         CResult_SpendableOutputDescriptorDecodeErrorZ {
3488                 contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr {
3489                         err: Box::into_raw(Box::new(e)),
3490                 },
3491                 result_ok: false,
3492         }
3493 }
3494 #[no_mangle]
3495 /// Frees any resources used by the CResult_SpendableOutputDescriptorDecodeErrorZ.
3496 pub extern "C" fn CResult_SpendableOutputDescriptorDecodeErrorZ_free(_res: CResult_SpendableOutputDescriptorDecodeErrorZ) { }
3497 impl Drop for CResult_SpendableOutputDescriptorDecodeErrorZ {
3498         fn drop(&mut self) {
3499                 if self.result_ok {
3500                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
3501                                 let _ = unsafe { Box::from_raw(self.contents.result) };
3502                         }
3503                 } else {
3504                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
3505                                 let _ = unsafe { Box::from_raw(self.contents.err) };
3506                         }
3507                 }
3508         }
3509 }
3510 impl From<crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::SpendableOutputDescriptor, crate::lightning::ln::msgs::DecodeError>> for CResult_SpendableOutputDescriptorDecodeErrorZ {
3511         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::SpendableOutputDescriptor, crate::lightning::ln::msgs::DecodeError>) -> Self {
3512                 let contents = if o.result_ok {
3513                         let result = unsafe { o.contents.result };
3514                         unsafe { o.contents.result = std::ptr::null_mut() };
3515                         CResult_SpendableOutputDescriptorDecodeErrorZPtr { result }
3516                 } else {
3517                         let err = unsafe { o.contents.err };
3518                         unsafe { o.contents.err = std::ptr::null_mut(); }
3519                         CResult_SpendableOutputDescriptorDecodeErrorZPtr { err }
3520                 };
3521                 Self {
3522                         contents,
3523                         result_ok: o.result_ok,
3524                 }
3525         }
3526 }
3527 impl Clone for CResult_SpendableOutputDescriptorDecodeErrorZ {
3528         fn clone(&self) -> Self {
3529                 if self.result_ok {
3530                         Self { result_ok: true, contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr {
3531                                 result: Box::into_raw(Box::new(<crate::lightning::chain::keysinterface::SpendableOutputDescriptor>::clone(unsafe { &*self.contents.result })))
3532                         } }
3533                 } else {
3534                         Self { result_ok: false, contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr {
3535                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
3536                         } }
3537                 }
3538         }
3539 }
3540 #[no_mangle]
3541 /// Creates a new CResult_SpendableOutputDescriptorDecodeErrorZ which has the same data as `orig`
3542 /// but with all dynamically-allocated buffers duplicated in new buffers.
3543 pub extern "C" fn CResult_SpendableOutputDescriptorDecodeErrorZ_clone(orig: &CResult_SpendableOutputDescriptorDecodeErrorZ) -> CResult_SpendableOutputDescriptorDecodeErrorZ { Clone::clone(&orig) }
3544 #[repr(C)]
3545 /// The contents of CResult_NoneNoneZ
3546 pub union CResult_NoneNoneZPtr {
3547         /// Note that this value is always NULL, as there are no contents in the OK variant
3548         pub result: *mut std::ffi::c_void,
3549         /// Note that this value is always NULL, as there are no contents in the Err variant
3550         pub err: *mut std::ffi::c_void,
3551 }
3552 #[repr(C)]
3553 /// A CResult_NoneNoneZ represents the result of a fallible operation,
3554 /// containing a () on success and a () on failure.
3555 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3556 pub struct CResult_NoneNoneZ {
3557         /// The contents of this CResult_NoneNoneZ, accessible via either
3558         /// `err` or `result` depending on the state of `result_ok`.
3559         pub contents: CResult_NoneNoneZPtr,
3560         /// Whether this CResult_NoneNoneZ represents a success state.
3561         pub result_ok: bool,
3562 }
3563 #[no_mangle]
3564 /// Creates a new CResult_NoneNoneZ in the success state.
3565 pub extern "C" fn CResult_NoneNoneZ_ok() -> CResult_NoneNoneZ {
3566         CResult_NoneNoneZ {
3567                 contents: CResult_NoneNoneZPtr {
3568                         result: std::ptr::null_mut(),
3569                 },
3570                 result_ok: true,
3571         }
3572 }
3573 #[no_mangle]
3574 /// Creates a new CResult_NoneNoneZ in the error state.
3575 pub extern "C" fn CResult_NoneNoneZ_err() -> CResult_NoneNoneZ {
3576         CResult_NoneNoneZ {
3577                 contents: CResult_NoneNoneZPtr {
3578                         err: std::ptr::null_mut(),
3579                 },
3580                 result_ok: false,
3581         }
3582 }
3583 #[no_mangle]
3584 /// Frees any resources used by the CResult_NoneNoneZ.
3585 pub extern "C" fn CResult_NoneNoneZ_free(_res: CResult_NoneNoneZ) { }
3586 impl Drop for CResult_NoneNoneZ {
3587         fn drop(&mut self) {
3588                 if self.result_ok {
3589                 } else {
3590                 }
3591         }
3592 }
3593 impl From<crate::c_types::CResultTempl<(), ()>> for CResult_NoneNoneZ {
3594         fn from(mut o: crate::c_types::CResultTempl<(), ()>) -> Self {
3595                 let contents = if o.result_ok {
3596                         let _ = unsafe { Box::from_raw(o.contents.result) };
3597                         o.contents.result = std::ptr::null_mut();
3598                         CResult_NoneNoneZPtr { result: std::ptr::null_mut() }
3599                 } else {
3600                         let _ = unsafe { Box::from_raw(o.contents.err) };
3601                         o.contents.err = std::ptr::null_mut();
3602                         CResult_NoneNoneZPtr { err: std::ptr::null_mut() }
3603                 };
3604                 Self {
3605                         contents,
3606                         result_ok: o.result_ok,
3607                 }
3608         }
3609 }
3610 impl Clone for CResult_NoneNoneZ {
3611         fn clone(&self) -> Self {
3612                 if self.result_ok {
3613                         Self { result_ok: true, contents: CResult_NoneNoneZPtr {
3614                                 result: std::ptr::null_mut()
3615                         } }
3616                 } else {
3617                         Self { result_ok: false, contents: CResult_NoneNoneZPtr {
3618                                 err: std::ptr::null_mut()
3619                         } }
3620                 }
3621         }
3622 }
3623 #[no_mangle]
3624 /// Creates a new CResult_NoneNoneZ which has the same data as `orig`
3625 /// but with all dynamically-allocated buffers duplicated in new buffers.
3626 pub extern "C" fn CResult_NoneNoneZ_clone(orig: &CResult_NoneNoneZ) -> CResult_NoneNoneZ { Clone::clone(&orig) }
3627 #[repr(C)]
3628 /// A tuple of 2 elements. See the individual fields for the types contained.
3629 pub struct C2Tuple_SignatureCVec_SignatureZZ {
3630         /// The element at position 0
3631         pub a: crate::c_types::Signature,
3632         /// The element at position 1
3633         pub b: crate::c_types::derived::CVec_SignatureZ,
3634 }
3635 impl From<(crate::c_types::Signature, crate::c_types::derived::CVec_SignatureZ)> for C2Tuple_SignatureCVec_SignatureZZ {
3636         fn from (tup: (crate::c_types::Signature, crate::c_types::derived::CVec_SignatureZ)) -> Self {
3637                 Self {
3638                         a: tup.0,
3639                         b: tup.1,
3640                 }
3641         }
3642 }
3643 impl C2Tuple_SignatureCVec_SignatureZZ {
3644         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::Signature, crate::c_types::derived::CVec_SignatureZ) {
3645                 (self.a, self.b)
3646         }
3647 }
3648 impl Clone for C2Tuple_SignatureCVec_SignatureZZ {
3649         fn clone(&self) -> Self {
3650                 Self {
3651                         a: Clone::clone(&self.a),
3652                         b: Clone::clone(&self.b),
3653                 }
3654         }
3655 }
3656 #[no_mangle]
3657 /// Creates a new tuple which has the same data as `orig`
3658 /// but with all dynamically-allocated buffers duplicated in new buffers.
3659 pub extern "C" fn C2Tuple_SignatureCVec_SignatureZZ_clone(orig: &C2Tuple_SignatureCVec_SignatureZZ) -> C2Tuple_SignatureCVec_SignatureZZ { Clone::clone(&orig) }
3660 /// Creates a new C2Tuple_SignatureCVec_SignatureZZ from the contained elements.
3661 #[no_mangle]
3662 pub extern "C" fn C2Tuple_SignatureCVec_SignatureZZ_new(a: crate::c_types::Signature, b: crate::c_types::derived::CVec_SignatureZ) -> C2Tuple_SignatureCVec_SignatureZZ {
3663         C2Tuple_SignatureCVec_SignatureZZ { a, b, }
3664 }
3665
3666 #[no_mangle]
3667 /// Frees any resources used by the C2Tuple_SignatureCVec_SignatureZZ.
3668 pub extern "C" fn C2Tuple_SignatureCVec_SignatureZZ_free(_res: C2Tuple_SignatureCVec_SignatureZZ) { }
3669 #[repr(C)]
3670 /// The contents of CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ
3671 pub union CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
3672         /// A pointer to the contents in the success state.
3673         /// Reading from this pointer when `result_ok` is not set is undefined.
3674         pub result: *mut crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ,
3675         /// Note that this value is always NULL, as there are no contents in the Err variant
3676         pub err: *mut std::ffi::c_void,
3677 }
3678 #[repr(C)]
3679 /// A CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ represents the result of a fallible operation,
3680 /// containing a crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ on success and a () on failure.
3681 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3682 pub struct CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
3683         /// The contents of this CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ, accessible via either
3684         /// `err` or `result` depending on the state of `result_ok`.
3685         pub contents: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr,
3686         /// Whether this CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ represents a success state.
3687         pub result_ok: bool,
3688 }
3689 #[no_mangle]
3690 /// Creates a new CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ in the success state.
3691 pub extern "C" fn CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_ok(o: crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ) -> CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
3692         CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
3693                 contents: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
3694                         result: Box::into_raw(Box::new(o)),
3695                 },
3696                 result_ok: true,
3697         }
3698 }
3699 #[no_mangle]
3700 /// Creates a new CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ in the error state.
3701 pub extern "C" fn CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_err() -> CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
3702         CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
3703                 contents: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
3704                         err: std::ptr::null_mut(),
3705                 },
3706                 result_ok: false,
3707         }
3708 }
3709 #[no_mangle]
3710 /// Frees any resources used by the CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ.
3711 pub extern "C" fn CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_free(_res: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ) { }
3712 impl Drop for CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
3713         fn drop(&mut self) {
3714                 if self.result_ok {
3715                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
3716                                 let _ = unsafe { Box::from_raw(self.contents.result) };
3717                         }
3718                 } else {
3719                 }
3720         }
3721 }
3722 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ, ()>> for CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
3723         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ, ()>) -> Self {
3724                 let contents = if o.result_ok {
3725                         let result = unsafe { o.contents.result };
3726                         unsafe { o.contents.result = std::ptr::null_mut() };
3727                         CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr { result }
3728                 } else {
3729                         let _ = unsafe { Box::from_raw(o.contents.err) };
3730                         o.contents.err = std::ptr::null_mut();
3731                         CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr { err: std::ptr::null_mut() }
3732                 };
3733                 Self {
3734                         contents,
3735                         result_ok: o.result_ok,
3736                 }
3737         }
3738 }
3739 impl Clone for CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
3740         fn clone(&self) -> Self {
3741                 if self.result_ok {
3742                         Self { result_ok: true, contents: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
3743                                 result: Box::into_raw(Box::new(<crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ>::clone(unsafe { &*self.contents.result })))
3744                         } }
3745                 } else {
3746                         Self { result_ok: false, contents: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
3747                                 err: std::ptr::null_mut()
3748                         } }
3749                 }
3750         }
3751 }
3752 #[no_mangle]
3753 /// Creates a new CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ which has the same data as `orig`
3754 /// but with all dynamically-allocated buffers duplicated in new buffers.
3755 pub extern "C" fn CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone(orig: &CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ) -> CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ { Clone::clone(&orig) }
3756 #[repr(C)]
3757 /// The contents of CResult_SignatureNoneZ
3758 pub union CResult_SignatureNoneZPtr {
3759         /// A pointer to the contents in the success state.
3760         /// Reading from this pointer when `result_ok` is not set is undefined.
3761         pub result: *mut crate::c_types::Signature,
3762         /// Note that this value is always NULL, as there are no contents in the Err variant
3763         pub err: *mut std::ffi::c_void,
3764 }
3765 #[repr(C)]
3766 /// A CResult_SignatureNoneZ represents the result of a fallible operation,
3767 /// containing a crate::c_types::Signature on success and a () on failure.
3768 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3769 pub struct CResult_SignatureNoneZ {
3770         /// The contents of this CResult_SignatureNoneZ, accessible via either
3771         /// `err` or `result` depending on the state of `result_ok`.
3772         pub contents: CResult_SignatureNoneZPtr,
3773         /// Whether this CResult_SignatureNoneZ represents a success state.
3774         pub result_ok: bool,
3775 }
3776 #[no_mangle]
3777 /// Creates a new CResult_SignatureNoneZ in the success state.
3778 pub extern "C" fn CResult_SignatureNoneZ_ok(o: crate::c_types::Signature) -> CResult_SignatureNoneZ {
3779         CResult_SignatureNoneZ {
3780                 contents: CResult_SignatureNoneZPtr {
3781                         result: Box::into_raw(Box::new(o)),
3782                 },
3783                 result_ok: true,
3784         }
3785 }
3786 #[no_mangle]
3787 /// Creates a new CResult_SignatureNoneZ in the error state.
3788 pub extern "C" fn CResult_SignatureNoneZ_err() -> CResult_SignatureNoneZ {
3789         CResult_SignatureNoneZ {
3790                 contents: CResult_SignatureNoneZPtr {
3791                         err: std::ptr::null_mut(),
3792                 },
3793                 result_ok: false,
3794         }
3795 }
3796 #[no_mangle]
3797 /// Frees any resources used by the CResult_SignatureNoneZ.
3798 pub extern "C" fn CResult_SignatureNoneZ_free(_res: CResult_SignatureNoneZ) { }
3799 impl Drop for CResult_SignatureNoneZ {
3800         fn drop(&mut self) {
3801                 if self.result_ok {
3802                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
3803                                 let _ = unsafe { Box::from_raw(self.contents.result) };
3804                         }
3805                 } else {
3806                 }
3807         }
3808 }
3809 impl From<crate::c_types::CResultTempl<crate::c_types::Signature, ()>> for CResult_SignatureNoneZ {
3810         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::Signature, ()>) -> Self {
3811                 let contents = if o.result_ok {
3812                         let result = unsafe { o.contents.result };
3813                         unsafe { o.contents.result = std::ptr::null_mut() };
3814                         CResult_SignatureNoneZPtr { result }
3815                 } else {
3816                         let _ = unsafe { Box::from_raw(o.contents.err) };
3817                         o.contents.err = std::ptr::null_mut();
3818                         CResult_SignatureNoneZPtr { err: std::ptr::null_mut() }
3819                 };
3820                 Self {
3821                         contents,
3822                         result_ok: o.result_ok,
3823                 }
3824         }
3825 }
3826 impl Clone for CResult_SignatureNoneZ {
3827         fn clone(&self) -> Self {
3828                 if self.result_ok {
3829                         Self { result_ok: true, contents: CResult_SignatureNoneZPtr {
3830                                 result: Box::into_raw(Box::new(<crate::c_types::Signature>::clone(unsafe { &*self.contents.result })))
3831                         } }
3832                 } else {
3833                         Self { result_ok: false, contents: CResult_SignatureNoneZPtr {
3834                                 err: std::ptr::null_mut()
3835                         } }
3836                 }
3837         }
3838 }
3839 #[no_mangle]
3840 /// Creates a new CResult_SignatureNoneZ which has the same data as `orig`
3841 /// but with all dynamically-allocated buffers duplicated in new buffers.
3842 pub extern "C" fn CResult_SignatureNoneZ_clone(orig: &CResult_SignatureNoneZ) -> CResult_SignatureNoneZ { Clone::clone(&orig) }
3843 #[repr(C)]
3844 /// The contents of CResult_SignDecodeErrorZ
3845 pub union CResult_SignDecodeErrorZPtr {
3846         /// A pointer to the contents in the success state.
3847         /// Reading from this pointer when `result_ok` is not set is undefined.
3848         pub result: *mut crate::lightning::chain::keysinterface::Sign,
3849         /// A pointer to the contents in the error state.
3850         /// Reading from this pointer when `result_ok` is set is undefined.
3851         pub err: *mut crate::lightning::ln::msgs::DecodeError,
3852 }
3853 #[repr(C)]
3854 /// A CResult_SignDecodeErrorZ represents the result of a fallible operation,
3855 /// containing a crate::lightning::chain::keysinterface::Sign on success and a crate::lightning::ln::msgs::DecodeError on failure.
3856 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3857 pub struct CResult_SignDecodeErrorZ {
3858         /// The contents of this CResult_SignDecodeErrorZ, accessible via either
3859         /// `err` or `result` depending on the state of `result_ok`.
3860         pub contents: CResult_SignDecodeErrorZPtr,
3861         /// Whether this CResult_SignDecodeErrorZ represents a success state.
3862         pub result_ok: bool,
3863 }
3864 #[no_mangle]
3865 /// Creates a new CResult_SignDecodeErrorZ in the success state.
3866 pub extern "C" fn CResult_SignDecodeErrorZ_ok(o: crate::lightning::chain::keysinterface::Sign) -> CResult_SignDecodeErrorZ {
3867         CResult_SignDecodeErrorZ {
3868                 contents: CResult_SignDecodeErrorZPtr {
3869                         result: Box::into_raw(Box::new(o)),
3870                 },
3871                 result_ok: true,
3872         }
3873 }
3874 #[no_mangle]
3875 /// Creates a new CResult_SignDecodeErrorZ in the error state.
3876 pub extern "C" fn CResult_SignDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_SignDecodeErrorZ {
3877         CResult_SignDecodeErrorZ {
3878                 contents: CResult_SignDecodeErrorZPtr {
3879                         err: Box::into_raw(Box::new(e)),
3880                 },
3881                 result_ok: false,
3882         }
3883 }
3884 #[no_mangle]
3885 /// Frees any resources used by the CResult_SignDecodeErrorZ.
3886 pub extern "C" fn CResult_SignDecodeErrorZ_free(_res: CResult_SignDecodeErrorZ) { }
3887 impl Drop for CResult_SignDecodeErrorZ {
3888         fn drop(&mut self) {
3889                 if self.result_ok {
3890                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
3891                                 let _ = unsafe { Box::from_raw(self.contents.result) };
3892                         }
3893                 } else {
3894                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
3895                                 let _ = unsafe { Box::from_raw(self.contents.err) };
3896                         }
3897                 }
3898         }
3899 }
3900 impl From<crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::Sign, crate::lightning::ln::msgs::DecodeError>> for CResult_SignDecodeErrorZ {
3901         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::Sign, crate::lightning::ln::msgs::DecodeError>) -> Self {
3902                 let contents = if o.result_ok {
3903                         let result = unsafe { o.contents.result };
3904                         unsafe { o.contents.result = std::ptr::null_mut() };
3905                         CResult_SignDecodeErrorZPtr { result }
3906                 } else {
3907                         let err = unsafe { o.contents.err };
3908                         unsafe { o.contents.err = std::ptr::null_mut(); }
3909                         CResult_SignDecodeErrorZPtr { err }
3910                 };
3911                 Self {
3912                         contents,
3913                         result_ok: o.result_ok,
3914                 }
3915         }
3916 }
3917 impl Clone for CResult_SignDecodeErrorZ {
3918         fn clone(&self) -> Self {
3919                 if self.result_ok {
3920                         Self { result_ok: true, contents: CResult_SignDecodeErrorZPtr {
3921                                 result: Box::into_raw(Box::new(<crate::lightning::chain::keysinterface::Sign>::clone(unsafe { &*self.contents.result })))
3922                         } }
3923                 } else {
3924                         Self { result_ok: false, contents: CResult_SignDecodeErrorZPtr {
3925                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
3926                         } }
3927                 }
3928         }
3929 }
3930 #[no_mangle]
3931 /// Creates a new CResult_SignDecodeErrorZ which has the same data as `orig`
3932 /// but with all dynamically-allocated buffers duplicated in new buffers.
3933 pub extern "C" fn CResult_SignDecodeErrorZ_clone(orig: &CResult_SignDecodeErrorZ) -> CResult_SignDecodeErrorZ { Clone::clone(&orig) }
3934 #[repr(C)]
3935 /// A dynamically-allocated array of u8s of arbitrary size.
3936 /// This corresponds to std::vector in C++
3937 pub struct CVec_u8Z {
3938         /// The elements in the array.
3939         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3940         pub data: *mut u8,
3941         /// The number of elements pointed to by `data`.
3942         pub datalen: usize
3943 }
3944 impl CVec_u8Z {
3945         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<u8> {
3946                 if self.datalen == 0 { return Vec::new(); }
3947                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
3948                 self.data = std::ptr::null_mut();
3949                 self.datalen = 0;
3950                 ret
3951         }
3952         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[u8] {
3953                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
3954         }
3955 }
3956 impl From<Vec<u8>> for CVec_u8Z {
3957         fn from(v: Vec<u8>) -> Self {
3958                 let datalen = v.len();
3959                 let data = Box::into_raw(v.into_boxed_slice());
3960                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
3961         }
3962 }
3963 #[no_mangle]
3964 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
3965 pub extern "C" fn CVec_u8Z_free(_res: CVec_u8Z) { }
3966 impl Drop for CVec_u8Z {
3967         fn drop(&mut self) {
3968                 if self.datalen == 0 { return; }
3969                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
3970         }
3971 }
3972 impl Clone for CVec_u8Z {
3973         fn clone(&self) -> Self {
3974                 let mut res = Vec::new();
3975                 if self.datalen == 0 { return Self::from(res); }
3976                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
3977                 Self::from(res)
3978         }
3979 }
3980 #[repr(C)]
3981 /// The contents of CResult_RecoverableSignatureNoneZ
3982 pub union CResult_RecoverableSignatureNoneZPtr {
3983         /// A pointer to the contents in the success state.
3984         /// Reading from this pointer when `result_ok` is not set is undefined.
3985         pub result: *mut crate::c_types::RecoverableSignature,
3986         /// Note that this value is always NULL, as there are no contents in the Err variant
3987         pub err: *mut std::ffi::c_void,
3988 }
3989 #[repr(C)]
3990 /// A CResult_RecoverableSignatureNoneZ represents the result of a fallible operation,
3991 /// containing a crate::c_types::RecoverableSignature on success and a () on failure.
3992 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3993 pub struct CResult_RecoverableSignatureNoneZ {
3994         /// The contents of this CResult_RecoverableSignatureNoneZ, accessible via either
3995         /// `err` or `result` depending on the state of `result_ok`.
3996         pub contents: CResult_RecoverableSignatureNoneZPtr,
3997         /// Whether this CResult_RecoverableSignatureNoneZ represents a success state.
3998         pub result_ok: bool,
3999 }
4000 #[no_mangle]
4001 /// Creates a new CResult_RecoverableSignatureNoneZ in the success state.
4002 pub extern "C" fn CResult_RecoverableSignatureNoneZ_ok(o: crate::c_types::RecoverableSignature) -> CResult_RecoverableSignatureNoneZ {
4003         CResult_RecoverableSignatureNoneZ {
4004                 contents: CResult_RecoverableSignatureNoneZPtr {
4005                         result: Box::into_raw(Box::new(o)),
4006                 },
4007                 result_ok: true,
4008         }
4009 }
4010 #[no_mangle]
4011 /// Creates a new CResult_RecoverableSignatureNoneZ in the error state.
4012 pub extern "C" fn CResult_RecoverableSignatureNoneZ_err() -> CResult_RecoverableSignatureNoneZ {
4013         CResult_RecoverableSignatureNoneZ {
4014                 contents: CResult_RecoverableSignatureNoneZPtr {
4015                         err: std::ptr::null_mut(),
4016                 },
4017                 result_ok: false,
4018         }
4019 }
4020 #[no_mangle]
4021 /// Frees any resources used by the CResult_RecoverableSignatureNoneZ.
4022 pub extern "C" fn CResult_RecoverableSignatureNoneZ_free(_res: CResult_RecoverableSignatureNoneZ) { }
4023 impl Drop for CResult_RecoverableSignatureNoneZ {
4024         fn drop(&mut self) {
4025                 if self.result_ok {
4026                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
4027                                 let _ = unsafe { Box::from_raw(self.contents.result) };
4028                         }
4029                 } else {
4030                 }
4031         }
4032 }
4033 impl From<crate::c_types::CResultTempl<crate::c_types::RecoverableSignature, ()>> for CResult_RecoverableSignatureNoneZ {
4034         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::RecoverableSignature, ()>) -> Self {
4035                 let contents = if o.result_ok {
4036                         let result = unsafe { o.contents.result };
4037                         unsafe { o.contents.result = std::ptr::null_mut() };
4038                         CResult_RecoverableSignatureNoneZPtr { result }
4039                 } else {
4040                         let _ = unsafe { Box::from_raw(o.contents.err) };
4041                         o.contents.err = std::ptr::null_mut();
4042                         CResult_RecoverableSignatureNoneZPtr { err: std::ptr::null_mut() }
4043                 };
4044                 Self {
4045                         contents,
4046                         result_ok: o.result_ok,
4047                 }
4048         }
4049 }
4050 impl Clone for CResult_RecoverableSignatureNoneZ {
4051         fn clone(&self) -> Self {
4052                 if self.result_ok {
4053                         Self { result_ok: true, contents: CResult_RecoverableSignatureNoneZPtr {
4054                                 result: Box::into_raw(Box::new(<crate::c_types::RecoverableSignature>::clone(unsafe { &*self.contents.result })))
4055                         } }
4056                 } else {
4057                         Self { result_ok: false, contents: CResult_RecoverableSignatureNoneZPtr {
4058                                 err: std::ptr::null_mut()
4059                         } }
4060                 }
4061         }
4062 }
4063 #[no_mangle]
4064 /// Creates a new CResult_RecoverableSignatureNoneZ which has the same data as `orig`
4065 /// but with all dynamically-allocated buffers duplicated in new buffers.
4066 pub extern "C" fn CResult_RecoverableSignatureNoneZ_clone(orig: &CResult_RecoverableSignatureNoneZ) -> CResult_RecoverableSignatureNoneZ { Clone::clone(&orig) }
4067 #[repr(C)]
4068 /// A dynamically-allocated array of crate::c_types::derived::CVec_u8Zs of arbitrary size.
4069 /// This corresponds to std::vector in C++
4070 pub struct CVec_CVec_u8ZZ {
4071         /// The elements in the array.
4072         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4073         pub data: *mut crate::c_types::derived::CVec_u8Z,
4074         /// The number of elements pointed to by `data`.
4075         pub datalen: usize
4076 }
4077 impl CVec_CVec_u8ZZ {
4078         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::CVec_u8Z> {
4079                 if self.datalen == 0 { return Vec::new(); }
4080                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
4081                 self.data = std::ptr::null_mut();
4082                 self.datalen = 0;
4083                 ret
4084         }
4085         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::CVec_u8Z] {
4086                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
4087         }
4088 }
4089 impl From<Vec<crate::c_types::derived::CVec_u8Z>> for CVec_CVec_u8ZZ {
4090         fn from(v: Vec<crate::c_types::derived::CVec_u8Z>) -> Self {
4091                 let datalen = v.len();
4092                 let data = Box::into_raw(v.into_boxed_slice());
4093                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
4094         }
4095 }
4096 #[no_mangle]
4097 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
4098 pub extern "C" fn CVec_CVec_u8ZZ_free(_res: CVec_CVec_u8ZZ) { }
4099 impl Drop for CVec_CVec_u8ZZ {
4100         fn drop(&mut self) {
4101                 if self.datalen == 0 { return; }
4102                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
4103         }
4104 }
4105 impl Clone for CVec_CVec_u8ZZ {
4106         fn clone(&self) -> Self {
4107                 let mut res = Vec::new();
4108                 if self.datalen == 0 { return Self::from(res); }
4109                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
4110                 Self::from(res)
4111         }
4112 }
4113 #[repr(C)]
4114 /// The contents of CResult_CVec_CVec_u8ZZNoneZ
4115 pub union CResult_CVec_CVec_u8ZZNoneZPtr {
4116         /// A pointer to the contents in the success state.
4117         /// Reading from this pointer when `result_ok` is not set is undefined.
4118         pub result: *mut crate::c_types::derived::CVec_CVec_u8ZZ,
4119         /// Note that this value is always NULL, as there are no contents in the Err variant
4120         pub err: *mut std::ffi::c_void,
4121 }
4122 #[repr(C)]
4123 /// A CResult_CVec_CVec_u8ZZNoneZ represents the result of a fallible operation,
4124 /// containing a crate::c_types::derived::CVec_CVec_u8ZZ on success and a () on failure.
4125 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4126 pub struct CResult_CVec_CVec_u8ZZNoneZ {
4127         /// The contents of this CResult_CVec_CVec_u8ZZNoneZ, accessible via either
4128         /// `err` or `result` depending on the state of `result_ok`.
4129         pub contents: CResult_CVec_CVec_u8ZZNoneZPtr,
4130         /// Whether this CResult_CVec_CVec_u8ZZNoneZ represents a success state.
4131         pub result_ok: bool,
4132 }
4133 #[no_mangle]
4134 /// Creates a new CResult_CVec_CVec_u8ZZNoneZ in the success state.
4135 pub extern "C" fn CResult_CVec_CVec_u8ZZNoneZ_ok(o: crate::c_types::derived::CVec_CVec_u8ZZ) -> CResult_CVec_CVec_u8ZZNoneZ {
4136         CResult_CVec_CVec_u8ZZNoneZ {
4137                 contents: CResult_CVec_CVec_u8ZZNoneZPtr {
4138                         result: Box::into_raw(Box::new(o)),
4139                 },
4140                 result_ok: true,
4141         }
4142 }
4143 #[no_mangle]
4144 /// Creates a new CResult_CVec_CVec_u8ZZNoneZ in the error state.
4145 pub extern "C" fn CResult_CVec_CVec_u8ZZNoneZ_err() -> CResult_CVec_CVec_u8ZZNoneZ {
4146         CResult_CVec_CVec_u8ZZNoneZ {
4147                 contents: CResult_CVec_CVec_u8ZZNoneZPtr {
4148                         err: std::ptr::null_mut(),
4149                 },
4150                 result_ok: false,
4151         }
4152 }
4153 #[no_mangle]
4154 /// Frees any resources used by the CResult_CVec_CVec_u8ZZNoneZ.
4155 pub extern "C" fn CResult_CVec_CVec_u8ZZNoneZ_free(_res: CResult_CVec_CVec_u8ZZNoneZ) { }
4156 impl Drop for CResult_CVec_CVec_u8ZZNoneZ {
4157         fn drop(&mut self) {
4158                 if self.result_ok {
4159                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
4160                                 let _ = unsafe { Box::from_raw(self.contents.result) };
4161                         }
4162                 } else {
4163                 }
4164         }
4165 }
4166 impl From<crate::c_types::CResultTempl<crate::c_types::derived::CVec_CVec_u8ZZ, ()>> for CResult_CVec_CVec_u8ZZNoneZ {
4167         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CVec_CVec_u8ZZ, ()>) -> Self {
4168                 let contents = if o.result_ok {
4169                         let result = unsafe { o.contents.result };
4170                         unsafe { o.contents.result = std::ptr::null_mut() };
4171                         CResult_CVec_CVec_u8ZZNoneZPtr { result }
4172                 } else {
4173                         let _ = unsafe { Box::from_raw(o.contents.err) };
4174                         o.contents.err = std::ptr::null_mut();
4175                         CResult_CVec_CVec_u8ZZNoneZPtr { err: std::ptr::null_mut() }
4176                 };
4177                 Self {
4178                         contents,
4179                         result_ok: o.result_ok,
4180                 }
4181         }
4182 }
4183 impl Clone for CResult_CVec_CVec_u8ZZNoneZ {
4184         fn clone(&self) -> Self {
4185                 if self.result_ok {
4186                         Self { result_ok: true, contents: CResult_CVec_CVec_u8ZZNoneZPtr {
4187                                 result: Box::into_raw(Box::new(<crate::c_types::derived::CVec_CVec_u8ZZ>::clone(unsafe { &*self.contents.result })))
4188                         } }
4189                 } else {
4190                         Self { result_ok: false, contents: CResult_CVec_CVec_u8ZZNoneZPtr {
4191                                 err: std::ptr::null_mut()
4192                         } }
4193                 }
4194         }
4195 }
4196 #[no_mangle]
4197 /// Creates a new CResult_CVec_CVec_u8ZZNoneZ which has the same data as `orig`
4198 /// but with all dynamically-allocated buffers duplicated in new buffers.
4199 pub extern "C" fn CResult_CVec_CVec_u8ZZNoneZ_clone(orig: &CResult_CVec_CVec_u8ZZNoneZ) -> CResult_CVec_CVec_u8ZZNoneZ { Clone::clone(&orig) }
4200 #[repr(C)]
4201 /// The contents of CResult_InMemorySignerDecodeErrorZ
4202 pub union CResult_InMemorySignerDecodeErrorZPtr {
4203         /// A pointer to the contents in the success state.
4204         /// Reading from this pointer when `result_ok` is not set is undefined.
4205         pub result: *mut crate::lightning::chain::keysinterface::InMemorySigner,
4206         /// A pointer to the contents in the error state.
4207         /// Reading from this pointer when `result_ok` is set is undefined.
4208         pub err: *mut crate::lightning::ln::msgs::DecodeError,
4209 }
4210 #[repr(C)]
4211 /// A CResult_InMemorySignerDecodeErrorZ represents the result of a fallible operation,
4212 /// containing a crate::lightning::chain::keysinterface::InMemorySigner on success and a crate::lightning::ln::msgs::DecodeError on failure.
4213 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4214 pub struct CResult_InMemorySignerDecodeErrorZ {
4215         /// The contents of this CResult_InMemorySignerDecodeErrorZ, accessible via either
4216         /// `err` or `result` depending on the state of `result_ok`.
4217         pub contents: CResult_InMemorySignerDecodeErrorZPtr,
4218         /// Whether this CResult_InMemorySignerDecodeErrorZ represents a success state.
4219         pub result_ok: bool,
4220 }
4221 #[no_mangle]
4222 /// Creates a new CResult_InMemorySignerDecodeErrorZ in the success state.
4223 pub extern "C" fn CResult_InMemorySignerDecodeErrorZ_ok(o: crate::lightning::chain::keysinterface::InMemorySigner) -> CResult_InMemorySignerDecodeErrorZ {
4224         CResult_InMemorySignerDecodeErrorZ {
4225                 contents: CResult_InMemorySignerDecodeErrorZPtr {
4226                         result: Box::into_raw(Box::new(o)),
4227                 },
4228                 result_ok: true,
4229         }
4230 }
4231 #[no_mangle]
4232 /// Creates a new CResult_InMemorySignerDecodeErrorZ in the error state.
4233 pub extern "C" fn CResult_InMemorySignerDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_InMemorySignerDecodeErrorZ {
4234         CResult_InMemorySignerDecodeErrorZ {
4235                 contents: CResult_InMemorySignerDecodeErrorZPtr {
4236                         err: Box::into_raw(Box::new(e)),
4237                 },
4238                 result_ok: false,
4239         }
4240 }
4241 #[no_mangle]
4242 /// Frees any resources used by the CResult_InMemorySignerDecodeErrorZ.
4243 pub extern "C" fn CResult_InMemorySignerDecodeErrorZ_free(_res: CResult_InMemorySignerDecodeErrorZ) { }
4244 impl Drop for CResult_InMemorySignerDecodeErrorZ {
4245         fn drop(&mut self) {
4246                 if self.result_ok {
4247                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
4248                                 let _ = unsafe { Box::from_raw(self.contents.result) };
4249                         }
4250                 } else {
4251                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
4252                                 let _ = unsafe { Box::from_raw(self.contents.err) };
4253                         }
4254                 }
4255         }
4256 }
4257 impl From<crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::InMemorySigner, crate::lightning::ln::msgs::DecodeError>> for CResult_InMemorySignerDecodeErrorZ {
4258         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::InMemorySigner, crate::lightning::ln::msgs::DecodeError>) -> Self {
4259                 let contents = if o.result_ok {
4260                         let result = unsafe { o.contents.result };
4261                         unsafe { o.contents.result = std::ptr::null_mut() };
4262                         CResult_InMemorySignerDecodeErrorZPtr { result }
4263                 } else {
4264                         let err = unsafe { o.contents.err };
4265                         unsafe { o.contents.err = std::ptr::null_mut(); }
4266                         CResult_InMemorySignerDecodeErrorZPtr { err }
4267                 };
4268                 Self {
4269                         contents,
4270                         result_ok: o.result_ok,
4271                 }
4272         }
4273 }
4274 impl Clone for CResult_InMemorySignerDecodeErrorZ {
4275         fn clone(&self) -> Self {
4276                 if self.result_ok {
4277                         Self { result_ok: true, contents: CResult_InMemorySignerDecodeErrorZPtr {
4278                                 result: Box::into_raw(Box::new(<crate::lightning::chain::keysinterface::InMemorySigner>::clone(unsafe { &*self.contents.result })))
4279                         } }
4280                 } else {
4281                         Self { result_ok: false, contents: CResult_InMemorySignerDecodeErrorZPtr {
4282                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
4283                         } }
4284                 }
4285         }
4286 }
4287 #[no_mangle]
4288 /// Creates a new CResult_InMemorySignerDecodeErrorZ which has the same data as `orig`
4289 /// but with all dynamically-allocated buffers duplicated in new buffers.
4290 pub extern "C" fn CResult_InMemorySignerDecodeErrorZ_clone(orig: &CResult_InMemorySignerDecodeErrorZ) -> CResult_InMemorySignerDecodeErrorZ { Clone::clone(&orig) }
4291 #[repr(C)]
4292 /// A dynamically-allocated array of crate::c_types::TxOuts of arbitrary size.
4293 /// This corresponds to std::vector in C++
4294 pub struct CVec_TxOutZ {
4295         /// The elements in the array.
4296         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4297         pub data: *mut crate::c_types::TxOut,
4298         /// The number of elements pointed to by `data`.
4299         pub datalen: usize
4300 }
4301 impl CVec_TxOutZ {
4302         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::TxOut> {
4303                 if self.datalen == 0 { return Vec::new(); }
4304                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
4305                 self.data = std::ptr::null_mut();
4306                 self.datalen = 0;
4307                 ret
4308         }
4309         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::TxOut] {
4310                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
4311         }
4312 }
4313 impl From<Vec<crate::c_types::TxOut>> for CVec_TxOutZ {
4314         fn from(v: Vec<crate::c_types::TxOut>) -> Self {
4315                 let datalen = v.len();
4316                 let data = Box::into_raw(v.into_boxed_slice());
4317                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
4318         }
4319 }
4320 #[no_mangle]
4321 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
4322 pub extern "C" fn CVec_TxOutZ_free(_res: CVec_TxOutZ) { }
4323 impl Drop for CVec_TxOutZ {
4324         fn drop(&mut self) {
4325                 if self.datalen == 0 { return; }
4326                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
4327         }
4328 }
4329 impl Clone for CVec_TxOutZ {
4330         fn clone(&self) -> Self {
4331                 let mut res = Vec::new();
4332                 if self.datalen == 0 { return Self::from(res); }
4333                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
4334                 Self::from(res)
4335         }
4336 }
4337 #[repr(C)]
4338 /// The contents of CResult_TransactionNoneZ
4339 pub union CResult_TransactionNoneZPtr {
4340         /// A pointer to the contents in the success state.
4341         /// Reading from this pointer when `result_ok` is not set is undefined.
4342         pub result: *mut crate::c_types::Transaction,
4343         /// Note that this value is always NULL, as there are no contents in the Err variant
4344         pub err: *mut std::ffi::c_void,
4345 }
4346 #[repr(C)]
4347 /// A CResult_TransactionNoneZ represents the result of a fallible operation,
4348 /// containing a crate::c_types::Transaction on success and a () on failure.
4349 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4350 pub struct CResult_TransactionNoneZ {
4351         /// The contents of this CResult_TransactionNoneZ, accessible via either
4352         /// `err` or `result` depending on the state of `result_ok`.
4353         pub contents: CResult_TransactionNoneZPtr,
4354         /// Whether this CResult_TransactionNoneZ represents a success state.
4355         pub result_ok: bool,
4356 }
4357 #[no_mangle]
4358 /// Creates a new CResult_TransactionNoneZ in the success state.
4359 pub extern "C" fn CResult_TransactionNoneZ_ok(o: crate::c_types::Transaction) -> CResult_TransactionNoneZ {
4360         CResult_TransactionNoneZ {
4361                 contents: CResult_TransactionNoneZPtr {
4362                         result: Box::into_raw(Box::new(o)),
4363                 },
4364                 result_ok: true,
4365         }
4366 }
4367 #[no_mangle]
4368 /// Creates a new CResult_TransactionNoneZ in the error state.
4369 pub extern "C" fn CResult_TransactionNoneZ_err() -> CResult_TransactionNoneZ {
4370         CResult_TransactionNoneZ {
4371                 contents: CResult_TransactionNoneZPtr {
4372                         err: std::ptr::null_mut(),
4373                 },
4374                 result_ok: false,
4375         }
4376 }
4377 #[no_mangle]
4378 /// Frees any resources used by the CResult_TransactionNoneZ.
4379 pub extern "C" fn CResult_TransactionNoneZ_free(_res: CResult_TransactionNoneZ) { }
4380 impl Drop for CResult_TransactionNoneZ {
4381         fn drop(&mut self) {
4382                 if self.result_ok {
4383                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
4384                                 let _ = unsafe { Box::from_raw(self.contents.result) };
4385                         }
4386                 } else {
4387                 }
4388         }
4389 }
4390 impl From<crate::c_types::CResultTempl<crate::c_types::Transaction, ()>> for CResult_TransactionNoneZ {
4391         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::Transaction, ()>) -> Self {
4392                 let contents = if o.result_ok {
4393                         let result = unsafe { o.contents.result };
4394                         unsafe { o.contents.result = std::ptr::null_mut() };
4395                         CResult_TransactionNoneZPtr { result }
4396                 } else {
4397                         let _ = unsafe { Box::from_raw(o.contents.err) };
4398                         o.contents.err = std::ptr::null_mut();
4399                         CResult_TransactionNoneZPtr { err: std::ptr::null_mut() }
4400                 };
4401                 Self {
4402                         contents,
4403                         result_ok: o.result_ok,
4404                 }
4405         }
4406 }
4407 impl Clone for CResult_TransactionNoneZ {
4408         fn clone(&self) -> Self {
4409                 if self.result_ok {
4410                         Self { result_ok: true, contents: CResult_TransactionNoneZPtr {
4411                                 result: Box::into_raw(Box::new(<crate::c_types::Transaction>::clone(unsafe { &*self.contents.result })))
4412                         } }
4413                 } else {
4414                         Self { result_ok: false, contents: CResult_TransactionNoneZPtr {
4415                                 err: std::ptr::null_mut()
4416                         } }
4417                 }
4418         }
4419 }
4420 #[no_mangle]
4421 /// Creates a new CResult_TransactionNoneZ which has the same data as `orig`
4422 /// but with all dynamically-allocated buffers duplicated in new buffers.
4423 pub extern "C" fn CResult_TransactionNoneZ_clone(orig: &CResult_TransactionNoneZ) -> CResult_TransactionNoneZ { Clone::clone(&orig) }
4424 #[repr(C)]
4425 /// A tuple of 2 elements. See the individual fields for the types contained.
4426 pub struct C2Tuple_BlockHashChannelMonitorZ {
4427         /// The element at position 0
4428         pub a: crate::c_types::ThirtyTwoBytes,
4429         /// The element at position 1
4430         pub b: crate::lightning::chain::channelmonitor::ChannelMonitor,
4431 }
4432 impl From<(crate::c_types::ThirtyTwoBytes, crate::lightning::chain::channelmonitor::ChannelMonitor)> for C2Tuple_BlockHashChannelMonitorZ {
4433         fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::lightning::chain::channelmonitor::ChannelMonitor)) -> Self {
4434                 Self {
4435                         a: tup.0,
4436                         b: tup.1,
4437                 }
4438         }
4439 }
4440 impl C2Tuple_BlockHashChannelMonitorZ {
4441         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::lightning::chain::channelmonitor::ChannelMonitor) {
4442                 (self.a, self.b)
4443         }
4444 }
4445 /// Creates a new C2Tuple_BlockHashChannelMonitorZ from the contained elements.
4446 #[no_mangle]
4447 pub extern "C" fn C2Tuple_BlockHashChannelMonitorZ_new(a: crate::c_types::ThirtyTwoBytes, b: crate::lightning::chain::channelmonitor::ChannelMonitor) -> C2Tuple_BlockHashChannelMonitorZ {
4448         C2Tuple_BlockHashChannelMonitorZ { a, b, }
4449 }
4450
4451 #[no_mangle]
4452 /// Frees any resources used by the C2Tuple_BlockHashChannelMonitorZ.
4453 pub extern "C" fn C2Tuple_BlockHashChannelMonitorZ_free(_res: C2Tuple_BlockHashChannelMonitorZ) { }
4454 #[repr(C)]
4455 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZs of arbitrary size.
4456 /// This corresponds to std::vector in C++
4457 pub struct CVec_C2Tuple_BlockHashChannelMonitorZZ {
4458         /// The elements in the array.
4459         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4460         pub data: *mut crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ,
4461         /// The number of elements pointed to by `data`.
4462         pub datalen: usize
4463 }
4464 impl CVec_C2Tuple_BlockHashChannelMonitorZZ {
4465         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ> {
4466                 if self.datalen == 0 { return Vec::new(); }
4467                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
4468                 self.data = std::ptr::null_mut();
4469                 self.datalen = 0;
4470                 ret
4471         }
4472         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ] {
4473                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
4474         }
4475 }
4476 impl From<Vec<crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ>> for CVec_C2Tuple_BlockHashChannelMonitorZZ {
4477         fn from(v: Vec<crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ>) -> Self {
4478                 let datalen = v.len();
4479                 let data = Box::into_raw(v.into_boxed_slice());
4480                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
4481         }
4482 }
4483 #[no_mangle]
4484 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
4485 pub extern "C" fn CVec_C2Tuple_BlockHashChannelMonitorZZ_free(_res: CVec_C2Tuple_BlockHashChannelMonitorZZ) { }
4486 impl Drop for CVec_C2Tuple_BlockHashChannelMonitorZZ {
4487         fn drop(&mut self) {
4488                 if self.datalen == 0 { return; }
4489                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
4490         }
4491 }
4492 #[repr(C)]
4493 /// The contents of CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ
4494 pub union CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr {
4495         /// A pointer to the contents in the success state.
4496         /// Reading from this pointer when `result_ok` is not set is undefined.
4497         pub result: *mut crate::c_types::derived::CVec_C2Tuple_BlockHashChannelMonitorZZ,
4498         /// A pointer to the contents in the error state.
4499         /// Reading from this pointer when `result_ok` is set is undefined.
4500         pub err: *mut crate::c_types::IOError,
4501 }
4502 #[repr(C)]
4503 /// A CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ represents the result of a fallible operation,
4504 /// containing a crate::c_types::derived::CVec_C2Tuple_BlockHashChannelMonitorZZ on success and a crate::c_types::IOError on failure.
4505 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4506 pub struct CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
4507         /// The contents of this CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ, accessible via either
4508         /// `err` or `result` depending on the state of `result_ok`.
4509         pub contents: CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr,
4510         /// Whether this CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ represents a success state.
4511         pub result_ok: bool,
4512 }
4513 #[no_mangle]
4514 /// Creates a new CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ in the success state.
4515 pub extern "C" fn CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_ok(o: crate::c_types::derived::CVec_C2Tuple_BlockHashChannelMonitorZZ) -> CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
4516         CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
4517                 contents: CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr {
4518                         result: Box::into_raw(Box::new(o)),
4519                 },
4520                 result_ok: true,
4521         }
4522 }
4523 #[no_mangle]
4524 /// Creates a new CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ in the error state.
4525 pub extern "C" fn CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_err(e: crate::c_types::IOError) -> CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
4526         CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
4527                 contents: CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr {
4528                         err: Box::into_raw(Box::new(e)),
4529                 },
4530                 result_ok: false,
4531         }
4532 }
4533 #[no_mangle]
4534 /// Frees any resources used by the CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ.
4535 pub extern "C" fn CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_free(_res: CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ) { }
4536 impl Drop for CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
4537         fn drop(&mut self) {
4538                 if self.result_ok {
4539                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
4540                                 let _ = unsafe { Box::from_raw(self.contents.result) };
4541                         }
4542                 } else {
4543                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
4544                                 let _ = unsafe { Box::from_raw(self.contents.err) };
4545                         }
4546                 }
4547         }
4548 }
4549 impl From<crate::c_types::CResultTempl<crate::c_types::derived::CVec_C2Tuple_BlockHashChannelMonitorZZ, crate::c_types::IOError>> for CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
4550         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CVec_C2Tuple_BlockHashChannelMonitorZZ, crate::c_types::IOError>) -> Self {
4551                 let contents = if o.result_ok {
4552                         let result = unsafe { o.contents.result };
4553                         unsafe { o.contents.result = std::ptr::null_mut() };
4554                         CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr { result }
4555                 } else {
4556                         let err = unsafe { o.contents.err };
4557                         unsafe { o.contents.err = std::ptr::null_mut(); }
4558                         CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr { err }
4559                 };
4560                 Self {
4561                         contents,
4562                         result_ok: o.result_ok,
4563                 }
4564         }
4565 }
4566 #[repr(C)]
4567 #[derive(Clone)]
4568 /// An enum which can either contain a u16 or not
4569 pub enum COption_u16Z {
4570         /// When we're in this state, this COption_u16Z contains a u16
4571         Some(u16),
4572         /// When we're in this state, this COption_u16Z contains nothing
4573         None
4574 }
4575 impl COption_u16Z {
4576         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
4577                 if let Self::Some(_) = self { true } else { false }
4578         }
4579         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
4580                 !self.is_some()
4581         }
4582         #[allow(unused)] pub(crate) fn take(mut self) -> u16 {
4583                 if let Self::Some(v) = self { v } else { unreachable!() }
4584         }
4585 }
4586 #[no_mangle]
4587 /// Constructs a new COption_u16Z containing a u16
4588 pub extern "C" fn COption_u16Z_some(o: u16) -> COption_u16Z {
4589         COption_u16Z::Some(o)
4590 }
4591 #[no_mangle]
4592 /// Constructs a new COption_u16Z containing nothing
4593 pub extern "C" fn COption_u16Z_none() -> COption_u16Z {
4594         COption_u16Z::None
4595 }
4596 #[no_mangle]
4597 /// Frees any resources associated with the u16, if we are in the Some state
4598 pub extern "C" fn COption_u16Z_free(_res: COption_u16Z) { }
4599 #[no_mangle]
4600 /// Creates a new COption_u16Z which has the same data as `orig`
4601 /// but with all dynamically-allocated buffers duplicated in new buffers.
4602 pub extern "C" fn COption_u16Z_clone(orig: &COption_u16Z) -> COption_u16Z { Clone::clone(&orig) }
4603 #[repr(C)]
4604 /// The contents of CResult_NoneAPIErrorZ
4605 pub union CResult_NoneAPIErrorZPtr {
4606         /// Note that this value is always NULL, as there are no contents in the OK variant
4607         pub result: *mut std::ffi::c_void,
4608         /// A pointer to the contents in the error state.
4609         /// Reading from this pointer when `result_ok` is set is undefined.
4610         pub err: *mut crate::lightning::util::errors::APIError,
4611 }
4612 #[repr(C)]
4613 /// A CResult_NoneAPIErrorZ represents the result of a fallible operation,
4614 /// containing a () on success and a crate::lightning::util::errors::APIError on failure.
4615 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4616 pub struct CResult_NoneAPIErrorZ {
4617         /// The contents of this CResult_NoneAPIErrorZ, accessible via either
4618         /// `err` or `result` depending on the state of `result_ok`.
4619         pub contents: CResult_NoneAPIErrorZPtr,
4620         /// Whether this CResult_NoneAPIErrorZ represents a success state.
4621         pub result_ok: bool,
4622 }
4623 #[no_mangle]
4624 /// Creates a new CResult_NoneAPIErrorZ in the success state.
4625 pub extern "C" fn CResult_NoneAPIErrorZ_ok() -> CResult_NoneAPIErrorZ {
4626         CResult_NoneAPIErrorZ {
4627                 contents: CResult_NoneAPIErrorZPtr {
4628                         result: std::ptr::null_mut(),
4629                 },
4630                 result_ok: true,
4631         }
4632 }
4633 #[no_mangle]
4634 /// Creates a new CResult_NoneAPIErrorZ in the error state.
4635 pub extern "C" fn CResult_NoneAPIErrorZ_err(e: crate::lightning::util::errors::APIError) -> CResult_NoneAPIErrorZ {
4636         CResult_NoneAPIErrorZ {
4637                 contents: CResult_NoneAPIErrorZPtr {
4638                         err: Box::into_raw(Box::new(e)),
4639                 },
4640                 result_ok: false,
4641         }
4642 }
4643 #[no_mangle]
4644 /// Frees any resources used by the CResult_NoneAPIErrorZ.
4645 pub extern "C" fn CResult_NoneAPIErrorZ_free(_res: CResult_NoneAPIErrorZ) { }
4646 impl Drop for CResult_NoneAPIErrorZ {
4647         fn drop(&mut self) {
4648                 if self.result_ok {
4649                 } else {
4650                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
4651                                 let _ = unsafe { Box::from_raw(self.contents.err) };
4652                         }
4653                 }
4654         }
4655 }
4656 impl From<crate::c_types::CResultTempl<(), crate::lightning::util::errors::APIError>> for CResult_NoneAPIErrorZ {
4657         fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::util::errors::APIError>) -> Self {
4658                 let contents = if o.result_ok {
4659                         let _ = unsafe { Box::from_raw(o.contents.result) };
4660                         o.contents.result = std::ptr::null_mut();
4661                         CResult_NoneAPIErrorZPtr { result: std::ptr::null_mut() }
4662                 } else {
4663                         let err = unsafe { o.contents.err };
4664                         unsafe { o.contents.err = std::ptr::null_mut(); }
4665                         CResult_NoneAPIErrorZPtr { err }
4666                 };
4667                 Self {
4668                         contents,
4669                         result_ok: o.result_ok,
4670                 }
4671         }
4672 }
4673 impl Clone for CResult_NoneAPIErrorZ {
4674         fn clone(&self) -> Self {
4675                 if self.result_ok {
4676                         Self { result_ok: true, contents: CResult_NoneAPIErrorZPtr {
4677                                 result: std::ptr::null_mut()
4678                         } }
4679                 } else {
4680                         Self { result_ok: false, contents: CResult_NoneAPIErrorZPtr {
4681                                 err: Box::into_raw(Box::new(<crate::lightning::util::errors::APIError>::clone(unsafe { &*self.contents.err })))
4682                         } }
4683                 }
4684         }
4685 }
4686 #[no_mangle]
4687 /// Creates a new CResult_NoneAPIErrorZ which has the same data as `orig`
4688 /// but with all dynamically-allocated buffers duplicated in new buffers.
4689 pub extern "C" fn CResult_NoneAPIErrorZ_clone(orig: &CResult_NoneAPIErrorZ) -> CResult_NoneAPIErrorZ { Clone::clone(&orig) }
4690 #[repr(C)]
4691 /// A dynamically-allocated array of crate::c_types::derived::CResult_NoneAPIErrorZs of arbitrary size.
4692 /// This corresponds to std::vector in C++
4693 pub struct CVec_CResult_NoneAPIErrorZZ {
4694         /// The elements in the array.
4695         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4696         pub data: *mut crate::c_types::derived::CResult_NoneAPIErrorZ,
4697         /// The number of elements pointed to by `data`.
4698         pub datalen: usize
4699 }
4700 impl CVec_CResult_NoneAPIErrorZZ {
4701         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::CResult_NoneAPIErrorZ> {
4702                 if self.datalen == 0 { return Vec::new(); }
4703                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
4704                 self.data = std::ptr::null_mut();
4705                 self.datalen = 0;
4706                 ret
4707         }
4708         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::CResult_NoneAPIErrorZ] {
4709                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
4710         }
4711 }
4712 impl From<Vec<crate::c_types::derived::CResult_NoneAPIErrorZ>> for CVec_CResult_NoneAPIErrorZZ {
4713         fn from(v: Vec<crate::c_types::derived::CResult_NoneAPIErrorZ>) -> Self {
4714                 let datalen = v.len();
4715                 let data = Box::into_raw(v.into_boxed_slice());
4716                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
4717         }
4718 }
4719 #[no_mangle]
4720 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
4721 pub extern "C" fn CVec_CResult_NoneAPIErrorZZ_free(_res: CVec_CResult_NoneAPIErrorZZ) { }
4722 impl Drop for CVec_CResult_NoneAPIErrorZZ {
4723         fn drop(&mut self) {
4724                 if self.datalen == 0 { return; }
4725                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
4726         }
4727 }
4728 impl Clone for CVec_CResult_NoneAPIErrorZZ {
4729         fn clone(&self) -> Self {
4730                 let mut res = Vec::new();
4731                 if self.datalen == 0 { return Self::from(res); }
4732                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
4733                 Self::from(res)
4734         }
4735 }
4736 #[repr(C)]
4737 /// A dynamically-allocated array of crate::lightning::util::errors::APIErrors of arbitrary size.
4738 /// This corresponds to std::vector in C++
4739 pub struct CVec_APIErrorZ {
4740         /// The elements in the array.
4741         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4742         pub data: *mut crate::lightning::util::errors::APIError,
4743         /// The number of elements pointed to by `data`.
4744         pub datalen: usize
4745 }
4746 impl CVec_APIErrorZ {
4747         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::util::errors::APIError> {
4748                 if self.datalen == 0 { return Vec::new(); }
4749                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
4750                 self.data = std::ptr::null_mut();
4751                 self.datalen = 0;
4752                 ret
4753         }
4754         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::util::errors::APIError] {
4755                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
4756         }
4757 }
4758 impl From<Vec<crate::lightning::util::errors::APIError>> for CVec_APIErrorZ {
4759         fn from(v: Vec<crate::lightning::util::errors::APIError>) -> Self {
4760                 let datalen = v.len();
4761                 let data = Box::into_raw(v.into_boxed_slice());
4762                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
4763         }
4764 }
4765 #[no_mangle]
4766 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
4767 pub extern "C" fn CVec_APIErrorZ_free(_res: CVec_APIErrorZ) { }
4768 impl Drop for CVec_APIErrorZ {
4769         fn drop(&mut self) {
4770                 if self.datalen == 0 { return; }
4771                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
4772         }
4773 }
4774 impl Clone for CVec_APIErrorZ {
4775         fn clone(&self) -> Self {
4776                 let mut res = Vec::new();
4777                 if self.datalen == 0 { return Self::from(res); }
4778                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
4779                 Self::from(res)
4780         }
4781 }
4782 #[repr(C)]
4783 /// The contents of CResult__u832APIErrorZ
4784 pub union CResult__u832APIErrorZPtr {
4785         /// A pointer to the contents in the success state.
4786         /// Reading from this pointer when `result_ok` is not set is undefined.
4787         pub result: *mut crate::c_types::ThirtyTwoBytes,
4788         /// A pointer to the contents in the error state.
4789         /// Reading from this pointer when `result_ok` is set is undefined.
4790         pub err: *mut crate::lightning::util::errors::APIError,
4791 }
4792 #[repr(C)]
4793 /// A CResult__u832APIErrorZ represents the result of a fallible operation,
4794 /// containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning::util::errors::APIError on failure.
4795 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4796 pub struct CResult__u832APIErrorZ {
4797         /// The contents of this CResult__u832APIErrorZ, accessible via either
4798         /// `err` or `result` depending on the state of `result_ok`.
4799         pub contents: CResult__u832APIErrorZPtr,
4800         /// Whether this CResult__u832APIErrorZ represents a success state.
4801         pub result_ok: bool,
4802 }
4803 #[no_mangle]
4804 /// Creates a new CResult__u832APIErrorZ in the success state.
4805 pub extern "C" fn CResult__u832APIErrorZ_ok(o: crate::c_types::ThirtyTwoBytes) -> CResult__u832APIErrorZ {
4806         CResult__u832APIErrorZ {
4807                 contents: CResult__u832APIErrorZPtr {
4808                         result: Box::into_raw(Box::new(o)),
4809                 },
4810                 result_ok: true,
4811         }
4812 }
4813 #[no_mangle]
4814 /// Creates a new CResult__u832APIErrorZ in the error state.
4815 pub extern "C" fn CResult__u832APIErrorZ_err(e: crate::lightning::util::errors::APIError) -> CResult__u832APIErrorZ {
4816         CResult__u832APIErrorZ {
4817                 contents: CResult__u832APIErrorZPtr {
4818                         err: Box::into_raw(Box::new(e)),
4819                 },
4820                 result_ok: false,
4821         }
4822 }
4823 #[no_mangle]
4824 /// Frees any resources used by the CResult__u832APIErrorZ.
4825 pub extern "C" fn CResult__u832APIErrorZ_free(_res: CResult__u832APIErrorZ) { }
4826 impl Drop for CResult__u832APIErrorZ {
4827         fn drop(&mut self) {
4828                 if self.result_ok {
4829                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
4830                                 let _ = unsafe { Box::from_raw(self.contents.result) };
4831                         }
4832                 } else {
4833                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
4834                                 let _ = unsafe { Box::from_raw(self.contents.err) };
4835                         }
4836                 }
4837         }
4838 }
4839 impl From<crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::util::errors::APIError>> for CResult__u832APIErrorZ {
4840         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::util::errors::APIError>) -> Self {
4841                 let contents = if o.result_ok {
4842                         let result = unsafe { o.contents.result };
4843                         unsafe { o.contents.result = std::ptr::null_mut() };
4844                         CResult__u832APIErrorZPtr { result }
4845                 } else {
4846                         let err = unsafe { o.contents.err };
4847                         unsafe { o.contents.err = std::ptr::null_mut(); }
4848                         CResult__u832APIErrorZPtr { err }
4849                 };
4850                 Self {
4851                         contents,
4852                         result_ok: o.result_ok,
4853                 }
4854         }
4855 }
4856 impl Clone for CResult__u832APIErrorZ {
4857         fn clone(&self) -> Self {
4858                 if self.result_ok {
4859                         Self { result_ok: true, contents: CResult__u832APIErrorZPtr {
4860                                 result: Box::into_raw(Box::new(<crate::c_types::ThirtyTwoBytes>::clone(unsafe { &*self.contents.result })))
4861                         } }
4862                 } else {
4863                         Self { result_ok: false, contents: CResult__u832APIErrorZPtr {
4864                                 err: Box::into_raw(Box::new(<crate::lightning::util::errors::APIError>::clone(unsafe { &*self.contents.err })))
4865                         } }
4866                 }
4867         }
4868 }
4869 #[no_mangle]
4870 /// Creates a new CResult__u832APIErrorZ which has the same data as `orig`
4871 /// but with all dynamically-allocated buffers duplicated in new buffers.
4872 pub extern "C" fn CResult__u832APIErrorZ_clone(orig: &CResult__u832APIErrorZ) -> CResult__u832APIErrorZ { Clone::clone(&orig) }
4873 #[repr(C)]
4874 /// The contents of CResult_PaymentIdPaymentSendFailureZ
4875 pub union CResult_PaymentIdPaymentSendFailureZPtr {
4876         /// A pointer to the contents in the success state.
4877         /// Reading from this pointer when `result_ok` is not set is undefined.
4878         pub result: *mut crate::c_types::ThirtyTwoBytes,
4879         /// A pointer to the contents in the error state.
4880         /// Reading from this pointer when `result_ok` is set is undefined.
4881         pub err: *mut crate::lightning::ln::channelmanager::PaymentSendFailure,
4882 }
4883 #[repr(C)]
4884 /// A CResult_PaymentIdPaymentSendFailureZ represents the result of a fallible operation,
4885 /// containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning::ln::channelmanager::PaymentSendFailure on failure.
4886 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4887 pub struct CResult_PaymentIdPaymentSendFailureZ {
4888         /// The contents of this CResult_PaymentIdPaymentSendFailureZ, accessible via either
4889         /// `err` or `result` depending on the state of `result_ok`.
4890         pub contents: CResult_PaymentIdPaymentSendFailureZPtr,
4891         /// Whether this CResult_PaymentIdPaymentSendFailureZ represents a success state.
4892         pub result_ok: bool,
4893 }
4894 #[no_mangle]
4895 /// Creates a new CResult_PaymentIdPaymentSendFailureZ in the success state.
4896 pub extern "C" fn CResult_PaymentIdPaymentSendFailureZ_ok(o: crate::c_types::ThirtyTwoBytes) -> CResult_PaymentIdPaymentSendFailureZ {
4897         CResult_PaymentIdPaymentSendFailureZ {
4898                 contents: CResult_PaymentIdPaymentSendFailureZPtr {
4899                         result: Box::into_raw(Box::new(o)),
4900                 },
4901                 result_ok: true,
4902         }
4903 }
4904 #[no_mangle]
4905 /// Creates a new CResult_PaymentIdPaymentSendFailureZ in the error state.
4906 pub extern "C" fn CResult_PaymentIdPaymentSendFailureZ_err(e: crate::lightning::ln::channelmanager::PaymentSendFailure) -> CResult_PaymentIdPaymentSendFailureZ {
4907         CResult_PaymentIdPaymentSendFailureZ {
4908                 contents: CResult_PaymentIdPaymentSendFailureZPtr {
4909                         err: Box::into_raw(Box::new(e)),
4910                 },
4911                 result_ok: false,
4912         }
4913 }
4914 #[no_mangle]
4915 /// Frees any resources used by the CResult_PaymentIdPaymentSendFailureZ.
4916 pub extern "C" fn CResult_PaymentIdPaymentSendFailureZ_free(_res: CResult_PaymentIdPaymentSendFailureZ) { }
4917 impl Drop for CResult_PaymentIdPaymentSendFailureZ {
4918         fn drop(&mut self) {
4919                 if self.result_ok {
4920                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
4921                                 let _ = unsafe { Box::from_raw(self.contents.result) };
4922                         }
4923                 } else {
4924                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
4925                                 let _ = unsafe { Box::from_raw(self.contents.err) };
4926                         }
4927                 }
4928         }
4929 }
4930 impl From<crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::ln::channelmanager::PaymentSendFailure>> for CResult_PaymentIdPaymentSendFailureZ {
4931         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::ln::channelmanager::PaymentSendFailure>) -> Self {
4932                 let contents = if o.result_ok {
4933                         let result = unsafe { o.contents.result };
4934                         unsafe { o.contents.result = std::ptr::null_mut() };
4935                         CResult_PaymentIdPaymentSendFailureZPtr { result }
4936                 } else {
4937                         let err = unsafe { o.contents.err };
4938                         unsafe { o.contents.err = std::ptr::null_mut(); }
4939                         CResult_PaymentIdPaymentSendFailureZPtr { err }
4940                 };
4941                 Self {
4942                         contents,
4943                         result_ok: o.result_ok,
4944                 }
4945         }
4946 }
4947 impl Clone for CResult_PaymentIdPaymentSendFailureZ {
4948         fn clone(&self) -> Self {
4949                 if self.result_ok {
4950                         Self { result_ok: true, contents: CResult_PaymentIdPaymentSendFailureZPtr {
4951                                 result: Box::into_raw(Box::new(<crate::c_types::ThirtyTwoBytes>::clone(unsafe { &*self.contents.result })))
4952                         } }
4953                 } else {
4954                         Self { result_ok: false, contents: CResult_PaymentIdPaymentSendFailureZPtr {
4955                                 err: Box::into_raw(Box::new(<crate::lightning::ln::channelmanager::PaymentSendFailure>::clone(unsafe { &*self.contents.err })))
4956                         } }
4957                 }
4958         }
4959 }
4960 #[no_mangle]
4961 /// Creates a new CResult_PaymentIdPaymentSendFailureZ which has the same data as `orig`
4962 /// but with all dynamically-allocated buffers duplicated in new buffers.
4963 pub extern "C" fn CResult_PaymentIdPaymentSendFailureZ_clone(orig: &CResult_PaymentIdPaymentSendFailureZ) -> CResult_PaymentIdPaymentSendFailureZ { Clone::clone(&orig) }
4964 #[repr(C)]
4965 /// The contents of CResult_NonePaymentSendFailureZ
4966 pub union CResult_NonePaymentSendFailureZPtr {
4967         /// Note that this value is always NULL, as there are no contents in the OK variant
4968         pub result: *mut std::ffi::c_void,
4969         /// A pointer to the contents in the error state.
4970         /// Reading from this pointer when `result_ok` is set is undefined.
4971         pub err: *mut crate::lightning::ln::channelmanager::PaymentSendFailure,
4972 }
4973 #[repr(C)]
4974 /// A CResult_NonePaymentSendFailureZ represents the result of a fallible operation,
4975 /// containing a () on success and a crate::lightning::ln::channelmanager::PaymentSendFailure on failure.
4976 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4977 pub struct CResult_NonePaymentSendFailureZ {
4978         /// The contents of this CResult_NonePaymentSendFailureZ, accessible via either
4979         /// `err` or `result` depending on the state of `result_ok`.
4980         pub contents: CResult_NonePaymentSendFailureZPtr,
4981         /// Whether this CResult_NonePaymentSendFailureZ represents a success state.
4982         pub result_ok: bool,
4983 }
4984 #[no_mangle]
4985 /// Creates a new CResult_NonePaymentSendFailureZ in the success state.
4986 pub extern "C" fn CResult_NonePaymentSendFailureZ_ok() -> CResult_NonePaymentSendFailureZ {
4987         CResult_NonePaymentSendFailureZ {
4988                 contents: CResult_NonePaymentSendFailureZPtr {
4989                         result: std::ptr::null_mut(),
4990                 },
4991                 result_ok: true,
4992         }
4993 }
4994 #[no_mangle]
4995 /// Creates a new CResult_NonePaymentSendFailureZ in the error state.
4996 pub extern "C" fn CResult_NonePaymentSendFailureZ_err(e: crate::lightning::ln::channelmanager::PaymentSendFailure) -> CResult_NonePaymentSendFailureZ {
4997         CResult_NonePaymentSendFailureZ {
4998                 contents: CResult_NonePaymentSendFailureZPtr {
4999                         err: Box::into_raw(Box::new(e)),
5000                 },
5001                 result_ok: false,
5002         }
5003 }
5004 #[no_mangle]
5005 /// Frees any resources used by the CResult_NonePaymentSendFailureZ.
5006 pub extern "C" fn CResult_NonePaymentSendFailureZ_free(_res: CResult_NonePaymentSendFailureZ) { }
5007 impl Drop for CResult_NonePaymentSendFailureZ {
5008         fn drop(&mut self) {
5009                 if self.result_ok {
5010                 } else {
5011                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
5012                                 let _ = unsafe { Box::from_raw(self.contents.err) };
5013                         }
5014                 }
5015         }
5016 }
5017 impl From<crate::c_types::CResultTempl<(), crate::lightning::ln::channelmanager::PaymentSendFailure>> for CResult_NonePaymentSendFailureZ {
5018         fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::ln::channelmanager::PaymentSendFailure>) -> Self {
5019                 let contents = if o.result_ok {
5020                         let _ = unsafe { Box::from_raw(o.contents.result) };
5021                         o.contents.result = std::ptr::null_mut();
5022                         CResult_NonePaymentSendFailureZPtr { result: std::ptr::null_mut() }
5023                 } else {
5024                         let err = unsafe { o.contents.err };
5025                         unsafe { o.contents.err = std::ptr::null_mut(); }
5026                         CResult_NonePaymentSendFailureZPtr { err }
5027                 };
5028                 Self {
5029                         contents,
5030                         result_ok: o.result_ok,
5031                 }
5032         }
5033 }
5034 impl Clone for CResult_NonePaymentSendFailureZ {
5035         fn clone(&self) -> Self {
5036                 if self.result_ok {
5037                         Self { result_ok: true, contents: CResult_NonePaymentSendFailureZPtr {
5038                                 result: std::ptr::null_mut()
5039                         } }
5040                 } else {
5041                         Self { result_ok: false, contents: CResult_NonePaymentSendFailureZPtr {
5042                                 err: Box::into_raw(Box::new(<crate::lightning::ln::channelmanager::PaymentSendFailure>::clone(unsafe { &*self.contents.err })))
5043                         } }
5044                 }
5045         }
5046 }
5047 #[no_mangle]
5048 /// Creates a new CResult_NonePaymentSendFailureZ which has the same data as `orig`
5049 /// but with all dynamically-allocated buffers duplicated in new buffers.
5050 pub extern "C" fn CResult_NonePaymentSendFailureZ_clone(orig: &CResult_NonePaymentSendFailureZ) -> CResult_NonePaymentSendFailureZ { Clone::clone(&orig) }
5051 #[repr(C)]
5052 /// A tuple of 2 elements. See the individual fields for the types contained.
5053 pub struct C2Tuple_PaymentHashPaymentIdZ {
5054         /// The element at position 0
5055         pub a: crate::c_types::ThirtyTwoBytes,
5056         /// The element at position 1
5057         pub b: crate::c_types::ThirtyTwoBytes,
5058 }
5059 impl From<(crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes)> for C2Tuple_PaymentHashPaymentIdZ {
5060         fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes)) -> Self {
5061                 Self {
5062                         a: tup.0,
5063                         b: tup.1,
5064                 }
5065         }
5066 }
5067 impl C2Tuple_PaymentHashPaymentIdZ {
5068         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes) {
5069                 (self.a, self.b)
5070         }
5071 }
5072 impl Clone for C2Tuple_PaymentHashPaymentIdZ {
5073         fn clone(&self) -> Self {
5074                 Self {
5075                         a: Clone::clone(&self.a),
5076                         b: Clone::clone(&self.b),
5077                 }
5078         }
5079 }
5080 #[no_mangle]
5081 /// Creates a new tuple which has the same data as `orig`
5082 /// but with all dynamically-allocated buffers duplicated in new buffers.
5083 pub extern "C" fn C2Tuple_PaymentHashPaymentIdZ_clone(orig: &C2Tuple_PaymentHashPaymentIdZ) -> C2Tuple_PaymentHashPaymentIdZ { Clone::clone(&orig) }
5084 /// Creates a new C2Tuple_PaymentHashPaymentIdZ from the contained elements.
5085 #[no_mangle]
5086 pub extern "C" fn C2Tuple_PaymentHashPaymentIdZ_new(a: crate::c_types::ThirtyTwoBytes, b: crate::c_types::ThirtyTwoBytes) -> C2Tuple_PaymentHashPaymentIdZ {
5087         C2Tuple_PaymentHashPaymentIdZ { a, b, }
5088 }
5089
5090 #[no_mangle]
5091 /// Frees any resources used by the C2Tuple_PaymentHashPaymentIdZ.
5092 pub extern "C" fn C2Tuple_PaymentHashPaymentIdZ_free(_res: C2Tuple_PaymentHashPaymentIdZ) { }
5093 #[repr(C)]
5094 /// The contents of CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ
5095 pub union CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr {
5096         /// A pointer to the contents in the success state.
5097         /// Reading from this pointer when `result_ok` is not set is undefined.
5098         pub result: *mut crate::c_types::derived::C2Tuple_PaymentHashPaymentIdZ,
5099         /// A pointer to the contents in the error state.
5100         /// Reading from this pointer when `result_ok` is set is undefined.
5101         pub err: *mut crate::lightning::ln::channelmanager::PaymentSendFailure,
5102 }
5103 #[repr(C)]
5104 /// A CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ represents the result of a fallible operation,
5105 /// containing a crate::c_types::derived::C2Tuple_PaymentHashPaymentIdZ on success and a crate::lightning::ln::channelmanager::PaymentSendFailure on failure.
5106 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5107 pub struct CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
5108         /// The contents of this CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ, accessible via either
5109         /// `err` or `result` depending on the state of `result_ok`.
5110         pub contents: CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr,
5111         /// Whether this CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ represents a success state.
5112         pub result_ok: bool,
5113 }
5114 #[no_mangle]
5115 /// Creates a new CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ in the success state.
5116 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_ok(o: crate::c_types::derived::C2Tuple_PaymentHashPaymentIdZ) -> CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
5117         CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
5118                 contents: CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr {
5119                         result: Box::into_raw(Box::new(o)),
5120                 },
5121                 result_ok: true,
5122         }
5123 }
5124 #[no_mangle]
5125 /// Creates a new CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ in the error state.
5126 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_err(e: crate::lightning::ln::channelmanager::PaymentSendFailure) -> CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
5127         CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
5128                 contents: CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr {
5129                         err: Box::into_raw(Box::new(e)),
5130                 },
5131                 result_ok: false,
5132         }
5133 }
5134 #[no_mangle]
5135 /// Frees any resources used by the CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ.
5136 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_free(_res: CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ) { }
5137 impl Drop for CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
5138         fn drop(&mut self) {
5139                 if self.result_ok {
5140                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
5141                                 let _ = unsafe { Box::from_raw(self.contents.result) };
5142                         }
5143                 } else {
5144                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
5145                                 let _ = unsafe { Box::from_raw(self.contents.err) };
5146                         }
5147                 }
5148         }
5149 }
5150 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_PaymentHashPaymentIdZ, crate::lightning::ln::channelmanager::PaymentSendFailure>> for CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
5151         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_PaymentHashPaymentIdZ, crate::lightning::ln::channelmanager::PaymentSendFailure>) -> Self {
5152                 let contents = if o.result_ok {
5153                         let result = unsafe { o.contents.result };
5154                         unsafe { o.contents.result = std::ptr::null_mut() };
5155                         CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr { result }
5156                 } else {
5157                         let err = unsafe { o.contents.err };
5158                         unsafe { o.contents.err = std::ptr::null_mut(); }
5159                         CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr { err }
5160                 };
5161                 Self {
5162                         contents,
5163                         result_ok: o.result_ok,
5164                 }
5165         }
5166 }
5167 impl Clone for CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
5168         fn clone(&self) -> Self {
5169                 if self.result_ok {
5170                         Self { result_ok: true, contents: CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr {
5171                                 result: Box::into_raw(Box::new(<crate::c_types::derived::C2Tuple_PaymentHashPaymentIdZ>::clone(unsafe { &*self.contents.result })))
5172                         } }
5173                 } else {
5174                         Self { result_ok: false, contents: CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr {
5175                                 err: Box::into_raw(Box::new(<crate::lightning::ln::channelmanager::PaymentSendFailure>::clone(unsafe { &*self.contents.err })))
5176                         } }
5177                 }
5178         }
5179 }
5180 #[no_mangle]
5181 /// Creates a new CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ which has the same data as `orig`
5182 /// but with all dynamically-allocated buffers duplicated in new buffers.
5183 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone(orig: &CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ) -> CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ { Clone::clone(&orig) }
5184 #[repr(C)]
5185 /// A dynamically-allocated array of crate::lightning::ln::msgs::NetAddresss of arbitrary size.
5186 /// This corresponds to std::vector in C++
5187 pub struct CVec_NetAddressZ {
5188         /// The elements in the array.
5189         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
5190         pub data: *mut crate::lightning::ln::msgs::NetAddress,
5191         /// The number of elements pointed to by `data`.
5192         pub datalen: usize
5193 }
5194 impl CVec_NetAddressZ {
5195         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::NetAddress> {
5196                 if self.datalen == 0 { return Vec::new(); }
5197                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
5198                 self.data = std::ptr::null_mut();
5199                 self.datalen = 0;
5200                 ret
5201         }
5202         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::NetAddress] {
5203                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
5204         }
5205 }
5206 impl From<Vec<crate::lightning::ln::msgs::NetAddress>> for CVec_NetAddressZ {
5207         fn from(v: Vec<crate::lightning::ln::msgs::NetAddress>) -> Self {
5208                 let datalen = v.len();
5209                 let data = Box::into_raw(v.into_boxed_slice());
5210                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
5211         }
5212 }
5213 #[no_mangle]
5214 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
5215 pub extern "C" fn CVec_NetAddressZ_free(_res: CVec_NetAddressZ) { }
5216 impl Drop for CVec_NetAddressZ {
5217         fn drop(&mut self) {
5218                 if self.datalen == 0 { return; }
5219                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
5220         }
5221 }
5222 impl Clone for CVec_NetAddressZ {
5223         fn clone(&self) -> Self {
5224                 let mut res = Vec::new();
5225                 if self.datalen == 0 { return Self::from(res); }
5226                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
5227                 Self::from(res)
5228         }
5229 }
5230 #[repr(C)]
5231 /// A tuple of 2 elements. See the individual fields for the types contained.
5232 pub struct C2Tuple_PaymentHashPaymentSecretZ {
5233         /// The element at position 0
5234         pub a: crate::c_types::ThirtyTwoBytes,
5235         /// The element at position 1
5236         pub b: crate::c_types::ThirtyTwoBytes,
5237 }
5238 impl From<(crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes)> for C2Tuple_PaymentHashPaymentSecretZ {
5239         fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes)) -> Self {
5240                 Self {
5241                         a: tup.0,
5242                         b: tup.1,
5243                 }
5244         }
5245 }
5246 impl C2Tuple_PaymentHashPaymentSecretZ {
5247         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes) {
5248                 (self.a, self.b)
5249         }
5250 }
5251 impl Clone for C2Tuple_PaymentHashPaymentSecretZ {
5252         fn clone(&self) -> Self {
5253                 Self {
5254                         a: Clone::clone(&self.a),
5255                         b: Clone::clone(&self.b),
5256                 }
5257         }
5258 }
5259 #[no_mangle]
5260 /// Creates a new tuple which has the same data as `orig`
5261 /// but with all dynamically-allocated buffers duplicated in new buffers.
5262 pub extern "C" fn C2Tuple_PaymentHashPaymentSecretZ_clone(orig: &C2Tuple_PaymentHashPaymentSecretZ) -> C2Tuple_PaymentHashPaymentSecretZ { Clone::clone(&orig) }
5263 /// Creates a new C2Tuple_PaymentHashPaymentSecretZ from the contained elements.
5264 #[no_mangle]
5265 pub extern "C" fn C2Tuple_PaymentHashPaymentSecretZ_new(a: crate::c_types::ThirtyTwoBytes, b: crate::c_types::ThirtyTwoBytes) -> C2Tuple_PaymentHashPaymentSecretZ {
5266         C2Tuple_PaymentHashPaymentSecretZ { a, b, }
5267 }
5268
5269 #[no_mangle]
5270 /// Frees any resources used by the C2Tuple_PaymentHashPaymentSecretZ.
5271 pub extern "C" fn C2Tuple_PaymentHashPaymentSecretZ_free(_res: C2Tuple_PaymentHashPaymentSecretZ) { }
5272 #[repr(C)]
5273 /// The contents of CResult_PaymentSecretAPIErrorZ
5274 pub union CResult_PaymentSecretAPIErrorZPtr {
5275         /// A pointer to the contents in the success state.
5276         /// Reading from this pointer when `result_ok` is not set is undefined.
5277         pub result: *mut crate::c_types::ThirtyTwoBytes,
5278         /// A pointer to the contents in the error state.
5279         /// Reading from this pointer when `result_ok` is set is undefined.
5280         pub err: *mut crate::lightning::util::errors::APIError,
5281 }
5282 #[repr(C)]
5283 /// A CResult_PaymentSecretAPIErrorZ represents the result of a fallible operation,
5284 /// containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning::util::errors::APIError on failure.
5285 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5286 pub struct CResult_PaymentSecretAPIErrorZ {
5287         /// The contents of this CResult_PaymentSecretAPIErrorZ, accessible via either
5288         /// `err` or `result` depending on the state of `result_ok`.
5289         pub contents: CResult_PaymentSecretAPIErrorZPtr,
5290         /// Whether this CResult_PaymentSecretAPIErrorZ represents a success state.
5291         pub result_ok: bool,
5292 }
5293 #[no_mangle]
5294 /// Creates a new CResult_PaymentSecretAPIErrorZ in the success state.
5295 pub extern "C" fn CResult_PaymentSecretAPIErrorZ_ok(o: crate::c_types::ThirtyTwoBytes) -> CResult_PaymentSecretAPIErrorZ {
5296         CResult_PaymentSecretAPIErrorZ {
5297                 contents: CResult_PaymentSecretAPIErrorZPtr {
5298                         result: Box::into_raw(Box::new(o)),
5299                 },
5300                 result_ok: true,
5301         }
5302 }
5303 #[no_mangle]
5304 /// Creates a new CResult_PaymentSecretAPIErrorZ in the error state.
5305 pub extern "C" fn CResult_PaymentSecretAPIErrorZ_err(e: crate::lightning::util::errors::APIError) -> CResult_PaymentSecretAPIErrorZ {
5306         CResult_PaymentSecretAPIErrorZ {
5307                 contents: CResult_PaymentSecretAPIErrorZPtr {
5308                         err: Box::into_raw(Box::new(e)),
5309                 },
5310                 result_ok: false,
5311         }
5312 }
5313 #[no_mangle]
5314 /// Frees any resources used by the CResult_PaymentSecretAPIErrorZ.
5315 pub extern "C" fn CResult_PaymentSecretAPIErrorZ_free(_res: CResult_PaymentSecretAPIErrorZ) { }
5316 impl Drop for CResult_PaymentSecretAPIErrorZ {
5317         fn drop(&mut self) {
5318                 if self.result_ok {
5319                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
5320                                 let _ = unsafe { Box::from_raw(self.contents.result) };
5321                         }
5322                 } else {
5323                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
5324                                 let _ = unsafe { Box::from_raw(self.contents.err) };
5325                         }
5326                 }
5327         }
5328 }
5329 impl From<crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::util::errors::APIError>> for CResult_PaymentSecretAPIErrorZ {
5330         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::util::errors::APIError>) -> Self {
5331                 let contents = if o.result_ok {
5332                         let result = unsafe { o.contents.result };
5333                         unsafe { o.contents.result = std::ptr::null_mut() };
5334                         CResult_PaymentSecretAPIErrorZPtr { result }
5335                 } else {
5336                         let err = unsafe { o.contents.err };
5337                         unsafe { o.contents.err = std::ptr::null_mut(); }
5338                         CResult_PaymentSecretAPIErrorZPtr { err }
5339                 };
5340                 Self {
5341                         contents,
5342                         result_ok: o.result_ok,
5343                 }
5344         }
5345 }
5346 impl Clone for CResult_PaymentSecretAPIErrorZ {
5347         fn clone(&self) -> Self {
5348                 if self.result_ok {
5349                         Self { result_ok: true, contents: CResult_PaymentSecretAPIErrorZPtr {
5350                                 result: Box::into_raw(Box::new(<crate::c_types::ThirtyTwoBytes>::clone(unsafe { &*self.contents.result })))
5351                         } }
5352                 } else {
5353                         Self { result_ok: false, contents: CResult_PaymentSecretAPIErrorZPtr {
5354                                 err: Box::into_raw(Box::new(<crate::lightning::util::errors::APIError>::clone(unsafe { &*self.contents.err })))
5355                         } }
5356                 }
5357         }
5358 }
5359 #[no_mangle]
5360 /// Creates a new CResult_PaymentSecretAPIErrorZ which has the same data as `orig`
5361 /// but with all dynamically-allocated buffers duplicated in new buffers.
5362 pub extern "C" fn CResult_PaymentSecretAPIErrorZ_clone(orig: &CResult_PaymentSecretAPIErrorZ) -> CResult_PaymentSecretAPIErrorZ { Clone::clone(&orig) }
5363 #[repr(C)]
5364 /// A dynamically-allocated array of crate::lightning::chain::channelmonitor::ChannelMonitors of arbitrary size.
5365 /// This corresponds to std::vector in C++
5366 pub struct CVec_ChannelMonitorZ {
5367         /// The elements in the array.
5368         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
5369         pub data: *mut crate::lightning::chain::channelmonitor::ChannelMonitor,
5370         /// The number of elements pointed to by `data`.
5371         pub datalen: usize
5372 }
5373 impl CVec_ChannelMonitorZ {
5374         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::chain::channelmonitor::ChannelMonitor> {
5375                 if self.datalen == 0 { return Vec::new(); }
5376                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
5377                 self.data = std::ptr::null_mut();
5378                 self.datalen = 0;
5379                 ret
5380         }
5381         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::chain::channelmonitor::ChannelMonitor] {
5382                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
5383         }
5384 }
5385 impl From<Vec<crate::lightning::chain::channelmonitor::ChannelMonitor>> for CVec_ChannelMonitorZ {
5386         fn from(v: Vec<crate::lightning::chain::channelmonitor::ChannelMonitor>) -> Self {
5387                 let datalen = v.len();
5388                 let data = Box::into_raw(v.into_boxed_slice());
5389                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
5390         }
5391 }
5392 #[no_mangle]
5393 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
5394 pub extern "C" fn CVec_ChannelMonitorZ_free(_res: CVec_ChannelMonitorZ) { }
5395 impl Drop for CVec_ChannelMonitorZ {
5396         fn drop(&mut self) {
5397                 if self.datalen == 0 { return; }
5398                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
5399         }
5400 }
5401 #[repr(C)]
5402 /// A tuple of 2 elements. See the individual fields for the types contained.
5403 pub struct C2Tuple_BlockHashChannelManagerZ {
5404         /// The element at position 0
5405         pub a: crate::c_types::ThirtyTwoBytes,
5406         /// The element at position 1
5407         pub b: crate::lightning::ln::channelmanager::ChannelManager,
5408 }
5409 impl From<(crate::c_types::ThirtyTwoBytes, crate::lightning::ln::channelmanager::ChannelManager)> for C2Tuple_BlockHashChannelManagerZ {
5410         fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::lightning::ln::channelmanager::ChannelManager)) -> Self {
5411                 Self {
5412                         a: tup.0,
5413                         b: tup.1,
5414                 }
5415         }
5416 }
5417 impl C2Tuple_BlockHashChannelManagerZ {
5418         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::lightning::ln::channelmanager::ChannelManager) {
5419                 (self.a, self.b)
5420         }
5421 }
5422 /// Creates a new C2Tuple_BlockHashChannelManagerZ from the contained elements.
5423 #[no_mangle]
5424 pub extern "C" fn C2Tuple_BlockHashChannelManagerZ_new(a: crate::c_types::ThirtyTwoBytes, b: crate::lightning::ln::channelmanager::ChannelManager) -> C2Tuple_BlockHashChannelManagerZ {
5425         C2Tuple_BlockHashChannelManagerZ { a, b, }
5426 }
5427
5428 #[no_mangle]
5429 /// Frees any resources used by the C2Tuple_BlockHashChannelManagerZ.
5430 pub extern "C" fn C2Tuple_BlockHashChannelManagerZ_free(_res: C2Tuple_BlockHashChannelManagerZ) { }
5431 #[repr(C)]
5432 /// The contents of CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ
5433 pub union CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr {
5434         /// A pointer to the contents in the success state.
5435         /// Reading from this pointer when `result_ok` is not set is undefined.
5436         pub result: *mut crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ,
5437         /// A pointer to the contents in the error state.
5438         /// Reading from this pointer when `result_ok` is set is undefined.
5439         pub err: *mut crate::lightning::ln::msgs::DecodeError,
5440 }
5441 #[repr(C)]
5442 /// A CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ represents the result of a fallible operation,
5443 /// containing a crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
5444 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5445 pub struct CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
5446         /// The contents of this CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ, accessible via either
5447         /// `err` or `result` depending on the state of `result_ok`.
5448         pub contents: CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr,
5449         /// Whether this CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ represents a success state.
5450         pub result_ok: bool,
5451 }
5452 #[no_mangle]
5453 /// Creates a new CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ in the success state.
5454 pub extern "C" fn CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_ok(o: crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ) -> CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
5455         CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
5456                 contents: CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr {
5457                         result: Box::into_raw(Box::new(o)),
5458                 },
5459                 result_ok: true,
5460         }
5461 }
5462 #[no_mangle]
5463 /// Creates a new CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ in the error state.
5464 pub extern "C" fn CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
5465         CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
5466                 contents: CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr {
5467                         err: Box::into_raw(Box::new(e)),
5468                 },
5469                 result_ok: false,
5470         }
5471 }
5472 #[no_mangle]
5473 /// Frees any resources used by the CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ.
5474 pub extern "C" fn CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_free(_res: CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ) { }
5475 impl Drop for CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
5476         fn drop(&mut self) {
5477                 if self.result_ok {
5478                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
5479                                 let _ = unsafe { Box::from_raw(self.contents.result) };
5480                         }
5481                 } else {
5482                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
5483                                 let _ = unsafe { Box::from_raw(self.contents.err) };
5484                         }
5485                 }
5486         }
5487 }
5488 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ, crate::lightning::ln::msgs::DecodeError>> for CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
5489         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
5490                 let contents = if o.result_ok {
5491                         let result = unsafe { o.contents.result };
5492                         unsafe { o.contents.result = std::ptr::null_mut() };
5493                         CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr { result }
5494                 } else {
5495                         let err = unsafe { o.contents.err };
5496                         unsafe { o.contents.err = std::ptr::null_mut(); }
5497                         CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr { err }
5498                 };
5499                 Self {
5500                         contents,
5501                         result_ok: o.result_ok,
5502                 }
5503         }
5504 }
5505 #[repr(C)]
5506 /// The contents of CResult_ChannelConfigDecodeErrorZ
5507 pub union CResult_ChannelConfigDecodeErrorZPtr {
5508         /// A pointer to the contents in the success state.
5509         /// Reading from this pointer when `result_ok` is not set is undefined.
5510         pub result: *mut crate::lightning::util::config::ChannelConfig,
5511         /// A pointer to the contents in the error state.
5512         /// Reading from this pointer when `result_ok` is set is undefined.
5513         pub err: *mut crate::lightning::ln::msgs::DecodeError,
5514 }
5515 #[repr(C)]
5516 /// A CResult_ChannelConfigDecodeErrorZ represents the result of a fallible operation,
5517 /// containing a crate::lightning::util::config::ChannelConfig on success and a crate::lightning::ln::msgs::DecodeError on failure.
5518 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5519 pub struct CResult_ChannelConfigDecodeErrorZ {
5520         /// The contents of this CResult_ChannelConfigDecodeErrorZ, accessible via either
5521         /// `err` or `result` depending on the state of `result_ok`.
5522         pub contents: CResult_ChannelConfigDecodeErrorZPtr,
5523         /// Whether this CResult_ChannelConfigDecodeErrorZ represents a success state.
5524         pub result_ok: bool,
5525 }
5526 #[no_mangle]
5527 /// Creates a new CResult_ChannelConfigDecodeErrorZ in the success state.
5528 pub extern "C" fn CResult_ChannelConfigDecodeErrorZ_ok(o: crate::lightning::util::config::ChannelConfig) -> CResult_ChannelConfigDecodeErrorZ {
5529         CResult_ChannelConfigDecodeErrorZ {
5530                 contents: CResult_ChannelConfigDecodeErrorZPtr {
5531                         result: Box::into_raw(Box::new(o)),
5532                 },
5533                 result_ok: true,
5534         }
5535 }
5536 #[no_mangle]
5537 /// Creates a new CResult_ChannelConfigDecodeErrorZ in the error state.
5538 pub extern "C" fn CResult_ChannelConfigDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelConfigDecodeErrorZ {
5539         CResult_ChannelConfigDecodeErrorZ {
5540                 contents: CResult_ChannelConfigDecodeErrorZPtr {
5541                         err: Box::into_raw(Box::new(e)),
5542                 },
5543                 result_ok: false,
5544         }
5545 }
5546 #[no_mangle]
5547 /// Frees any resources used by the CResult_ChannelConfigDecodeErrorZ.
5548 pub extern "C" fn CResult_ChannelConfigDecodeErrorZ_free(_res: CResult_ChannelConfigDecodeErrorZ) { }
5549 impl Drop for CResult_ChannelConfigDecodeErrorZ {
5550         fn drop(&mut self) {
5551                 if self.result_ok {
5552                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
5553                                 let _ = unsafe { Box::from_raw(self.contents.result) };
5554                         }
5555                 } else {
5556                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
5557                                 let _ = unsafe { Box::from_raw(self.contents.err) };
5558                         }
5559                 }
5560         }
5561 }
5562 impl From<crate::c_types::CResultTempl<crate::lightning::util::config::ChannelConfig, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelConfigDecodeErrorZ {
5563         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::util::config::ChannelConfig, crate::lightning::ln::msgs::DecodeError>) -> Self {
5564                 let contents = if o.result_ok {
5565                         let result = unsafe { o.contents.result };
5566                         unsafe { o.contents.result = std::ptr::null_mut() };
5567                         CResult_ChannelConfigDecodeErrorZPtr { result }
5568                 } else {
5569                         let err = unsafe { o.contents.err };
5570                         unsafe { o.contents.err = std::ptr::null_mut(); }
5571                         CResult_ChannelConfigDecodeErrorZPtr { err }
5572                 };
5573                 Self {
5574                         contents,
5575                         result_ok: o.result_ok,
5576                 }
5577         }
5578 }
5579 impl Clone for CResult_ChannelConfigDecodeErrorZ {
5580         fn clone(&self) -> Self {
5581                 if self.result_ok {
5582                         Self { result_ok: true, contents: CResult_ChannelConfigDecodeErrorZPtr {
5583                                 result: Box::into_raw(Box::new(<crate::lightning::util::config::ChannelConfig>::clone(unsafe { &*self.contents.result })))
5584                         } }
5585                 } else {
5586                         Self { result_ok: false, contents: CResult_ChannelConfigDecodeErrorZPtr {
5587                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
5588                         } }
5589                 }
5590         }
5591 }
5592 #[no_mangle]
5593 /// Creates a new CResult_ChannelConfigDecodeErrorZ which has the same data as `orig`
5594 /// but with all dynamically-allocated buffers duplicated in new buffers.
5595 pub extern "C" fn CResult_ChannelConfigDecodeErrorZ_clone(orig: &CResult_ChannelConfigDecodeErrorZ) -> CResult_ChannelConfigDecodeErrorZ { Clone::clone(&orig) }
5596 #[repr(C)]
5597 /// The contents of CResult_OutPointDecodeErrorZ
5598 pub union CResult_OutPointDecodeErrorZPtr {
5599         /// A pointer to the contents in the success state.
5600         /// Reading from this pointer when `result_ok` is not set is undefined.
5601         pub result: *mut crate::lightning::chain::transaction::OutPoint,
5602         /// A pointer to the contents in the error state.
5603         /// Reading from this pointer when `result_ok` is set is undefined.
5604         pub err: *mut crate::lightning::ln::msgs::DecodeError,
5605 }
5606 #[repr(C)]
5607 /// A CResult_OutPointDecodeErrorZ represents the result of a fallible operation,
5608 /// containing a crate::lightning::chain::transaction::OutPoint on success and a crate::lightning::ln::msgs::DecodeError on failure.
5609 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5610 pub struct CResult_OutPointDecodeErrorZ {
5611         /// The contents of this CResult_OutPointDecodeErrorZ, accessible via either
5612         /// `err` or `result` depending on the state of `result_ok`.
5613         pub contents: CResult_OutPointDecodeErrorZPtr,
5614         /// Whether this CResult_OutPointDecodeErrorZ represents a success state.
5615         pub result_ok: bool,
5616 }
5617 #[no_mangle]
5618 /// Creates a new CResult_OutPointDecodeErrorZ in the success state.
5619 pub extern "C" fn CResult_OutPointDecodeErrorZ_ok(o: crate::lightning::chain::transaction::OutPoint) -> CResult_OutPointDecodeErrorZ {
5620         CResult_OutPointDecodeErrorZ {
5621                 contents: CResult_OutPointDecodeErrorZPtr {
5622                         result: Box::into_raw(Box::new(o)),
5623                 },
5624                 result_ok: true,
5625         }
5626 }
5627 #[no_mangle]
5628 /// Creates a new CResult_OutPointDecodeErrorZ in the error state.
5629 pub extern "C" fn CResult_OutPointDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_OutPointDecodeErrorZ {
5630         CResult_OutPointDecodeErrorZ {
5631                 contents: CResult_OutPointDecodeErrorZPtr {
5632                         err: Box::into_raw(Box::new(e)),
5633                 },
5634                 result_ok: false,
5635         }
5636 }
5637 #[no_mangle]
5638 /// Frees any resources used by the CResult_OutPointDecodeErrorZ.
5639 pub extern "C" fn CResult_OutPointDecodeErrorZ_free(_res: CResult_OutPointDecodeErrorZ) { }
5640 impl Drop for CResult_OutPointDecodeErrorZ {
5641         fn drop(&mut self) {
5642                 if self.result_ok {
5643                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
5644                                 let _ = unsafe { Box::from_raw(self.contents.result) };
5645                         }
5646                 } else {
5647                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
5648                                 let _ = unsafe { Box::from_raw(self.contents.err) };
5649                         }
5650                 }
5651         }
5652 }
5653 impl From<crate::c_types::CResultTempl<crate::lightning::chain::transaction::OutPoint, crate::lightning::ln::msgs::DecodeError>> for CResult_OutPointDecodeErrorZ {
5654         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::transaction::OutPoint, crate::lightning::ln::msgs::DecodeError>) -> Self {
5655                 let contents = if o.result_ok {
5656                         let result = unsafe { o.contents.result };
5657                         unsafe { o.contents.result = std::ptr::null_mut() };
5658                         CResult_OutPointDecodeErrorZPtr { result }
5659                 } else {
5660                         let err = unsafe { o.contents.err };
5661                         unsafe { o.contents.err = std::ptr::null_mut(); }
5662                         CResult_OutPointDecodeErrorZPtr { err }
5663                 };
5664                 Self {
5665                         contents,
5666                         result_ok: o.result_ok,
5667                 }
5668         }
5669 }
5670 impl Clone for CResult_OutPointDecodeErrorZ {
5671         fn clone(&self) -> Self {
5672                 if self.result_ok {
5673                         Self { result_ok: true, contents: CResult_OutPointDecodeErrorZPtr {
5674                                 result: Box::into_raw(Box::new(<crate::lightning::chain::transaction::OutPoint>::clone(unsafe { &*self.contents.result })))
5675                         } }
5676                 } else {
5677                         Self { result_ok: false, contents: CResult_OutPointDecodeErrorZPtr {
5678                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
5679                         } }
5680                 }
5681         }
5682 }
5683 #[no_mangle]
5684 /// Creates a new CResult_OutPointDecodeErrorZ which has the same data as `orig`
5685 /// but with all dynamically-allocated buffers duplicated in new buffers.
5686 pub extern "C" fn CResult_OutPointDecodeErrorZ_clone(orig: &CResult_OutPointDecodeErrorZ) -> CResult_OutPointDecodeErrorZ { Clone::clone(&orig) }
5687 #[repr(C)]
5688 /// An enum which can either contain a crate::lightning::ln::wire::Type or not
5689 pub enum COption_TypeZ {
5690         /// When we're in this state, this COption_TypeZ contains a crate::lightning::ln::wire::Type
5691         Some(crate::lightning::ln::wire::Type),
5692         /// When we're in this state, this COption_TypeZ contains nothing
5693         None
5694 }
5695 impl COption_TypeZ {
5696         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
5697                 if let Self::Some(_) = self { true } else { false }
5698         }
5699         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
5700                 !self.is_some()
5701         }
5702         #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::ln::wire::Type {
5703                 if let Self::Some(v) = self { v } else { unreachable!() }
5704         }
5705 }
5706 #[no_mangle]
5707 /// Constructs a new COption_TypeZ containing a crate::lightning::ln::wire::Type
5708 pub extern "C" fn COption_TypeZ_some(o: crate::lightning::ln::wire::Type) -> COption_TypeZ {
5709         COption_TypeZ::Some(o)
5710 }
5711 #[no_mangle]
5712 /// Constructs a new COption_TypeZ containing nothing
5713 pub extern "C" fn COption_TypeZ_none() -> COption_TypeZ {
5714         COption_TypeZ::None
5715 }
5716 #[no_mangle]
5717 /// Frees any resources associated with the crate::lightning::ln::wire::Type, if we are in the Some state
5718 pub extern "C" fn COption_TypeZ_free(_res: COption_TypeZ) { }
5719 #[repr(C)]
5720 /// The contents of CResult_COption_TypeZDecodeErrorZ
5721 pub union CResult_COption_TypeZDecodeErrorZPtr {
5722         /// A pointer to the contents in the success state.
5723         /// Reading from this pointer when `result_ok` is not set is undefined.
5724         pub result: *mut crate::c_types::derived::COption_TypeZ,
5725         /// A pointer to the contents in the error state.
5726         /// Reading from this pointer when `result_ok` is set is undefined.
5727         pub err: *mut crate::lightning::ln::msgs::DecodeError,
5728 }
5729 #[repr(C)]
5730 /// A CResult_COption_TypeZDecodeErrorZ represents the result of a fallible operation,
5731 /// containing a crate::c_types::derived::COption_TypeZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
5732 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5733 pub struct CResult_COption_TypeZDecodeErrorZ {
5734         /// The contents of this CResult_COption_TypeZDecodeErrorZ, accessible via either
5735         /// `err` or `result` depending on the state of `result_ok`.
5736         pub contents: CResult_COption_TypeZDecodeErrorZPtr,
5737         /// Whether this CResult_COption_TypeZDecodeErrorZ represents a success state.
5738         pub result_ok: bool,
5739 }
5740 #[no_mangle]
5741 /// Creates a new CResult_COption_TypeZDecodeErrorZ in the success state.
5742 pub extern "C" fn CResult_COption_TypeZDecodeErrorZ_ok(o: crate::c_types::derived::COption_TypeZ) -> CResult_COption_TypeZDecodeErrorZ {
5743         CResult_COption_TypeZDecodeErrorZ {
5744                 contents: CResult_COption_TypeZDecodeErrorZPtr {
5745                         result: Box::into_raw(Box::new(o)),
5746                 },
5747                 result_ok: true,
5748         }
5749 }
5750 #[no_mangle]
5751 /// Creates a new CResult_COption_TypeZDecodeErrorZ in the error state.
5752 pub extern "C" fn CResult_COption_TypeZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_TypeZDecodeErrorZ {
5753         CResult_COption_TypeZDecodeErrorZ {
5754                 contents: CResult_COption_TypeZDecodeErrorZPtr {
5755                         err: Box::into_raw(Box::new(e)),
5756                 },
5757                 result_ok: false,
5758         }
5759 }
5760 #[no_mangle]
5761 /// Frees any resources used by the CResult_COption_TypeZDecodeErrorZ.
5762 pub extern "C" fn CResult_COption_TypeZDecodeErrorZ_free(_res: CResult_COption_TypeZDecodeErrorZ) { }
5763 impl Drop for CResult_COption_TypeZDecodeErrorZ {
5764         fn drop(&mut self) {
5765                 if self.result_ok {
5766                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
5767                                 let _ = unsafe { Box::from_raw(self.contents.result) };
5768                         }
5769                 } else {
5770                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
5771                                 let _ = unsafe { Box::from_raw(self.contents.err) };
5772                         }
5773                 }
5774         }
5775 }
5776 impl From<crate::c_types::CResultTempl<crate::c_types::derived::COption_TypeZ, crate::lightning::ln::msgs::DecodeError>> for CResult_COption_TypeZDecodeErrorZ {
5777         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::COption_TypeZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
5778                 let contents = if o.result_ok {
5779                         let result = unsafe { o.contents.result };
5780                         unsafe { o.contents.result = std::ptr::null_mut() };
5781                         CResult_COption_TypeZDecodeErrorZPtr { result }
5782                 } else {
5783                         let err = unsafe { o.contents.err };
5784                         unsafe { o.contents.err = std::ptr::null_mut(); }
5785                         CResult_COption_TypeZDecodeErrorZPtr { err }
5786                 };
5787                 Self {
5788                         contents,
5789                         result_ok: o.result_ok,
5790                 }
5791         }
5792 }
5793 #[repr(C)]
5794 /// The contents of CResult_PaymentIdPaymentErrorZ
5795 pub union CResult_PaymentIdPaymentErrorZPtr {
5796         /// A pointer to the contents in the success state.
5797         /// Reading from this pointer when `result_ok` is not set is undefined.
5798         pub result: *mut crate::c_types::ThirtyTwoBytes,
5799         /// A pointer to the contents in the error state.
5800         /// Reading from this pointer when `result_ok` is set is undefined.
5801         pub err: *mut crate::lightning_invoice::payment::PaymentError,
5802 }
5803 #[repr(C)]
5804 /// A CResult_PaymentIdPaymentErrorZ represents the result of a fallible operation,
5805 /// containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning_invoice::payment::PaymentError on failure.
5806 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5807 pub struct CResult_PaymentIdPaymentErrorZ {
5808         /// The contents of this CResult_PaymentIdPaymentErrorZ, accessible via either
5809         /// `err` or `result` depending on the state of `result_ok`.
5810         pub contents: CResult_PaymentIdPaymentErrorZPtr,
5811         /// Whether this CResult_PaymentIdPaymentErrorZ represents a success state.
5812         pub result_ok: bool,
5813 }
5814 #[no_mangle]
5815 /// Creates a new CResult_PaymentIdPaymentErrorZ in the success state.
5816 pub extern "C" fn CResult_PaymentIdPaymentErrorZ_ok(o: crate::c_types::ThirtyTwoBytes) -> CResult_PaymentIdPaymentErrorZ {
5817         CResult_PaymentIdPaymentErrorZ {
5818                 contents: CResult_PaymentIdPaymentErrorZPtr {
5819                         result: Box::into_raw(Box::new(o)),
5820                 },
5821                 result_ok: true,
5822         }
5823 }
5824 #[no_mangle]
5825 /// Creates a new CResult_PaymentIdPaymentErrorZ in the error state.
5826 pub extern "C" fn CResult_PaymentIdPaymentErrorZ_err(e: crate::lightning_invoice::payment::PaymentError) -> CResult_PaymentIdPaymentErrorZ {
5827         CResult_PaymentIdPaymentErrorZ {
5828                 contents: CResult_PaymentIdPaymentErrorZPtr {
5829                         err: Box::into_raw(Box::new(e)),
5830                 },
5831                 result_ok: false,
5832         }
5833 }
5834 #[no_mangle]
5835 /// Frees any resources used by the CResult_PaymentIdPaymentErrorZ.
5836 pub extern "C" fn CResult_PaymentIdPaymentErrorZ_free(_res: CResult_PaymentIdPaymentErrorZ) { }
5837 impl Drop for CResult_PaymentIdPaymentErrorZ {
5838         fn drop(&mut self) {
5839                 if self.result_ok {
5840                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
5841                                 let _ = unsafe { Box::from_raw(self.contents.result) };
5842                         }
5843                 } else {
5844                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
5845                                 let _ = unsafe { Box::from_raw(self.contents.err) };
5846                         }
5847                 }
5848         }
5849 }
5850 impl From<crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning_invoice::payment::PaymentError>> for CResult_PaymentIdPaymentErrorZ {
5851         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning_invoice::payment::PaymentError>) -> Self {
5852                 let contents = if o.result_ok {
5853                         let result = unsafe { o.contents.result };
5854                         unsafe { o.contents.result = std::ptr::null_mut() };
5855                         CResult_PaymentIdPaymentErrorZPtr { result }
5856                 } else {
5857                         let err = unsafe { o.contents.err };
5858                         unsafe { o.contents.err = std::ptr::null_mut(); }
5859                         CResult_PaymentIdPaymentErrorZPtr { err }
5860                 };
5861                 Self {
5862                         contents,
5863                         result_ok: o.result_ok,
5864                 }
5865         }
5866 }
5867 impl Clone for CResult_PaymentIdPaymentErrorZ {
5868         fn clone(&self) -> Self {
5869                 if self.result_ok {
5870                         Self { result_ok: true, contents: CResult_PaymentIdPaymentErrorZPtr {
5871                                 result: Box::into_raw(Box::new(<crate::c_types::ThirtyTwoBytes>::clone(unsafe { &*self.contents.result })))
5872                         } }
5873                 } else {
5874                         Self { result_ok: false, contents: CResult_PaymentIdPaymentErrorZPtr {
5875                                 err: Box::into_raw(Box::new(<crate::lightning_invoice::payment::PaymentError>::clone(unsafe { &*self.contents.err })))
5876                         } }
5877                 }
5878         }
5879 }
5880 #[no_mangle]
5881 /// Creates a new CResult_PaymentIdPaymentErrorZ which has the same data as `orig`
5882 /// but with all dynamically-allocated buffers duplicated in new buffers.
5883 pub extern "C" fn CResult_PaymentIdPaymentErrorZ_clone(orig: &CResult_PaymentIdPaymentErrorZ) -> CResult_PaymentIdPaymentErrorZ { Clone::clone(&orig) }
5884 #[repr(C)]
5885 /// The contents of CResult_SiPrefixNoneZ
5886 pub union CResult_SiPrefixNoneZPtr {
5887         /// A pointer to the contents in the success state.
5888         /// Reading from this pointer when `result_ok` is not set is undefined.
5889         pub result: *mut crate::lightning_invoice::SiPrefix,
5890         /// Note that this value is always NULL, as there are no contents in the Err variant
5891         pub err: *mut std::ffi::c_void,
5892 }
5893 #[repr(C)]
5894 /// A CResult_SiPrefixNoneZ represents the result of a fallible operation,
5895 /// containing a crate::lightning_invoice::SiPrefix on success and a () on failure.
5896 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5897 pub struct CResult_SiPrefixNoneZ {
5898         /// The contents of this CResult_SiPrefixNoneZ, accessible via either
5899         /// `err` or `result` depending on the state of `result_ok`.
5900         pub contents: CResult_SiPrefixNoneZPtr,
5901         /// Whether this CResult_SiPrefixNoneZ represents a success state.
5902         pub result_ok: bool,
5903 }
5904 #[no_mangle]
5905 /// Creates a new CResult_SiPrefixNoneZ in the success state.
5906 pub extern "C" fn CResult_SiPrefixNoneZ_ok(o: crate::lightning_invoice::SiPrefix) -> CResult_SiPrefixNoneZ {
5907         CResult_SiPrefixNoneZ {
5908                 contents: CResult_SiPrefixNoneZPtr {
5909                         result: Box::into_raw(Box::new(o)),
5910                 },
5911                 result_ok: true,
5912         }
5913 }
5914 #[no_mangle]
5915 /// Creates a new CResult_SiPrefixNoneZ in the error state.
5916 pub extern "C" fn CResult_SiPrefixNoneZ_err() -> CResult_SiPrefixNoneZ {
5917         CResult_SiPrefixNoneZ {
5918                 contents: CResult_SiPrefixNoneZPtr {
5919                         err: std::ptr::null_mut(),
5920                 },
5921                 result_ok: false,
5922         }
5923 }
5924 #[no_mangle]
5925 /// Frees any resources used by the CResult_SiPrefixNoneZ.
5926 pub extern "C" fn CResult_SiPrefixNoneZ_free(_res: CResult_SiPrefixNoneZ) { }
5927 impl Drop for CResult_SiPrefixNoneZ {
5928         fn drop(&mut self) {
5929                 if self.result_ok {
5930                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
5931                                 let _ = unsafe { Box::from_raw(self.contents.result) };
5932                         }
5933                 } else {
5934                 }
5935         }
5936 }
5937 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::SiPrefix, ()>> for CResult_SiPrefixNoneZ {
5938         fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::SiPrefix, ()>) -> Self {
5939                 let contents = if o.result_ok {
5940                         let result = unsafe { o.contents.result };
5941                         unsafe { o.contents.result = std::ptr::null_mut() };
5942                         CResult_SiPrefixNoneZPtr { result }
5943                 } else {
5944                         let _ = unsafe { Box::from_raw(o.contents.err) };
5945                         o.contents.err = std::ptr::null_mut();
5946                         CResult_SiPrefixNoneZPtr { err: std::ptr::null_mut() }
5947                 };
5948                 Self {
5949                         contents,
5950                         result_ok: o.result_ok,
5951                 }
5952         }
5953 }
5954 impl Clone for CResult_SiPrefixNoneZ {
5955         fn clone(&self) -> Self {
5956                 if self.result_ok {
5957                         Self { result_ok: true, contents: CResult_SiPrefixNoneZPtr {
5958                                 result: Box::into_raw(Box::new(<crate::lightning_invoice::SiPrefix>::clone(unsafe { &*self.contents.result })))
5959                         } }
5960                 } else {
5961                         Self { result_ok: false, contents: CResult_SiPrefixNoneZPtr {
5962                                 err: std::ptr::null_mut()
5963                         } }
5964                 }
5965         }
5966 }
5967 #[no_mangle]
5968 /// Creates a new CResult_SiPrefixNoneZ which has the same data as `orig`
5969 /// but with all dynamically-allocated buffers duplicated in new buffers.
5970 pub extern "C" fn CResult_SiPrefixNoneZ_clone(orig: &CResult_SiPrefixNoneZ) -> CResult_SiPrefixNoneZ { Clone::clone(&orig) }
5971 #[repr(C)]
5972 /// The contents of CResult_InvoiceNoneZ
5973 pub union CResult_InvoiceNoneZPtr {
5974         /// A pointer to the contents in the success state.
5975         /// Reading from this pointer when `result_ok` is not set is undefined.
5976         pub result: *mut crate::lightning_invoice::Invoice,
5977         /// Note that this value is always NULL, as there are no contents in the Err variant
5978         pub err: *mut std::ffi::c_void,
5979 }
5980 #[repr(C)]
5981 /// A CResult_InvoiceNoneZ represents the result of a fallible operation,
5982 /// containing a crate::lightning_invoice::Invoice on success and a () on failure.
5983 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5984 pub struct CResult_InvoiceNoneZ {
5985         /// The contents of this CResult_InvoiceNoneZ, accessible via either
5986         /// `err` or `result` depending on the state of `result_ok`.
5987         pub contents: CResult_InvoiceNoneZPtr,
5988         /// Whether this CResult_InvoiceNoneZ represents a success state.
5989         pub result_ok: bool,
5990 }
5991 #[no_mangle]
5992 /// Creates a new CResult_InvoiceNoneZ in the success state.
5993 pub extern "C" fn CResult_InvoiceNoneZ_ok(o: crate::lightning_invoice::Invoice) -> CResult_InvoiceNoneZ {
5994         CResult_InvoiceNoneZ {
5995                 contents: CResult_InvoiceNoneZPtr {
5996                         result: Box::into_raw(Box::new(o)),
5997                 },
5998                 result_ok: true,
5999         }
6000 }
6001 #[no_mangle]
6002 /// Creates a new CResult_InvoiceNoneZ in the error state.
6003 pub extern "C" fn CResult_InvoiceNoneZ_err() -> CResult_InvoiceNoneZ {
6004         CResult_InvoiceNoneZ {
6005                 contents: CResult_InvoiceNoneZPtr {
6006                         err: std::ptr::null_mut(),
6007                 },
6008                 result_ok: false,
6009         }
6010 }
6011 #[no_mangle]
6012 /// Frees any resources used by the CResult_InvoiceNoneZ.
6013 pub extern "C" fn CResult_InvoiceNoneZ_free(_res: CResult_InvoiceNoneZ) { }
6014 impl Drop for CResult_InvoiceNoneZ {
6015         fn drop(&mut self) {
6016                 if self.result_ok {
6017                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
6018                                 let _ = unsafe { Box::from_raw(self.contents.result) };
6019                         }
6020                 } else {
6021                 }
6022         }
6023 }
6024 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::Invoice, ()>> for CResult_InvoiceNoneZ {
6025         fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::Invoice, ()>) -> Self {
6026                 let contents = if o.result_ok {
6027                         let result = unsafe { o.contents.result };
6028                         unsafe { o.contents.result = std::ptr::null_mut() };
6029                         CResult_InvoiceNoneZPtr { result }
6030                 } else {
6031                         let _ = unsafe { Box::from_raw(o.contents.err) };
6032                         o.contents.err = std::ptr::null_mut();
6033                         CResult_InvoiceNoneZPtr { err: std::ptr::null_mut() }
6034                 };
6035                 Self {
6036                         contents,
6037                         result_ok: o.result_ok,
6038                 }
6039         }
6040 }
6041 impl Clone for CResult_InvoiceNoneZ {
6042         fn clone(&self) -> Self {
6043                 if self.result_ok {
6044                         Self { result_ok: true, contents: CResult_InvoiceNoneZPtr {
6045                                 result: Box::into_raw(Box::new(<crate::lightning_invoice::Invoice>::clone(unsafe { &*self.contents.result })))
6046                         } }
6047                 } else {
6048                         Self { result_ok: false, contents: CResult_InvoiceNoneZPtr {
6049                                 err: std::ptr::null_mut()
6050                         } }
6051                 }
6052         }
6053 }
6054 #[no_mangle]
6055 /// Creates a new CResult_InvoiceNoneZ which has the same data as `orig`
6056 /// but with all dynamically-allocated buffers duplicated in new buffers.
6057 pub extern "C" fn CResult_InvoiceNoneZ_clone(orig: &CResult_InvoiceNoneZ) -> CResult_InvoiceNoneZ { Clone::clone(&orig) }
6058 #[repr(C)]
6059 /// The contents of CResult_SignedRawInvoiceNoneZ
6060 pub union CResult_SignedRawInvoiceNoneZPtr {
6061         /// A pointer to the contents in the success state.
6062         /// Reading from this pointer when `result_ok` is not set is undefined.
6063         pub result: *mut crate::lightning_invoice::SignedRawInvoice,
6064         /// Note that this value is always NULL, as there are no contents in the Err variant
6065         pub err: *mut std::ffi::c_void,
6066 }
6067 #[repr(C)]
6068 /// A CResult_SignedRawInvoiceNoneZ represents the result of a fallible operation,
6069 /// containing a crate::lightning_invoice::SignedRawInvoice on success and a () on failure.
6070 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6071 pub struct CResult_SignedRawInvoiceNoneZ {
6072         /// The contents of this CResult_SignedRawInvoiceNoneZ, accessible via either
6073         /// `err` or `result` depending on the state of `result_ok`.
6074         pub contents: CResult_SignedRawInvoiceNoneZPtr,
6075         /// Whether this CResult_SignedRawInvoiceNoneZ represents a success state.
6076         pub result_ok: bool,
6077 }
6078 #[no_mangle]
6079 /// Creates a new CResult_SignedRawInvoiceNoneZ in the success state.
6080 pub extern "C" fn CResult_SignedRawInvoiceNoneZ_ok(o: crate::lightning_invoice::SignedRawInvoice) -> CResult_SignedRawInvoiceNoneZ {
6081         CResult_SignedRawInvoiceNoneZ {
6082                 contents: CResult_SignedRawInvoiceNoneZPtr {
6083                         result: Box::into_raw(Box::new(o)),
6084                 },
6085                 result_ok: true,
6086         }
6087 }
6088 #[no_mangle]
6089 /// Creates a new CResult_SignedRawInvoiceNoneZ in the error state.
6090 pub extern "C" fn CResult_SignedRawInvoiceNoneZ_err() -> CResult_SignedRawInvoiceNoneZ {
6091         CResult_SignedRawInvoiceNoneZ {
6092                 contents: CResult_SignedRawInvoiceNoneZPtr {
6093                         err: std::ptr::null_mut(),
6094                 },
6095                 result_ok: false,
6096         }
6097 }
6098 #[no_mangle]
6099 /// Frees any resources used by the CResult_SignedRawInvoiceNoneZ.
6100 pub extern "C" fn CResult_SignedRawInvoiceNoneZ_free(_res: CResult_SignedRawInvoiceNoneZ) { }
6101 impl Drop for CResult_SignedRawInvoiceNoneZ {
6102         fn drop(&mut self) {
6103                 if self.result_ok {
6104                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
6105                                 let _ = unsafe { Box::from_raw(self.contents.result) };
6106                         }
6107                 } else {
6108                 }
6109         }
6110 }
6111 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::SignedRawInvoice, ()>> for CResult_SignedRawInvoiceNoneZ {
6112         fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::SignedRawInvoice, ()>) -> Self {
6113                 let contents = if o.result_ok {
6114                         let result = unsafe { o.contents.result };
6115                         unsafe { o.contents.result = std::ptr::null_mut() };
6116                         CResult_SignedRawInvoiceNoneZPtr { result }
6117                 } else {
6118                         let _ = unsafe { Box::from_raw(o.contents.err) };
6119                         o.contents.err = std::ptr::null_mut();
6120                         CResult_SignedRawInvoiceNoneZPtr { err: std::ptr::null_mut() }
6121                 };
6122                 Self {
6123                         contents,
6124                         result_ok: o.result_ok,
6125                 }
6126         }
6127 }
6128 impl Clone for CResult_SignedRawInvoiceNoneZ {
6129         fn clone(&self) -> Self {
6130                 if self.result_ok {
6131                         Self { result_ok: true, contents: CResult_SignedRawInvoiceNoneZPtr {
6132                                 result: Box::into_raw(Box::new(<crate::lightning_invoice::SignedRawInvoice>::clone(unsafe { &*self.contents.result })))
6133                         } }
6134                 } else {
6135                         Self { result_ok: false, contents: CResult_SignedRawInvoiceNoneZPtr {
6136                                 err: std::ptr::null_mut()
6137                         } }
6138                 }
6139         }
6140 }
6141 #[no_mangle]
6142 /// Creates a new CResult_SignedRawInvoiceNoneZ which has the same data as `orig`
6143 /// but with all dynamically-allocated buffers duplicated in new buffers.
6144 pub extern "C" fn CResult_SignedRawInvoiceNoneZ_clone(orig: &CResult_SignedRawInvoiceNoneZ) -> CResult_SignedRawInvoiceNoneZ { Clone::clone(&orig) }
6145 #[repr(C)]
6146 /// A tuple of 3 elements. See the individual fields for the types contained.
6147 pub struct C3Tuple_RawInvoice_u832InvoiceSignatureZ {
6148         /// The element at position 0
6149         pub a: crate::lightning_invoice::RawInvoice,
6150         /// The element at position 1
6151         pub b: crate::c_types::ThirtyTwoBytes,
6152         /// The element at position 2
6153         pub c: crate::lightning_invoice::InvoiceSignature,
6154 }
6155 impl From<(crate::lightning_invoice::RawInvoice, crate::c_types::ThirtyTwoBytes, crate::lightning_invoice::InvoiceSignature)> for C3Tuple_RawInvoice_u832InvoiceSignatureZ {
6156         fn from (tup: (crate::lightning_invoice::RawInvoice, crate::c_types::ThirtyTwoBytes, crate::lightning_invoice::InvoiceSignature)) -> Self {
6157                 Self {
6158                         a: tup.0,
6159                         b: tup.1,
6160                         c: tup.2,
6161                 }
6162         }
6163 }
6164 impl C3Tuple_RawInvoice_u832InvoiceSignatureZ {
6165         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::lightning_invoice::RawInvoice, crate::c_types::ThirtyTwoBytes, crate::lightning_invoice::InvoiceSignature) {
6166                 (self.a, self.b, self.c)
6167         }
6168 }
6169 impl Clone for C3Tuple_RawInvoice_u832InvoiceSignatureZ {
6170         fn clone(&self) -> Self {
6171                 Self {
6172                         a: Clone::clone(&self.a),
6173                         b: Clone::clone(&self.b),
6174                         c: Clone::clone(&self.c),
6175                 }
6176         }
6177 }
6178 #[no_mangle]
6179 /// Creates a new tuple which has the same data as `orig`
6180 /// but with all dynamically-allocated buffers duplicated in new buffers.
6181 pub extern "C" fn C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone(orig: &C3Tuple_RawInvoice_u832InvoiceSignatureZ) -> C3Tuple_RawInvoice_u832InvoiceSignatureZ { Clone::clone(&orig) }
6182 /// Creates a new C3Tuple_RawInvoice_u832InvoiceSignatureZ from the contained elements.
6183 #[no_mangle]
6184 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 {
6185         C3Tuple_RawInvoice_u832InvoiceSignatureZ { a, b, c, }
6186 }
6187
6188 #[no_mangle]
6189 /// Frees any resources used by the C3Tuple_RawInvoice_u832InvoiceSignatureZ.
6190 pub extern "C" fn C3Tuple_RawInvoice_u832InvoiceSignatureZ_free(_res: C3Tuple_RawInvoice_u832InvoiceSignatureZ) { }
6191 #[repr(C)]
6192 /// The contents of CResult_PayeePubKeyErrorZ
6193 pub union CResult_PayeePubKeyErrorZPtr {
6194         /// A pointer to the contents in the success state.
6195         /// Reading from this pointer when `result_ok` is not set is undefined.
6196         pub result: *mut crate::lightning_invoice::PayeePubKey,
6197         /// A pointer to the contents in the error state.
6198         /// Reading from this pointer when `result_ok` is set is undefined.
6199         pub err: *mut crate::c_types::Secp256k1Error,
6200 }
6201 #[repr(C)]
6202 /// A CResult_PayeePubKeyErrorZ represents the result of a fallible operation,
6203 /// containing a crate::lightning_invoice::PayeePubKey on success and a crate::c_types::Secp256k1Error on failure.
6204 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6205 pub struct CResult_PayeePubKeyErrorZ {
6206         /// The contents of this CResult_PayeePubKeyErrorZ, accessible via either
6207         /// `err` or `result` depending on the state of `result_ok`.
6208         pub contents: CResult_PayeePubKeyErrorZPtr,
6209         /// Whether this CResult_PayeePubKeyErrorZ represents a success state.
6210         pub result_ok: bool,
6211 }
6212 #[no_mangle]
6213 /// Creates a new CResult_PayeePubKeyErrorZ in the success state.
6214 pub extern "C" fn CResult_PayeePubKeyErrorZ_ok(o: crate::lightning_invoice::PayeePubKey) -> CResult_PayeePubKeyErrorZ {
6215         CResult_PayeePubKeyErrorZ {
6216                 contents: CResult_PayeePubKeyErrorZPtr {
6217                         result: Box::into_raw(Box::new(o)),
6218                 },
6219                 result_ok: true,
6220         }
6221 }
6222 #[no_mangle]
6223 /// Creates a new CResult_PayeePubKeyErrorZ in the error state.
6224 pub extern "C" fn CResult_PayeePubKeyErrorZ_err(e: crate::c_types::Secp256k1Error) -> CResult_PayeePubKeyErrorZ {
6225         CResult_PayeePubKeyErrorZ {
6226                 contents: CResult_PayeePubKeyErrorZPtr {
6227                         err: Box::into_raw(Box::new(e)),
6228                 },
6229                 result_ok: false,
6230         }
6231 }
6232 #[no_mangle]
6233 /// Frees any resources used by the CResult_PayeePubKeyErrorZ.
6234 pub extern "C" fn CResult_PayeePubKeyErrorZ_free(_res: CResult_PayeePubKeyErrorZ) { }
6235 impl Drop for CResult_PayeePubKeyErrorZ {
6236         fn drop(&mut self) {
6237                 if self.result_ok {
6238                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
6239                                 let _ = unsafe { Box::from_raw(self.contents.result) };
6240                         }
6241                 } else {
6242                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
6243                                 let _ = unsafe { Box::from_raw(self.contents.err) };
6244                         }
6245                 }
6246         }
6247 }
6248 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::PayeePubKey, crate::c_types::Secp256k1Error>> for CResult_PayeePubKeyErrorZ {
6249         fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::PayeePubKey, crate::c_types::Secp256k1Error>) -> Self {
6250                 let contents = if o.result_ok {
6251                         let result = unsafe { o.contents.result };
6252                         unsafe { o.contents.result = std::ptr::null_mut() };
6253                         CResult_PayeePubKeyErrorZPtr { result }
6254                 } else {
6255                         let err = unsafe { o.contents.err };
6256                         unsafe { o.contents.err = std::ptr::null_mut(); }
6257                         CResult_PayeePubKeyErrorZPtr { err }
6258                 };
6259                 Self {
6260                         contents,
6261                         result_ok: o.result_ok,
6262                 }
6263         }
6264 }
6265 impl Clone for CResult_PayeePubKeyErrorZ {
6266         fn clone(&self) -> Self {
6267                 if self.result_ok {
6268                         Self { result_ok: true, contents: CResult_PayeePubKeyErrorZPtr {
6269                                 result: Box::into_raw(Box::new(<crate::lightning_invoice::PayeePubKey>::clone(unsafe { &*self.contents.result })))
6270                         } }
6271                 } else {
6272                         Self { result_ok: false, contents: CResult_PayeePubKeyErrorZPtr {
6273                                 err: Box::into_raw(Box::new(<crate::c_types::Secp256k1Error>::clone(unsafe { &*self.contents.err })))
6274                         } }
6275                 }
6276         }
6277 }
6278 #[no_mangle]
6279 /// Creates a new CResult_PayeePubKeyErrorZ which has the same data as `orig`
6280 /// but with all dynamically-allocated buffers duplicated in new buffers.
6281 pub extern "C" fn CResult_PayeePubKeyErrorZ_clone(orig: &CResult_PayeePubKeyErrorZ) -> CResult_PayeePubKeyErrorZ { Clone::clone(&orig) }
6282 #[repr(C)]
6283 /// A dynamically-allocated array of crate::lightning_invoice::PrivateRoutes of arbitrary size.
6284 /// This corresponds to std::vector in C++
6285 pub struct CVec_PrivateRouteZ {
6286         /// The elements in the array.
6287         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
6288         pub data: *mut crate::lightning_invoice::PrivateRoute,
6289         /// The number of elements pointed to by `data`.
6290         pub datalen: usize
6291 }
6292 impl CVec_PrivateRouteZ {
6293         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning_invoice::PrivateRoute> {
6294                 if self.datalen == 0 { return Vec::new(); }
6295                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
6296                 self.data = std::ptr::null_mut();
6297                 self.datalen = 0;
6298                 ret
6299         }
6300         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning_invoice::PrivateRoute] {
6301                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
6302         }
6303 }
6304 impl From<Vec<crate::lightning_invoice::PrivateRoute>> for CVec_PrivateRouteZ {
6305         fn from(v: Vec<crate::lightning_invoice::PrivateRoute>) -> Self {
6306                 let datalen = v.len();
6307                 let data = Box::into_raw(v.into_boxed_slice());
6308                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
6309         }
6310 }
6311 #[no_mangle]
6312 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
6313 pub extern "C" fn CVec_PrivateRouteZ_free(_res: CVec_PrivateRouteZ) { }
6314 impl Drop for CVec_PrivateRouteZ {
6315         fn drop(&mut self) {
6316                 if self.datalen == 0 { return; }
6317                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
6318         }
6319 }
6320 impl Clone for CVec_PrivateRouteZ {
6321         fn clone(&self) -> Self {
6322                 let mut res = Vec::new();
6323                 if self.datalen == 0 { return Self::from(res); }
6324                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
6325                 Self::from(res)
6326         }
6327 }
6328 #[repr(C)]
6329 /// The contents of CResult_PositiveTimestampCreationErrorZ
6330 pub union CResult_PositiveTimestampCreationErrorZPtr {
6331         /// A pointer to the contents in the success state.
6332         /// Reading from this pointer when `result_ok` is not set is undefined.
6333         pub result: *mut crate::lightning_invoice::PositiveTimestamp,
6334         /// A pointer to the contents in the error state.
6335         /// Reading from this pointer when `result_ok` is set is undefined.
6336         pub err: *mut crate::lightning_invoice::CreationError,
6337 }
6338 #[repr(C)]
6339 /// A CResult_PositiveTimestampCreationErrorZ represents the result of a fallible operation,
6340 /// containing a crate::lightning_invoice::PositiveTimestamp on success and a crate::lightning_invoice::CreationError on failure.
6341 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6342 pub struct CResult_PositiveTimestampCreationErrorZ {
6343         /// The contents of this CResult_PositiveTimestampCreationErrorZ, accessible via either
6344         /// `err` or `result` depending on the state of `result_ok`.
6345         pub contents: CResult_PositiveTimestampCreationErrorZPtr,
6346         /// Whether this CResult_PositiveTimestampCreationErrorZ represents a success state.
6347         pub result_ok: bool,
6348 }
6349 #[no_mangle]
6350 /// Creates a new CResult_PositiveTimestampCreationErrorZ in the success state.
6351 pub extern "C" fn CResult_PositiveTimestampCreationErrorZ_ok(o: crate::lightning_invoice::PositiveTimestamp) -> CResult_PositiveTimestampCreationErrorZ {
6352         CResult_PositiveTimestampCreationErrorZ {
6353                 contents: CResult_PositiveTimestampCreationErrorZPtr {
6354                         result: Box::into_raw(Box::new(o)),
6355                 },
6356                 result_ok: true,
6357         }
6358 }
6359 #[no_mangle]
6360 /// Creates a new CResult_PositiveTimestampCreationErrorZ in the error state.
6361 pub extern "C" fn CResult_PositiveTimestampCreationErrorZ_err(e: crate::lightning_invoice::CreationError) -> CResult_PositiveTimestampCreationErrorZ {
6362         CResult_PositiveTimestampCreationErrorZ {
6363                 contents: CResult_PositiveTimestampCreationErrorZPtr {
6364                         err: Box::into_raw(Box::new(e)),
6365                 },
6366                 result_ok: false,
6367         }
6368 }
6369 #[no_mangle]
6370 /// Frees any resources used by the CResult_PositiveTimestampCreationErrorZ.
6371 pub extern "C" fn CResult_PositiveTimestampCreationErrorZ_free(_res: CResult_PositiveTimestampCreationErrorZ) { }
6372 impl Drop for CResult_PositiveTimestampCreationErrorZ {
6373         fn drop(&mut self) {
6374                 if self.result_ok {
6375                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
6376                                 let _ = unsafe { Box::from_raw(self.contents.result) };
6377                         }
6378                 } else {
6379                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
6380                                 let _ = unsafe { Box::from_raw(self.contents.err) };
6381                         }
6382                 }
6383         }
6384 }
6385 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::PositiveTimestamp, crate::lightning_invoice::CreationError>> for CResult_PositiveTimestampCreationErrorZ {
6386         fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::PositiveTimestamp, crate::lightning_invoice::CreationError>) -> Self {
6387                 let contents = if o.result_ok {
6388                         let result = unsafe { o.contents.result };
6389                         unsafe { o.contents.result = std::ptr::null_mut() };
6390                         CResult_PositiveTimestampCreationErrorZPtr { result }
6391                 } else {
6392                         let err = unsafe { o.contents.err };
6393                         unsafe { o.contents.err = std::ptr::null_mut(); }
6394                         CResult_PositiveTimestampCreationErrorZPtr { err }
6395                 };
6396                 Self {
6397                         contents,
6398                         result_ok: o.result_ok,
6399                 }
6400         }
6401 }
6402 impl Clone for CResult_PositiveTimestampCreationErrorZ {
6403         fn clone(&self) -> Self {
6404                 if self.result_ok {
6405                         Self { result_ok: true, contents: CResult_PositiveTimestampCreationErrorZPtr {
6406                                 result: Box::into_raw(Box::new(<crate::lightning_invoice::PositiveTimestamp>::clone(unsafe { &*self.contents.result })))
6407                         } }
6408                 } else {
6409                         Self { result_ok: false, contents: CResult_PositiveTimestampCreationErrorZPtr {
6410                                 err: Box::into_raw(Box::new(<crate::lightning_invoice::CreationError>::clone(unsafe { &*self.contents.err })))
6411                         } }
6412                 }
6413         }
6414 }
6415 #[no_mangle]
6416 /// Creates a new CResult_PositiveTimestampCreationErrorZ which has the same data as `orig`
6417 /// but with all dynamically-allocated buffers duplicated in new buffers.
6418 pub extern "C" fn CResult_PositiveTimestampCreationErrorZ_clone(orig: &CResult_PositiveTimestampCreationErrorZ) -> CResult_PositiveTimestampCreationErrorZ { Clone::clone(&orig) }
6419 #[repr(C)]
6420 /// The contents of CResult_NoneSemanticErrorZ
6421 pub union CResult_NoneSemanticErrorZPtr {
6422         /// Note that this value is always NULL, as there are no contents in the OK variant
6423         pub result: *mut std::ffi::c_void,
6424         /// A pointer to the contents in the error state.
6425         /// Reading from this pointer when `result_ok` is set is undefined.
6426         pub err: *mut crate::lightning_invoice::SemanticError,
6427 }
6428 #[repr(C)]
6429 /// A CResult_NoneSemanticErrorZ represents the result of a fallible operation,
6430 /// containing a () on success and a crate::lightning_invoice::SemanticError on failure.
6431 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6432 pub struct CResult_NoneSemanticErrorZ {
6433         /// The contents of this CResult_NoneSemanticErrorZ, accessible via either
6434         /// `err` or `result` depending on the state of `result_ok`.
6435         pub contents: CResult_NoneSemanticErrorZPtr,
6436         /// Whether this CResult_NoneSemanticErrorZ represents a success state.
6437         pub result_ok: bool,
6438 }
6439 #[no_mangle]
6440 /// Creates a new CResult_NoneSemanticErrorZ in the success state.
6441 pub extern "C" fn CResult_NoneSemanticErrorZ_ok() -> CResult_NoneSemanticErrorZ {
6442         CResult_NoneSemanticErrorZ {
6443                 contents: CResult_NoneSemanticErrorZPtr {
6444                         result: std::ptr::null_mut(),
6445                 },
6446                 result_ok: true,
6447         }
6448 }
6449 #[no_mangle]
6450 /// Creates a new CResult_NoneSemanticErrorZ in the error state.
6451 pub extern "C" fn CResult_NoneSemanticErrorZ_err(e: crate::lightning_invoice::SemanticError) -> CResult_NoneSemanticErrorZ {
6452         CResult_NoneSemanticErrorZ {
6453                 contents: CResult_NoneSemanticErrorZPtr {
6454                         err: Box::into_raw(Box::new(e)),
6455                 },
6456                 result_ok: false,
6457         }
6458 }
6459 #[no_mangle]
6460 /// Frees any resources used by the CResult_NoneSemanticErrorZ.
6461 pub extern "C" fn CResult_NoneSemanticErrorZ_free(_res: CResult_NoneSemanticErrorZ) { }
6462 impl Drop for CResult_NoneSemanticErrorZ {
6463         fn drop(&mut self) {
6464                 if self.result_ok {
6465                 } else {
6466                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
6467                                 let _ = unsafe { Box::from_raw(self.contents.err) };
6468                         }
6469                 }
6470         }
6471 }
6472 impl From<crate::c_types::CResultTempl<(), crate::lightning_invoice::SemanticError>> for CResult_NoneSemanticErrorZ {
6473         fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning_invoice::SemanticError>) -> Self {
6474                 let contents = if o.result_ok {
6475                         let _ = unsafe { Box::from_raw(o.contents.result) };
6476                         o.contents.result = std::ptr::null_mut();
6477                         CResult_NoneSemanticErrorZPtr { result: std::ptr::null_mut() }
6478                 } else {
6479                         let err = unsafe { o.contents.err };
6480                         unsafe { o.contents.err = std::ptr::null_mut(); }
6481                         CResult_NoneSemanticErrorZPtr { err }
6482                 };
6483                 Self {
6484                         contents,
6485                         result_ok: o.result_ok,
6486                 }
6487         }
6488 }
6489 impl Clone for CResult_NoneSemanticErrorZ {
6490         fn clone(&self) -> Self {
6491                 if self.result_ok {
6492                         Self { result_ok: true, contents: CResult_NoneSemanticErrorZPtr {
6493                                 result: std::ptr::null_mut()
6494                         } }
6495                 } else {
6496                         Self { result_ok: false, contents: CResult_NoneSemanticErrorZPtr {
6497                                 err: Box::into_raw(Box::new(<crate::lightning_invoice::SemanticError>::clone(unsafe { &*self.contents.err })))
6498                         } }
6499                 }
6500         }
6501 }
6502 #[no_mangle]
6503 /// Creates a new CResult_NoneSemanticErrorZ which has the same data as `orig`
6504 /// but with all dynamically-allocated buffers duplicated in new buffers.
6505 pub extern "C" fn CResult_NoneSemanticErrorZ_clone(orig: &CResult_NoneSemanticErrorZ) -> CResult_NoneSemanticErrorZ { Clone::clone(&orig) }
6506 #[repr(C)]
6507 /// The contents of CResult_InvoiceSemanticErrorZ
6508 pub union CResult_InvoiceSemanticErrorZPtr {
6509         /// A pointer to the contents in the success state.
6510         /// Reading from this pointer when `result_ok` is not set is undefined.
6511         pub result: *mut crate::lightning_invoice::Invoice,
6512         /// A pointer to the contents in the error state.
6513         /// Reading from this pointer when `result_ok` is set is undefined.
6514         pub err: *mut crate::lightning_invoice::SemanticError,
6515 }
6516 #[repr(C)]
6517 /// A CResult_InvoiceSemanticErrorZ represents the result of a fallible operation,
6518 /// containing a crate::lightning_invoice::Invoice on success and a crate::lightning_invoice::SemanticError on failure.
6519 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6520 pub struct CResult_InvoiceSemanticErrorZ {
6521         /// The contents of this CResult_InvoiceSemanticErrorZ, accessible via either
6522         /// `err` or `result` depending on the state of `result_ok`.
6523         pub contents: CResult_InvoiceSemanticErrorZPtr,
6524         /// Whether this CResult_InvoiceSemanticErrorZ represents a success state.
6525         pub result_ok: bool,
6526 }
6527 #[no_mangle]
6528 /// Creates a new CResult_InvoiceSemanticErrorZ in the success state.
6529 pub extern "C" fn CResult_InvoiceSemanticErrorZ_ok(o: crate::lightning_invoice::Invoice) -> CResult_InvoiceSemanticErrorZ {
6530         CResult_InvoiceSemanticErrorZ {
6531                 contents: CResult_InvoiceSemanticErrorZPtr {
6532                         result: Box::into_raw(Box::new(o)),
6533                 },
6534                 result_ok: true,
6535         }
6536 }
6537 #[no_mangle]
6538 /// Creates a new CResult_InvoiceSemanticErrorZ in the error state.
6539 pub extern "C" fn CResult_InvoiceSemanticErrorZ_err(e: crate::lightning_invoice::SemanticError) -> CResult_InvoiceSemanticErrorZ {
6540         CResult_InvoiceSemanticErrorZ {
6541                 contents: CResult_InvoiceSemanticErrorZPtr {
6542                         err: Box::into_raw(Box::new(e)),
6543                 },
6544                 result_ok: false,
6545         }
6546 }
6547 #[no_mangle]
6548 /// Frees any resources used by the CResult_InvoiceSemanticErrorZ.
6549 pub extern "C" fn CResult_InvoiceSemanticErrorZ_free(_res: CResult_InvoiceSemanticErrorZ) { }
6550 impl Drop for CResult_InvoiceSemanticErrorZ {
6551         fn drop(&mut self) {
6552                 if self.result_ok {
6553                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
6554                                 let _ = unsafe { Box::from_raw(self.contents.result) };
6555                         }
6556                 } else {
6557                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
6558                                 let _ = unsafe { Box::from_raw(self.contents.err) };
6559                         }
6560                 }
6561         }
6562 }
6563 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::Invoice, crate::lightning_invoice::SemanticError>> for CResult_InvoiceSemanticErrorZ {
6564         fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::Invoice, crate::lightning_invoice::SemanticError>) -> Self {
6565                 let contents = if o.result_ok {
6566                         let result = unsafe { o.contents.result };
6567                         unsafe { o.contents.result = std::ptr::null_mut() };
6568                         CResult_InvoiceSemanticErrorZPtr { result }
6569                 } else {
6570                         let err = unsafe { o.contents.err };
6571                         unsafe { o.contents.err = std::ptr::null_mut(); }
6572                         CResult_InvoiceSemanticErrorZPtr { err }
6573                 };
6574                 Self {
6575                         contents,
6576                         result_ok: o.result_ok,
6577                 }
6578         }
6579 }
6580 impl Clone for CResult_InvoiceSemanticErrorZ {
6581         fn clone(&self) -> Self {
6582                 if self.result_ok {
6583                         Self { result_ok: true, contents: CResult_InvoiceSemanticErrorZPtr {
6584                                 result: Box::into_raw(Box::new(<crate::lightning_invoice::Invoice>::clone(unsafe { &*self.contents.result })))
6585                         } }
6586                 } else {
6587                         Self { result_ok: false, contents: CResult_InvoiceSemanticErrorZPtr {
6588                                 err: Box::into_raw(Box::new(<crate::lightning_invoice::SemanticError>::clone(unsafe { &*self.contents.err })))
6589                         } }
6590                 }
6591         }
6592 }
6593 #[no_mangle]
6594 /// Creates a new CResult_InvoiceSemanticErrorZ which has the same data as `orig`
6595 /// but with all dynamically-allocated buffers duplicated in new buffers.
6596 pub extern "C" fn CResult_InvoiceSemanticErrorZ_clone(orig: &CResult_InvoiceSemanticErrorZ) -> CResult_InvoiceSemanticErrorZ { Clone::clone(&orig) }
6597 #[repr(C)]
6598 /// The contents of CResult_DescriptionCreationErrorZ
6599 pub union CResult_DescriptionCreationErrorZPtr {
6600         /// A pointer to the contents in the success state.
6601         /// Reading from this pointer when `result_ok` is not set is undefined.
6602         pub result: *mut crate::lightning_invoice::Description,
6603         /// A pointer to the contents in the error state.
6604         /// Reading from this pointer when `result_ok` is set is undefined.
6605         pub err: *mut crate::lightning_invoice::CreationError,
6606 }
6607 #[repr(C)]
6608 /// A CResult_DescriptionCreationErrorZ represents the result of a fallible operation,
6609 /// containing a crate::lightning_invoice::Description on success and a crate::lightning_invoice::CreationError on failure.
6610 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6611 pub struct CResult_DescriptionCreationErrorZ {
6612         /// The contents of this CResult_DescriptionCreationErrorZ, accessible via either
6613         /// `err` or `result` depending on the state of `result_ok`.
6614         pub contents: CResult_DescriptionCreationErrorZPtr,
6615         /// Whether this CResult_DescriptionCreationErrorZ represents a success state.
6616         pub result_ok: bool,
6617 }
6618 #[no_mangle]
6619 /// Creates a new CResult_DescriptionCreationErrorZ in the success state.
6620 pub extern "C" fn CResult_DescriptionCreationErrorZ_ok(o: crate::lightning_invoice::Description) -> CResult_DescriptionCreationErrorZ {
6621         CResult_DescriptionCreationErrorZ {
6622                 contents: CResult_DescriptionCreationErrorZPtr {
6623                         result: Box::into_raw(Box::new(o)),
6624                 },
6625                 result_ok: true,
6626         }
6627 }
6628 #[no_mangle]
6629 /// Creates a new CResult_DescriptionCreationErrorZ in the error state.
6630 pub extern "C" fn CResult_DescriptionCreationErrorZ_err(e: crate::lightning_invoice::CreationError) -> CResult_DescriptionCreationErrorZ {
6631         CResult_DescriptionCreationErrorZ {
6632                 contents: CResult_DescriptionCreationErrorZPtr {
6633                         err: Box::into_raw(Box::new(e)),
6634                 },
6635                 result_ok: false,
6636         }
6637 }
6638 #[no_mangle]
6639 /// Frees any resources used by the CResult_DescriptionCreationErrorZ.
6640 pub extern "C" fn CResult_DescriptionCreationErrorZ_free(_res: CResult_DescriptionCreationErrorZ) { }
6641 impl Drop for CResult_DescriptionCreationErrorZ {
6642         fn drop(&mut self) {
6643                 if self.result_ok {
6644                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
6645                                 let _ = unsafe { Box::from_raw(self.contents.result) };
6646                         }
6647                 } else {
6648                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
6649                                 let _ = unsafe { Box::from_raw(self.contents.err) };
6650                         }
6651                 }
6652         }
6653 }
6654 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::Description, crate::lightning_invoice::CreationError>> for CResult_DescriptionCreationErrorZ {
6655         fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::Description, crate::lightning_invoice::CreationError>) -> Self {
6656                 let contents = if o.result_ok {
6657                         let result = unsafe { o.contents.result };
6658                         unsafe { o.contents.result = std::ptr::null_mut() };
6659                         CResult_DescriptionCreationErrorZPtr { result }
6660                 } else {
6661                         let err = unsafe { o.contents.err };
6662                         unsafe { o.contents.err = std::ptr::null_mut(); }
6663                         CResult_DescriptionCreationErrorZPtr { err }
6664                 };
6665                 Self {
6666                         contents,
6667                         result_ok: o.result_ok,
6668                 }
6669         }
6670 }
6671 impl Clone for CResult_DescriptionCreationErrorZ {
6672         fn clone(&self) -> Self {
6673                 if self.result_ok {
6674                         Self { result_ok: true, contents: CResult_DescriptionCreationErrorZPtr {
6675                                 result: Box::into_raw(Box::new(<crate::lightning_invoice::Description>::clone(unsafe { &*self.contents.result })))
6676                         } }
6677                 } else {
6678                         Self { result_ok: false, contents: CResult_DescriptionCreationErrorZPtr {
6679                                 err: Box::into_raw(Box::new(<crate::lightning_invoice::CreationError>::clone(unsafe { &*self.contents.err })))
6680                         } }
6681                 }
6682         }
6683 }
6684 #[no_mangle]
6685 /// Creates a new CResult_DescriptionCreationErrorZ which has the same data as `orig`
6686 /// but with all dynamically-allocated buffers duplicated in new buffers.
6687 pub extern "C" fn CResult_DescriptionCreationErrorZ_clone(orig: &CResult_DescriptionCreationErrorZ) -> CResult_DescriptionCreationErrorZ { Clone::clone(&orig) }
6688 #[repr(C)]
6689 /// The contents of CResult_ExpiryTimeCreationErrorZ
6690 pub union CResult_ExpiryTimeCreationErrorZPtr {
6691         /// A pointer to the contents in the success state.
6692         /// Reading from this pointer when `result_ok` is not set is undefined.
6693         pub result: *mut crate::lightning_invoice::ExpiryTime,
6694         /// A pointer to the contents in the error state.
6695         /// Reading from this pointer when `result_ok` is set is undefined.
6696         pub err: *mut crate::lightning_invoice::CreationError,
6697 }
6698 #[repr(C)]
6699 /// A CResult_ExpiryTimeCreationErrorZ represents the result of a fallible operation,
6700 /// containing a crate::lightning_invoice::ExpiryTime on success and a crate::lightning_invoice::CreationError on failure.
6701 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6702 pub struct CResult_ExpiryTimeCreationErrorZ {
6703         /// The contents of this CResult_ExpiryTimeCreationErrorZ, accessible via either
6704         /// `err` or `result` depending on the state of `result_ok`.
6705         pub contents: CResult_ExpiryTimeCreationErrorZPtr,
6706         /// Whether this CResult_ExpiryTimeCreationErrorZ represents a success state.
6707         pub result_ok: bool,
6708 }
6709 #[no_mangle]
6710 /// Creates a new CResult_ExpiryTimeCreationErrorZ in the success state.
6711 pub extern "C" fn CResult_ExpiryTimeCreationErrorZ_ok(o: crate::lightning_invoice::ExpiryTime) -> CResult_ExpiryTimeCreationErrorZ {
6712         CResult_ExpiryTimeCreationErrorZ {
6713                 contents: CResult_ExpiryTimeCreationErrorZPtr {
6714                         result: Box::into_raw(Box::new(o)),
6715                 },
6716                 result_ok: true,
6717         }
6718 }
6719 #[no_mangle]
6720 /// Creates a new CResult_ExpiryTimeCreationErrorZ in the error state.
6721 pub extern "C" fn CResult_ExpiryTimeCreationErrorZ_err(e: crate::lightning_invoice::CreationError) -> CResult_ExpiryTimeCreationErrorZ {
6722         CResult_ExpiryTimeCreationErrorZ {
6723                 contents: CResult_ExpiryTimeCreationErrorZPtr {
6724                         err: Box::into_raw(Box::new(e)),
6725                 },
6726                 result_ok: false,
6727         }
6728 }
6729 #[no_mangle]
6730 /// Frees any resources used by the CResult_ExpiryTimeCreationErrorZ.
6731 pub extern "C" fn CResult_ExpiryTimeCreationErrorZ_free(_res: CResult_ExpiryTimeCreationErrorZ) { }
6732 impl Drop for CResult_ExpiryTimeCreationErrorZ {
6733         fn drop(&mut self) {
6734                 if self.result_ok {
6735                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
6736                                 let _ = unsafe { Box::from_raw(self.contents.result) };
6737                         }
6738                 } else {
6739                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
6740                                 let _ = unsafe { Box::from_raw(self.contents.err) };
6741                         }
6742                 }
6743         }
6744 }
6745 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::ExpiryTime, crate::lightning_invoice::CreationError>> for CResult_ExpiryTimeCreationErrorZ {
6746         fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::ExpiryTime, crate::lightning_invoice::CreationError>) -> Self {
6747                 let contents = if o.result_ok {
6748                         let result = unsafe { o.contents.result };
6749                         unsafe { o.contents.result = std::ptr::null_mut() };
6750                         CResult_ExpiryTimeCreationErrorZPtr { result }
6751                 } else {
6752                         let err = unsafe { o.contents.err };
6753                         unsafe { o.contents.err = std::ptr::null_mut(); }
6754                         CResult_ExpiryTimeCreationErrorZPtr { err }
6755                 };
6756                 Self {
6757                         contents,
6758                         result_ok: o.result_ok,
6759                 }
6760         }
6761 }
6762 impl Clone for CResult_ExpiryTimeCreationErrorZ {
6763         fn clone(&self) -> Self {
6764                 if self.result_ok {
6765                         Self { result_ok: true, contents: CResult_ExpiryTimeCreationErrorZPtr {
6766                                 result: Box::into_raw(Box::new(<crate::lightning_invoice::ExpiryTime>::clone(unsafe { &*self.contents.result })))
6767                         } }
6768                 } else {
6769                         Self { result_ok: false, contents: CResult_ExpiryTimeCreationErrorZPtr {
6770                                 err: Box::into_raw(Box::new(<crate::lightning_invoice::CreationError>::clone(unsafe { &*self.contents.err })))
6771                         } }
6772                 }
6773         }
6774 }
6775 #[no_mangle]
6776 /// Creates a new CResult_ExpiryTimeCreationErrorZ which has the same data as `orig`
6777 /// but with all dynamically-allocated buffers duplicated in new buffers.
6778 pub extern "C" fn CResult_ExpiryTimeCreationErrorZ_clone(orig: &CResult_ExpiryTimeCreationErrorZ) -> CResult_ExpiryTimeCreationErrorZ { Clone::clone(&orig) }
6779 #[repr(C)]
6780 /// The contents of CResult_PrivateRouteCreationErrorZ
6781 pub union CResult_PrivateRouteCreationErrorZPtr {
6782         /// A pointer to the contents in the success state.
6783         /// Reading from this pointer when `result_ok` is not set is undefined.
6784         pub result: *mut crate::lightning_invoice::PrivateRoute,
6785         /// A pointer to the contents in the error state.
6786         /// Reading from this pointer when `result_ok` is set is undefined.
6787         pub err: *mut crate::lightning_invoice::CreationError,
6788 }
6789 #[repr(C)]
6790 /// A CResult_PrivateRouteCreationErrorZ represents the result of a fallible operation,
6791 /// containing a crate::lightning_invoice::PrivateRoute on success and a crate::lightning_invoice::CreationError on failure.
6792 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6793 pub struct CResult_PrivateRouteCreationErrorZ {
6794         /// The contents of this CResult_PrivateRouteCreationErrorZ, accessible via either
6795         /// `err` or `result` depending on the state of `result_ok`.
6796         pub contents: CResult_PrivateRouteCreationErrorZPtr,
6797         /// Whether this CResult_PrivateRouteCreationErrorZ represents a success state.
6798         pub result_ok: bool,
6799 }
6800 #[no_mangle]
6801 /// Creates a new CResult_PrivateRouteCreationErrorZ in the success state.
6802 pub extern "C" fn CResult_PrivateRouteCreationErrorZ_ok(o: crate::lightning_invoice::PrivateRoute) -> CResult_PrivateRouteCreationErrorZ {
6803         CResult_PrivateRouteCreationErrorZ {
6804                 contents: CResult_PrivateRouteCreationErrorZPtr {
6805                         result: Box::into_raw(Box::new(o)),
6806                 },
6807                 result_ok: true,
6808         }
6809 }
6810 #[no_mangle]
6811 /// Creates a new CResult_PrivateRouteCreationErrorZ in the error state.
6812 pub extern "C" fn CResult_PrivateRouteCreationErrorZ_err(e: crate::lightning_invoice::CreationError) -> CResult_PrivateRouteCreationErrorZ {
6813         CResult_PrivateRouteCreationErrorZ {
6814                 contents: CResult_PrivateRouteCreationErrorZPtr {
6815                         err: Box::into_raw(Box::new(e)),
6816                 },
6817                 result_ok: false,
6818         }
6819 }
6820 #[no_mangle]
6821 /// Frees any resources used by the CResult_PrivateRouteCreationErrorZ.
6822 pub extern "C" fn CResult_PrivateRouteCreationErrorZ_free(_res: CResult_PrivateRouteCreationErrorZ) { }
6823 impl Drop for CResult_PrivateRouteCreationErrorZ {
6824         fn drop(&mut self) {
6825                 if self.result_ok {
6826                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
6827                                 let _ = unsafe { Box::from_raw(self.contents.result) };
6828                         }
6829                 } else {
6830                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
6831                                 let _ = unsafe { Box::from_raw(self.contents.err) };
6832                         }
6833                 }
6834         }
6835 }
6836 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::PrivateRoute, crate::lightning_invoice::CreationError>> for CResult_PrivateRouteCreationErrorZ {
6837         fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::PrivateRoute, crate::lightning_invoice::CreationError>) -> Self {
6838                 let contents = if o.result_ok {
6839                         let result = unsafe { o.contents.result };
6840                         unsafe { o.contents.result = std::ptr::null_mut() };
6841                         CResult_PrivateRouteCreationErrorZPtr { result }
6842                 } else {
6843                         let err = unsafe { o.contents.err };
6844                         unsafe { o.contents.err = std::ptr::null_mut(); }
6845                         CResult_PrivateRouteCreationErrorZPtr { err }
6846                 };
6847                 Self {
6848                         contents,
6849                         result_ok: o.result_ok,
6850                 }
6851         }
6852 }
6853 impl Clone for CResult_PrivateRouteCreationErrorZ {
6854         fn clone(&self) -> Self {
6855                 if self.result_ok {
6856                         Self { result_ok: true, contents: CResult_PrivateRouteCreationErrorZPtr {
6857                                 result: Box::into_raw(Box::new(<crate::lightning_invoice::PrivateRoute>::clone(unsafe { &*self.contents.result })))
6858                         } }
6859                 } else {
6860                         Self { result_ok: false, contents: CResult_PrivateRouteCreationErrorZPtr {
6861                                 err: Box::into_raw(Box::new(<crate::lightning_invoice::CreationError>::clone(unsafe { &*self.contents.err })))
6862                         } }
6863                 }
6864         }
6865 }
6866 #[no_mangle]
6867 /// Creates a new CResult_PrivateRouteCreationErrorZ which has the same data as `orig`
6868 /// but with all dynamically-allocated buffers duplicated in new buffers.
6869 pub extern "C" fn CResult_PrivateRouteCreationErrorZ_clone(orig: &CResult_PrivateRouteCreationErrorZ) -> CResult_PrivateRouteCreationErrorZ { Clone::clone(&orig) }
6870 #[repr(C)]
6871 /// The contents of CResult_StringErrorZ
6872 pub union CResult_StringErrorZPtr {
6873         /// A pointer to the contents in the success state.
6874         /// Reading from this pointer when `result_ok` is not set is undefined.
6875         pub result: *mut crate::c_types::Str,
6876         /// A pointer to the contents in the error state.
6877         /// Reading from this pointer when `result_ok` is set is undefined.
6878         pub err: *mut crate::c_types::Secp256k1Error,
6879 }
6880 #[repr(C)]
6881 /// A CResult_StringErrorZ represents the result of a fallible operation,
6882 /// containing a crate::c_types::Str on success and a crate::c_types::Secp256k1Error on failure.
6883 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6884 pub struct CResult_StringErrorZ {
6885         /// The contents of this CResult_StringErrorZ, accessible via either
6886         /// `err` or `result` depending on the state of `result_ok`.
6887         pub contents: CResult_StringErrorZPtr,
6888         /// Whether this CResult_StringErrorZ represents a success state.
6889         pub result_ok: bool,
6890 }
6891 #[no_mangle]
6892 /// Creates a new CResult_StringErrorZ in the success state.
6893 pub extern "C" fn CResult_StringErrorZ_ok(o: crate::c_types::Str) -> CResult_StringErrorZ {
6894         CResult_StringErrorZ {
6895                 contents: CResult_StringErrorZPtr {
6896                         result: Box::into_raw(Box::new(o)),
6897                 },
6898                 result_ok: true,
6899         }
6900 }
6901 #[no_mangle]
6902 /// Creates a new CResult_StringErrorZ in the error state.
6903 pub extern "C" fn CResult_StringErrorZ_err(e: crate::c_types::Secp256k1Error) -> CResult_StringErrorZ {
6904         CResult_StringErrorZ {
6905                 contents: CResult_StringErrorZPtr {
6906                         err: Box::into_raw(Box::new(e)),
6907                 },
6908                 result_ok: false,
6909         }
6910 }
6911 #[no_mangle]
6912 /// Frees any resources used by the CResult_StringErrorZ.
6913 pub extern "C" fn CResult_StringErrorZ_free(_res: CResult_StringErrorZ) { }
6914 impl Drop for CResult_StringErrorZ {
6915         fn drop(&mut self) {
6916                 if self.result_ok {
6917                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
6918                                 let _ = unsafe { Box::from_raw(self.contents.result) };
6919                         }
6920                 } else {
6921                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
6922                                 let _ = unsafe { Box::from_raw(self.contents.err) };
6923                         }
6924                 }
6925         }
6926 }
6927 impl From<crate::c_types::CResultTempl<crate::c_types::Str, crate::c_types::Secp256k1Error>> for CResult_StringErrorZ {
6928         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::Str, crate::c_types::Secp256k1Error>) -> Self {
6929                 let contents = if o.result_ok {
6930                         let result = unsafe { o.contents.result };
6931                         unsafe { o.contents.result = std::ptr::null_mut() };
6932                         CResult_StringErrorZPtr { result }
6933                 } else {
6934                         let err = unsafe { o.contents.err };
6935                         unsafe { o.contents.err = std::ptr::null_mut(); }
6936                         CResult_StringErrorZPtr { err }
6937                 };
6938                 Self {
6939                         contents,
6940                         result_ok: o.result_ok,
6941                 }
6942         }
6943 }
6944 #[repr(C)]
6945 /// The contents of CResult_ChannelMonitorUpdateDecodeErrorZ
6946 pub union CResult_ChannelMonitorUpdateDecodeErrorZPtr {
6947         /// A pointer to the contents in the success state.
6948         /// Reading from this pointer when `result_ok` is not set is undefined.
6949         pub result: *mut crate::lightning::chain::channelmonitor::ChannelMonitorUpdate,
6950         /// A pointer to the contents in the error state.
6951         /// Reading from this pointer when `result_ok` is set is undefined.
6952         pub err: *mut crate::lightning::ln::msgs::DecodeError,
6953 }
6954 #[repr(C)]
6955 /// A CResult_ChannelMonitorUpdateDecodeErrorZ represents the result of a fallible operation,
6956 /// containing a crate::lightning::chain::channelmonitor::ChannelMonitorUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
6957 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6958 pub struct CResult_ChannelMonitorUpdateDecodeErrorZ {
6959         /// The contents of this CResult_ChannelMonitorUpdateDecodeErrorZ, accessible via either
6960         /// `err` or `result` depending on the state of `result_ok`.
6961         pub contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr,
6962         /// Whether this CResult_ChannelMonitorUpdateDecodeErrorZ represents a success state.
6963         pub result_ok: bool,
6964 }
6965 #[no_mangle]
6966 /// Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ in the success state.
6967 pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_ok(o: crate::lightning::chain::channelmonitor::ChannelMonitorUpdate) -> CResult_ChannelMonitorUpdateDecodeErrorZ {
6968         CResult_ChannelMonitorUpdateDecodeErrorZ {
6969                 contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr {
6970                         result: Box::into_raw(Box::new(o)),
6971                 },
6972                 result_ok: true,
6973         }
6974 }
6975 #[no_mangle]
6976 /// Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ in the error state.
6977 pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelMonitorUpdateDecodeErrorZ {
6978         CResult_ChannelMonitorUpdateDecodeErrorZ {
6979                 contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr {
6980                         err: Box::into_raw(Box::new(e)),
6981                 },
6982                 result_ok: false,
6983         }
6984 }
6985 #[no_mangle]
6986 /// Frees any resources used by the CResult_ChannelMonitorUpdateDecodeErrorZ.
6987 pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_free(_res: CResult_ChannelMonitorUpdateDecodeErrorZ) { }
6988 impl Drop for CResult_ChannelMonitorUpdateDecodeErrorZ {
6989         fn drop(&mut self) {
6990                 if self.result_ok {
6991                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
6992                                 let _ = unsafe { Box::from_raw(self.contents.result) };
6993                         }
6994                 } else {
6995                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
6996                                 let _ = unsafe { Box::from_raw(self.contents.err) };
6997                         }
6998                 }
6999         }
7000 }
7001 impl From<crate::c_types::CResultTempl<crate::lightning::chain::channelmonitor::ChannelMonitorUpdate, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelMonitorUpdateDecodeErrorZ {
7002         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::channelmonitor::ChannelMonitorUpdate, crate::lightning::ln::msgs::DecodeError>) -> Self {
7003                 let contents = if o.result_ok {
7004                         let result = unsafe { o.contents.result };
7005                         unsafe { o.contents.result = std::ptr::null_mut() };
7006                         CResult_ChannelMonitorUpdateDecodeErrorZPtr { result }
7007                 } else {
7008                         let err = unsafe { o.contents.err };
7009                         unsafe { o.contents.err = std::ptr::null_mut(); }
7010                         CResult_ChannelMonitorUpdateDecodeErrorZPtr { err }
7011                 };
7012                 Self {
7013                         contents,
7014                         result_ok: o.result_ok,
7015                 }
7016         }
7017 }
7018 impl Clone for CResult_ChannelMonitorUpdateDecodeErrorZ {
7019         fn clone(&self) -> Self {
7020                 if self.result_ok {
7021                         Self { result_ok: true, contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr {
7022                                 result: Box::into_raw(Box::new(<crate::lightning::chain::channelmonitor::ChannelMonitorUpdate>::clone(unsafe { &*self.contents.result })))
7023                         } }
7024                 } else {
7025                         Self { result_ok: false, contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr {
7026                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
7027                         } }
7028                 }
7029         }
7030 }
7031 #[no_mangle]
7032 /// Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ which has the same data as `orig`
7033 /// but with all dynamically-allocated buffers duplicated in new buffers.
7034 pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_clone(orig: &CResult_ChannelMonitorUpdateDecodeErrorZ) -> CResult_ChannelMonitorUpdateDecodeErrorZ { Clone::clone(&orig) }
7035 #[repr(C)]
7036 /// The contents of CResult_HTLCUpdateDecodeErrorZ
7037 pub union CResult_HTLCUpdateDecodeErrorZPtr {
7038         /// A pointer to the contents in the success state.
7039         /// Reading from this pointer when `result_ok` is not set is undefined.
7040         pub result: *mut crate::lightning::chain::channelmonitor::HTLCUpdate,
7041         /// A pointer to the contents in the error state.
7042         /// Reading from this pointer when `result_ok` is set is undefined.
7043         pub err: *mut crate::lightning::ln::msgs::DecodeError,
7044 }
7045 #[repr(C)]
7046 /// A CResult_HTLCUpdateDecodeErrorZ represents the result of a fallible operation,
7047 /// containing a crate::lightning::chain::channelmonitor::HTLCUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
7048 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7049 pub struct CResult_HTLCUpdateDecodeErrorZ {
7050         /// The contents of this CResult_HTLCUpdateDecodeErrorZ, accessible via either
7051         /// `err` or `result` depending on the state of `result_ok`.
7052         pub contents: CResult_HTLCUpdateDecodeErrorZPtr,
7053         /// Whether this CResult_HTLCUpdateDecodeErrorZ represents a success state.
7054         pub result_ok: bool,
7055 }
7056 #[no_mangle]
7057 /// Creates a new CResult_HTLCUpdateDecodeErrorZ in the success state.
7058 pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_ok(o: crate::lightning::chain::channelmonitor::HTLCUpdate) -> CResult_HTLCUpdateDecodeErrorZ {
7059         CResult_HTLCUpdateDecodeErrorZ {
7060                 contents: CResult_HTLCUpdateDecodeErrorZPtr {
7061                         result: Box::into_raw(Box::new(o)),
7062                 },
7063                 result_ok: true,
7064         }
7065 }
7066 #[no_mangle]
7067 /// Creates a new CResult_HTLCUpdateDecodeErrorZ in the error state.
7068 pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_HTLCUpdateDecodeErrorZ {
7069         CResult_HTLCUpdateDecodeErrorZ {
7070                 contents: CResult_HTLCUpdateDecodeErrorZPtr {
7071                         err: Box::into_raw(Box::new(e)),
7072                 },
7073                 result_ok: false,
7074         }
7075 }
7076 #[no_mangle]
7077 /// Frees any resources used by the CResult_HTLCUpdateDecodeErrorZ.
7078 pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_free(_res: CResult_HTLCUpdateDecodeErrorZ) { }
7079 impl Drop for CResult_HTLCUpdateDecodeErrorZ {
7080         fn drop(&mut self) {
7081                 if self.result_ok {
7082                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
7083                                 let _ = unsafe { Box::from_raw(self.contents.result) };
7084                         }
7085                 } else {
7086                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
7087                                 let _ = unsafe { Box::from_raw(self.contents.err) };
7088                         }
7089                 }
7090         }
7091 }
7092 impl From<crate::c_types::CResultTempl<crate::lightning::chain::channelmonitor::HTLCUpdate, crate::lightning::ln::msgs::DecodeError>> for CResult_HTLCUpdateDecodeErrorZ {
7093         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::channelmonitor::HTLCUpdate, crate::lightning::ln::msgs::DecodeError>) -> Self {
7094                 let contents = if o.result_ok {
7095                         let result = unsafe { o.contents.result };
7096                         unsafe { o.contents.result = std::ptr::null_mut() };
7097                         CResult_HTLCUpdateDecodeErrorZPtr { result }
7098                 } else {
7099                         let err = unsafe { o.contents.err };
7100                         unsafe { o.contents.err = std::ptr::null_mut(); }
7101                         CResult_HTLCUpdateDecodeErrorZPtr { err }
7102                 };
7103                 Self {
7104                         contents,
7105                         result_ok: o.result_ok,
7106                 }
7107         }
7108 }
7109 impl Clone for CResult_HTLCUpdateDecodeErrorZ {
7110         fn clone(&self) -> Self {
7111                 if self.result_ok {
7112                         Self { result_ok: true, contents: CResult_HTLCUpdateDecodeErrorZPtr {
7113                                 result: Box::into_raw(Box::new(<crate::lightning::chain::channelmonitor::HTLCUpdate>::clone(unsafe { &*self.contents.result })))
7114                         } }
7115                 } else {
7116                         Self { result_ok: false, contents: CResult_HTLCUpdateDecodeErrorZPtr {
7117                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
7118                         } }
7119                 }
7120         }
7121 }
7122 #[no_mangle]
7123 /// Creates a new CResult_HTLCUpdateDecodeErrorZ which has the same data as `orig`
7124 /// but with all dynamically-allocated buffers duplicated in new buffers.
7125 pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_clone(orig: &CResult_HTLCUpdateDecodeErrorZ) -> CResult_HTLCUpdateDecodeErrorZ { Clone::clone(&orig) }
7126 #[repr(C)]
7127 /// The contents of CResult_NoneMonitorUpdateErrorZ
7128 pub union CResult_NoneMonitorUpdateErrorZPtr {
7129         /// Note that this value is always NULL, as there are no contents in the OK variant
7130         pub result: *mut std::ffi::c_void,
7131         /// A pointer to the contents in the error state.
7132         /// Reading from this pointer when `result_ok` is set is undefined.
7133         pub err: *mut crate::lightning::chain::channelmonitor::MonitorUpdateError,
7134 }
7135 #[repr(C)]
7136 /// A CResult_NoneMonitorUpdateErrorZ represents the result of a fallible operation,
7137 /// containing a () on success and a crate::lightning::chain::channelmonitor::MonitorUpdateError on failure.
7138 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7139 pub struct CResult_NoneMonitorUpdateErrorZ {
7140         /// The contents of this CResult_NoneMonitorUpdateErrorZ, accessible via either
7141         /// `err` or `result` depending on the state of `result_ok`.
7142         pub contents: CResult_NoneMonitorUpdateErrorZPtr,
7143         /// Whether this CResult_NoneMonitorUpdateErrorZ represents a success state.
7144         pub result_ok: bool,
7145 }
7146 #[no_mangle]
7147 /// Creates a new CResult_NoneMonitorUpdateErrorZ in the success state.
7148 pub extern "C" fn CResult_NoneMonitorUpdateErrorZ_ok() -> CResult_NoneMonitorUpdateErrorZ {
7149         CResult_NoneMonitorUpdateErrorZ {
7150                 contents: CResult_NoneMonitorUpdateErrorZPtr {
7151                         result: std::ptr::null_mut(),
7152                 },
7153                 result_ok: true,
7154         }
7155 }
7156 #[no_mangle]
7157 /// Creates a new CResult_NoneMonitorUpdateErrorZ in the error state.
7158 pub extern "C" fn CResult_NoneMonitorUpdateErrorZ_err(e: crate::lightning::chain::channelmonitor::MonitorUpdateError) -> CResult_NoneMonitorUpdateErrorZ {
7159         CResult_NoneMonitorUpdateErrorZ {
7160                 contents: CResult_NoneMonitorUpdateErrorZPtr {
7161                         err: Box::into_raw(Box::new(e)),
7162                 },
7163                 result_ok: false,
7164         }
7165 }
7166 #[no_mangle]
7167 /// Frees any resources used by the CResult_NoneMonitorUpdateErrorZ.
7168 pub extern "C" fn CResult_NoneMonitorUpdateErrorZ_free(_res: CResult_NoneMonitorUpdateErrorZ) { }
7169 impl Drop for CResult_NoneMonitorUpdateErrorZ {
7170         fn drop(&mut self) {
7171                 if self.result_ok {
7172                 } else {
7173                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
7174                                 let _ = unsafe { Box::from_raw(self.contents.err) };
7175                         }
7176                 }
7177         }
7178 }
7179 impl From<crate::c_types::CResultTempl<(), crate::lightning::chain::channelmonitor::MonitorUpdateError>> for CResult_NoneMonitorUpdateErrorZ {
7180         fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::chain::channelmonitor::MonitorUpdateError>) -> Self {
7181                 let contents = if o.result_ok {
7182                         let _ = unsafe { Box::from_raw(o.contents.result) };
7183                         o.contents.result = std::ptr::null_mut();
7184                         CResult_NoneMonitorUpdateErrorZPtr { result: std::ptr::null_mut() }
7185                 } else {
7186                         let err = unsafe { o.contents.err };
7187                         unsafe { o.contents.err = std::ptr::null_mut(); }
7188                         CResult_NoneMonitorUpdateErrorZPtr { err }
7189                 };
7190                 Self {
7191                         contents,
7192                         result_ok: o.result_ok,
7193                 }
7194         }
7195 }
7196 impl Clone for CResult_NoneMonitorUpdateErrorZ {
7197         fn clone(&self) -> Self {
7198                 if self.result_ok {
7199                         Self { result_ok: true, contents: CResult_NoneMonitorUpdateErrorZPtr {
7200                                 result: std::ptr::null_mut()
7201                         } }
7202                 } else {
7203                         Self { result_ok: false, contents: CResult_NoneMonitorUpdateErrorZPtr {
7204                                 err: Box::into_raw(Box::new(<crate::lightning::chain::channelmonitor::MonitorUpdateError>::clone(unsafe { &*self.contents.err })))
7205                         } }
7206                 }
7207         }
7208 }
7209 #[no_mangle]
7210 /// Creates a new CResult_NoneMonitorUpdateErrorZ which has the same data as `orig`
7211 /// but with all dynamically-allocated buffers duplicated in new buffers.
7212 pub extern "C" fn CResult_NoneMonitorUpdateErrorZ_clone(orig: &CResult_NoneMonitorUpdateErrorZ) -> CResult_NoneMonitorUpdateErrorZ { Clone::clone(&orig) }
7213 #[repr(C)]
7214 /// A tuple of 2 elements. See the individual fields for the types contained.
7215 pub struct C2Tuple_OutPointScriptZ {
7216         /// The element at position 0
7217         pub a: crate::lightning::chain::transaction::OutPoint,
7218         /// The element at position 1
7219         pub b: crate::c_types::derived::CVec_u8Z,
7220 }
7221 impl From<(crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_u8Z)> for C2Tuple_OutPointScriptZ {
7222         fn from (tup: (crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_u8Z)) -> Self {
7223                 Self {
7224                         a: tup.0,
7225                         b: tup.1,
7226                 }
7227         }
7228 }
7229 impl C2Tuple_OutPointScriptZ {
7230         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_u8Z) {
7231                 (self.a, self.b)
7232         }
7233 }
7234 impl Clone for C2Tuple_OutPointScriptZ {
7235         fn clone(&self) -> Self {
7236                 Self {
7237                         a: Clone::clone(&self.a),
7238                         b: Clone::clone(&self.b),
7239                 }
7240         }
7241 }
7242 #[no_mangle]
7243 /// Creates a new tuple which has the same data as `orig`
7244 /// but with all dynamically-allocated buffers duplicated in new buffers.
7245 pub extern "C" fn C2Tuple_OutPointScriptZ_clone(orig: &C2Tuple_OutPointScriptZ) -> C2Tuple_OutPointScriptZ { Clone::clone(&orig) }
7246 /// Creates a new C2Tuple_OutPointScriptZ from the contained elements.
7247 #[no_mangle]
7248 pub extern "C" fn C2Tuple_OutPointScriptZ_new(a: crate::lightning::chain::transaction::OutPoint, b: crate::c_types::derived::CVec_u8Z) -> C2Tuple_OutPointScriptZ {
7249         C2Tuple_OutPointScriptZ { a, b, }
7250 }
7251
7252 #[no_mangle]
7253 /// Frees any resources used by the C2Tuple_OutPointScriptZ.
7254 pub extern "C" fn C2Tuple_OutPointScriptZ_free(_res: C2Tuple_OutPointScriptZ) { }
7255 #[repr(C)]
7256 /// A tuple of 2 elements. See the individual fields for the types contained.
7257 pub struct C2Tuple_u32ScriptZ {
7258         /// The element at position 0
7259         pub a: u32,
7260         /// The element at position 1
7261         pub b: crate::c_types::derived::CVec_u8Z,
7262 }
7263 impl From<(u32, crate::c_types::derived::CVec_u8Z)> for C2Tuple_u32ScriptZ {
7264         fn from (tup: (u32, crate::c_types::derived::CVec_u8Z)) -> Self {
7265                 Self {
7266                         a: tup.0,
7267                         b: tup.1,
7268                 }
7269         }
7270 }
7271 impl C2Tuple_u32ScriptZ {
7272         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (u32, crate::c_types::derived::CVec_u8Z) {
7273                 (self.a, self.b)
7274         }
7275 }
7276 impl Clone for C2Tuple_u32ScriptZ {
7277         fn clone(&self) -> Self {
7278                 Self {
7279                         a: Clone::clone(&self.a),
7280                         b: Clone::clone(&self.b),
7281                 }
7282         }
7283 }
7284 #[no_mangle]
7285 /// Creates a new tuple which has the same data as `orig`
7286 /// but with all dynamically-allocated buffers duplicated in new buffers.
7287 pub extern "C" fn C2Tuple_u32ScriptZ_clone(orig: &C2Tuple_u32ScriptZ) -> C2Tuple_u32ScriptZ { Clone::clone(&orig) }
7288 /// Creates a new C2Tuple_u32ScriptZ from the contained elements.
7289 #[no_mangle]
7290 pub extern "C" fn C2Tuple_u32ScriptZ_new(a: u32, b: crate::c_types::derived::CVec_u8Z) -> C2Tuple_u32ScriptZ {
7291         C2Tuple_u32ScriptZ { a, b, }
7292 }
7293
7294 #[no_mangle]
7295 /// Frees any resources used by the C2Tuple_u32ScriptZ.
7296 pub extern "C" fn C2Tuple_u32ScriptZ_free(_res: C2Tuple_u32ScriptZ) { }
7297 #[repr(C)]
7298 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_u32ScriptZs of arbitrary size.
7299 /// This corresponds to std::vector in C++
7300 pub struct CVec_C2Tuple_u32ScriptZZ {
7301         /// The elements in the array.
7302         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
7303         pub data: *mut crate::c_types::derived::C2Tuple_u32ScriptZ,
7304         /// The number of elements pointed to by `data`.
7305         pub datalen: usize
7306 }
7307 impl CVec_C2Tuple_u32ScriptZZ {
7308         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_u32ScriptZ> {
7309                 if self.datalen == 0 { return Vec::new(); }
7310                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
7311                 self.data = std::ptr::null_mut();
7312                 self.datalen = 0;
7313                 ret
7314         }
7315         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_u32ScriptZ] {
7316                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
7317         }
7318 }
7319 impl From<Vec<crate::c_types::derived::C2Tuple_u32ScriptZ>> for CVec_C2Tuple_u32ScriptZZ {
7320         fn from(v: Vec<crate::c_types::derived::C2Tuple_u32ScriptZ>) -> Self {
7321                 let datalen = v.len();
7322                 let data = Box::into_raw(v.into_boxed_slice());
7323                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
7324         }
7325 }
7326 #[no_mangle]
7327 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
7328 pub extern "C" fn CVec_C2Tuple_u32ScriptZZ_free(_res: CVec_C2Tuple_u32ScriptZZ) { }
7329 impl Drop for CVec_C2Tuple_u32ScriptZZ {
7330         fn drop(&mut self) {
7331                 if self.datalen == 0 { return; }
7332                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
7333         }
7334 }
7335 impl Clone for CVec_C2Tuple_u32ScriptZZ {
7336         fn clone(&self) -> Self {
7337                 let mut res = Vec::new();
7338                 if self.datalen == 0 { return Self::from(res); }
7339                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
7340                 Self::from(res)
7341         }
7342 }
7343 #[repr(C)]
7344 /// A tuple of 2 elements. See the individual fields for the types contained.
7345 pub struct C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ {
7346         /// The element at position 0
7347         pub a: crate::c_types::ThirtyTwoBytes,
7348         /// The element at position 1
7349         pub b: crate::c_types::derived::CVec_C2Tuple_u32ScriptZZ,
7350 }
7351 impl From<(crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32ScriptZZ)> for C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ {
7352         fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32ScriptZZ)) -> Self {
7353                 Self {
7354                         a: tup.0,
7355                         b: tup.1,
7356                 }
7357         }
7358 }
7359 impl C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ {
7360         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32ScriptZZ) {
7361                 (self.a, self.b)
7362         }
7363 }
7364 impl Clone for C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ {
7365         fn clone(&self) -> Self {
7366                 Self {
7367                         a: Clone::clone(&self.a),
7368                         b: Clone::clone(&self.b),
7369                 }
7370         }
7371 }
7372 #[no_mangle]
7373 /// Creates a new tuple which has the same data as `orig`
7374 /// but with all dynamically-allocated buffers duplicated in new buffers.
7375 pub extern "C" fn C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone(orig: &C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ) -> C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ { Clone::clone(&orig) }
7376 /// Creates a new C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ from the contained elements.
7377 #[no_mangle]
7378 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 {
7379         C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ { a, b, }
7380 }
7381
7382 #[no_mangle]
7383 /// Frees any resources used by the C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ.
7384 pub extern "C" fn C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_free(_res: C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ) { }
7385 #[repr(C)]
7386 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZs of arbitrary size.
7387 /// This corresponds to std::vector in C++
7388 pub struct CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ {
7389         /// The elements in the array.
7390         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
7391         pub data: *mut crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ,
7392         /// The number of elements pointed to by `data`.
7393         pub datalen: usize
7394 }
7395 impl CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ {
7396         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ> {
7397                 if self.datalen == 0 { return Vec::new(); }
7398                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
7399                 self.data = std::ptr::null_mut();
7400                 self.datalen = 0;
7401                 ret
7402         }
7403         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ] {
7404                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
7405         }
7406 }
7407 impl From<Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ>> for CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ {
7408         fn from(v: Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ>) -> Self {
7409                 let datalen = v.len();
7410                 let data = Box::into_raw(v.into_boxed_slice());
7411                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
7412         }
7413 }
7414 #[no_mangle]
7415 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
7416 pub extern "C" fn CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ_free(_res: CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ) { }
7417 impl Drop for CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ {
7418         fn drop(&mut self) {
7419                 if self.datalen == 0 { return; }
7420                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
7421         }
7422 }
7423 impl Clone for CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ {
7424         fn clone(&self) -> Self {
7425                 let mut res = Vec::new();
7426                 if self.datalen == 0 { return Self::from(res); }
7427                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
7428                 Self::from(res)
7429         }
7430 }
7431 #[repr(C)]
7432 /// A dynamically-allocated array of crate::lightning::util::events::Events of arbitrary size.
7433 /// This corresponds to std::vector in C++
7434 pub struct CVec_EventZ {
7435         /// The elements in the array.
7436         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
7437         pub data: *mut crate::lightning::util::events::Event,
7438         /// The number of elements pointed to by `data`.
7439         pub datalen: usize
7440 }
7441 impl CVec_EventZ {
7442         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::util::events::Event> {
7443                 if self.datalen == 0 { return Vec::new(); }
7444                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
7445                 self.data = std::ptr::null_mut();
7446                 self.datalen = 0;
7447                 ret
7448         }
7449         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::util::events::Event] {
7450                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
7451         }
7452 }
7453 impl From<Vec<crate::lightning::util::events::Event>> for CVec_EventZ {
7454         fn from(v: Vec<crate::lightning::util::events::Event>) -> Self {
7455                 let datalen = v.len();
7456                 let data = Box::into_raw(v.into_boxed_slice());
7457                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
7458         }
7459 }
7460 #[no_mangle]
7461 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
7462 pub extern "C" fn CVec_EventZ_free(_res: CVec_EventZ) { }
7463 impl Drop for CVec_EventZ {
7464         fn drop(&mut self) {
7465                 if self.datalen == 0 { return; }
7466                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
7467         }
7468 }
7469 impl Clone for CVec_EventZ {
7470         fn clone(&self) -> Self {
7471                 let mut res = Vec::new();
7472                 if self.datalen == 0 { return Self::from(res); }
7473                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
7474                 Self::from(res)
7475         }
7476 }
7477 #[repr(C)]
7478 /// A dynamically-allocated array of crate::c_types::Transactions of arbitrary size.
7479 /// This corresponds to std::vector in C++
7480 pub struct CVec_TransactionZ {
7481         /// The elements in the array.
7482         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
7483         pub data: *mut crate::c_types::Transaction,
7484         /// The number of elements pointed to by `data`.
7485         pub datalen: usize
7486 }
7487 impl CVec_TransactionZ {
7488         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::Transaction> {
7489                 if self.datalen == 0 { return Vec::new(); }
7490                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
7491                 self.data = std::ptr::null_mut();
7492                 self.datalen = 0;
7493                 ret
7494         }
7495         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::Transaction] {
7496                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
7497         }
7498 }
7499 impl From<Vec<crate::c_types::Transaction>> for CVec_TransactionZ {
7500         fn from(v: Vec<crate::c_types::Transaction>) -> Self {
7501                 let datalen = v.len();
7502                 let data = Box::into_raw(v.into_boxed_slice());
7503                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
7504         }
7505 }
7506 #[no_mangle]
7507 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
7508 pub extern "C" fn CVec_TransactionZ_free(_res: CVec_TransactionZ) { }
7509 impl Drop for CVec_TransactionZ {
7510         fn drop(&mut self) {
7511                 if self.datalen == 0 { return; }
7512                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
7513         }
7514 }
7515 impl Clone for CVec_TransactionZ {
7516         fn clone(&self) -> Self {
7517                 let mut res = Vec::new();
7518                 if self.datalen == 0 { return Self::from(res); }
7519                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
7520                 Self::from(res)
7521         }
7522 }
7523 #[repr(C)]
7524 /// A tuple of 2 elements. See the individual fields for the types contained.
7525 pub struct C2Tuple_u32TxOutZ {
7526         /// The element at position 0
7527         pub a: u32,
7528         /// The element at position 1
7529         pub b: crate::c_types::TxOut,
7530 }
7531 impl From<(u32, crate::c_types::TxOut)> for C2Tuple_u32TxOutZ {
7532         fn from (tup: (u32, crate::c_types::TxOut)) -> Self {
7533                 Self {
7534                         a: tup.0,
7535                         b: tup.1,
7536                 }
7537         }
7538 }
7539 impl C2Tuple_u32TxOutZ {
7540         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (u32, crate::c_types::TxOut) {
7541                 (self.a, self.b)
7542         }
7543 }
7544 impl Clone for C2Tuple_u32TxOutZ {
7545         fn clone(&self) -> Self {
7546                 Self {
7547                         a: Clone::clone(&self.a),
7548                         b: Clone::clone(&self.b),
7549                 }
7550         }
7551 }
7552 #[no_mangle]
7553 /// Creates a new tuple which has the same data as `orig`
7554 /// but with all dynamically-allocated buffers duplicated in new buffers.
7555 pub extern "C" fn C2Tuple_u32TxOutZ_clone(orig: &C2Tuple_u32TxOutZ) -> C2Tuple_u32TxOutZ { Clone::clone(&orig) }
7556 /// Creates a new C2Tuple_u32TxOutZ from the contained elements.
7557 #[no_mangle]
7558 pub extern "C" fn C2Tuple_u32TxOutZ_new(a: u32, b: crate::c_types::TxOut) -> C2Tuple_u32TxOutZ {
7559         C2Tuple_u32TxOutZ { a, b, }
7560 }
7561
7562 #[no_mangle]
7563 /// Frees any resources used by the C2Tuple_u32TxOutZ.
7564 pub extern "C" fn C2Tuple_u32TxOutZ_free(_res: C2Tuple_u32TxOutZ) { }
7565 #[repr(C)]
7566 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_u32TxOutZs of arbitrary size.
7567 /// This corresponds to std::vector in C++
7568 pub struct CVec_C2Tuple_u32TxOutZZ {
7569         /// The elements in the array.
7570         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
7571         pub data: *mut crate::c_types::derived::C2Tuple_u32TxOutZ,
7572         /// The number of elements pointed to by `data`.
7573         pub datalen: usize
7574 }
7575 impl CVec_C2Tuple_u32TxOutZZ {
7576         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_u32TxOutZ> {
7577                 if self.datalen == 0 { return Vec::new(); }
7578                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
7579                 self.data = std::ptr::null_mut();
7580                 self.datalen = 0;
7581                 ret
7582         }
7583         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_u32TxOutZ] {
7584                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
7585         }
7586 }
7587 impl From<Vec<crate::c_types::derived::C2Tuple_u32TxOutZ>> for CVec_C2Tuple_u32TxOutZZ {
7588         fn from(v: Vec<crate::c_types::derived::C2Tuple_u32TxOutZ>) -> Self {
7589                 let datalen = v.len();
7590                 let data = Box::into_raw(v.into_boxed_slice());
7591                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
7592         }
7593 }
7594 #[no_mangle]
7595 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
7596 pub extern "C" fn CVec_C2Tuple_u32TxOutZZ_free(_res: CVec_C2Tuple_u32TxOutZZ) { }
7597 impl Drop for CVec_C2Tuple_u32TxOutZZ {
7598         fn drop(&mut self) {
7599                 if self.datalen == 0 { return; }
7600                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
7601         }
7602 }
7603 impl Clone for CVec_C2Tuple_u32TxOutZZ {
7604         fn clone(&self) -> Self {
7605                 let mut res = Vec::new();
7606                 if self.datalen == 0 { return Self::from(res); }
7607                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
7608                 Self::from(res)
7609         }
7610 }
7611 #[repr(C)]
7612 /// A tuple of 2 elements. See the individual fields for the types contained.
7613 pub struct C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ {
7614         /// The element at position 0
7615         pub a: crate::c_types::ThirtyTwoBytes,
7616         /// The element at position 1
7617         pub b: crate::c_types::derived::CVec_C2Tuple_u32TxOutZZ,
7618 }
7619 impl From<(crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32TxOutZZ)> for C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ {
7620         fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32TxOutZZ)) -> Self {
7621                 Self {
7622                         a: tup.0,
7623                         b: tup.1,
7624                 }
7625         }
7626 }
7627 impl C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ {
7628         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32TxOutZZ) {
7629                 (self.a, self.b)
7630         }
7631 }
7632 impl Clone for C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ {
7633         fn clone(&self) -> Self {
7634                 Self {
7635                         a: Clone::clone(&self.a),
7636                         b: Clone::clone(&self.b),
7637                 }
7638         }
7639 }
7640 #[no_mangle]
7641 /// Creates a new tuple which has the same data as `orig`
7642 /// but with all dynamically-allocated buffers duplicated in new buffers.
7643 pub extern "C" fn C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone(orig: &C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ) -> C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ { Clone::clone(&orig) }
7644 /// Creates a new C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ from the contained elements.
7645 #[no_mangle]
7646 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 {
7647         C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ { a, b, }
7648 }
7649
7650 #[no_mangle]
7651 /// Frees any resources used by the C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ.
7652 pub extern "C" fn C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_free(_res: C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ) { }
7653 #[repr(C)]
7654 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZs of arbitrary size.
7655 /// This corresponds to std::vector in C++
7656 pub struct CVec_TransactionOutputsZ {
7657         /// The elements in the array.
7658         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
7659         pub data: *mut crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ,
7660         /// The number of elements pointed to by `data`.
7661         pub datalen: usize
7662 }
7663 impl CVec_TransactionOutputsZ {
7664         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ> {
7665                 if self.datalen == 0 { return Vec::new(); }
7666                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
7667                 self.data = std::ptr::null_mut();
7668                 self.datalen = 0;
7669                 ret
7670         }
7671         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ] {
7672                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
7673         }
7674 }
7675 impl From<Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ>> for CVec_TransactionOutputsZ {
7676         fn from(v: Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ>) -> Self {
7677                 let datalen = v.len();
7678                 let data = Box::into_raw(v.into_boxed_slice());
7679                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
7680         }
7681 }
7682 #[no_mangle]
7683 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
7684 pub extern "C" fn CVec_TransactionOutputsZ_free(_res: CVec_TransactionOutputsZ) { }
7685 impl Drop for CVec_TransactionOutputsZ {
7686         fn drop(&mut self) {
7687                 if self.datalen == 0 { return; }
7688                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
7689         }
7690 }
7691 impl Clone for CVec_TransactionOutputsZ {
7692         fn clone(&self) -> Self {
7693                 let mut res = Vec::new();
7694                 if self.datalen == 0 { return Self::from(res); }
7695                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
7696                 Self::from(res)
7697         }
7698 }
7699 #[repr(C)]
7700 /// A dynamically-allocated array of crate::lightning::chain::channelmonitor::Balances of arbitrary size.
7701 /// This corresponds to std::vector in C++
7702 pub struct CVec_BalanceZ {
7703         /// The elements in the array.
7704         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
7705         pub data: *mut crate::lightning::chain::channelmonitor::Balance,
7706         /// The number of elements pointed to by `data`.
7707         pub datalen: usize
7708 }
7709 impl CVec_BalanceZ {
7710         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::chain::channelmonitor::Balance> {
7711                 if self.datalen == 0 { return Vec::new(); }
7712                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
7713                 self.data = std::ptr::null_mut();
7714                 self.datalen = 0;
7715                 ret
7716         }
7717         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::chain::channelmonitor::Balance] {
7718                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
7719         }
7720 }
7721 impl From<Vec<crate::lightning::chain::channelmonitor::Balance>> for CVec_BalanceZ {
7722         fn from(v: Vec<crate::lightning::chain::channelmonitor::Balance>) -> Self {
7723                 let datalen = v.len();
7724                 let data = Box::into_raw(v.into_boxed_slice());
7725                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
7726         }
7727 }
7728 #[no_mangle]
7729 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
7730 pub extern "C" fn CVec_BalanceZ_free(_res: CVec_BalanceZ) { }
7731 impl Drop for CVec_BalanceZ {
7732         fn drop(&mut self) {
7733                 if self.datalen == 0 { return; }
7734                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
7735         }
7736 }
7737 impl Clone for CVec_BalanceZ {
7738         fn clone(&self) -> Self {
7739                 let mut res = Vec::new();
7740                 if self.datalen == 0 { return Self::from(res); }
7741                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
7742                 Self::from(res)
7743         }
7744 }
7745 #[repr(C)]
7746 /// The contents of CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ
7747 pub union CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr {
7748         /// A pointer to the contents in the success state.
7749         /// Reading from this pointer when `result_ok` is not set is undefined.
7750         pub result: *mut crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ,
7751         /// A pointer to the contents in the error state.
7752         /// Reading from this pointer when `result_ok` is set is undefined.
7753         pub err: *mut crate::lightning::ln::msgs::DecodeError,
7754 }
7755 #[repr(C)]
7756 /// A CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ represents the result of a fallible operation,
7757 /// containing a crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
7758 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7759 pub struct CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
7760         /// The contents of this CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ, accessible via either
7761         /// `err` or `result` depending on the state of `result_ok`.
7762         pub contents: CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr,
7763         /// Whether this CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ represents a success state.
7764         pub result_ok: bool,
7765 }
7766 #[no_mangle]
7767 /// Creates a new CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ in the success state.
7768 pub extern "C" fn CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_ok(o: crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ) -> CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
7769         CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
7770                 contents: CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr {
7771                         result: Box::into_raw(Box::new(o)),
7772                 },
7773                 result_ok: true,
7774         }
7775 }
7776 #[no_mangle]
7777 /// Creates a new CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ in the error state.
7778 pub extern "C" fn CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
7779         CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
7780                 contents: CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr {
7781                         err: Box::into_raw(Box::new(e)),
7782                 },
7783                 result_ok: false,
7784         }
7785 }
7786 #[no_mangle]
7787 /// Frees any resources used by the CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ.
7788 pub extern "C" fn CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_free(_res: CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ) { }
7789 impl Drop for CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
7790         fn drop(&mut self) {
7791                 if self.result_ok {
7792                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
7793                                 let _ = unsafe { Box::from_raw(self.contents.result) };
7794                         }
7795                 } else {
7796                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
7797                                 let _ = unsafe { Box::from_raw(self.contents.err) };
7798                         }
7799                 }
7800         }
7801 }
7802 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ, crate::lightning::ln::msgs::DecodeError>> for CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
7803         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
7804                 let contents = if o.result_ok {
7805                         let result = unsafe { o.contents.result };
7806                         unsafe { o.contents.result = std::ptr::null_mut() };
7807                         CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr { result }
7808                 } else {
7809                         let err = unsafe { o.contents.err };
7810                         unsafe { o.contents.err = std::ptr::null_mut(); }
7811                         CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr { err }
7812                 };
7813                 Self {
7814                         contents,
7815                         result_ok: o.result_ok,
7816                 }
7817         }
7818 }
7819 #[repr(C)]
7820 /// The contents of CResult_NoneLightningErrorZ
7821 pub union CResult_NoneLightningErrorZPtr {
7822         /// Note that this value is always NULL, as there are no contents in the OK variant
7823         pub result: *mut std::ffi::c_void,
7824         /// A pointer to the contents in the error state.
7825         /// Reading from this pointer when `result_ok` is set is undefined.
7826         pub err: *mut crate::lightning::ln::msgs::LightningError,
7827 }
7828 #[repr(C)]
7829 /// A CResult_NoneLightningErrorZ represents the result of a fallible operation,
7830 /// containing a () on success and a crate::lightning::ln::msgs::LightningError on failure.
7831 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7832 pub struct CResult_NoneLightningErrorZ {
7833         /// The contents of this CResult_NoneLightningErrorZ, accessible via either
7834         /// `err` or `result` depending on the state of `result_ok`.
7835         pub contents: CResult_NoneLightningErrorZPtr,
7836         /// Whether this CResult_NoneLightningErrorZ represents a success state.
7837         pub result_ok: bool,
7838 }
7839 #[no_mangle]
7840 /// Creates a new CResult_NoneLightningErrorZ in the success state.
7841 pub extern "C" fn CResult_NoneLightningErrorZ_ok() -> CResult_NoneLightningErrorZ {
7842         CResult_NoneLightningErrorZ {
7843                 contents: CResult_NoneLightningErrorZPtr {
7844                         result: std::ptr::null_mut(),
7845                 },
7846                 result_ok: true,
7847         }
7848 }
7849 #[no_mangle]
7850 /// Creates a new CResult_NoneLightningErrorZ in the error state.
7851 pub extern "C" fn CResult_NoneLightningErrorZ_err(e: crate::lightning::ln::msgs::LightningError) -> CResult_NoneLightningErrorZ {
7852         CResult_NoneLightningErrorZ {
7853                 contents: CResult_NoneLightningErrorZPtr {
7854                         err: Box::into_raw(Box::new(e)),
7855                 },
7856                 result_ok: false,
7857         }
7858 }
7859 #[no_mangle]
7860 /// Frees any resources used by the CResult_NoneLightningErrorZ.
7861 pub extern "C" fn CResult_NoneLightningErrorZ_free(_res: CResult_NoneLightningErrorZ) { }
7862 impl Drop for CResult_NoneLightningErrorZ {
7863         fn drop(&mut self) {
7864                 if self.result_ok {
7865                 } else {
7866                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
7867                                 let _ = unsafe { Box::from_raw(self.contents.err) };
7868                         }
7869                 }
7870         }
7871 }
7872 impl From<crate::c_types::CResultTempl<(), crate::lightning::ln::msgs::LightningError>> for CResult_NoneLightningErrorZ {
7873         fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::ln::msgs::LightningError>) -> Self {
7874                 let contents = if o.result_ok {
7875                         let _ = unsafe { Box::from_raw(o.contents.result) };
7876                         o.contents.result = std::ptr::null_mut();
7877                         CResult_NoneLightningErrorZPtr { result: std::ptr::null_mut() }
7878                 } else {
7879                         let err = unsafe { o.contents.err };
7880                         unsafe { o.contents.err = std::ptr::null_mut(); }
7881                         CResult_NoneLightningErrorZPtr { err }
7882                 };
7883                 Self {
7884                         contents,
7885                         result_ok: o.result_ok,
7886                 }
7887         }
7888 }
7889 impl Clone for CResult_NoneLightningErrorZ {
7890         fn clone(&self) -> Self {
7891                 if self.result_ok {
7892                         Self { result_ok: true, contents: CResult_NoneLightningErrorZPtr {
7893                                 result: std::ptr::null_mut()
7894                         } }
7895                 } else {
7896                         Self { result_ok: false, contents: CResult_NoneLightningErrorZPtr {
7897                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::LightningError>::clone(unsafe { &*self.contents.err })))
7898                         } }
7899                 }
7900         }
7901 }
7902 #[no_mangle]
7903 /// Creates a new CResult_NoneLightningErrorZ which has the same data as `orig`
7904 /// but with all dynamically-allocated buffers duplicated in new buffers.
7905 pub extern "C" fn CResult_NoneLightningErrorZ_clone(orig: &CResult_NoneLightningErrorZ) -> CResult_NoneLightningErrorZ { Clone::clone(&orig) }
7906 #[repr(C)]
7907 /// A tuple of 2 elements. See the individual fields for the types contained.
7908 pub struct C2Tuple_PublicKeyTypeZ {
7909         /// The element at position 0
7910         pub a: crate::c_types::PublicKey,
7911         /// The element at position 1
7912         pub b: crate::lightning::ln::wire::Type,
7913 }
7914 impl From<(crate::c_types::PublicKey, crate::lightning::ln::wire::Type)> for C2Tuple_PublicKeyTypeZ {
7915         fn from (tup: (crate::c_types::PublicKey, crate::lightning::ln::wire::Type)) -> Self {
7916                 Self {
7917                         a: tup.0,
7918                         b: tup.1,
7919                 }
7920         }
7921 }
7922 impl C2Tuple_PublicKeyTypeZ {
7923         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::PublicKey, crate::lightning::ln::wire::Type) {
7924                 (self.a, self.b)
7925         }
7926 }
7927 /// Creates a new C2Tuple_PublicKeyTypeZ from the contained elements.
7928 #[no_mangle]
7929 pub extern "C" fn C2Tuple_PublicKeyTypeZ_new(a: crate::c_types::PublicKey, b: crate::lightning::ln::wire::Type) -> C2Tuple_PublicKeyTypeZ {
7930         C2Tuple_PublicKeyTypeZ { a, b, }
7931 }
7932
7933 #[no_mangle]
7934 /// Frees any resources used by the C2Tuple_PublicKeyTypeZ.
7935 pub extern "C" fn C2Tuple_PublicKeyTypeZ_free(_res: C2Tuple_PublicKeyTypeZ) { }
7936 #[repr(C)]
7937 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_PublicKeyTypeZs of arbitrary size.
7938 /// This corresponds to std::vector in C++
7939 pub struct CVec_C2Tuple_PublicKeyTypeZZ {
7940         /// The elements in the array.
7941         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
7942         pub data: *mut crate::c_types::derived::C2Tuple_PublicKeyTypeZ,
7943         /// The number of elements pointed to by `data`.
7944         pub datalen: usize
7945 }
7946 impl CVec_C2Tuple_PublicKeyTypeZZ {
7947         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_PublicKeyTypeZ> {
7948                 if self.datalen == 0 { return Vec::new(); }
7949                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
7950                 self.data = std::ptr::null_mut();
7951                 self.datalen = 0;
7952                 ret
7953         }
7954         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_PublicKeyTypeZ] {
7955                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
7956         }
7957 }
7958 impl From<Vec<crate::c_types::derived::C2Tuple_PublicKeyTypeZ>> for CVec_C2Tuple_PublicKeyTypeZZ {
7959         fn from(v: Vec<crate::c_types::derived::C2Tuple_PublicKeyTypeZ>) -> Self {
7960                 let datalen = v.len();
7961                 let data = Box::into_raw(v.into_boxed_slice());
7962                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
7963         }
7964 }
7965 #[no_mangle]
7966 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
7967 pub extern "C" fn CVec_C2Tuple_PublicKeyTypeZZ_free(_res: CVec_C2Tuple_PublicKeyTypeZZ) { }
7968 impl Drop for CVec_C2Tuple_PublicKeyTypeZZ {
7969         fn drop(&mut self) {
7970                 if self.datalen == 0 { return; }
7971                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
7972         }
7973 }
7974 #[repr(C)]
7975 /// The contents of CResult_boolLightningErrorZ
7976 pub union CResult_boolLightningErrorZPtr {
7977         /// A pointer to the contents in the success state.
7978         /// Reading from this pointer when `result_ok` is not set is undefined.
7979         pub result: *mut bool,
7980         /// A pointer to the contents in the error state.
7981         /// Reading from this pointer when `result_ok` is set is undefined.
7982         pub err: *mut crate::lightning::ln::msgs::LightningError,
7983 }
7984 #[repr(C)]
7985 /// A CResult_boolLightningErrorZ represents the result of a fallible operation,
7986 /// containing a bool on success and a crate::lightning::ln::msgs::LightningError on failure.
7987 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7988 pub struct CResult_boolLightningErrorZ {
7989         /// The contents of this CResult_boolLightningErrorZ, accessible via either
7990         /// `err` or `result` depending on the state of `result_ok`.
7991         pub contents: CResult_boolLightningErrorZPtr,
7992         /// Whether this CResult_boolLightningErrorZ represents a success state.
7993         pub result_ok: bool,
7994 }
7995 #[no_mangle]
7996 /// Creates a new CResult_boolLightningErrorZ in the success state.
7997 pub extern "C" fn CResult_boolLightningErrorZ_ok(o: bool) -> CResult_boolLightningErrorZ {
7998         CResult_boolLightningErrorZ {
7999                 contents: CResult_boolLightningErrorZPtr {
8000                         result: Box::into_raw(Box::new(o)),
8001                 },
8002                 result_ok: true,
8003         }
8004 }
8005 #[no_mangle]
8006 /// Creates a new CResult_boolLightningErrorZ in the error state.
8007 pub extern "C" fn CResult_boolLightningErrorZ_err(e: crate::lightning::ln::msgs::LightningError) -> CResult_boolLightningErrorZ {
8008         CResult_boolLightningErrorZ {
8009                 contents: CResult_boolLightningErrorZPtr {
8010                         err: Box::into_raw(Box::new(e)),
8011                 },
8012                 result_ok: false,
8013         }
8014 }
8015 #[no_mangle]
8016 /// Frees any resources used by the CResult_boolLightningErrorZ.
8017 pub extern "C" fn CResult_boolLightningErrorZ_free(_res: CResult_boolLightningErrorZ) { }
8018 impl Drop for CResult_boolLightningErrorZ {
8019         fn drop(&mut self) {
8020                 if self.result_ok {
8021                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
8022                                 let _ = unsafe { Box::from_raw(self.contents.result) };
8023                         }
8024                 } else {
8025                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
8026                                 let _ = unsafe { Box::from_raw(self.contents.err) };
8027                         }
8028                 }
8029         }
8030 }
8031 impl From<crate::c_types::CResultTempl<bool, crate::lightning::ln::msgs::LightningError>> for CResult_boolLightningErrorZ {
8032         fn from(mut o: crate::c_types::CResultTempl<bool, crate::lightning::ln::msgs::LightningError>) -> Self {
8033                 let contents = if o.result_ok {
8034                         let result = unsafe { o.contents.result };
8035                         unsafe { o.contents.result = std::ptr::null_mut() };
8036                         CResult_boolLightningErrorZPtr { result }
8037                 } else {
8038                         let err = unsafe { o.contents.err };
8039                         unsafe { o.contents.err = std::ptr::null_mut(); }
8040                         CResult_boolLightningErrorZPtr { err }
8041                 };
8042                 Self {
8043                         contents,
8044                         result_ok: o.result_ok,
8045                 }
8046         }
8047 }
8048 impl Clone for CResult_boolLightningErrorZ {
8049         fn clone(&self) -> Self {
8050                 if self.result_ok {
8051                         Self { result_ok: true, contents: CResult_boolLightningErrorZPtr {
8052                                 result: Box::into_raw(Box::new(<bool>::clone(unsafe { &*self.contents.result })))
8053                         } }
8054                 } else {
8055                         Self { result_ok: false, contents: CResult_boolLightningErrorZPtr {
8056                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::LightningError>::clone(unsafe { &*self.contents.err })))
8057                         } }
8058                 }
8059         }
8060 }
8061 #[no_mangle]
8062 /// Creates a new CResult_boolLightningErrorZ which has the same data as `orig`
8063 /// but with all dynamically-allocated buffers duplicated in new buffers.
8064 pub extern "C" fn CResult_boolLightningErrorZ_clone(orig: &CResult_boolLightningErrorZ) -> CResult_boolLightningErrorZ { Clone::clone(&orig) }
8065 #[repr(C)]
8066 /// A tuple of 3 elements. See the individual fields for the types contained.
8067 pub struct C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
8068         /// The element at position 0
8069         pub a: crate::lightning::ln::msgs::ChannelAnnouncement,
8070         /// The element at position 1
8071         pub b: crate::lightning::ln::msgs::ChannelUpdate,
8072         /// The element at position 2
8073         pub c: crate::lightning::ln::msgs::ChannelUpdate,
8074 }
8075 impl From<(crate::lightning::ln::msgs::ChannelAnnouncement, crate::lightning::ln::msgs::ChannelUpdate, crate::lightning::ln::msgs::ChannelUpdate)> for C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
8076         fn from (tup: (crate::lightning::ln::msgs::ChannelAnnouncement, crate::lightning::ln::msgs::ChannelUpdate, crate::lightning::ln::msgs::ChannelUpdate)) -> Self {
8077                 Self {
8078                         a: tup.0,
8079                         b: tup.1,
8080                         c: tup.2,
8081                 }
8082         }
8083 }
8084 impl C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
8085         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::lightning::ln::msgs::ChannelAnnouncement, crate::lightning::ln::msgs::ChannelUpdate, crate::lightning::ln::msgs::ChannelUpdate) {
8086                 (self.a, self.b, self.c)
8087         }
8088 }
8089 impl Clone for C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
8090         fn clone(&self) -> Self {
8091                 Self {
8092                         a: Clone::clone(&self.a),
8093                         b: Clone::clone(&self.b),
8094                         c: Clone::clone(&self.c),
8095                 }
8096         }
8097 }
8098 #[no_mangle]
8099 /// Creates a new tuple which has the same data as `orig`
8100 /// but with all dynamically-allocated buffers duplicated in new buffers.
8101 pub extern "C" fn C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(orig: &C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ) -> C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ { Clone::clone(&orig) }
8102 /// Creates a new C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ from the contained elements.
8103 #[no_mangle]
8104 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 {
8105         C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ { a, b, c, }
8106 }
8107
8108 #[no_mangle]
8109 /// Frees any resources used by the C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ.
8110 pub extern "C" fn C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free(_res: C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ) { }
8111 #[repr(C)]
8112 /// A dynamically-allocated array of crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZs of arbitrary size.
8113 /// This corresponds to std::vector in C++
8114 pub struct CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
8115         /// The elements in the array.
8116         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
8117         pub data: *mut crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ,
8118         /// The number of elements pointed to by `data`.
8119         pub datalen: usize
8120 }
8121 impl CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
8122         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ> {
8123                 if self.datalen == 0 { return Vec::new(); }
8124                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
8125                 self.data = std::ptr::null_mut();
8126                 self.datalen = 0;
8127                 ret
8128         }
8129         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ] {
8130                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
8131         }
8132 }
8133 impl From<Vec<crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ>> for CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
8134         fn from(v: Vec<crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ>) -> Self {
8135                 let datalen = v.len();
8136                 let data = Box::into_raw(v.into_boxed_slice());
8137                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
8138         }
8139 }
8140 #[no_mangle]
8141 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
8142 pub extern "C" fn CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free(_res: CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ) { }
8143 impl Drop for CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
8144         fn drop(&mut self) {
8145                 if self.datalen == 0 { return; }
8146                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
8147         }
8148 }
8149 impl Clone for CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
8150         fn clone(&self) -> Self {
8151                 let mut res = Vec::new();
8152                 if self.datalen == 0 { return Self::from(res); }
8153                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
8154                 Self::from(res)
8155         }
8156 }
8157 #[repr(C)]
8158 /// A dynamically-allocated array of crate::lightning::ln::msgs::NodeAnnouncements of arbitrary size.
8159 /// This corresponds to std::vector in C++
8160 pub struct CVec_NodeAnnouncementZ {
8161         /// The elements in the array.
8162         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
8163         pub data: *mut crate::lightning::ln::msgs::NodeAnnouncement,
8164         /// The number of elements pointed to by `data`.
8165         pub datalen: usize
8166 }
8167 impl CVec_NodeAnnouncementZ {
8168         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::NodeAnnouncement> {
8169                 if self.datalen == 0 { return Vec::new(); }
8170                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
8171                 self.data = std::ptr::null_mut();
8172                 self.datalen = 0;
8173                 ret
8174         }
8175         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::NodeAnnouncement] {
8176                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
8177         }
8178 }
8179 impl From<Vec<crate::lightning::ln::msgs::NodeAnnouncement>> for CVec_NodeAnnouncementZ {
8180         fn from(v: Vec<crate::lightning::ln::msgs::NodeAnnouncement>) -> Self {
8181                 let datalen = v.len();
8182                 let data = Box::into_raw(v.into_boxed_slice());
8183                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
8184         }
8185 }
8186 #[no_mangle]
8187 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
8188 pub extern "C" fn CVec_NodeAnnouncementZ_free(_res: CVec_NodeAnnouncementZ) { }
8189 impl Drop for CVec_NodeAnnouncementZ {
8190         fn drop(&mut self) {
8191                 if self.datalen == 0 { return; }
8192                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
8193         }
8194 }
8195 impl Clone for CVec_NodeAnnouncementZ {
8196         fn clone(&self) -> Self {
8197                 let mut res = Vec::new();
8198                 if self.datalen == 0 { return Self::from(res); }
8199                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
8200                 Self::from(res)
8201         }
8202 }
8203 #[repr(C)]
8204 /// A dynamically-allocated array of crate::c_types::PublicKeys of arbitrary size.
8205 /// This corresponds to std::vector in C++
8206 pub struct CVec_PublicKeyZ {
8207         /// The elements in the array.
8208         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
8209         pub data: *mut crate::c_types::PublicKey,
8210         /// The number of elements pointed to by `data`.
8211         pub datalen: usize
8212 }
8213 impl CVec_PublicKeyZ {
8214         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::PublicKey> {
8215                 if self.datalen == 0 { return Vec::new(); }
8216                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
8217                 self.data = std::ptr::null_mut();
8218                 self.datalen = 0;
8219                 ret
8220         }
8221         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::PublicKey] {
8222                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
8223         }
8224 }
8225 impl From<Vec<crate::c_types::PublicKey>> for CVec_PublicKeyZ {
8226         fn from(v: Vec<crate::c_types::PublicKey>) -> Self {
8227                 let datalen = v.len();
8228                 let data = Box::into_raw(v.into_boxed_slice());
8229                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
8230         }
8231 }
8232 #[no_mangle]
8233 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
8234 pub extern "C" fn CVec_PublicKeyZ_free(_res: CVec_PublicKeyZ) { }
8235 impl Drop for CVec_PublicKeyZ {
8236         fn drop(&mut self) {
8237                 if self.datalen == 0 { return; }
8238                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
8239         }
8240 }
8241 impl Clone for CVec_PublicKeyZ {
8242         fn clone(&self) -> Self {
8243                 let mut res = Vec::new();
8244                 if self.datalen == 0 { return Self::from(res); }
8245                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
8246                 Self::from(res)
8247         }
8248 }
8249 #[repr(C)]
8250 /// The contents of CResult_CVec_u8ZPeerHandleErrorZ
8251 pub union CResult_CVec_u8ZPeerHandleErrorZPtr {
8252         /// A pointer to the contents in the success state.
8253         /// Reading from this pointer when `result_ok` is not set is undefined.
8254         pub result: *mut crate::c_types::derived::CVec_u8Z,
8255         /// A pointer to the contents in the error state.
8256         /// Reading from this pointer when `result_ok` is set is undefined.
8257         pub err: *mut crate::lightning::ln::peer_handler::PeerHandleError,
8258 }
8259 #[repr(C)]
8260 /// A CResult_CVec_u8ZPeerHandleErrorZ represents the result of a fallible operation,
8261 /// containing a crate::c_types::derived::CVec_u8Z on success and a crate::lightning::ln::peer_handler::PeerHandleError on failure.
8262 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8263 pub struct CResult_CVec_u8ZPeerHandleErrorZ {
8264         /// The contents of this CResult_CVec_u8ZPeerHandleErrorZ, accessible via either
8265         /// `err` or `result` depending on the state of `result_ok`.
8266         pub contents: CResult_CVec_u8ZPeerHandleErrorZPtr,
8267         /// Whether this CResult_CVec_u8ZPeerHandleErrorZ represents a success state.
8268         pub result_ok: bool,
8269 }
8270 #[no_mangle]
8271 /// Creates a new CResult_CVec_u8ZPeerHandleErrorZ in the success state.
8272 pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_ok(o: crate::c_types::derived::CVec_u8Z) -> CResult_CVec_u8ZPeerHandleErrorZ {
8273         CResult_CVec_u8ZPeerHandleErrorZ {
8274                 contents: CResult_CVec_u8ZPeerHandleErrorZPtr {
8275                         result: Box::into_raw(Box::new(o)),
8276                 },
8277                 result_ok: true,
8278         }
8279 }
8280 #[no_mangle]
8281 /// Creates a new CResult_CVec_u8ZPeerHandleErrorZ in the error state.
8282 pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_err(e: crate::lightning::ln::peer_handler::PeerHandleError) -> CResult_CVec_u8ZPeerHandleErrorZ {
8283         CResult_CVec_u8ZPeerHandleErrorZ {
8284                 contents: CResult_CVec_u8ZPeerHandleErrorZPtr {
8285                         err: Box::into_raw(Box::new(e)),
8286                 },
8287                 result_ok: false,
8288         }
8289 }
8290 #[no_mangle]
8291 /// Frees any resources used by the CResult_CVec_u8ZPeerHandleErrorZ.
8292 pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_free(_res: CResult_CVec_u8ZPeerHandleErrorZ) { }
8293 impl Drop for CResult_CVec_u8ZPeerHandleErrorZ {
8294         fn drop(&mut self) {
8295                 if self.result_ok {
8296                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
8297                                 let _ = unsafe { Box::from_raw(self.contents.result) };
8298                         }
8299                 } else {
8300                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
8301                                 let _ = unsafe { Box::from_raw(self.contents.err) };
8302                         }
8303                 }
8304         }
8305 }
8306 impl From<crate::c_types::CResultTempl<crate::c_types::derived::CVec_u8Z, crate::lightning::ln::peer_handler::PeerHandleError>> for CResult_CVec_u8ZPeerHandleErrorZ {
8307         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CVec_u8Z, crate::lightning::ln::peer_handler::PeerHandleError>) -> Self {
8308                 let contents = if o.result_ok {
8309                         let result = unsafe { o.contents.result };
8310                         unsafe { o.contents.result = std::ptr::null_mut() };
8311                         CResult_CVec_u8ZPeerHandleErrorZPtr { result }
8312                 } else {
8313                         let err = unsafe { o.contents.err };
8314                         unsafe { o.contents.err = std::ptr::null_mut(); }
8315                         CResult_CVec_u8ZPeerHandleErrorZPtr { err }
8316                 };
8317                 Self {
8318                         contents,
8319                         result_ok: o.result_ok,
8320                 }
8321         }
8322 }
8323 impl Clone for CResult_CVec_u8ZPeerHandleErrorZ {
8324         fn clone(&self) -> Self {
8325                 if self.result_ok {
8326                         Self { result_ok: true, contents: CResult_CVec_u8ZPeerHandleErrorZPtr {
8327                                 result: Box::into_raw(Box::new(<crate::c_types::derived::CVec_u8Z>::clone(unsafe { &*self.contents.result })))
8328                         } }
8329                 } else {
8330                         Self { result_ok: false, contents: CResult_CVec_u8ZPeerHandleErrorZPtr {
8331                                 err: Box::into_raw(Box::new(<crate::lightning::ln::peer_handler::PeerHandleError>::clone(unsafe { &*self.contents.err })))
8332                         } }
8333                 }
8334         }
8335 }
8336 #[no_mangle]
8337 /// Creates a new CResult_CVec_u8ZPeerHandleErrorZ which has the same data as `orig`
8338 /// but with all dynamically-allocated buffers duplicated in new buffers.
8339 pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_clone(orig: &CResult_CVec_u8ZPeerHandleErrorZ) -> CResult_CVec_u8ZPeerHandleErrorZ { Clone::clone(&orig) }
8340 #[repr(C)]
8341 /// The contents of CResult_NonePeerHandleErrorZ
8342 pub union CResult_NonePeerHandleErrorZPtr {
8343         /// Note that this value is always NULL, as there are no contents in the OK variant
8344         pub result: *mut std::ffi::c_void,
8345         /// A pointer to the contents in the error state.
8346         /// Reading from this pointer when `result_ok` is set is undefined.
8347         pub err: *mut crate::lightning::ln::peer_handler::PeerHandleError,
8348 }
8349 #[repr(C)]
8350 /// A CResult_NonePeerHandleErrorZ represents the result of a fallible operation,
8351 /// containing a () on success and a crate::lightning::ln::peer_handler::PeerHandleError on failure.
8352 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8353 pub struct CResult_NonePeerHandleErrorZ {
8354         /// The contents of this CResult_NonePeerHandleErrorZ, accessible via either
8355         /// `err` or `result` depending on the state of `result_ok`.
8356         pub contents: CResult_NonePeerHandleErrorZPtr,
8357         /// Whether this CResult_NonePeerHandleErrorZ represents a success state.
8358         pub result_ok: bool,
8359 }
8360 #[no_mangle]
8361 /// Creates a new CResult_NonePeerHandleErrorZ in the success state.
8362 pub extern "C" fn CResult_NonePeerHandleErrorZ_ok() -> CResult_NonePeerHandleErrorZ {
8363         CResult_NonePeerHandleErrorZ {
8364                 contents: CResult_NonePeerHandleErrorZPtr {
8365                         result: std::ptr::null_mut(),
8366                 },
8367                 result_ok: true,
8368         }
8369 }
8370 #[no_mangle]
8371 /// Creates a new CResult_NonePeerHandleErrorZ in the error state.
8372 pub extern "C" fn CResult_NonePeerHandleErrorZ_err(e: crate::lightning::ln::peer_handler::PeerHandleError) -> CResult_NonePeerHandleErrorZ {
8373         CResult_NonePeerHandleErrorZ {
8374                 contents: CResult_NonePeerHandleErrorZPtr {
8375                         err: Box::into_raw(Box::new(e)),
8376                 },
8377                 result_ok: false,
8378         }
8379 }
8380 #[no_mangle]
8381 /// Frees any resources used by the CResult_NonePeerHandleErrorZ.
8382 pub extern "C" fn CResult_NonePeerHandleErrorZ_free(_res: CResult_NonePeerHandleErrorZ) { }
8383 impl Drop for CResult_NonePeerHandleErrorZ {
8384         fn drop(&mut self) {
8385                 if self.result_ok {
8386                 } else {
8387                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
8388                                 let _ = unsafe { Box::from_raw(self.contents.err) };
8389                         }
8390                 }
8391         }
8392 }
8393 impl From<crate::c_types::CResultTempl<(), crate::lightning::ln::peer_handler::PeerHandleError>> for CResult_NonePeerHandleErrorZ {
8394         fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::ln::peer_handler::PeerHandleError>) -> Self {
8395                 let contents = if o.result_ok {
8396                         let _ = unsafe { Box::from_raw(o.contents.result) };
8397                         o.contents.result = std::ptr::null_mut();
8398                         CResult_NonePeerHandleErrorZPtr { result: std::ptr::null_mut() }
8399                 } else {
8400                         let err = unsafe { o.contents.err };
8401                         unsafe { o.contents.err = std::ptr::null_mut(); }
8402                         CResult_NonePeerHandleErrorZPtr { err }
8403                 };
8404                 Self {
8405                         contents,
8406                         result_ok: o.result_ok,
8407                 }
8408         }
8409 }
8410 impl Clone for CResult_NonePeerHandleErrorZ {
8411         fn clone(&self) -> Self {
8412                 if self.result_ok {
8413                         Self { result_ok: true, contents: CResult_NonePeerHandleErrorZPtr {
8414                                 result: std::ptr::null_mut()
8415                         } }
8416                 } else {
8417                         Self { result_ok: false, contents: CResult_NonePeerHandleErrorZPtr {
8418                                 err: Box::into_raw(Box::new(<crate::lightning::ln::peer_handler::PeerHandleError>::clone(unsafe { &*self.contents.err })))
8419                         } }
8420                 }
8421         }
8422 }
8423 #[no_mangle]
8424 /// Creates a new CResult_NonePeerHandleErrorZ which has the same data as `orig`
8425 /// but with all dynamically-allocated buffers duplicated in new buffers.
8426 pub extern "C" fn CResult_NonePeerHandleErrorZ_clone(orig: &CResult_NonePeerHandleErrorZ) -> CResult_NonePeerHandleErrorZ { Clone::clone(&orig) }
8427 #[repr(C)]
8428 /// The contents of CResult_boolPeerHandleErrorZ
8429 pub union CResult_boolPeerHandleErrorZPtr {
8430         /// A pointer to the contents in the success state.
8431         /// Reading from this pointer when `result_ok` is not set is undefined.
8432         pub result: *mut bool,
8433         /// A pointer to the contents in the error state.
8434         /// Reading from this pointer when `result_ok` is set is undefined.
8435         pub err: *mut crate::lightning::ln::peer_handler::PeerHandleError,
8436 }
8437 #[repr(C)]
8438 /// A CResult_boolPeerHandleErrorZ represents the result of a fallible operation,
8439 /// containing a bool on success and a crate::lightning::ln::peer_handler::PeerHandleError on failure.
8440 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8441 pub struct CResult_boolPeerHandleErrorZ {
8442         /// The contents of this CResult_boolPeerHandleErrorZ, accessible via either
8443         /// `err` or `result` depending on the state of `result_ok`.
8444         pub contents: CResult_boolPeerHandleErrorZPtr,
8445         /// Whether this CResult_boolPeerHandleErrorZ represents a success state.
8446         pub result_ok: bool,
8447 }
8448 #[no_mangle]
8449 /// Creates a new CResult_boolPeerHandleErrorZ in the success state.
8450 pub extern "C" fn CResult_boolPeerHandleErrorZ_ok(o: bool) -> CResult_boolPeerHandleErrorZ {
8451         CResult_boolPeerHandleErrorZ {
8452                 contents: CResult_boolPeerHandleErrorZPtr {
8453                         result: Box::into_raw(Box::new(o)),
8454                 },
8455                 result_ok: true,
8456         }
8457 }
8458 #[no_mangle]
8459 /// Creates a new CResult_boolPeerHandleErrorZ in the error state.
8460 pub extern "C" fn CResult_boolPeerHandleErrorZ_err(e: crate::lightning::ln::peer_handler::PeerHandleError) -> CResult_boolPeerHandleErrorZ {
8461         CResult_boolPeerHandleErrorZ {
8462                 contents: CResult_boolPeerHandleErrorZPtr {
8463                         err: Box::into_raw(Box::new(e)),
8464                 },
8465                 result_ok: false,
8466         }
8467 }
8468 #[no_mangle]
8469 /// Frees any resources used by the CResult_boolPeerHandleErrorZ.
8470 pub extern "C" fn CResult_boolPeerHandleErrorZ_free(_res: CResult_boolPeerHandleErrorZ) { }
8471 impl Drop for CResult_boolPeerHandleErrorZ {
8472         fn drop(&mut self) {
8473                 if self.result_ok {
8474                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
8475                                 let _ = unsafe { Box::from_raw(self.contents.result) };
8476                         }
8477                 } else {
8478                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
8479                                 let _ = unsafe { Box::from_raw(self.contents.err) };
8480                         }
8481                 }
8482         }
8483 }
8484 impl From<crate::c_types::CResultTempl<bool, crate::lightning::ln::peer_handler::PeerHandleError>> for CResult_boolPeerHandleErrorZ {
8485         fn from(mut o: crate::c_types::CResultTempl<bool, crate::lightning::ln::peer_handler::PeerHandleError>) -> Self {
8486                 let contents = if o.result_ok {
8487                         let result = unsafe { o.contents.result };
8488                         unsafe { o.contents.result = std::ptr::null_mut() };
8489                         CResult_boolPeerHandleErrorZPtr { result }
8490                 } else {
8491                         let err = unsafe { o.contents.err };
8492                         unsafe { o.contents.err = std::ptr::null_mut(); }
8493                         CResult_boolPeerHandleErrorZPtr { err }
8494                 };
8495                 Self {
8496                         contents,
8497                         result_ok: o.result_ok,
8498                 }
8499         }
8500 }
8501 impl Clone for CResult_boolPeerHandleErrorZ {
8502         fn clone(&self) -> Self {
8503                 if self.result_ok {
8504                         Self { result_ok: true, contents: CResult_boolPeerHandleErrorZPtr {
8505                                 result: Box::into_raw(Box::new(<bool>::clone(unsafe { &*self.contents.result })))
8506                         } }
8507                 } else {
8508                         Self { result_ok: false, contents: CResult_boolPeerHandleErrorZPtr {
8509                                 err: Box::into_raw(Box::new(<crate::lightning::ln::peer_handler::PeerHandleError>::clone(unsafe { &*self.contents.err })))
8510                         } }
8511                 }
8512         }
8513 }
8514 #[no_mangle]
8515 /// Creates a new CResult_boolPeerHandleErrorZ which has the same data as `orig`
8516 /// but with all dynamically-allocated buffers duplicated in new buffers.
8517 pub extern "C" fn CResult_boolPeerHandleErrorZ_clone(orig: &CResult_boolPeerHandleErrorZ) -> CResult_boolPeerHandleErrorZ { Clone::clone(&orig) }
8518 #[repr(C)]
8519 /// The contents of CResult_NodeIdDecodeErrorZ
8520 pub union CResult_NodeIdDecodeErrorZPtr {
8521         /// A pointer to the contents in the success state.
8522         /// Reading from this pointer when `result_ok` is not set is undefined.
8523         pub result: *mut crate::lightning::routing::network_graph::NodeId,
8524         /// A pointer to the contents in the error state.
8525         /// Reading from this pointer when `result_ok` is set is undefined.
8526         pub err: *mut crate::lightning::ln::msgs::DecodeError,
8527 }
8528 #[repr(C)]
8529 /// A CResult_NodeIdDecodeErrorZ represents the result of a fallible operation,
8530 /// containing a crate::lightning::routing::network_graph::NodeId on success and a crate::lightning::ln::msgs::DecodeError on failure.
8531 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8532 pub struct CResult_NodeIdDecodeErrorZ {
8533         /// The contents of this CResult_NodeIdDecodeErrorZ, accessible via either
8534         /// `err` or `result` depending on the state of `result_ok`.
8535         pub contents: CResult_NodeIdDecodeErrorZPtr,
8536         /// Whether this CResult_NodeIdDecodeErrorZ represents a success state.
8537         pub result_ok: bool,
8538 }
8539 #[no_mangle]
8540 /// Creates a new CResult_NodeIdDecodeErrorZ in the success state.
8541 pub extern "C" fn CResult_NodeIdDecodeErrorZ_ok(o: crate::lightning::routing::network_graph::NodeId) -> CResult_NodeIdDecodeErrorZ {
8542         CResult_NodeIdDecodeErrorZ {
8543                 contents: CResult_NodeIdDecodeErrorZPtr {
8544                         result: Box::into_raw(Box::new(o)),
8545                 },
8546                 result_ok: true,
8547         }
8548 }
8549 #[no_mangle]
8550 /// Creates a new CResult_NodeIdDecodeErrorZ in the error state.
8551 pub extern "C" fn CResult_NodeIdDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeIdDecodeErrorZ {
8552         CResult_NodeIdDecodeErrorZ {
8553                 contents: CResult_NodeIdDecodeErrorZPtr {
8554                         err: Box::into_raw(Box::new(e)),
8555                 },
8556                 result_ok: false,
8557         }
8558 }
8559 #[no_mangle]
8560 /// Frees any resources used by the CResult_NodeIdDecodeErrorZ.
8561 pub extern "C" fn CResult_NodeIdDecodeErrorZ_free(_res: CResult_NodeIdDecodeErrorZ) { }
8562 impl Drop for CResult_NodeIdDecodeErrorZ {
8563         fn drop(&mut self) {
8564                 if self.result_ok {
8565                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
8566                                 let _ = unsafe { Box::from_raw(self.contents.result) };
8567                         }
8568                 } else {
8569                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
8570                                 let _ = unsafe { Box::from_raw(self.contents.err) };
8571                         }
8572                 }
8573         }
8574 }
8575 impl From<crate::c_types::CResultTempl<crate::lightning::routing::network_graph::NodeId, crate::lightning::ln::msgs::DecodeError>> for CResult_NodeIdDecodeErrorZ {
8576         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::network_graph::NodeId, crate::lightning::ln::msgs::DecodeError>) -> Self {
8577                 let contents = if o.result_ok {
8578                         let result = unsafe { o.contents.result };
8579                         unsafe { o.contents.result = std::ptr::null_mut() };
8580                         CResult_NodeIdDecodeErrorZPtr { result }
8581                 } else {
8582                         let err = unsafe { o.contents.err };
8583                         unsafe { o.contents.err = std::ptr::null_mut(); }
8584                         CResult_NodeIdDecodeErrorZPtr { err }
8585                 };
8586                 Self {
8587                         contents,
8588                         result_ok: o.result_ok,
8589                 }
8590         }
8591 }
8592 impl Clone for CResult_NodeIdDecodeErrorZ {
8593         fn clone(&self) -> Self {
8594                 if self.result_ok {
8595                         Self { result_ok: true, contents: CResult_NodeIdDecodeErrorZPtr {
8596                                 result: Box::into_raw(Box::new(<crate::lightning::routing::network_graph::NodeId>::clone(unsafe { &*self.contents.result })))
8597                         } }
8598                 } else {
8599                         Self { result_ok: false, contents: CResult_NodeIdDecodeErrorZPtr {
8600                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
8601                         } }
8602                 }
8603         }
8604 }
8605 #[no_mangle]
8606 /// Creates a new CResult_NodeIdDecodeErrorZ which has the same data as `orig`
8607 /// but with all dynamically-allocated buffers duplicated in new buffers.
8608 pub extern "C" fn CResult_NodeIdDecodeErrorZ_clone(orig: &CResult_NodeIdDecodeErrorZ) -> CResult_NodeIdDecodeErrorZ { Clone::clone(&orig) }
8609 #[repr(C)]
8610 /// An enum which can either contain a crate::lightning::chain::Access or not
8611 pub enum COption_AccessZ {
8612         /// When we're in this state, this COption_AccessZ contains a crate::lightning::chain::Access
8613         Some(crate::lightning::chain::Access),
8614         /// When we're in this state, this COption_AccessZ contains nothing
8615         None
8616 }
8617 impl COption_AccessZ {
8618         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
8619                 if let Self::Some(_) = self { true } else { false }
8620         }
8621         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
8622                 !self.is_some()
8623         }
8624         #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::chain::Access {
8625                 if let Self::Some(v) = self { v } else { unreachable!() }
8626         }
8627 }
8628 #[no_mangle]
8629 /// Constructs a new COption_AccessZ containing a crate::lightning::chain::Access
8630 pub extern "C" fn COption_AccessZ_some(o: crate::lightning::chain::Access) -> COption_AccessZ {
8631         COption_AccessZ::Some(o)
8632 }
8633 #[no_mangle]
8634 /// Constructs a new COption_AccessZ containing nothing
8635 pub extern "C" fn COption_AccessZ_none() -> COption_AccessZ {
8636         COption_AccessZ::None
8637 }
8638 #[no_mangle]
8639 /// Frees any resources associated with the crate::lightning::chain::Access, if we are in the Some state
8640 pub extern "C" fn COption_AccessZ_free(_res: COption_AccessZ) { }
8641 #[repr(C)]
8642 /// The contents of CResult_DirectionalChannelInfoDecodeErrorZ
8643 pub union CResult_DirectionalChannelInfoDecodeErrorZPtr {
8644         /// A pointer to the contents in the success state.
8645         /// Reading from this pointer when `result_ok` is not set is undefined.
8646         pub result: *mut crate::lightning::routing::network_graph::DirectionalChannelInfo,
8647         /// A pointer to the contents in the error state.
8648         /// Reading from this pointer when `result_ok` is set is undefined.
8649         pub err: *mut crate::lightning::ln::msgs::DecodeError,
8650 }
8651 #[repr(C)]
8652 /// A CResult_DirectionalChannelInfoDecodeErrorZ represents the result of a fallible operation,
8653 /// containing a crate::lightning::routing::network_graph::DirectionalChannelInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
8654 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8655 pub struct CResult_DirectionalChannelInfoDecodeErrorZ {
8656         /// The contents of this CResult_DirectionalChannelInfoDecodeErrorZ, accessible via either
8657         /// `err` or `result` depending on the state of `result_ok`.
8658         pub contents: CResult_DirectionalChannelInfoDecodeErrorZPtr,
8659         /// Whether this CResult_DirectionalChannelInfoDecodeErrorZ represents a success state.
8660         pub result_ok: bool,
8661 }
8662 #[no_mangle]
8663 /// Creates a new CResult_DirectionalChannelInfoDecodeErrorZ in the success state.
8664 pub extern "C" fn CResult_DirectionalChannelInfoDecodeErrorZ_ok(o: crate::lightning::routing::network_graph::DirectionalChannelInfo) -> CResult_DirectionalChannelInfoDecodeErrorZ {
8665         CResult_DirectionalChannelInfoDecodeErrorZ {
8666                 contents: CResult_DirectionalChannelInfoDecodeErrorZPtr {
8667                         result: Box::into_raw(Box::new(o)),
8668                 },
8669                 result_ok: true,
8670         }
8671 }
8672 #[no_mangle]
8673 /// Creates a new CResult_DirectionalChannelInfoDecodeErrorZ in the error state.
8674 pub extern "C" fn CResult_DirectionalChannelInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_DirectionalChannelInfoDecodeErrorZ {
8675         CResult_DirectionalChannelInfoDecodeErrorZ {
8676                 contents: CResult_DirectionalChannelInfoDecodeErrorZPtr {
8677                         err: Box::into_raw(Box::new(e)),
8678                 },
8679                 result_ok: false,
8680         }
8681 }
8682 #[no_mangle]
8683 /// Frees any resources used by the CResult_DirectionalChannelInfoDecodeErrorZ.
8684 pub extern "C" fn CResult_DirectionalChannelInfoDecodeErrorZ_free(_res: CResult_DirectionalChannelInfoDecodeErrorZ) { }
8685 impl Drop for CResult_DirectionalChannelInfoDecodeErrorZ {
8686         fn drop(&mut self) {
8687                 if self.result_ok {
8688                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
8689                                 let _ = unsafe { Box::from_raw(self.contents.result) };
8690                         }
8691                 } else {
8692                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
8693                                 let _ = unsafe { Box::from_raw(self.contents.err) };
8694                         }
8695                 }
8696         }
8697 }
8698 impl From<crate::c_types::CResultTempl<crate::lightning::routing::network_graph::DirectionalChannelInfo, crate::lightning::ln::msgs::DecodeError>> for CResult_DirectionalChannelInfoDecodeErrorZ {
8699         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::network_graph::DirectionalChannelInfo, crate::lightning::ln::msgs::DecodeError>) -> Self {
8700                 let contents = if o.result_ok {
8701                         let result = unsafe { o.contents.result };
8702                         unsafe { o.contents.result = std::ptr::null_mut() };
8703                         CResult_DirectionalChannelInfoDecodeErrorZPtr { result }
8704                 } else {
8705                         let err = unsafe { o.contents.err };
8706                         unsafe { o.contents.err = std::ptr::null_mut(); }
8707                         CResult_DirectionalChannelInfoDecodeErrorZPtr { err }
8708                 };
8709                 Self {
8710                         contents,
8711                         result_ok: o.result_ok,
8712                 }
8713         }
8714 }
8715 impl Clone for CResult_DirectionalChannelInfoDecodeErrorZ {
8716         fn clone(&self) -> Self {
8717                 if self.result_ok {
8718                         Self { result_ok: true, contents: CResult_DirectionalChannelInfoDecodeErrorZPtr {
8719                                 result: Box::into_raw(Box::new(<crate::lightning::routing::network_graph::DirectionalChannelInfo>::clone(unsafe { &*self.contents.result })))
8720                         } }
8721                 } else {
8722                         Self { result_ok: false, contents: CResult_DirectionalChannelInfoDecodeErrorZPtr {
8723                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
8724                         } }
8725                 }
8726         }
8727 }
8728 #[no_mangle]
8729 /// Creates a new CResult_DirectionalChannelInfoDecodeErrorZ which has the same data as `orig`
8730 /// but with all dynamically-allocated buffers duplicated in new buffers.
8731 pub extern "C" fn CResult_DirectionalChannelInfoDecodeErrorZ_clone(orig: &CResult_DirectionalChannelInfoDecodeErrorZ) -> CResult_DirectionalChannelInfoDecodeErrorZ { Clone::clone(&orig) }
8732 #[repr(C)]
8733 /// The contents of CResult_ChannelInfoDecodeErrorZ
8734 pub union CResult_ChannelInfoDecodeErrorZPtr {
8735         /// A pointer to the contents in the success state.
8736         /// Reading from this pointer when `result_ok` is not set is undefined.
8737         pub result: *mut crate::lightning::routing::network_graph::ChannelInfo,
8738         /// A pointer to the contents in the error state.
8739         /// Reading from this pointer when `result_ok` is set is undefined.
8740         pub err: *mut crate::lightning::ln::msgs::DecodeError,
8741 }
8742 #[repr(C)]
8743 /// A CResult_ChannelInfoDecodeErrorZ represents the result of a fallible operation,
8744 /// containing a crate::lightning::routing::network_graph::ChannelInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
8745 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8746 pub struct CResult_ChannelInfoDecodeErrorZ {
8747         /// The contents of this CResult_ChannelInfoDecodeErrorZ, accessible via either
8748         /// `err` or `result` depending on the state of `result_ok`.
8749         pub contents: CResult_ChannelInfoDecodeErrorZPtr,
8750         /// Whether this CResult_ChannelInfoDecodeErrorZ represents a success state.
8751         pub result_ok: bool,
8752 }
8753 #[no_mangle]
8754 /// Creates a new CResult_ChannelInfoDecodeErrorZ in the success state.
8755 pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_ok(o: crate::lightning::routing::network_graph::ChannelInfo) -> CResult_ChannelInfoDecodeErrorZ {
8756         CResult_ChannelInfoDecodeErrorZ {
8757                 contents: CResult_ChannelInfoDecodeErrorZPtr {
8758                         result: Box::into_raw(Box::new(o)),
8759                 },
8760                 result_ok: true,
8761         }
8762 }
8763 #[no_mangle]
8764 /// Creates a new CResult_ChannelInfoDecodeErrorZ in the error state.
8765 pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelInfoDecodeErrorZ {
8766         CResult_ChannelInfoDecodeErrorZ {
8767                 contents: CResult_ChannelInfoDecodeErrorZPtr {
8768                         err: Box::into_raw(Box::new(e)),
8769                 },
8770                 result_ok: false,
8771         }
8772 }
8773 #[no_mangle]
8774 /// Frees any resources used by the CResult_ChannelInfoDecodeErrorZ.
8775 pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_free(_res: CResult_ChannelInfoDecodeErrorZ) { }
8776 impl Drop for CResult_ChannelInfoDecodeErrorZ {
8777         fn drop(&mut self) {
8778                 if self.result_ok {
8779                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
8780                                 let _ = unsafe { Box::from_raw(self.contents.result) };
8781                         }
8782                 } else {
8783                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
8784                                 let _ = unsafe { Box::from_raw(self.contents.err) };
8785                         }
8786                 }
8787         }
8788 }
8789 impl From<crate::c_types::CResultTempl<crate::lightning::routing::network_graph::ChannelInfo, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelInfoDecodeErrorZ {
8790         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::network_graph::ChannelInfo, crate::lightning::ln::msgs::DecodeError>) -> Self {
8791                 let contents = if o.result_ok {
8792                         let result = unsafe { o.contents.result };
8793                         unsafe { o.contents.result = std::ptr::null_mut() };
8794                         CResult_ChannelInfoDecodeErrorZPtr { result }
8795                 } else {
8796                         let err = unsafe { o.contents.err };
8797                         unsafe { o.contents.err = std::ptr::null_mut(); }
8798                         CResult_ChannelInfoDecodeErrorZPtr { err }
8799                 };
8800                 Self {
8801                         contents,
8802                         result_ok: o.result_ok,
8803                 }
8804         }
8805 }
8806 impl Clone for CResult_ChannelInfoDecodeErrorZ {
8807         fn clone(&self) -> Self {
8808                 if self.result_ok {
8809                         Self { result_ok: true, contents: CResult_ChannelInfoDecodeErrorZPtr {
8810                                 result: Box::into_raw(Box::new(<crate::lightning::routing::network_graph::ChannelInfo>::clone(unsafe { &*self.contents.result })))
8811                         } }
8812                 } else {
8813                         Self { result_ok: false, contents: CResult_ChannelInfoDecodeErrorZPtr {
8814                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
8815                         } }
8816                 }
8817         }
8818 }
8819 #[no_mangle]
8820 /// Creates a new CResult_ChannelInfoDecodeErrorZ which has the same data as `orig`
8821 /// but with all dynamically-allocated buffers duplicated in new buffers.
8822 pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_clone(orig: &CResult_ChannelInfoDecodeErrorZ) -> CResult_ChannelInfoDecodeErrorZ { Clone::clone(&orig) }
8823 #[repr(C)]
8824 /// The contents of CResult_RoutingFeesDecodeErrorZ
8825 pub union CResult_RoutingFeesDecodeErrorZPtr {
8826         /// A pointer to the contents in the success state.
8827         /// Reading from this pointer when `result_ok` is not set is undefined.
8828         pub result: *mut crate::lightning::routing::network_graph::RoutingFees,
8829         /// A pointer to the contents in the error state.
8830         /// Reading from this pointer when `result_ok` is set is undefined.
8831         pub err: *mut crate::lightning::ln::msgs::DecodeError,
8832 }
8833 #[repr(C)]
8834 /// A CResult_RoutingFeesDecodeErrorZ represents the result of a fallible operation,
8835 /// containing a crate::lightning::routing::network_graph::RoutingFees on success and a crate::lightning::ln::msgs::DecodeError on failure.
8836 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8837 pub struct CResult_RoutingFeesDecodeErrorZ {
8838         /// The contents of this CResult_RoutingFeesDecodeErrorZ, accessible via either
8839         /// `err` or `result` depending on the state of `result_ok`.
8840         pub contents: CResult_RoutingFeesDecodeErrorZPtr,
8841         /// Whether this CResult_RoutingFeesDecodeErrorZ represents a success state.
8842         pub result_ok: bool,
8843 }
8844 #[no_mangle]
8845 /// Creates a new CResult_RoutingFeesDecodeErrorZ in the success state.
8846 pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_ok(o: crate::lightning::routing::network_graph::RoutingFees) -> CResult_RoutingFeesDecodeErrorZ {
8847         CResult_RoutingFeesDecodeErrorZ {
8848                 contents: CResult_RoutingFeesDecodeErrorZPtr {
8849                         result: Box::into_raw(Box::new(o)),
8850                 },
8851                 result_ok: true,
8852         }
8853 }
8854 #[no_mangle]
8855 /// Creates a new CResult_RoutingFeesDecodeErrorZ in the error state.
8856 pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RoutingFeesDecodeErrorZ {
8857         CResult_RoutingFeesDecodeErrorZ {
8858                 contents: CResult_RoutingFeesDecodeErrorZPtr {
8859                         err: Box::into_raw(Box::new(e)),
8860                 },
8861                 result_ok: false,
8862         }
8863 }
8864 #[no_mangle]
8865 /// Frees any resources used by the CResult_RoutingFeesDecodeErrorZ.
8866 pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_free(_res: CResult_RoutingFeesDecodeErrorZ) { }
8867 impl Drop for CResult_RoutingFeesDecodeErrorZ {
8868         fn drop(&mut self) {
8869                 if self.result_ok {
8870                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
8871                                 let _ = unsafe { Box::from_raw(self.contents.result) };
8872                         }
8873                 } else {
8874                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
8875                                 let _ = unsafe { Box::from_raw(self.contents.err) };
8876                         }
8877                 }
8878         }
8879 }
8880 impl From<crate::c_types::CResultTempl<crate::lightning::routing::network_graph::RoutingFees, crate::lightning::ln::msgs::DecodeError>> for CResult_RoutingFeesDecodeErrorZ {
8881         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::network_graph::RoutingFees, crate::lightning::ln::msgs::DecodeError>) -> Self {
8882                 let contents = if o.result_ok {
8883                         let result = unsafe { o.contents.result };
8884                         unsafe { o.contents.result = std::ptr::null_mut() };
8885                         CResult_RoutingFeesDecodeErrorZPtr { result }
8886                 } else {
8887                         let err = unsafe { o.contents.err };
8888                         unsafe { o.contents.err = std::ptr::null_mut(); }
8889                         CResult_RoutingFeesDecodeErrorZPtr { err }
8890                 };
8891                 Self {
8892                         contents,
8893                         result_ok: o.result_ok,
8894                 }
8895         }
8896 }
8897 impl Clone for CResult_RoutingFeesDecodeErrorZ {
8898         fn clone(&self) -> Self {
8899                 if self.result_ok {
8900                         Self { result_ok: true, contents: CResult_RoutingFeesDecodeErrorZPtr {
8901                                 result: Box::into_raw(Box::new(<crate::lightning::routing::network_graph::RoutingFees>::clone(unsafe { &*self.contents.result })))
8902                         } }
8903                 } else {
8904                         Self { result_ok: false, contents: CResult_RoutingFeesDecodeErrorZPtr {
8905                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
8906                         } }
8907                 }
8908         }
8909 }
8910 #[no_mangle]
8911 /// Creates a new CResult_RoutingFeesDecodeErrorZ which has the same data as `orig`
8912 /// but with all dynamically-allocated buffers duplicated in new buffers.
8913 pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_clone(orig: &CResult_RoutingFeesDecodeErrorZ) -> CResult_RoutingFeesDecodeErrorZ { Clone::clone(&orig) }
8914 #[repr(C)]
8915 /// The contents of CResult_NodeAnnouncementInfoDecodeErrorZ
8916 pub union CResult_NodeAnnouncementInfoDecodeErrorZPtr {
8917         /// A pointer to the contents in the success state.
8918         /// Reading from this pointer when `result_ok` is not set is undefined.
8919         pub result: *mut crate::lightning::routing::network_graph::NodeAnnouncementInfo,
8920         /// A pointer to the contents in the error state.
8921         /// Reading from this pointer when `result_ok` is set is undefined.
8922         pub err: *mut crate::lightning::ln::msgs::DecodeError,
8923 }
8924 #[repr(C)]
8925 /// A CResult_NodeAnnouncementInfoDecodeErrorZ represents the result of a fallible operation,
8926 /// containing a crate::lightning::routing::network_graph::NodeAnnouncementInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
8927 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8928 pub struct CResult_NodeAnnouncementInfoDecodeErrorZ {
8929         /// The contents of this CResult_NodeAnnouncementInfoDecodeErrorZ, accessible via either
8930         /// `err` or `result` depending on the state of `result_ok`.
8931         pub contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr,
8932         /// Whether this CResult_NodeAnnouncementInfoDecodeErrorZ represents a success state.
8933         pub result_ok: bool,
8934 }
8935 #[no_mangle]
8936 /// Creates a new CResult_NodeAnnouncementInfoDecodeErrorZ in the success state.
8937 pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_ok(o: crate::lightning::routing::network_graph::NodeAnnouncementInfo) -> CResult_NodeAnnouncementInfoDecodeErrorZ {
8938         CResult_NodeAnnouncementInfoDecodeErrorZ {
8939                 contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr {
8940                         result: Box::into_raw(Box::new(o)),
8941                 },
8942                 result_ok: true,
8943         }
8944 }
8945 #[no_mangle]
8946 /// Creates a new CResult_NodeAnnouncementInfoDecodeErrorZ in the error state.
8947 pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeAnnouncementInfoDecodeErrorZ {
8948         CResult_NodeAnnouncementInfoDecodeErrorZ {
8949                 contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr {
8950                         err: Box::into_raw(Box::new(e)),
8951                 },
8952                 result_ok: false,
8953         }
8954 }
8955 #[no_mangle]
8956 /// Frees any resources used by the CResult_NodeAnnouncementInfoDecodeErrorZ.
8957 pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_free(_res: CResult_NodeAnnouncementInfoDecodeErrorZ) { }
8958 impl Drop for CResult_NodeAnnouncementInfoDecodeErrorZ {
8959         fn drop(&mut self) {
8960                 if self.result_ok {
8961                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
8962                                 let _ = unsafe { Box::from_raw(self.contents.result) };
8963                         }
8964                 } else {
8965                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
8966                                 let _ = unsafe { Box::from_raw(self.contents.err) };
8967                         }
8968                 }
8969         }
8970 }
8971 impl From<crate::c_types::CResultTempl<crate::lightning::routing::network_graph::NodeAnnouncementInfo, crate::lightning::ln::msgs::DecodeError>> for CResult_NodeAnnouncementInfoDecodeErrorZ {
8972         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::network_graph::NodeAnnouncementInfo, crate::lightning::ln::msgs::DecodeError>) -> Self {
8973                 let contents = if o.result_ok {
8974                         let result = unsafe { o.contents.result };
8975                         unsafe { o.contents.result = std::ptr::null_mut() };
8976                         CResult_NodeAnnouncementInfoDecodeErrorZPtr { result }
8977                 } else {
8978                         let err = unsafe { o.contents.err };
8979                         unsafe { o.contents.err = std::ptr::null_mut(); }
8980                         CResult_NodeAnnouncementInfoDecodeErrorZPtr { err }
8981                 };
8982                 Self {
8983                         contents,
8984                         result_ok: o.result_ok,
8985                 }
8986         }
8987 }
8988 impl Clone for CResult_NodeAnnouncementInfoDecodeErrorZ {
8989         fn clone(&self) -> Self {
8990                 if self.result_ok {
8991                         Self { result_ok: true, contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr {
8992                                 result: Box::into_raw(Box::new(<crate::lightning::routing::network_graph::NodeAnnouncementInfo>::clone(unsafe { &*self.contents.result })))
8993                         } }
8994                 } else {
8995                         Self { result_ok: false, contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr {
8996                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
8997                         } }
8998                 }
8999         }
9000 }
9001 #[no_mangle]
9002 /// Creates a new CResult_NodeAnnouncementInfoDecodeErrorZ which has the same data as `orig`
9003 /// but with all dynamically-allocated buffers duplicated in new buffers.
9004 pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_clone(orig: &CResult_NodeAnnouncementInfoDecodeErrorZ) -> CResult_NodeAnnouncementInfoDecodeErrorZ { Clone::clone(&orig) }
9005 #[repr(C)]
9006 /// A dynamically-allocated array of u64s of arbitrary size.
9007 /// This corresponds to std::vector in C++
9008 pub struct CVec_u64Z {
9009         /// The elements in the array.
9010         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
9011         pub data: *mut u64,
9012         /// The number of elements pointed to by `data`.
9013         pub datalen: usize
9014 }
9015 impl CVec_u64Z {
9016         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<u64> {
9017                 if self.datalen == 0 { return Vec::new(); }
9018                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
9019                 self.data = std::ptr::null_mut();
9020                 self.datalen = 0;
9021                 ret
9022         }
9023         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[u64] {
9024                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
9025         }
9026 }
9027 impl From<Vec<u64>> for CVec_u64Z {
9028         fn from(v: Vec<u64>) -> Self {
9029                 let datalen = v.len();
9030                 let data = Box::into_raw(v.into_boxed_slice());
9031                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
9032         }
9033 }
9034 #[no_mangle]
9035 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
9036 pub extern "C" fn CVec_u64Z_free(_res: CVec_u64Z) { }
9037 impl Drop for CVec_u64Z {
9038         fn drop(&mut self) {
9039                 if self.datalen == 0 { return; }
9040                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
9041         }
9042 }
9043 impl Clone for CVec_u64Z {
9044         fn clone(&self) -> Self {
9045                 let mut res = Vec::new();
9046                 if self.datalen == 0 { return Self::from(res); }
9047                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
9048                 Self::from(res)
9049         }
9050 }
9051 #[repr(C)]
9052 /// The contents of CResult_NodeInfoDecodeErrorZ
9053 pub union CResult_NodeInfoDecodeErrorZPtr {
9054         /// A pointer to the contents in the success state.
9055         /// Reading from this pointer when `result_ok` is not set is undefined.
9056         pub result: *mut crate::lightning::routing::network_graph::NodeInfo,
9057         /// A pointer to the contents in the error state.
9058         /// Reading from this pointer when `result_ok` is set is undefined.
9059         pub err: *mut crate::lightning::ln::msgs::DecodeError,
9060 }
9061 #[repr(C)]
9062 /// A CResult_NodeInfoDecodeErrorZ represents the result of a fallible operation,
9063 /// containing a crate::lightning::routing::network_graph::NodeInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
9064 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9065 pub struct CResult_NodeInfoDecodeErrorZ {
9066         /// The contents of this CResult_NodeInfoDecodeErrorZ, accessible via either
9067         /// `err` or `result` depending on the state of `result_ok`.
9068         pub contents: CResult_NodeInfoDecodeErrorZPtr,
9069         /// Whether this CResult_NodeInfoDecodeErrorZ represents a success state.
9070         pub result_ok: bool,
9071 }
9072 #[no_mangle]
9073 /// Creates a new CResult_NodeInfoDecodeErrorZ in the success state.
9074 pub extern "C" fn CResult_NodeInfoDecodeErrorZ_ok(o: crate::lightning::routing::network_graph::NodeInfo) -> CResult_NodeInfoDecodeErrorZ {
9075         CResult_NodeInfoDecodeErrorZ {
9076                 contents: CResult_NodeInfoDecodeErrorZPtr {
9077                         result: Box::into_raw(Box::new(o)),
9078                 },
9079                 result_ok: true,
9080         }
9081 }
9082 #[no_mangle]
9083 /// Creates a new CResult_NodeInfoDecodeErrorZ in the error state.
9084 pub extern "C" fn CResult_NodeInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeInfoDecodeErrorZ {
9085         CResult_NodeInfoDecodeErrorZ {
9086                 contents: CResult_NodeInfoDecodeErrorZPtr {
9087                         err: Box::into_raw(Box::new(e)),
9088                 },
9089                 result_ok: false,
9090         }
9091 }
9092 #[no_mangle]
9093 /// Frees any resources used by the CResult_NodeInfoDecodeErrorZ.
9094 pub extern "C" fn CResult_NodeInfoDecodeErrorZ_free(_res: CResult_NodeInfoDecodeErrorZ) { }
9095 impl Drop for CResult_NodeInfoDecodeErrorZ {
9096         fn drop(&mut self) {
9097                 if self.result_ok {
9098                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
9099                                 let _ = unsafe { Box::from_raw(self.contents.result) };
9100                         }
9101                 } else {
9102                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
9103                                 let _ = unsafe { Box::from_raw(self.contents.err) };
9104                         }
9105                 }
9106         }
9107 }
9108 impl From<crate::c_types::CResultTempl<crate::lightning::routing::network_graph::NodeInfo, crate::lightning::ln::msgs::DecodeError>> for CResult_NodeInfoDecodeErrorZ {
9109         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::network_graph::NodeInfo, crate::lightning::ln::msgs::DecodeError>) -> Self {
9110                 let contents = if o.result_ok {
9111                         let result = unsafe { o.contents.result };
9112                         unsafe { o.contents.result = std::ptr::null_mut() };
9113                         CResult_NodeInfoDecodeErrorZPtr { result }
9114                 } else {
9115                         let err = unsafe { o.contents.err };
9116                         unsafe { o.contents.err = std::ptr::null_mut(); }
9117                         CResult_NodeInfoDecodeErrorZPtr { err }
9118                 };
9119                 Self {
9120                         contents,
9121                         result_ok: o.result_ok,
9122                 }
9123         }
9124 }
9125 impl Clone for CResult_NodeInfoDecodeErrorZ {
9126         fn clone(&self) -> Self {
9127                 if self.result_ok {
9128                         Self { result_ok: true, contents: CResult_NodeInfoDecodeErrorZPtr {
9129                                 result: Box::into_raw(Box::new(<crate::lightning::routing::network_graph::NodeInfo>::clone(unsafe { &*self.contents.result })))
9130                         } }
9131                 } else {
9132                         Self { result_ok: false, contents: CResult_NodeInfoDecodeErrorZPtr {
9133                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
9134                         } }
9135                 }
9136         }
9137 }
9138 #[no_mangle]
9139 /// Creates a new CResult_NodeInfoDecodeErrorZ which has the same data as `orig`
9140 /// but with all dynamically-allocated buffers duplicated in new buffers.
9141 pub extern "C" fn CResult_NodeInfoDecodeErrorZ_clone(orig: &CResult_NodeInfoDecodeErrorZ) -> CResult_NodeInfoDecodeErrorZ { Clone::clone(&orig) }
9142 #[repr(C)]
9143 /// The contents of CResult_NetworkGraphDecodeErrorZ
9144 pub union CResult_NetworkGraphDecodeErrorZPtr {
9145         /// A pointer to the contents in the success state.
9146         /// Reading from this pointer when `result_ok` is not set is undefined.
9147         pub result: *mut crate::lightning::routing::network_graph::NetworkGraph,
9148         /// A pointer to the contents in the error state.
9149         /// Reading from this pointer when `result_ok` is set is undefined.
9150         pub err: *mut crate::lightning::ln::msgs::DecodeError,
9151 }
9152 #[repr(C)]
9153 /// A CResult_NetworkGraphDecodeErrorZ represents the result of a fallible operation,
9154 /// containing a crate::lightning::routing::network_graph::NetworkGraph on success and a crate::lightning::ln::msgs::DecodeError on failure.
9155 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9156 pub struct CResult_NetworkGraphDecodeErrorZ {
9157         /// The contents of this CResult_NetworkGraphDecodeErrorZ, accessible via either
9158         /// `err` or `result` depending on the state of `result_ok`.
9159         pub contents: CResult_NetworkGraphDecodeErrorZPtr,
9160         /// Whether this CResult_NetworkGraphDecodeErrorZ represents a success state.
9161         pub result_ok: bool,
9162 }
9163 #[no_mangle]
9164 /// Creates a new CResult_NetworkGraphDecodeErrorZ in the success state.
9165 pub extern "C" fn CResult_NetworkGraphDecodeErrorZ_ok(o: crate::lightning::routing::network_graph::NetworkGraph) -> CResult_NetworkGraphDecodeErrorZ {
9166         CResult_NetworkGraphDecodeErrorZ {
9167                 contents: CResult_NetworkGraphDecodeErrorZPtr {
9168                         result: Box::into_raw(Box::new(o)),
9169                 },
9170                 result_ok: true,
9171         }
9172 }
9173 #[no_mangle]
9174 /// Creates a new CResult_NetworkGraphDecodeErrorZ in the error state.
9175 pub extern "C" fn CResult_NetworkGraphDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NetworkGraphDecodeErrorZ {
9176         CResult_NetworkGraphDecodeErrorZ {
9177                 contents: CResult_NetworkGraphDecodeErrorZPtr {
9178                         err: Box::into_raw(Box::new(e)),
9179                 },
9180                 result_ok: false,
9181         }
9182 }
9183 #[no_mangle]
9184 /// Frees any resources used by the CResult_NetworkGraphDecodeErrorZ.
9185 pub extern "C" fn CResult_NetworkGraphDecodeErrorZ_free(_res: CResult_NetworkGraphDecodeErrorZ) { }
9186 impl Drop for CResult_NetworkGraphDecodeErrorZ {
9187         fn drop(&mut self) {
9188                 if self.result_ok {
9189                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
9190                                 let _ = unsafe { Box::from_raw(self.contents.result) };
9191                         }
9192                 } else {
9193                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
9194                                 let _ = unsafe { Box::from_raw(self.contents.err) };
9195                         }
9196                 }
9197         }
9198 }
9199 impl From<crate::c_types::CResultTempl<crate::lightning::routing::network_graph::NetworkGraph, crate::lightning::ln::msgs::DecodeError>> for CResult_NetworkGraphDecodeErrorZ {
9200         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::network_graph::NetworkGraph, crate::lightning::ln::msgs::DecodeError>) -> Self {
9201                 let contents = if o.result_ok {
9202                         let result = unsafe { o.contents.result };
9203                         unsafe { o.contents.result = std::ptr::null_mut() };
9204                         CResult_NetworkGraphDecodeErrorZPtr { result }
9205                 } else {
9206                         let err = unsafe { o.contents.err };
9207                         unsafe { o.contents.err = std::ptr::null_mut(); }
9208                         CResult_NetworkGraphDecodeErrorZPtr { err }
9209                 };
9210                 Self {
9211                         contents,
9212                         result_ok: o.result_ok,
9213                 }
9214         }
9215 }
9216 impl Clone for CResult_NetworkGraphDecodeErrorZ {
9217         fn clone(&self) -> Self {
9218                 if self.result_ok {
9219                         Self { result_ok: true, contents: CResult_NetworkGraphDecodeErrorZPtr {
9220                                 result: Box::into_raw(Box::new(<crate::lightning::routing::network_graph::NetworkGraph>::clone(unsafe { &*self.contents.result })))
9221                         } }
9222                 } else {
9223                         Self { result_ok: false, contents: CResult_NetworkGraphDecodeErrorZPtr {
9224                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
9225                         } }
9226                 }
9227         }
9228 }
9229 #[no_mangle]
9230 /// Creates a new CResult_NetworkGraphDecodeErrorZ which has the same data as `orig`
9231 /// but with all dynamically-allocated buffers duplicated in new buffers.
9232 pub extern "C" fn CResult_NetworkGraphDecodeErrorZ_clone(orig: &CResult_NetworkGraphDecodeErrorZ) -> CResult_NetworkGraphDecodeErrorZ { Clone::clone(&orig) }
9233 #[repr(C)]
9234 #[derive(Clone)]
9235 /// An enum which can either contain a crate::c_types::derived::CVec_NetAddressZ or not
9236 pub enum COption_CVec_NetAddressZZ {
9237         /// When we're in this state, this COption_CVec_NetAddressZZ contains a crate::c_types::derived::CVec_NetAddressZ
9238         Some(crate::c_types::derived::CVec_NetAddressZ),
9239         /// When we're in this state, this COption_CVec_NetAddressZZ contains nothing
9240         None
9241 }
9242 impl COption_CVec_NetAddressZZ {
9243         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
9244                 if let Self::Some(_) = self { true } else { false }
9245         }
9246         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
9247                 !self.is_some()
9248         }
9249         #[allow(unused)] pub(crate) fn take(mut self) -> crate::c_types::derived::CVec_NetAddressZ {
9250                 if let Self::Some(v) = self { v } else { unreachable!() }
9251         }
9252 }
9253 #[no_mangle]
9254 /// Constructs a new COption_CVec_NetAddressZZ containing a crate::c_types::derived::CVec_NetAddressZ
9255 pub extern "C" fn COption_CVec_NetAddressZZ_some(o: crate::c_types::derived::CVec_NetAddressZ) -> COption_CVec_NetAddressZZ {
9256         COption_CVec_NetAddressZZ::Some(o)
9257 }
9258 #[no_mangle]
9259 /// Constructs a new COption_CVec_NetAddressZZ containing nothing
9260 pub extern "C" fn COption_CVec_NetAddressZZ_none() -> COption_CVec_NetAddressZZ {
9261         COption_CVec_NetAddressZZ::None
9262 }
9263 #[no_mangle]
9264 /// Frees any resources associated with the crate::c_types::derived::CVec_NetAddressZ, if we are in the Some state
9265 pub extern "C" fn COption_CVec_NetAddressZZ_free(_res: COption_CVec_NetAddressZZ) { }
9266 #[no_mangle]
9267 /// Creates a new COption_CVec_NetAddressZZ which has the same data as `orig`
9268 /// but with all dynamically-allocated buffers duplicated in new buffers.
9269 pub extern "C" fn COption_CVec_NetAddressZZ_clone(orig: &COption_CVec_NetAddressZZ) -> COption_CVec_NetAddressZZ { Clone::clone(&orig) }
9270 #[repr(C)]
9271 /// The contents of CResult_NetAddressDecodeErrorZ
9272 pub union CResult_NetAddressDecodeErrorZPtr {
9273         /// A pointer to the contents in the success state.
9274         /// Reading from this pointer when `result_ok` is not set is undefined.
9275         pub result: *mut crate::lightning::ln::msgs::NetAddress,
9276         /// A pointer to the contents in the error state.
9277         /// Reading from this pointer when `result_ok` is set is undefined.
9278         pub err: *mut crate::lightning::ln::msgs::DecodeError,
9279 }
9280 #[repr(C)]
9281 /// A CResult_NetAddressDecodeErrorZ represents the result of a fallible operation,
9282 /// containing a crate::lightning::ln::msgs::NetAddress on success and a crate::lightning::ln::msgs::DecodeError on failure.
9283 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9284 pub struct CResult_NetAddressDecodeErrorZ {
9285         /// The contents of this CResult_NetAddressDecodeErrorZ, accessible via either
9286         /// `err` or `result` depending on the state of `result_ok`.
9287         pub contents: CResult_NetAddressDecodeErrorZPtr,
9288         /// Whether this CResult_NetAddressDecodeErrorZ represents a success state.
9289         pub result_ok: bool,
9290 }
9291 #[no_mangle]
9292 /// Creates a new CResult_NetAddressDecodeErrorZ in the success state.
9293 pub extern "C" fn CResult_NetAddressDecodeErrorZ_ok(o: crate::lightning::ln::msgs::NetAddress) -> CResult_NetAddressDecodeErrorZ {
9294         CResult_NetAddressDecodeErrorZ {
9295                 contents: CResult_NetAddressDecodeErrorZPtr {
9296                         result: Box::into_raw(Box::new(o)),
9297                 },
9298                 result_ok: true,
9299         }
9300 }
9301 #[no_mangle]
9302 /// Creates a new CResult_NetAddressDecodeErrorZ in the error state.
9303 pub extern "C" fn CResult_NetAddressDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NetAddressDecodeErrorZ {
9304         CResult_NetAddressDecodeErrorZ {
9305                 contents: CResult_NetAddressDecodeErrorZPtr {
9306                         err: Box::into_raw(Box::new(e)),
9307                 },
9308                 result_ok: false,
9309         }
9310 }
9311 #[no_mangle]
9312 /// Frees any resources used by the CResult_NetAddressDecodeErrorZ.
9313 pub extern "C" fn CResult_NetAddressDecodeErrorZ_free(_res: CResult_NetAddressDecodeErrorZ) { }
9314 impl Drop for CResult_NetAddressDecodeErrorZ {
9315         fn drop(&mut self) {
9316                 if self.result_ok {
9317                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
9318                                 let _ = unsafe { Box::from_raw(self.contents.result) };
9319                         }
9320                 } else {
9321                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
9322                                 let _ = unsafe { Box::from_raw(self.contents.err) };
9323                         }
9324                 }
9325         }
9326 }
9327 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::NetAddress, crate::lightning::ln::msgs::DecodeError>> for CResult_NetAddressDecodeErrorZ {
9328         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::NetAddress, crate::lightning::ln::msgs::DecodeError>) -> Self {
9329                 let contents = if o.result_ok {
9330                         let result = unsafe { o.contents.result };
9331                         unsafe { o.contents.result = std::ptr::null_mut() };
9332                         CResult_NetAddressDecodeErrorZPtr { result }
9333                 } else {
9334                         let err = unsafe { o.contents.err };
9335                         unsafe { o.contents.err = std::ptr::null_mut(); }
9336                         CResult_NetAddressDecodeErrorZPtr { err }
9337                 };
9338                 Self {
9339                         contents,
9340                         result_ok: o.result_ok,
9341                 }
9342         }
9343 }
9344 impl Clone for CResult_NetAddressDecodeErrorZ {
9345         fn clone(&self) -> Self {
9346                 if self.result_ok {
9347                         Self { result_ok: true, contents: CResult_NetAddressDecodeErrorZPtr {
9348                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::NetAddress>::clone(unsafe { &*self.contents.result })))
9349                         } }
9350                 } else {
9351                         Self { result_ok: false, contents: CResult_NetAddressDecodeErrorZPtr {
9352                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
9353                         } }
9354                 }
9355         }
9356 }
9357 #[no_mangle]
9358 /// Creates a new CResult_NetAddressDecodeErrorZ which has the same data as `orig`
9359 /// but with all dynamically-allocated buffers duplicated in new buffers.
9360 pub extern "C" fn CResult_NetAddressDecodeErrorZ_clone(orig: &CResult_NetAddressDecodeErrorZ) -> CResult_NetAddressDecodeErrorZ { Clone::clone(&orig) }
9361 #[repr(C)]
9362 /// A dynamically-allocated array of crate::lightning::ln::msgs::UpdateAddHTLCs of arbitrary size.
9363 /// This corresponds to std::vector in C++
9364 pub struct CVec_UpdateAddHTLCZ {
9365         /// The elements in the array.
9366         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
9367         pub data: *mut crate::lightning::ln::msgs::UpdateAddHTLC,
9368         /// The number of elements pointed to by `data`.
9369         pub datalen: usize
9370 }
9371 impl CVec_UpdateAddHTLCZ {
9372         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::UpdateAddHTLC> {
9373                 if self.datalen == 0 { return Vec::new(); }
9374                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
9375                 self.data = std::ptr::null_mut();
9376                 self.datalen = 0;
9377                 ret
9378         }
9379         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::UpdateAddHTLC] {
9380                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
9381         }
9382 }
9383 impl From<Vec<crate::lightning::ln::msgs::UpdateAddHTLC>> for CVec_UpdateAddHTLCZ {
9384         fn from(v: Vec<crate::lightning::ln::msgs::UpdateAddHTLC>) -> Self {
9385                 let datalen = v.len();
9386                 let data = Box::into_raw(v.into_boxed_slice());
9387                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
9388         }
9389 }
9390 #[no_mangle]
9391 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
9392 pub extern "C" fn CVec_UpdateAddHTLCZ_free(_res: CVec_UpdateAddHTLCZ) { }
9393 impl Drop for CVec_UpdateAddHTLCZ {
9394         fn drop(&mut self) {
9395                 if self.datalen == 0 { return; }
9396                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
9397         }
9398 }
9399 impl Clone for CVec_UpdateAddHTLCZ {
9400         fn clone(&self) -> Self {
9401                 let mut res = Vec::new();
9402                 if self.datalen == 0 { return Self::from(res); }
9403                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
9404                 Self::from(res)
9405         }
9406 }
9407 #[repr(C)]
9408 /// A dynamically-allocated array of crate::lightning::ln::msgs::UpdateFulfillHTLCs of arbitrary size.
9409 /// This corresponds to std::vector in C++
9410 pub struct CVec_UpdateFulfillHTLCZ {
9411         /// The elements in the array.
9412         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
9413         pub data: *mut crate::lightning::ln::msgs::UpdateFulfillHTLC,
9414         /// The number of elements pointed to by `data`.
9415         pub datalen: usize
9416 }
9417 impl CVec_UpdateFulfillHTLCZ {
9418         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::UpdateFulfillHTLC> {
9419                 if self.datalen == 0 { return Vec::new(); }
9420                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
9421                 self.data = std::ptr::null_mut();
9422                 self.datalen = 0;
9423                 ret
9424         }
9425         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::UpdateFulfillHTLC] {
9426                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
9427         }
9428 }
9429 impl From<Vec<crate::lightning::ln::msgs::UpdateFulfillHTLC>> for CVec_UpdateFulfillHTLCZ {
9430         fn from(v: Vec<crate::lightning::ln::msgs::UpdateFulfillHTLC>) -> Self {
9431                 let datalen = v.len();
9432                 let data = Box::into_raw(v.into_boxed_slice());
9433                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
9434         }
9435 }
9436 #[no_mangle]
9437 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
9438 pub extern "C" fn CVec_UpdateFulfillHTLCZ_free(_res: CVec_UpdateFulfillHTLCZ) { }
9439 impl Drop for CVec_UpdateFulfillHTLCZ {
9440         fn drop(&mut self) {
9441                 if self.datalen == 0 { return; }
9442                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
9443         }
9444 }
9445 impl Clone for CVec_UpdateFulfillHTLCZ {
9446         fn clone(&self) -> Self {
9447                 let mut res = Vec::new();
9448                 if self.datalen == 0 { return Self::from(res); }
9449                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
9450                 Self::from(res)
9451         }
9452 }
9453 #[repr(C)]
9454 /// A dynamically-allocated array of crate::lightning::ln::msgs::UpdateFailHTLCs of arbitrary size.
9455 /// This corresponds to std::vector in C++
9456 pub struct CVec_UpdateFailHTLCZ {
9457         /// The elements in the array.
9458         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
9459         pub data: *mut crate::lightning::ln::msgs::UpdateFailHTLC,
9460         /// The number of elements pointed to by `data`.
9461         pub datalen: usize
9462 }
9463 impl CVec_UpdateFailHTLCZ {
9464         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::UpdateFailHTLC> {
9465                 if self.datalen == 0 { return Vec::new(); }
9466                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
9467                 self.data = std::ptr::null_mut();
9468                 self.datalen = 0;
9469                 ret
9470         }
9471         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::UpdateFailHTLC] {
9472                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
9473         }
9474 }
9475 impl From<Vec<crate::lightning::ln::msgs::UpdateFailHTLC>> for CVec_UpdateFailHTLCZ {
9476         fn from(v: Vec<crate::lightning::ln::msgs::UpdateFailHTLC>) -> Self {
9477                 let datalen = v.len();
9478                 let data = Box::into_raw(v.into_boxed_slice());
9479                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
9480         }
9481 }
9482 #[no_mangle]
9483 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
9484 pub extern "C" fn CVec_UpdateFailHTLCZ_free(_res: CVec_UpdateFailHTLCZ) { }
9485 impl Drop for CVec_UpdateFailHTLCZ {
9486         fn drop(&mut self) {
9487                 if self.datalen == 0 { return; }
9488                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
9489         }
9490 }
9491 impl Clone for CVec_UpdateFailHTLCZ {
9492         fn clone(&self) -> Self {
9493                 let mut res = Vec::new();
9494                 if self.datalen == 0 { return Self::from(res); }
9495                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
9496                 Self::from(res)
9497         }
9498 }
9499 #[repr(C)]
9500 /// A dynamically-allocated array of crate::lightning::ln::msgs::UpdateFailMalformedHTLCs of arbitrary size.
9501 /// This corresponds to std::vector in C++
9502 pub struct CVec_UpdateFailMalformedHTLCZ {
9503         /// The elements in the array.
9504         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
9505         pub data: *mut crate::lightning::ln::msgs::UpdateFailMalformedHTLC,
9506         /// The number of elements pointed to by `data`.
9507         pub datalen: usize
9508 }
9509 impl CVec_UpdateFailMalformedHTLCZ {
9510         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::UpdateFailMalformedHTLC> {
9511                 if self.datalen == 0 { return Vec::new(); }
9512                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
9513                 self.data = std::ptr::null_mut();
9514                 self.datalen = 0;
9515                 ret
9516         }
9517         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::UpdateFailMalformedHTLC] {
9518                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
9519         }
9520 }
9521 impl From<Vec<crate::lightning::ln::msgs::UpdateFailMalformedHTLC>> for CVec_UpdateFailMalformedHTLCZ {
9522         fn from(v: Vec<crate::lightning::ln::msgs::UpdateFailMalformedHTLC>) -> Self {
9523                 let datalen = v.len();
9524                 let data = Box::into_raw(v.into_boxed_slice());
9525                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
9526         }
9527 }
9528 #[no_mangle]
9529 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
9530 pub extern "C" fn CVec_UpdateFailMalformedHTLCZ_free(_res: CVec_UpdateFailMalformedHTLCZ) { }
9531 impl Drop for CVec_UpdateFailMalformedHTLCZ {
9532         fn drop(&mut self) {
9533                 if self.datalen == 0 { return; }
9534                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
9535         }
9536 }
9537 impl Clone for CVec_UpdateFailMalformedHTLCZ {
9538         fn clone(&self) -> Self {
9539                 let mut res = Vec::new();
9540                 if self.datalen == 0 { return Self::from(res); }
9541                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
9542                 Self::from(res)
9543         }
9544 }
9545 #[repr(C)]
9546 /// The contents of CResult_AcceptChannelDecodeErrorZ
9547 pub union CResult_AcceptChannelDecodeErrorZPtr {
9548         /// A pointer to the contents in the success state.
9549         /// Reading from this pointer when `result_ok` is not set is undefined.
9550         pub result: *mut crate::lightning::ln::msgs::AcceptChannel,
9551         /// A pointer to the contents in the error state.
9552         /// Reading from this pointer when `result_ok` is set is undefined.
9553         pub err: *mut crate::lightning::ln::msgs::DecodeError,
9554 }
9555 #[repr(C)]
9556 /// A CResult_AcceptChannelDecodeErrorZ represents the result of a fallible operation,
9557 /// containing a crate::lightning::ln::msgs::AcceptChannel on success and a crate::lightning::ln::msgs::DecodeError on failure.
9558 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9559 pub struct CResult_AcceptChannelDecodeErrorZ {
9560         /// The contents of this CResult_AcceptChannelDecodeErrorZ, accessible via either
9561         /// `err` or `result` depending on the state of `result_ok`.
9562         pub contents: CResult_AcceptChannelDecodeErrorZPtr,
9563         /// Whether this CResult_AcceptChannelDecodeErrorZ represents a success state.
9564         pub result_ok: bool,
9565 }
9566 #[no_mangle]
9567 /// Creates a new CResult_AcceptChannelDecodeErrorZ in the success state.
9568 pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_ok(o: crate::lightning::ln::msgs::AcceptChannel) -> CResult_AcceptChannelDecodeErrorZ {
9569         CResult_AcceptChannelDecodeErrorZ {
9570                 contents: CResult_AcceptChannelDecodeErrorZPtr {
9571                         result: Box::into_raw(Box::new(o)),
9572                 },
9573                 result_ok: true,
9574         }
9575 }
9576 #[no_mangle]
9577 /// Creates a new CResult_AcceptChannelDecodeErrorZ in the error state.
9578 pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_AcceptChannelDecodeErrorZ {
9579         CResult_AcceptChannelDecodeErrorZ {
9580                 contents: CResult_AcceptChannelDecodeErrorZPtr {
9581                         err: Box::into_raw(Box::new(e)),
9582                 },
9583                 result_ok: false,
9584         }
9585 }
9586 #[no_mangle]
9587 /// Frees any resources used by the CResult_AcceptChannelDecodeErrorZ.
9588 pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_free(_res: CResult_AcceptChannelDecodeErrorZ) { }
9589 impl Drop for CResult_AcceptChannelDecodeErrorZ {
9590         fn drop(&mut self) {
9591                 if self.result_ok {
9592                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
9593                                 let _ = unsafe { Box::from_raw(self.contents.result) };
9594                         }
9595                 } else {
9596                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
9597                                 let _ = unsafe { Box::from_raw(self.contents.err) };
9598                         }
9599                 }
9600         }
9601 }
9602 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::AcceptChannel, crate::lightning::ln::msgs::DecodeError>> for CResult_AcceptChannelDecodeErrorZ {
9603         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::AcceptChannel, crate::lightning::ln::msgs::DecodeError>) -> Self {
9604                 let contents = if o.result_ok {
9605                         let result = unsafe { o.contents.result };
9606                         unsafe { o.contents.result = std::ptr::null_mut() };
9607                         CResult_AcceptChannelDecodeErrorZPtr { result }
9608                 } else {
9609                         let err = unsafe { o.contents.err };
9610                         unsafe { o.contents.err = std::ptr::null_mut(); }
9611                         CResult_AcceptChannelDecodeErrorZPtr { err }
9612                 };
9613                 Self {
9614                         contents,
9615                         result_ok: o.result_ok,
9616                 }
9617         }
9618 }
9619 impl Clone for CResult_AcceptChannelDecodeErrorZ {
9620         fn clone(&self) -> Self {
9621                 if self.result_ok {
9622                         Self { result_ok: true, contents: CResult_AcceptChannelDecodeErrorZPtr {
9623                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::AcceptChannel>::clone(unsafe { &*self.contents.result })))
9624                         } }
9625                 } else {
9626                         Self { result_ok: false, contents: CResult_AcceptChannelDecodeErrorZPtr {
9627                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
9628                         } }
9629                 }
9630         }
9631 }
9632 #[no_mangle]
9633 /// Creates a new CResult_AcceptChannelDecodeErrorZ which has the same data as `orig`
9634 /// but with all dynamically-allocated buffers duplicated in new buffers.
9635 pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_clone(orig: &CResult_AcceptChannelDecodeErrorZ) -> CResult_AcceptChannelDecodeErrorZ { Clone::clone(&orig) }
9636 #[repr(C)]
9637 /// The contents of CResult_AnnouncementSignaturesDecodeErrorZ
9638 pub union CResult_AnnouncementSignaturesDecodeErrorZPtr {
9639         /// A pointer to the contents in the success state.
9640         /// Reading from this pointer when `result_ok` is not set is undefined.
9641         pub result: *mut crate::lightning::ln::msgs::AnnouncementSignatures,
9642         /// A pointer to the contents in the error state.
9643         /// Reading from this pointer when `result_ok` is set is undefined.
9644         pub err: *mut crate::lightning::ln::msgs::DecodeError,
9645 }
9646 #[repr(C)]
9647 /// A CResult_AnnouncementSignaturesDecodeErrorZ represents the result of a fallible operation,
9648 /// containing a crate::lightning::ln::msgs::AnnouncementSignatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
9649 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9650 pub struct CResult_AnnouncementSignaturesDecodeErrorZ {
9651         /// The contents of this CResult_AnnouncementSignaturesDecodeErrorZ, accessible via either
9652         /// `err` or `result` depending on the state of `result_ok`.
9653         pub contents: CResult_AnnouncementSignaturesDecodeErrorZPtr,
9654         /// Whether this CResult_AnnouncementSignaturesDecodeErrorZ represents a success state.
9655         pub result_ok: bool,
9656 }
9657 #[no_mangle]
9658 /// Creates a new CResult_AnnouncementSignaturesDecodeErrorZ in the success state.
9659 pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_ok(o: crate::lightning::ln::msgs::AnnouncementSignatures) -> CResult_AnnouncementSignaturesDecodeErrorZ {
9660         CResult_AnnouncementSignaturesDecodeErrorZ {
9661                 contents: CResult_AnnouncementSignaturesDecodeErrorZPtr {
9662                         result: Box::into_raw(Box::new(o)),
9663                 },
9664                 result_ok: true,
9665         }
9666 }
9667 #[no_mangle]
9668 /// Creates a new CResult_AnnouncementSignaturesDecodeErrorZ in the error state.
9669 pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_AnnouncementSignaturesDecodeErrorZ {
9670         CResult_AnnouncementSignaturesDecodeErrorZ {
9671                 contents: CResult_AnnouncementSignaturesDecodeErrorZPtr {
9672                         err: Box::into_raw(Box::new(e)),
9673                 },
9674                 result_ok: false,
9675         }
9676 }
9677 #[no_mangle]
9678 /// Frees any resources used by the CResult_AnnouncementSignaturesDecodeErrorZ.
9679 pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_free(_res: CResult_AnnouncementSignaturesDecodeErrorZ) { }
9680 impl Drop for CResult_AnnouncementSignaturesDecodeErrorZ {
9681         fn drop(&mut self) {
9682                 if self.result_ok {
9683                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
9684                                 let _ = unsafe { Box::from_raw(self.contents.result) };
9685                         }
9686                 } else {
9687                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
9688                                 let _ = unsafe { Box::from_raw(self.contents.err) };
9689                         }
9690                 }
9691         }
9692 }
9693 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::AnnouncementSignatures, crate::lightning::ln::msgs::DecodeError>> for CResult_AnnouncementSignaturesDecodeErrorZ {
9694         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::AnnouncementSignatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
9695                 let contents = if o.result_ok {
9696                         let result = unsafe { o.contents.result };
9697                         unsafe { o.contents.result = std::ptr::null_mut() };
9698                         CResult_AnnouncementSignaturesDecodeErrorZPtr { result }
9699                 } else {
9700                         let err = unsafe { o.contents.err };
9701                         unsafe { o.contents.err = std::ptr::null_mut(); }
9702                         CResult_AnnouncementSignaturesDecodeErrorZPtr { err }
9703                 };
9704                 Self {
9705                         contents,
9706                         result_ok: o.result_ok,
9707                 }
9708         }
9709 }
9710 impl Clone for CResult_AnnouncementSignaturesDecodeErrorZ {
9711         fn clone(&self) -> Self {
9712                 if self.result_ok {
9713                         Self { result_ok: true, contents: CResult_AnnouncementSignaturesDecodeErrorZPtr {
9714                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::AnnouncementSignatures>::clone(unsafe { &*self.contents.result })))
9715                         } }
9716                 } else {
9717                         Self { result_ok: false, contents: CResult_AnnouncementSignaturesDecodeErrorZPtr {
9718                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
9719                         } }
9720                 }
9721         }
9722 }
9723 #[no_mangle]
9724 /// Creates a new CResult_AnnouncementSignaturesDecodeErrorZ which has the same data as `orig`
9725 /// but with all dynamically-allocated buffers duplicated in new buffers.
9726 pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_clone(orig: &CResult_AnnouncementSignaturesDecodeErrorZ) -> CResult_AnnouncementSignaturesDecodeErrorZ { Clone::clone(&orig) }
9727 #[repr(C)]
9728 /// The contents of CResult_ChannelReestablishDecodeErrorZ
9729 pub union CResult_ChannelReestablishDecodeErrorZPtr {
9730         /// A pointer to the contents in the success state.
9731         /// Reading from this pointer when `result_ok` is not set is undefined.
9732         pub result: *mut crate::lightning::ln::msgs::ChannelReestablish,
9733         /// A pointer to the contents in the error state.
9734         /// Reading from this pointer when `result_ok` is set is undefined.
9735         pub err: *mut crate::lightning::ln::msgs::DecodeError,
9736 }
9737 #[repr(C)]
9738 /// A CResult_ChannelReestablishDecodeErrorZ represents the result of a fallible operation,
9739 /// containing a crate::lightning::ln::msgs::ChannelReestablish on success and a crate::lightning::ln::msgs::DecodeError on failure.
9740 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9741 pub struct CResult_ChannelReestablishDecodeErrorZ {
9742         /// The contents of this CResult_ChannelReestablishDecodeErrorZ, accessible via either
9743         /// `err` or `result` depending on the state of `result_ok`.
9744         pub contents: CResult_ChannelReestablishDecodeErrorZPtr,
9745         /// Whether this CResult_ChannelReestablishDecodeErrorZ represents a success state.
9746         pub result_ok: bool,
9747 }
9748 #[no_mangle]
9749 /// Creates a new CResult_ChannelReestablishDecodeErrorZ in the success state.
9750 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ChannelReestablish) -> CResult_ChannelReestablishDecodeErrorZ {
9751         CResult_ChannelReestablishDecodeErrorZ {
9752                 contents: CResult_ChannelReestablishDecodeErrorZPtr {
9753                         result: Box::into_raw(Box::new(o)),
9754                 },
9755                 result_ok: true,
9756         }
9757 }
9758 #[no_mangle]
9759 /// Creates a new CResult_ChannelReestablishDecodeErrorZ in the error state.
9760 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelReestablishDecodeErrorZ {
9761         CResult_ChannelReestablishDecodeErrorZ {
9762                 contents: CResult_ChannelReestablishDecodeErrorZPtr {
9763                         err: Box::into_raw(Box::new(e)),
9764                 },
9765                 result_ok: false,
9766         }
9767 }
9768 #[no_mangle]
9769 /// Frees any resources used by the CResult_ChannelReestablishDecodeErrorZ.
9770 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_free(_res: CResult_ChannelReestablishDecodeErrorZ) { }
9771 impl Drop for CResult_ChannelReestablishDecodeErrorZ {
9772         fn drop(&mut self) {
9773                 if self.result_ok {
9774                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
9775                                 let _ = unsafe { Box::from_raw(self.contents.result) };
9776                         }
9777                 } else {
9778                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
9779                                 let _ = unsafe { Box::from_raw(self.contents.err) };
9780                         }
9781                 }
9782         }
9783 }
9784 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelReestablish, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelReestablishDecodeErrorZ {
9785         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelReestablish, crate::lightning::ln::msgs::DecodeError>) -> Self {
9786                 let contents = if o.result_ok {
9787                         let result = unsafe { o.contents.result };
9788                         unsafe { o.contents.result = std::ptr::null_mut() };
9789                         CResult_ChannelReestablishDecodeErrorZPtr { result }
9790                 } else {
9791                         let err = unsafe { o.contents.err };
9792                         unsafe { o.contents.err = std::ptr::null_mut(); }
9793                         CResult_ChannelReestablishDecodeErrorZPtr { err }
9794                 };
9795                 Self {
9796                         contents,
9797                         result_ok: o.result_ok,
9798                 }
9799         }
9800 }
9801 impl Clone for CResult_ChannelReestablishDecodeErrorZ {
9802         fn clone(&self) -> Self {
9803                 if self.result_ok {
9804                         Self { result_ok: true, contents: CResult_ChannelReestablishDecodeErrorZPtr {
9805                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ChannelReestablish>::clone(unsafe { &*self.contents.result })))
9806                         } }
9807                 } else {
9808                         Self { result_ok: false, contents: CResult_ChannelReestablishDecodeErrorZPtr {
9809                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
9810                         } }
9811                 }
9812         }
9813 }
9814 #[no_mangle]
9815 /// Creates a new CResult_ChannelReestablishDecodeErrorZ which has the same data as `orig`
9816 /// but with all dynamically-allocated buffers duplicated in new buffers.
9817 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_clone(orig: &CResult_ChannelReestablishDecodeErrorZ) -> CResult_ChannelReestablishDecodeErrorZ { Clone::clone(&orig) }
9818 #[repr(C)]
9819 /// The contents of CResult_ClosingSignedDecodeErrorZ
9820 pub union CResult_ClosingSignedDecodeErrorZPtr {
9821         /// A pointer to the contents in the success state.
9822         /// Reading from this pointer when `result_ok` is not set is undefined.
9823         pub result: *mut crate::lightning::ln::msgs::ClosingSigned,
9824         /// A pointer to the contents in the error state.
9825         /// Reading from this pointer when `result_ok` is set is undefined.
9826         pub err: *mut crate::lightning::ln::msgs::DecodeError,
9827 }
9828 #[repr(C)]
9829 /// A CResult_ClosingSignedDecodeErrorZ represents the result of a fallible operation,
9830 /// containing a crate::lightning::ln::msgs::ClosingSigned on success and a crate::lightning::ln::msgs::DecodeError on failure.
9831 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9832 pub struct CResult_ClosingSignedDecodeErrorZ {
9833         /// The contents of this CResult_ClosingSignedDecodeErrorZ, accessible via either
9834         /// `err` or `result` depending on the state of `result_ok`.
9835         pub contents: CResult_ClosingSignedDecodeErrorZPtr,
9836         /// Whether this CResult_ClosingSignedDecodeErrorZ represents a success state.
9837         pub result_ok: bool,
9838 }
9839 #[no_mangle]
9840 /// Creates a new CResult_ClosingSignedDecodeErrorZ in the success state.
9841 pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ClosingSigned) -> CResult_ClosingSignedDecodeErrorZ {
9842         CResult_ClosingSignedDecodeErrorZ {
9843                 contents: CResult_ClosingSignedDecodeErrorZPtr {
9844                         result: Box::into_raw(Box::new(o)),
9845                 },
9846                 result_ok: true,
9847         }
9848 }
9849 #[no_mangle]
9850 /// Creates a new CResult_ClosingSignedDecodeErrorZ in the error state.
9851 pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ClosingSignedDecodeErrorZ {
9852         CResult_ClosingSignedDecodeErrorZ {
9853                 contents: CResult_ClosingSignedDecodeErrorZPtr {
9854                         err: Box::into_raw(Box::new(e)),
9855                 },
9856                 result_ok: false,
9857         }
9858 }
9859 #[no_mangle]
9860 /// Frees any resources used by the CResult_ClosingSignedDecodeErrorZ.
9861 pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_free(_res: CResult_ClosingSignedDecodeErrorZ) { }
9862 impl Drop for CResult_ClosingSignedDecodeErrorZ {
9863         fn drop(&mut self) {
9864                 if self.result_ok {
9865                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
9866                                 let _ = unsafe { Box::from_raw(self.contents.result) };
9867                         }
9868                 } else {
9869                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
9870                                 let _ = unsafe { Box::from_raw(self.contents.err) };
9871                         }
9872                 }
9873         }
9874 }
9875 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ClosingSigned, crate::lightning::ln::msgs::DecodeError>> for CResult_ClosingSignedDecodeErrorZ {
9876         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ClosingSigned, crate::lightning::ln::msgs::DecodeError>) -> Self {
9877                 let contents = if o.result_ok {
9878                         let result = unsafe { o.contents.result };
9879                         unsafe { o.contents.result = std::ptr::null_mut() };
9880                         CResult_ClosingSignedDecodeErrorZPtr { result }
9881                 } else {
9882                         let err = unsafe { o.contents.err };
9883                         unsafe { o.contents.err = std::ptr::null_mut(); }
9884                         CResult_ClosingSignedDecodeErrorZPtr { err }
9885                 };
9886                 Self {
9887                         contents,
9888                         result_ok: o.result_ok,
9889                 }
9890         }
9891 }
9892 impl Clone for CResult_ClosingSignedDecodeErrorZ {
9893         fn clone(&self) -> Self {
9894                 if self.result_ok {
9895                         Self { result_ok: true, contents: CResult_ClosingSignedDecodeErrorZPtr {
9896                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ClosingSigned>::clone(unsafe { &*self.contents.result })))
9897                         } }
9898                 } else {
9899                         Self { result_ok: false, contents: CResult_ClosingSignedDecodeErrorZPtr {
9900                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
9901                         } }
9902                 }
9903         }
9904 }
9905 #[no_mangle]
9906 /// Creates a new CResult_ClosingSignedDecodeErrorZ which has the same data as `orig`
9907 /// but with all dynamically-allocated buffers duplicated in new buffers.
9908 pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_clone(orig: &CResult_ClosingSignedDecodeErrorZ) -> CResult_ClosingSignedDecodeErrorZ { Clone::clone(&orig) }
9909 #[repr(C)]
9910 /// The contents of CResult_ClosingSignedFeeRangeDecodeErrorZ
9911 pub union CResult_ClosingSignedFeeRangeDecodeErrorZPtr {
9912         /// A pointer to the contents in the success state.
9913         /// Reading from this pointer when `result_ok` is not set is undefined.
9914         pub result: *mut crate::lightning::ln::msgs::ClosingSignedFeeRange,
9915         /// A pointer to the contents in the error state.
9916         /// Reading from this pointer when `result_ok` is set is undefined.
9917         pub err: *mut crate::lightning::ln::msgs::DecodeError,
9918 }
9919 #[repr(C)]
9920 /// A CResult_ClosingSignedFeeRangeDecodeErrorZ represents the result of a fallible operation,
9921 /// containing a crate::lightning::ln::msgs::ClosingSignedFeeRange on success and a crate::lightning::ln::msgs::DecodeError on failure.
9922 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9923 pub struct CResult_ClosingSignedFeeRangeDecodeErrorZ {
9924         /// The contents of this CResult_ClosingSignedFeeRangeDecodeErrorZ, accessible via either
9925         /// `err` or `result` depending on the state of `result_ok`.
9926         pub contents: CResult_ClosingSignedFeeRangeDecodeErrorZPtr,
9927         /// Whether this CResult_ClosingSignedFeeRangeDecodeErrorZ represents a success state.
9928         pub result_ok: bool,
9929 }
9930 #[no_mangle]
9931 /// Creates a new CResult_ClosingSignedFeeRangeDecodeErrorZ in the success state.
9932 pub extern "C" fn CResult_ClosingSignedFeeRangeDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ClosingSignedFeeRange) -> CResult_ClosingSignedFeeRangeDecodeErrorZ {
9933         CResult_ClosingSignedFeeRangeDecodeErrorZ {
9934                 contents: CResult_ClosingSignedFeeRangeDecodeErrorZPtr {
9935                         result: Box::into_raw(Box::new(o)),
9936                 },
9937                 result_ok: true,
9938         }
9939 }
9940 #[no_mangle]
9941 /// Creates a new CResult_ClosingSignedFeeRangeDecodeErrorZ in the error state.
9942 pub extern "C" fn CResult_ClosingSignedFeeRangeDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ClosingSignedFeeRangeDecodeErrorZ {
9943         CResult_ClosingSignedFeeRangeDecodeErrorZ {
9944                 contents: CResult_ClosingSignedFeeRangeDecodeErrorZPtr {
9945                         err: Box::into_raw(Box::new(e)),
9946                 },
9947                 result_ok: false,
9948         }
9949 }
9950 #[no_mangle]
9951 /// Frees any resources used by the CResult_ClosingSignedFeeRangeDecodeErrorZ.
9952 pub extern "C" fn CResult_ClosingSignedFeeRangeDecodeErrorZ_free(_res: CResult_ClosingSignedFeeRangeDecodeErrorZ) { }
9953 impl Drop for CResult_ClosingSignedFeeRangeDecodeErrorZ {
9954         fn drop(&mut self) {
9955                 if self.result_ok {
9956                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
9957                                 let _ = unsafe { Box::from_raw(self.contents.result) };
9958                         }
9959                 } else {
9960                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
9961                                 let _ = unsafe { Box::from_raw(self.contents.err) };
9962                         }
9963                 }
9964         }
9965 }
9966 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ClosingSignedFeeRange, crate::lightning::ln::msgs::DecodeError>> for CResult_ClosingSignedFeeRangeDecodeErrorZ {
9967         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ClosingSignedFeeRange, crate::lightning::ln::msgs::DecodeError>) -> Self {
9968                 let contents = if o.result_ok {
9969                         let result = unsafe { o.contents.result };
9970                         unsafe { o.contents.result = std::ptr::null_mut() };
9971                         CResult_ClosingSignedFeeRangeDecodeErrorZPtr { result }
9972                 } else {
9973                         let err = unsafe { o.contents.err };
9974                         unsafe { o.contents.err = std::ptr::null_mut(); }
9975                         CResult_ClosingSignedFeeRangeDecodeErrorZPtr { err }
9976                 };
9977                 Self {
9978                         contents,
9979                         result_ok: o.result_ok,
9980                 }
9981         }
9982 }
9983 impl Clone for CResult_ClosingSignedFeeRangeDecodeErrorZ {
9984         fn clone(&self) -> Self {
9985                 if self.result_ok {
9986                         Self { result_ok: true, contents: CResult_ClosingSignedFeeRangeDecodeErrorZPtr {
9987                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ClosingSignedFeeRange>::clone(unsafe { &*self.contents.result })))
9988                         } }
9989                 } else {
9990                         Self { result_ok: false, contents: CResult_ClosingSignedFeeRangeDecodeErrorZPtr {
9991                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
9992                         } }
9993                 }
9994         }
9995 }
9996 #[no_mangle]
9997 /// Creates a new CResult_ClosingSignedFeeRangeDecodeErrorZ which has the same data as `orig`
9998 /// but with all dynamically-allocated buffers duplicated in new buffers.
9999 pub extern "C" fn CResult_ClosingSignedFeeRangeDecodeErrorZ_clone(orig: &CResult_ClosingSignedFeeRangeDecodeErrorZ) -> CResult_ClosingSignedFeeRangeDecodeErrorZ { Clone::clone(&orig) }
10000 #[repr(C)]
10001 /// The contents of CResult_CommitmentSignedDecodeErrorZ
10002 pub union CResult_CommitmentSignedDecodeErrorZPtr {
10003         /// A pointer to the contents in the success state.
10004         /// Reading from this pointer when `result_ok` is not set is undefined.
10005         pub result: *mut crate::lightning::ln::msgs::CommitmentSigned,
10006         /// A pointer to the contents in the error state.
10007         /// Reading from this pointer when `result_ok` is set is undefined.
10008         pub err: *mut crate::lightning::ln::msgs::DecodeError,
10009 }
10010 #[repr(C)]
10011 /// A CResult_CommitmentSignedDecodeErrorZ represents the result of a fallible operation,
10012 /// containing a crate::lightning::ln::msgs::CommitmentSigned on success and a crate::lightning::ln::msgs::DecodeError on failure.
10013 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10014 pub struct CResult_CommitmentSignedDecodeErrorZ {
10015         /// The contents of this CResult_CommitmentSignedDecodeErrorZ, accessible via either
10016         /// `err` or `result` depending on the state of `result_ok`.
10017         pub contents: CResult_CommitmentSignedDecodeErrorZPtr,
10018         /// Whether this CResult_CommitmentSignedDecodeErrorZ represents a success state.
10019         pub result_ok: bool,
10020 }
10021 #[no_mangle]
10022 /// Creates a new CResult_CommitmentSignedDecodeErrorZ in the success state.
10023 pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_ok(o: crate::lightning::ln::msgs::CommitmentSigned) -> CResult_CommitmentSignedDecodeErrorZ {
10024         CResult_CommitmentSignedDecodeErrorZ {
10025                 contents: CResult_CommitmentSignedDecodeErrorZPtr {
10026                         result: Box::into_raw(Box::new(o)),
10027                 },
10028                 result_ok: true,
10029         }
10030 }
10031 #[no_mangle]
10032 /// Creates a new CResult_CommitmentSignedDecodeErrorZ in the error state.
10033 pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_CommitmentSignedDecodeErrorZ {
10034         CResult_CommitmentSignedDecodeErrorZ {
10035                 contents: CResult_CommitmentSignedDecodeErrorZPtr {
10036                         err: Box::into_raw(Box::new(e)),
10037                 },
10038                 result_ok: false,
10039         }
10040 }
10041 #[no_mangle]
10042 /// Frees any resources used by the CResult_CommitmentSignedDecodeErrorZ.
10043 pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_free(_res: CResult_CommitmentSignedDecodeErrorZ) { }
10044 impl Drop for CResult_CommitmentSignedDecodeErrorZ {
10045         fn drop(&mut self) {
10046                 if self.result_ok {
10047                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
10048                                 let _ = unsafe { Box::from_raw(self.contents.result) };
10049                         }
10050                 } else {
10051                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
10052                                 let _ = unsafe { Box::from_raw(self.contents.err) };
10053                         }
10054                 }
10055         }
10056 }
10057 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::CommitmentSigned, crate::lightning::ln::msgs::DecodeError>> for CResult_CommitmentSignedDecodeErrorZ {
10058         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::CommitmentSigned, crate::lightning::ln::msgs::DecodeError>) -> Self {
10059                 let contents = if o.result_ok {
10060                         let result = unsafe { o.contents.result };
10061                         unsafe { o.contents.result = std::ptr::null_mut() };
10062                         CResult_CommitmentSignedDecodeErrorZPtr { result }
10063                 } else {
10064                         let err = unsafe { o.contents.err };
10065                         unsafe { o.contents.err = std::ptr::null_mut(); }
10066                         CResult_CommitmentSignedDecodeErrorZPtr { err }
10067                 };
10068                 Self {
10069                         contents,
10070                         result_ok: o.result_ok,
10071                 }
10072         }
10073 }
10074 impl Clone for CResult_CommitmentSignedDecodeErrorZ {
10075         fn clone(&self) -> Self {
10076                 if self.result_ok {
10077                         Self { result_ok: true, contents: CResult_CommitmentSignedDecodeErrorZPtr {
10078                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::CommitmentSigned>::clone(unsafe { &*self.contents.result })))
10079                         } }
10080                 } else {
10081                         Self { result_ok: false, contents: CResult_CommitmentSignedDecodeErrorZPtr {
10082                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
10083                         } }
10084                 }
10085         }
10086 }
10087 #[no_mangle]
10088 /// Creates a new CResult_CommitmentSignedDecodeErrorZ which has the same data as `orig`
10089 /// but with all dynamically-allocated buffers duplicated in new buffers.
10090 pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_clone(orig: &CResult_CommitmentSignedDecodeErrorZ) -> CResult_CommitmentSignedDecodeErrorZ { Clone::clone(&orig) }
10091 #[repr(C)]
10092 /// The contents of CResult_FundingCreatedDecodeErrorZ
10093 pub union CResult_FundingCreatedDecodeErrorZPtr {
10094         /// A pointer to the contents in the success state.
10095         /// Reading from this pointer when `result_ok` is not set is undefined.
10096         pub result: *mut crate::lightning::ln::msgs::FundingCreated,
10097         /// A pointer to the contents in the error state.
10098         /// Reading from this pointer when `result_ok` is set is undefined.
10099         pub err: *mut crate::lightning::ln::msgs::DecodeError,
10100 }
10101 #[repr(C)]
10102 /// A CResult_FundingCreatedDecodeErrorZ represents the result of a fallible operation,
10103 /// containing a crate::lightning::ln::msgs::FundingCreated on success and a crate::lightning::ln::msgs::DecodeError on failure.
10104 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10105 pub struct CResult_FundingCreatedDecodeErrorZ {
10106         /// The contents of this CResult_FundingCreatedDecodeErrorZ, accessible via either
10107         /// `err` or `result` depending on the state of `result_ok`.
10108         pub contents: CResult_FundingCreatedDecodeErrorZPtr,
10109         /// Whether this CResult_FundingCreatedDecodeErrorZ represents a success state.
10110         pub result_ok: bool,
10111 }
10112 #[no_mangle]
10113 /// Creates a new CResult_FundingCreatedDecodeErrorZ in the success state.
10114 pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_ok(o: crate::lightning::ln::msgs::FundingCreated) -> CResult_FundingCreatedDecodeErrorZ {
10115         CResult_FundingCreatedDecodeErrorZ {
10116                 contents: CResult_FundingCreatedDecodeErrorZPtr {
10117                         result: Box::into_raw(Box::new(o)),
10118                 },
10119                 result_ok: true,
10120         }
10121 }
10122 #[no_mangle]
10123 /// Creates a new CResult_FundingCreatedDecodeErrorZ in the error state.
10124 pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_FundingCreatedDecodeErrorZ {
10125         CResult_FundingCreatedDecodeErrorZ {
10126                 contents: CResult_FundingCreatedDecodeErrorZPtr {
10127                         err: Box::into_raw(Box::new(e)),
10128                 },
10129                 result_ok: false,
10130         }
10131 }
10132 #[no_mangle]
10133 /// Frees any resources used by the CResult_FundingCreatedDecodeErrorZ.
10134 pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_free(_res: CResult_FundingCreatedDecodeErrorZ) { }
10135 impl Drop for CResult_FundingCreatedDecodeErrorZ {
10136         fn drop(&mut self) {
10137                 if self.result_ok {
10138                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
10139                                 let _ = unsafe { Box::from_raw(self.contents.result) };
10140                         }
10141                 } else {
10142                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
10143                                 let _ = unsafe { Box::from_raw(self.contents.err) };
10144                         }
10145                 }
10146         }
10147 }
10148 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::FundingCreated, crate::lightning::ln::msgs::DecodeError>> for CResult_FundingCreatedDecodeErrorZ {
10149         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::FundingCreated, crate::lightning::ln::msgs::DecodeError>) -> Self {
10150                 let contents = if o.result_ok {
10151                         let result = unsafe { o.contents.result };
10152                         unsafe { o.contents.result = std::ptr::null_mut() };
10153                         CResult_FundingCreatedDecodeErrorZPtr { result }
10154                 } else {
10155                         let err = unsafe { o.contents.err };
10156                         unsafe { o.contents.err = std::ptr::null_mut(); }
10157                         CResult_FundingCreatedDecodeErrorZPtr { err }
10158                 };
10159                 Self {
10160                         contents,
10161                         result_ok: o.result_ok,
10162                 }
10163         }
10164 }
10165 impl Clone for CResult_FundingCreatedDecodeErrorZ {
10166         fn clone(&self) -> Self {
10167                 if self.result_ok {
10168                         Self { result_ok: true, contents: CResult_FundingCreatedDecodeErrorZPtr {
10169                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::FundingCreated>::clone(unsafe { &*self.contents.result })))
10170                         } }
10171                 } else {
10172                         Self { result_ok: false, contents: CResult_FundingCreatedDecodeErrorZPtr {
10173                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
10174                         } }
10175                 }
10176         }
10177 }
10178 #[no_mangle]
10179 /// Creates a new CResult_FundingCreatedDecodeErrorZ which has the same data as `orig`
10180 /// but with all dynamically-allocated buffers duplicated in new buffers.
10181 pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_clone(orig: &CResult_FundingCreatedDecodeErrorZ) -> CResult_FundingCreatedDecodeErrorZ { Clone::clone(&orig) }
10182 #[repr(C)]
10183 /// The contents of CResult_FundingSignedDecodeErrorZ
10184 pub union CResult_FundingSignedDecodeErrorZPtr {
10185         /// A pointer to the contents in the success state.
10186         /// Reading from this pointer when `result_ok` is not set is undefined.
10187         pub result: *mut crate::lightning::ln::msgs::FundingSigned,
10188         /// A pointer to the contents in the error state.
10189         /// Reading from this pointer when `result_ok` is set is undefined.
10190         pub err: *mut crate::lightning::ln::msgs::DecodeError,
10191 }
10192 #[repr(C)]
10193 /// A CResult_FundingSignedDecodeErrorZ represents the result of a fallible operation,
10194 /// containing a crate::lightning::ln::msgs::FundingSigned on success and a crate::lightning::ln::msgs::DecodeError on failure.
10195 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10196 pub struct CResult_FundingSignedDecodeErrorZ {
10197         /// The contents of this CResult_FundingSignedDecodeErrorZ, accessible via either
10198         /// `err` or `result` depending on the state of `result_ok`.
10199         pub contents: CResult_FundingSignedDecodeErrorZPtr,
10200         /// Whether this CResult_FundingSignedDecodeErrorZ represents a success state.
10201         pub result_ok: bool,
10202 }
10203 #[no_mangle]
10204 /// Creates a new CResult_FundingSignedDecodeErrorZ in the success state.
10205 pub extern "C" fn CResult_FundingSignedDecodeErrorZ_ok(o: crate::lightning::ln::msgs::FundingSigned) -> CResult_FundingSignedDecodeErrorZ {
10206         CResult_FundingSignedDecodeErrorZ {
10207                 contents: CResult_FundingSignedDecodeErrorZPtr {
10208                         result: Box::into_raw(Box::new(o)),
10209                 },
10210                 result_ok: true,
10211         }
10212 }
10213 #[no_mangle]
10214 /// Creates a new CResult_FundingSignedDecodeErrorZ in the error state.
10215 pub extern "C" fn CResult_FundingSignedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_FundingSignedDecodeErrorZ {
10216         CResult_FundingSignedDecodeErrorZ {
10217                 contents: CResult_FundingSignedDecodeErrorZPtr {
10218                         err: Box::into_raw(Box::new(e)),
10219                 },
10220                 result_ok: false,
10221         }
10222 }
10223 #[no_mangle]
10224 /// Frees any resources used by the CResult_FundingSignedDecodeErrorZ.
10225 pub extern "C" fn CResult_FundingSignedDecodeErrorZ_free(_res: CResult_FundingSignedDecodeErrorZ) { }
10226 impl Drop for CResult_FundingSignedDecodeErrorZ {
10227         fn drop(&mut self) {
10228                 if self.result_ok {
10229                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
10230                                 let _ = unsafe { Box::from_raw(self.contents.result) };
10231                         }
10232                 } else {
10233                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
10234                                 let _ = unsafe { Box::from_raw(self.contents.err) };
10235                         }
10236                 }
10237         }
10238 }
10239 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::FundingSigned, crate::lightning::ln::msgs::DecodeError>> for CResult_FundingSignedDecodeErrorZ {
10240         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::FundingSigned, crate::lightning::ln::msgs::DecodeError>) -> Self {
10241                 let contents = if o.result_ok {
10242                         let result = unsafe { o.contents.result };
10243                         unsafe { o.contents.result = std::ptr::null_mut() };
10244                         CResult_FundingSignedDecodeErrorZPtr { result }
10245                 } else {
10246                         let err = unsafe { o.contents.err };
10247                         unsafe { o.contents.err = std::ptr::null_mut(); }
10248                         CResult_FundingSignedDecodeErrorZPtr { err }
10249                 };
10250                 Self {
10251                         contents,
10252                         result_ok: o.result_ok,
10253                 }
10254         }
10255 }
10256 impl Clone for CResult_FundingSignedDecodeErrorZ {
10257         fn clone(&self) -> Self {
10258                 if self.result_ok {
10259                         Self { result_ok: true, contents: CResult_FundingSignedDecodeErrorZPtr {
10260                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::FundingSigned>::clone(unsafe { &*self.contents.result })))
10261                         } }
10262                 } else {
10263                         Self { result_ok: false, contents: CResult_FundingSignedDecodeErrorZPtr {
10264                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
10265                         } }
10266                 }
10267         }
10268 }
10269 #[no_mangle]
10270 /// Creates a new CResult_FundingSignedDecodeErrorZ which has the same data as `orig`
10271 /// but with all dynamically-allocated buffers duplicated in new buffers.
10272 pub extern "C" fn CResult_FundingSignedDecodeErrorZ_clone(orig: &CResult_FundingSignedDecodeErrorZ) -> CResult_FundingSignedDecodeErrorZ { Clone::clone(&orig) }
10273 #[repr(C)]
10274 /// The contents of CResult_FundingLockedDecodeErrorZ
10275 pub union CResult_FundingLockedDecodeErrorZPtr {
10276         /// A pointer to the contents in the success state.
10277         /// Reading from this pointer when `result_ok` is not set is undefined.
10278         pub result: *mut crate::lightning::ln::msgs::FundingLocked,
10279         /// A pointer to the contents in the error state.
10280         /// Reading from this pointer when `result_ok` is set is undefined.
10281         pub err: *mut crate::lightning::ln::msgs::DecodeError,
10282 }
10283 #[repr(C)]
10284 /// A CResult_FundingLockedDecodeErrorZ represents the result of a fallible operation,
10285 /// containing a crate::lightning::ln::msgs::FundingLocked on success and a crate::lightning::ln::msgs::DecodeError on failure.
10286 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10287 pub struct CResult_FundingLockedDecodeErrorZ {
10288         /// The contents of this CResult_FundingLockedDecodeErrorZ, accessible via either
10289         /// `err` or `result` depending on the state of `result_ok`.
10290         pub contents: CResult_FundingLockedDecodeErrorZPtr,
10291         /// Whether this CResult_FundingLockedDecodeErrorZ represents a success state.
10292         pub result_ok: bool,
10293 }
10294 #[no_mangle]
10295 /// Creates a new CResult_FundingLockedDecodeErrorZ in the success state.
10296 pub extern "C" fn CResult_FundingLockedDecodeErrorZ_ok(o: crate::lightning::ln::msgs::FundingLocked) -> CResult_FundingLockedDecodeErrorZ {
10297         CResult_FundingLockedDecodeErrorZ {
10298                 contents: CResult_FundingLockedDecodeErrorZPtr {
10299                         result: Box::into_raw(Box::new(o)),
10300                 },
10301                 result_ok: true,
10302         }
10303 }
10304 #[no_mangle]
10305 /// Creates a new CResult_FundingLockedDecodeErrorZ in the error state.
10306 pub extern "C" fn CResult_FundingLockedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_FundingLockedDecodeErrorZ {
10307         CResult_FundingLockedDecodeErrorZ {
10308                 contents: CResult_FundingLockedDecodeErrorZPtr {
10309                         err: Box::into_raw(Box::new(e)),
10310                 },
10311                 result_ok: false,
10312         }
10313 }
10314 #[no_mangle]
10315 /// Frees any resources used by the CResult_FundingLockedDecodeErrorZ.
10316 pub extern "C" fn CResult_FundingLockedDecodeErrorZ_free(_res: CResult_FundingLockedDecodeErrorZ) { }
10317 impl Drop for CResult_FundingLockedDecodeErrorZ {
10318         fn drop(&mut self) {
10319                 if self.result_ok {
10320                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
10321                                 let _ = unsafe { Box::from_raw(self.contents.result) };
10322                         }
10323                 } else {
10324                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
10325                                 let _ = unsafe { Box::from_raw(self.contents.err) };
10326                         }
10327                 }
10328         }
10329 }
10330 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::FundingLocked, crate::lightning::ln::msgs::DecodeError>> for CResult_FundingLockedDecodeErrorZ {
10331         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::FundingLocked, crate::lightning::ln::msgs::DecodeError>) -> Self {
10332                 let contents = if o.result_ok {
10333                         let result = unsafe { o.contents.result };
10334                         unsafe { o.contents.result = std::ptr::null_mut() };
10335                         CResult_FundingLockedDecodeErrorZPtr { result }
10336                 } else {
10337                         let err = unsafe { o.contents.err };
10338                         unsafe { o.contents.err = std::ptr::null_mut(); }
10339                         CResult_FundingLockedDecodeErrorZPtr { err }
10340                 };
10341                 Self {
10342                         contents,
10343                         result_ok: o.result_ok,
10344                 }
10345         }
10346 }
10347 impl Clone for CResult_FundingLockedDecodeErrorZ {
10348         fn clone(&self) -> Self {
10349                 if self.result_ok {
10350                         Self { result_ok: true, contents: CResult_FundingLockedDecodeErrorZPtr {
10351                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::FundingLocked>::clone(unsafe { &*self.contents.result })))
10352                         } }
10353                 } else {
10354                         Self { result_ok: false, contents: CResult_FundingLockedDecodeErrorZPtr {
10355                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
10356                         } }
10357                 }
10358         }
10359 }
10360 #[no_mangle]
10361 /// Creates a new CResult_FundingLockedDecodeErrorZ which has the same data as `orig`
10362 /// but with all dynamically-allocated buffers duplicated in new buffers.
10363 pub extern "C" fn CResult_FundingLockedDecodeErrorZ_clone(orig: &CResult_FundingLockedDecodeErrorZ) -> CResult_FundingLockedDecodeErrorZ { Clone::clone(&orig) }
10364 #[repr(C)]
10365 /// The contents of CResult_InitDecodeErrorZ
10366 pub union CResult_InitDecodeErrorZPtr {
10367         /// A pointer to the contents in the success state.
10368         /// Reading from this pointer when `result_ok` is not set is undefined.
10369         pub result: *mut crate::lightning::ln::msgs::Init,
10370         /// A pointer to the contents in the error state.
10371         /// Reading from this pointer when `result_ok` is set is undefined.
10372         pub err: *mut crate::lightning::ln::msgs::DecodeError,
10373 }
10374 #[repr(C)]
10375 /// A CResult_InitDecodeErrorZ represents the result of a fallible operation,
10376 /// containing a crate::lightning::ln::msgs::Init on success and a crate::lightning::ln::msgs::DecodeError on failure.
10377 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10378 pub struct CResult_InitDecodeErrorZ {
10379         /// The contents of this CResult_InitDecodeErrorZ, accessible via either
10380         /// `err` or `result` depending on the state of `result_ok`.
10381         pub contents: CResult_InitDecodeErrorZPtr,
10382         /// Whether this CResult_InitDecodeErrorZ represents a success state.
10383         pub result_ok: bool,
10384 }
10385 #[no_mangle]
10386 /// Creates a new CResult_InitDecodeErrorZ in the success state.
10387 pub extern "C" fn CResult_InitDecodeErrorZ_ok(o: crate::lightning::ln::msgs::Init) -> CResult_InitDecodeErrorZ {
10388         CResult_InitDecodeErrorZ {
10389                 contents: CResult_InitDecodeErrorZPtr {
10390                         result: Box::into_raw(Box::new(o)),
10391                 },
10392                 result_ok: true,
10393         }
10394 }
10395 #[no_mangle]
10396 /// Creates a new CResult_InitDecodeErrorZ in the error state.
10397 pub extern "C" fn CResult_InitDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_InitDecodeErrorZ {
10398         CResult_InitDecodeErrorZ {
10399                 contents: CResult_InitDecodeErrorZPtr {
10400                         err: Box::into_raw(Box::new(e)),
10401                 },
10402                 result_ok: false,
10403         }
10404 }
10405 #[no_mangle]
10406 /// Frees any resources used by the CResult_InitDecodeErrorZ.
10407 pub extern "C" fn CResult_InitDecodeErrorZ_free(_res: CResult_InitDecodeErrorZ) { }
10408 impl Drop for CResult_InitDecodeErrorZ {
10409         fn drop(&mut self) {
10410                 if self.result_ok {
10411                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
10412                                 let _ = unsafe { Box::from_raw(self.contents.result) };
10413                         }
10414                 } else {
10415                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
10416                                 let _ = unsafe { Box::from_raw(self.contents.err) };
10417                         }
10418                 }
10419         }
10420 }
10421 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::Init, crate::lightning::ln::msgs::DecodeError>> for CResult_InitDecodeErrorZ {
10422         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::Init, crate::lightning::ln::msgs::DecodeError>) -> Self {
10423                 let contents = if o.result_ok {
10424                         let result = unsafe { o.contents.result };
10425                         unsafe { o.contents.result = std::ptr::null_mut() };
10426                         CResult_InitDecodeErrorZPtr { result }
10427                 } else {
10428                         let err = unsafe { o.contents.err };
10429                         unsafe { o.contents.err = std::ptr::null_mut(); }
10430                         CResult_InitDecodeErrorZPtr { err }
10431                 };
10432                 Self {
10433                         contents,
10434                         result_ok: o.result_ok,
10435                 }
10436         }
10437 }
10438 impl Clone for CResult_InitDecodeErrorZ {
10439         fn clone(&self) -> Self {
10440                 if self.result_ok {
10441                         Self { result_ok: true, contents: CResult_InitDecodeErrorZPtr {
10442                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::Init>::clone(unsafe { &*self.contents.result })))
10443                         } }
10444                 } else {
10445                         Self { result_ok: false, contents: CResult_InitDecodeErrorZPtr {
10446                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
10447                         } }
10448                 }
10449         }
10450 }
10451 #[no_mangle]
10452 /// Creates a new CResult_InitDecodeErrorZ which has the same data as `orig`
10453 /// but with all dynamically-allocated buffers duplicated in new buffers.
10454 pub extern "C" fn CResult_InitDecodeErrorZ_clone(orig: &CResult_InitDecodeErrorZ) -> CResult_InitDecodeErrorZ { Clone::clone(&orig) }
10455 #[repr(C)]
10456 /// The contents of CResult_OpenChannelDecodeErrorZ
10457 pub union CResult_OpenChannelDecodeErrorZPtr {
10458         /// A pointer to the contents in the success state.
10459         /// Reading from this pointer when `result_ok` is not set is undefined.
10460         pub result: *mut crate::lightning::ln::msgs::OpenChannel,
10461         /// A pointer to the contents in the error state.
10462         /// Reading from this pointer when `result_ok` is set is undefined.
10463         pub err: *mut crate::lightning::ln::msgs::DecodeError,
10464 }
10465 #[repr(C)]
10466 /// A CResult_OpenChannelDecodeErrorZ represents the result of a fallible operation,
10467 /// containing a crate::lightning::ln::msgs::OpenChannel on success and a crate::lightning::ln::msgs::DecodeError on failure.
10468 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10469 pub struct CResult_OpenChannelDecodeErrorZ {
10470         /// The contents of this CResult_OpenChannelDecodeErrorZ, accessible via either
10471         /// `err` or `result` depending on the state of `result_ok`.
10472         pub contents: CResult_OpenChannelDecodeErrorZPtr,
10473         /// Whether this CResult_OpenChannelDecodeErrorZ represents a success state.
10474         pub result_ok: bool,
10475 }
10476 #[no_mangle]
10477 /// Creates a new CResult_OpenChannelDecodeErrorZ in the success state.
10478 pub extern "C" fn CResult_OpenChannelDecodeErrorZ_ok(o: crate::lightning::ln::msgs::OpenChannel) -> CResult_OpenChannelDecodeErrorZ {
10479         CResult_OpenChannelDecodeErrorZ {
10480                 contents: CResult_OpenChannelDecodeErrorZPtr {
10481                         result: Box::into_raw(Box::new(o)),
10482                 },
10483                 result_ok: true,
10484         }
10485 }
10486 #[no_mangle]
10487 /// Creates a new CResult_OpenChannelDecodeErrorZ in the error state.
10488 pub extern "C" fn CResult_OpenChannelDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_OpenChannelDecodeErrorZ {
10489         CResult_OpenChannelDecodeErrorZ {
10490                 contents: CResult_OpenChannelDecodeErrorZPtr {
10491                         err: Box::into_raw(Box::new(e)),
10492                 },
10493                 result_ok: false,
10494         }
10495 }
10496 #[no_mangle]
10497 /// Frees any resources used by the CResult_OpenChannelDecodeErrorZ.
10498 pub extern "C" fn CResult_OpenChannelDecodeErrorZ_free(_res: CResult_OpenChannelDecodeErrorZ) { }
10499 impl Drop for CResult_OpenChannelDecodeErrorZ {
10500         fn drop(&mut self) {
10501                 if self.result_ok {
10502                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
10503                                 let _ = unsafe { Box::from_raw(self.contents.result) };
10504                         }
10505                 } else {
10506                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
10507                                 let _ = unsafe { Box::from_raw(self.contents.err) };
10508                         }
10509                 }
10510         }
10511 }
10512 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::OpenChannel, crate::lightning::ln::msgs::DecodeError>> for CResult_OpenChannelDecodeErrorZ {
10513         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::OpenChannel, crate::lightning::ln::msgs::DecodeError>) -> Self {
10514                 let contents = if o.result_ok {
10515                         let result = unsafe { o.contents.result };
10516                         unsafe { o.contents.result = std::ptr::null_mut() };
10517                         CResult_OpenChannelDecodeErrorZPtr { result }
10518                 } else {
10519                         let err = unsafe { o.contents.err };
10520                         unsafe { o.contents.err = std::ptr::null_mut(); }
10521                         CResult_OpenChannelDecodeErrorZPtr { err }
10522                 };
10523                 Self {
10524                         contents,
10525                         result_ok: o.result_ok,
10526                 }
10527         }
10528 }
10529 impl Clone for CResult_OpenChannelDecodeErrorZ {
10530         fn clone(&self) -> Self {
10531                 if self.result_ok {
10532                         Self { result_ok: true, contents: CResult_OpenChannelDecodeErrorZPtr {
10533                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::OpenChannel>::clone(unsafe { &*self.contents.result })))
10534                         } }
10535                 } else {
10536                         Self { result_ok: false, contents: CResult_OpenChannelDecodeErrorZPtr {
10537                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
10538                         } }
10539                 }
10540         }
10541 }
10542 #[no_mangle]
10543 /// Creates a new CResult_OpenChannelDecodeErrorZ which has the same data as `orig`
10544 /// but with all dynamically-allocated buffers duplicated in new buffers.
10545 pub extern "C" fn CResult_OpenChannelDecodeErrorZ_clone(orig: &CResult_OpenChannelDecodeErrorZ) -> CResult_OpenChannelDecodeErrorZ { Clone::clone(&orig) }
10546 #[repr(C)]
10547 /// The contents of CResult_RevokeAndACKDecodeErrorZ
10548 pub union CResult_RevokeAndACKDecodeErrorZPtr {
10549         /// A pointer to the contents in the success state.
10550         /// Reading from this pointer when `result_ok` is not set is undefined.
10551         pub result: *mut crate::lightning::ln::msgs::RevokeAndACK,
10552         /// A pointer to the contents in the error state.
10553         /// Reading from this pointer when `result_ok` is set is undefined.
10554         pub err: *mut crate::lightning::ln::msgs::DecodeError,
10555 }
10556 #[repr(C)]
10557 /// A CResult_RevokeAndACKDecodeErrorZ represents the result of a fallible operation,
10558 /// containing a crate::lightning::ln::msgs::RevokeAndACK on success and a crate::lightning::ln::msgs::DecodeError on failure.
10559 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10560 pub struct CResult_RevokeAndACKDecodeErrorZ {
10561         /// The contents of this CResult_RevokeAndACKDecodeErrorZ, accessible via either
10562         /// `err` or `result` depending on the state of `result_ok`.
10563         pub contents: CResult_RevokeAndACKDecodeErrorZPtr,
10564         /// Whether this CResult_RevokeAndACKDecodeErrorZ represents a success state.
10565         pub result_ok: bool,
10566 }
10567 #[no_mangle]
10568 /// Creates a new CResult_RevokeAndACKDecodeErrorZ in the success state.
10569 pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_ok(o: crate::lightning::ln::msgs::RevokeAndACK) -> CResult_RevokeAndACKDecodeErrorZ {
10570         CResult_RevokeAndACKDecodeErrorZ {
10571                 contents: CResult_RevokeAndACKDecodeErrorZPtr {
10572                         result: Box::into_raw(Box::new(o)),
10573                 },
10574                 result_ok: true,
10575         }
10576 }
10577 #[no_mangle]
10578 /// Creates a new CResult_RevokeAndACKDecodeErrorZ in the error state.
10579 pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RevokeAndACKDecodeErrorZ {
10580         CResult_RevokeAndACKDecodeErrorZ {
10581                 contents: CResult_RevokeAndACKDecodeErrorZPtr {
10582                         err: Box::into_raw(Box::new(e)),
10583                 },
10584                 result_ok: false,
10585         }
10586 }
10587 #[no_mangle]
10588 /// Frees any resources used by the CResult_RevokeAndACKDecodeErrorZ.
10589 pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_free(_res: CResult_RevokeAndACKDecodeErrorZ) { }
10590 impl Drop for CResult_RevokeAndACKDecodeErrorZ {
10591         fn drop(&mut self) {
10592                 if self.result_ok {
10593                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
10594                                 let _ = unsafe { Box::from_raw(self.contents.result) };
10595                         }
10596                 } else {
10597                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
10598                                 let _ = unsafe { Box::from_raw(self.contents.err) };
10599                         }
10600                 }
10601         }
10602 }
10603 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::RevokeAndACK, crate::lightning::ln::msgs::DecodeError>> for CResult_RevokeAndACKDecodeErrorZ {
10604         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::RevokeAndACK, crate::lightning::ln::msgs::DecodeError>) -> Self {
10605                 let contents = if o.result_ok {
10606                         let result = unsafe { o.contents.result };
10607                         unsafe { o.contents.result = std::ptr::null_mut() };
10608                         CResult_RevokeAndACKDecodeErrorZPtr { result }
10609                 } else {
10610                         let err = unsafe { o.contents.err };
10611                         unsafe { o.contents.err = std::ptr::null_mut(); }
10612                         CResult_RevokeAndACKDecodeErrorZPtr { err }
10613                 };
10614                 Self {
10615                         contents,
10616                         result_ok: o.result_ok,
10617                 }
10618         }
10619 }
10620 impl Clone for CResult_RevokeAndACKDecodeErrorZ {
10621         fn clone(&self) -> Self {
10622                 if self.result_ok {
10623                         Self { result_ok: true, contents: CResult_RevokeAndACKDecodeErrorZPtr {
10624                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::RevokeAndACK>::clone(unsafe { &*self.contents.result })))
10625                         } }
10626                 } else {
10627                         Self { result_ok: false, contents: CResult_RevokeAndACKDecodeErrorZPtr {
10628                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
10629                         } }
10630                 }
10631         }
10632 }
10633 #[no_mangle]
10634 /// Creates a new CResult_RevokeAndACKDecodeErrorZ which has the same data as `orig`
10635 /// but with all dynamically-allocated buffers duplicated in new buffers.
10636 pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_clone(orig: &CResult_RevokeAndACKDecodeErrorZ) -> CResult_RevokeAndACKDecodeErrorZ { Clone::clone(&orig) }
10637 #[repr(C)]
10638 /// The contents of CResult_ShutdownDecodeErrorZ
10639 pub union CResult_ShutdownDecodeErrorZPtr {
10640         /// A pointer to the contents in the success state.
10641         /// Reading from this pointer when `result_ok` is not set is undefined.
10642         pub result: *mut crate::lightning::ln::msgs::Shutdown,
10643         /// A pointer to the contents in the error state.
10644         /// Reading from this pointer when `result_ok` is set is undefined.
10645         pub err: *mut crate::lightning::ln::msgs::DecodeError,
10646 }
10647 #[repr(C)]
10648 /// A CResult_ShutdownDecodeErrorZ represents the result of a fallible operation,
10649 /// containing a crate::lightning::ln::msgs::Shutdown on success and a crate::lightning::ln::msgs::DecodeError on failure.
10650 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10651 pub struct CResult_ShutdownDecodeErrorZ {
10652         /// The contents of this CResult_ShutdownDecodeErrorZ, accessible via either
10653         /// `err` or `result` depending on the state of `result_ok`.
10654         pub contents: CResult_ShutdownDecodeErrorZPtr,
10655         /// Whether this CResult_ShutdownDecodeErrorZ represents a success state.
10656         pub result_ok: bool,
10657 }
10658 #[no_mangle]
10659 /// Creates a new CResult_ShutdownDecodeErrorZ in the success state.
10660 pub extern "C" fn CResult_ShutdownDecodeErrorZ_ok(o: crate::lightning::ln::msgs::Shutdown) -> CResult_ShutdownDecodeErrorZ {
10661         CResult_ShutdownDecodeErrorZ {
10662                 contents: CResult_ShutdownDecodeErrorZPtr {
10663                         result: Box::into_raw(Box::new(o)),
10664                 },
10665                 result_ok: true,
10666         }
10667 }
10668 #[no_mangle]
10669 /// Creates a new CResult_ShutdownDecodeErrorZ in the error state.
10670 pub extern "C" fn CResult_ShutdownDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ShutdownDecodeErrorZ {
10671         CResult_ShutdownDecodeErrorZ {
10672                 contents: CResult_ShutdownDecodeErrorZPtr {
10673                         err: Box::into_raw(Box::new(e)),
10674                 },
10675                 result_ok: false,
10676         }
10677 }
10678 #[no_mangle]
10679 /// Frees any resources used by the CResult_ShutdownDecodeErrorZ.
10680 pub extern "C" fn CResult_ShutdownDecodeErrorZ_free(_res: CResult_ShutdownDecodeErrorZ) { }
10681 impl Drop for CResult_ShutdownDecodeErrorZ {
10682         fn drop(&mut self) {
10683                 if self.result_ok {
10684                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
10685                                 let _ = unsafe { Box::from_raw(self.contents.result) };
10686                         }
10687                 } else {
10688                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
10689                                 let _ = unsafe { Box::from_raw(self.contents.err) };
10690                         }
10691                 }
10692         }
10693 }
10694 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::Shutdown, crate::lightning::ln::msgs::DecodeError>> for CResult_ShutdownDecodeErrorZ {
10695         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::Shutdown, crate::lightning::ln::msgs::DecodeError>) -> Self {
10696                 let contents = if o.result_ok {
10697                         let result = unsafe { o.contents.result };
10698                         unsafe { o.contents.result = std::ptr::null_mut() };
10699                         CResult_ShutdownDecodeErrorZPtr { result }
10700                 } else {
10701                         let err = unsafe { o.contents.err };
10702                         unsafe { o.contents.err = std::ptr::null_mut(); }
10703                         CResult_ShutdownDecodeErrorZPtr { err }
10704                 };
10705                 Self {
10706                         contents,
10707                         result_ok: o.result_ok,
10708                 }
10709         }
10710 }
10711 impl Clone for CResult_ShutdownDecodeErrorZ {
10712         fn clone(&self) -> Self {
10713                 if self.result_ok {
10714                         Self { result_ok: true, contents: CResult_ShutdownDecodeErrorZPtr {
10715                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::Shutdown>::clone(unsafe { &*self.contents.result })))
10716                         } }
10717                 } else {
10718                         Self { result_ok: false, contents: CResult_ShutdownDecodeErrorZPtr {
10719                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
10720                         } }
10721                 }
10722         }
10723 }
10724 #[no_mangle]
10725 /// Creates a new CResult_ShutdownDecodeErrorZ which has the same data as `orig`
10726 /// but with all dynamically-allocated buffers duplicated in new buffers.
10727 pub extern "C" fn CResult_ShutdownDecodeErrorZ_clone(orig: &CResult_ShutdownDecodeErrorZ) -> CResult_ShutdownDecodeErrorZ { Clone::clone(&orig) }
10728 #[repr(C)]
10729 /// The contents of CResult_UpdateFailHTLCDecodeErrorZ
10730 pub union CResult_UpdateFailHTLCDecodeErrorZPtr {
10731         /// A pointer to the contents in the success state.
10732         /// Reading from this pointer when `result_ok` is not set is undefined.
10733         pub result: *mut crate::lightning::ln::msgs::UpdateFailHTLC,
10734         /// A pointer to the contents in the error state.
10735         /// Reading from this pointer when `result_ok` is set is undefined.
10736         pub err: *mut crate::lightning::ln::msgs::DecodeError,
10737 }
10738 #[repr(C)]
10739 /// A CResult_UpdateFailHTLCDecodeErrorZ represents the result of a fallible operation,
10740 /// containing a crate::lightning::ln::msgs::UpdateFailHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
10741 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10742 pub struct CResult_UpdateFailHTLCDecodeErrorZ {
10743         /// The contents of this CResult_UpdateFailHTLCDecodeErrorZ, accessible via either
10744         /// `err` or `result` depending on the state of `result_ok`.
10745         pub contents: CResult_UpdateFailHTLCDecodeErrorZPtr,
10746         /// Whether this CResult_UpdateFailHTLCDecodeErrorZ represents a success state.
10747         pub result_ok: bool,
10748 }
10749 #[no_mangle]
10750 /// Creates a new CResult_UpdateFailHTLCDecodeErrorZ in the success state.
10751 pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateFailHTLC) -> CResult_UpdateFailHTLCDecodeErrorZ {
10752         CResult_UpdateFailHTLCDecodeErrorZ {
10753                 contents: CResult_UpdateFailHTLCDecodeErrorZPtr {
10754                         result: Box::into_raw(Box::new(o)),
10755                 },
10756                 result_ok: true,
10757         }
10758 }
10759 #[no_mangle]
10760 /// Creates a new CResult_UpdateFailHTLCDecodeErrorZ in the error state.
10761 pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateFailHTLCDecodeErrorZ {
10762         CResult_UpdateFailHTLCDecodeErrorZ {
10763                 contents: CResult_UpdateFailHTLCDecodeErrorZPtr {
10764                         err: Box::into_raw(Box::new(e)),
10765                 },
10766                 result_ok: false,
10767         }
10768 }
10769 #[no_mangle]
10770 /// Frees any resources used by the CResult_UpdateFailHTLCDecodeErrorZ.
10771 pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_free(_res: CResult_UpdateFailHTLCDecodeErrorZ) { }
10772 impl Drop for CResult_UpdateFailHTLCDecodeErrorZ {
10773         fn drop(&mut self) {
10774                 if self.result_ok {
10775                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
10776                                 let _ = unsafe { Box::from_raw(self.contents.result) };
10777                         }
10778                 } else {
10779                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
10780                                 let _ = unsafe { Box::from_raw(self.contents.err) };
10781                         }
10782                 }
10783         }
10784 }
10785 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFailHTLC, crate::lightning::ln::msgs::DecodeError>> for CResult_UpdateFailHTLCDecodeErrorZ {
10786         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFailHTLC, crate::lightning::ln::msgs::DecodeError>) -> Self {
10787                 let contents = if o.result_ok {
10788                         let result = unsafe { o.contents.result };
10789                         unsafe { o.contents.result = std::ptr::null_mut() };
10790                         CResult_UpdateFailHTLCDecodeErrorZPtr { result }
10791                 } else {
10792                         let err = unsafe { o.contents.err };
10793                         unsafe { o.contents.err = std::ptr::null_mut(); }
10794                         CResult_UpdateFailHTLCDecodeErrorZPtr { err }
10795                 };
10796                 Self {
10797                         contents,
10798                         result_ok: o.result_ok,
10799                 }
10800         }
10801 }
10802 impl Clone for CResult_UpdateFailHTLCDecodeErrorZ {
10803         fn clone(&self) -> Self {
10804                 if self.result_ok {
10805                         Self { result_ok: true, contents: CResult_UpdateFailHTLCDecodeErrorZPtr {
10806                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UpdateFailHTLC>::clone(unsafe { &*self.contents.result })))
10807                         } }
10808                 } else {
10809                         Self { result_ok: false, contents: CResult_UpdateFailHTLCDecodeErrorZPtr {
10810                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
10811                         } }
10812                 }
10813         }
10814 }
10815 #[no_mangle]
10816 /// Creates a new CResult_UpdateFailHTLCDecodeErrorZ which has the same data as `orig`
10817 /// but with all dynamically-allocated buffers duplicated in new buffers.
10818 pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_clone(orig: &CResult_UpdateFailHTLCDecodeErrorZ) -> CResult_UpdateFailHTLCDecodeErrorZ { Clone::clone(&orig) }
10819 #[repr(C)]
10820 /// The contents of CResult_UpdateFailMalformedHTLCDecodeErrorZ
10821 pub union CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
10822         /// A pointer to the contents in the success state.
10823         /// Reading from this pointer when `result_ok` is not set is undefined.
10824         pub result: *mut crate::lightning::ln::msgs::UpdateFailMalformedHTLC,
10825         /// A pointer to the contents in the error state.
10826         /// Reading from this pointer when `result_ok` is set is undefined.
10827         pub err: *mut crate::lightning::ln::msgs::DecodeError,
10828 }
10829 #[repr(C)]
10830 /// A CResult_UpdateFailMalformedHTLCDecodeErrorZ represents the result of a fallible operation,
10831 /// containing a crate::lightning::ln::msgs::UpdateFailMalformedHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
10832 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10833 pub struct CResult_UpdateFailMalformedHTLCDecodeErrorZ {
10834         /// The contents of this CResult_UpdateFailMalformedHTLCDecodeErrorZ, accessible via either
10835         /// `err` or `result` depending on the state of `result_ok`.
10836         pub contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr,
10837         /// Whether this CResult_UpdateFailMalformedHTLCDecodeErrorZ represents a success state.
10838         pub result_ok: bool,
10839 }
10840 #[no_mangle]
10841 /// Creates a new CResult_UpdateFailMalformedHTLCDecodeErrorZ in the success state.
10842 pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateFailMalformedHTLC) -> CResult_UpdateFailMalformedHTLCDecodeErrorZ {
10843         CResult_UpdateFailMalformedHTLCDecodeErrorZ {
10844                 contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
10845                         result: Box::into_raw(Box::new(o)),
10846                 },
10847                 result_ok: true,
10848         }
10849 }
10850 #[no_mangle]
10851 /// Creates a new CResult_UpdateFailMalformedHTLCDecodeErrorZ in the error state.
10852 pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateFailMalformedHTLCDecodeErrorZ {
10853         CResult_UpdateFailMalformedHTLCDecodeErrorZ {
10854                 contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
10855                         err: Box::into_raw(Box::new(e)),
10856                 },
10857                 result_ok: false,
10858         }
10859 }
10860 #[no_mangle]
10861 /// Frees any resources used by the CResult_UpdateFailMalformedHTLCDecodeErrorZ.
10862 pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_free(_res: CResult_UpdateFailMalformedHTLCDecodeErrorZ) { }
10863 impl Drop for CResult_UpdateFailMalformedHTLCDecodeErrorZ {
10864         fn drop(&mut self) {
10865                 if self.result_ok {
10866                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
10867                                 let _ = unsafe { Box::from_raw(self.contents.result) };
10868                         }
10869                 } else {
10870                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
10871                                 let _ = unsafe { Box::from_raw(self.contents.err) };
10872                         }
10873                 }
10874         }
10875 }
10876 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFailMalformedHTLC, crate::lightning::ln::msgs::DecodeError>> for CResult_UpdateFailMalformedHTLCDecodeErrorZ {
10877         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFailMalformedHTLC, crate::lightning::ln::msgs::DecodeError>) -> Self {
10878                 let contents = if o.result_ok {
10879                         let result = unsafe { o.contents.result };
10880                         unsafe { o.contents.result = std::ptr::null_mut() };
10881                         CResult_UpdateFailMalformedHTLCDecodeErrorZPtr { result }
10882                 } else {
10883                         let err = unsafe { o.contents.err };
10884                         unsafe { o.contents.err = std::ptr::null_mut(); }
10885                         CResult_UpdateFailMalformedHTLCDecodeErrorZPtr { err }
10886                 };
10887                 Self {
10888                         contents,
10889                         result_ok: o.result_ok,
10890                 }
10891         }
10892 }
10893 impl Clone for CResult_UpdateFailMalformedHTLCDecodeErrorZ {
10894         fn clone(&self) -> Self {
10895                 if self.result_ok {
10896                         Self { result_ok: true, contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
10897                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UpdateFailMalformedHTLC>::clone(unsafe { &*self.contents.result })))
10898                         } }
10899                 } else {
10900                         Self { result_ok: false, contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
10901                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
10902                         } }
10903                 }
10904         }
10905 }
10906 #[no_mangle]
10907 /// Creates a new CResult_UpdateFailMalformedHTLCDecodeErrorZ which has the same data as `orig`
10908 /// but with all dynamically-allocated buffers duplicated in new buffers.
10909 pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone(orig: &CResult_UpdateFailMalformedHTLCDecodeErrorZ) -> CResult_UpdateFailMalformedHTLCDecodeErrorZ { Clone::clone(&orig) }
10910 #[repr(C)]
10911 /// The contents of CResult_UpdateFeeDecodeErrorZ
10912 pub union CResult_UpdateFeeDecodeErrorZPtr {
10913         /// A pointer to the contents in the success state.
10914         /// Reading from this pointer when `result_ok` is not set is undefined.
10915         pub result: *mut crate::lightning::ln::msgs::UpdateFee,
10916         /// A pointer to the contents in the error state.
10917         /// Reading from this pointer when `result_ok` is set is undefined.
10918         pub err: *mut crate::lightning::ln::msgs::DecodeError,
10919 }
10920 #[repr(C)]
10921 /// A CResult_UpdateFeeDecodeErrorZ represents the result of a fallible operation,
10922 /// containing a crate::lightning::ln::msgs::UpdateFee on success and a crate::lightning::ln::msgs::DecodeError on failure.
10923 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10924 pub struct CResult_UpdateFeeDecodeErrorZ {
10925         /// The contents of this CResult_UpdateFeeDecodeErrorZ, accessible via either
10926         /// `err` or `result` depending on the state of `result_ok`.
10927         pub contents: CResult_UpdateFeeDecodeErrorZPtr,
10928         /// Whether this CResult_UpdateFeeDecodeErrorZ represents a success state.
10929         pub result_ok: bool,
10930 }
10931 #[no_mangle]
10932 /// Creates a new CResult_UpdateFeeDecodeErrorZ in the success state.
10933 pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateFee) -> CResult_UpdateFeeDecodeErrorZ {
10934         CResult_UpdateFeeDecodeErrorZ {
10935                 contents: CResult_UpdateFeeDecodeErrorZPtr {
10936                         result: Box::into_raw(Box::new(o)),
10937                 },
10938                 result_ok: true,
10939         }
10940 }
10941 #[no_mangle]
10942 /// Creates a new CResult_UpdateFeeDecodeErrorZ in the error state.
10943 pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateFeeDecodeErrorZ {
10944         CResult_UpdateFeeDecodeErrorZ {
10945                 contents: CResult_UpdateFeeDecodeErrorZPtr {
10946                         err: Box::into_raw(Box::new(e)),
10947                 },
10948                 result_ok: false,
10949         }
10950 }
10951 #[no_mangle]
10952 /// Frees any resources used by the CResult_UpdateFeeDecodeErrorZ.
10953 pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_free(_res: CResult_UpdateFeeDecodeErrorZ) { }
10954 impl Drop for CResult_UpdateFeeDecodeErrorZ {
10955         fn drop(&mut self) {
10956                 if self.result_ok {
10957                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
10958                                 let _ = unsafe { Box::from_raw(self.contents.result) };
10959                         }
10960                 } else {
10961                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
10962                                 let _ = unsafe { Box::from_raw(self.contents.err) };
10963                         }
10964                 }
10965         }
10966 }
10967 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFee, crate::lightning::ln::msgs::DecodeError>> for CResult_UpdateFeeDecodeErrorZ {
10968         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFee, crate::lightning::ln::msgs::DecodeError>) -> Self {
10969                 let contents = if o.result_ok {
10970                         let result = unsafe { o.contents.result };
10971                         unsafe { o.contents.result = std::ptr::null_mut() };
10972                         CResult_UpdateFeeDecodeErrorZPtr { result }
10973                 } else {
10974                         let err = unsafe { o.contents.err };
10975                         unsafe { o.contents.err = std::ptr::null_mut(); }
10976                         CResult_UpdateFeeDecodeErrorZPtr { err }
10977                 };
10978                 Self {
10979                         contents,
10980                         result_ok: o.result_ok,
10981                 }
10982         }
10983 }
10984 impl Clone for CResult_UpdateFeeDecodeErrorZ {
10985         fn clone(&self) -> Self {
10986                 if self.result_ok {
10987                         Self { result_ok: true, contents: CResult_UpdateFeeDecodeErrorZPtr {
10988                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UpdateFee>::clone(unsafe { &*self.contents.result })))
10989                         } }
10990                 } else {
10991                         Self { result_ok: false, contents: CResult_UpdateFeeDecodeErrorZPtr {
10992                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
10993                         } }
10994                 }
10995         }
10996 }
10997 #[no_mangle]
10998 /// Creates a new CResult_UpdateFeeDecodeErrorZ which has the same data as `orig`
10999 /// but with all dynamically-allocated buffers duplicated in new buffers.
11000 pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_clone(orig: &CResult_UpdateFeeDecodeErrorZ) -> CResult_UpdateFeeDecodeErrorZ { Clone::clone(&orig) }
11001 #[repr(C)]
11002 /// The contents of CResult_UpdateFulfillHTLCDecodeErrorZ
11003 pub union CResult_UpdateFulfillHTLCDecodeErrorZPtr {
11004         /// A pointer to the contents in the success state.
11005         /// Reading from this pointer when `result_ok` is not set is undefined.
11006         pub result: *mut crate::lightning::ln::msgs::UpdateFulfillHTLC,
11007         /// A pointer to the contents in the error state.
11008         /// Reading from this pointer when `result_ok` is set is undefined.
11009         pub err: *mut crate::lightning::ln::msgs::DecodeError,
11010 }
11011 #[repr(C)]
11012 /// A CResult_UpdateFulfillHTLCDecodeErrorZ represents the result of a fallible operation,
11013 /// containing a crate::lightning::ln::msgs::UpdateFulfillHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
11014 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11015 pub struct CResult_UpdateFulfillHTLCDecodeErrorZ {
11016         /// The contents of this CResult_UpdateFulfillHTLCDecodeErrorZ, accessible via either
11017         /// `err` or `result` depending on the state of `result_ok`.
11018         pub contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr,
11019         /// Whether this CResult_UpdateFulfillHTLCDecodeErrorZ represents a success state.
11020         pub result_ok: bool,
11021 }
11022 #[no_mangle]
11023 /// Creates a new CResult_UpdateFulfillHTLCDecodeErrorZ in the success state.
11024 pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateFulfillHTLC) -> CResult_UpdateFulfillHTLCDecodeErrorZ {
11025         CResult_UpdateFulfillHTLCDecodeErrorZ {
11026                 contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr {
11027                         result: Box::into_raw(Box::new(o)),
11028                 },
11029                 result_ok: true,
11030         }
11031 }
11032 #[no_mangle]
11033 /// Creates a new CResult_UpdateFulfillHTLCDecodeErrorZ in the error state.
11034 pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateFulfillHTLCDecodeErrorZ {
11035         CResult_UpdateFulfillHTLCDecodeErrorZ {
11036                 contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr {
11037                         err: Box::into_raw(Box::new(e)),
11038                 },
11039                 result_ok: false,
11040         }
11041 }
11042 #[no_mangle]
11043 /// Frees any resources used by the CResult_UpdateFulfillHTLCDecodeErrorZ.
11044 pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_free(_res: CResult_UpdateFulfillHTLCDecodeErrorZ) { }
11045 impl Drop for CResult_UpdateFulfillHTLCDecodeErrorZ {
11046         fn drop(&mut self) {
11047                 if self.result_ok {
11048                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
11049                                 let _ = unsafe { Box::from_raw(self.contents.result) };
11050                         }
11051                 } else {
11052                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
11053                                 let _ = unsafe { Box::from_raw(self.contents.err) };
11054                         }
11055                 }
11056         }
11057 }
11058 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFulfillHTLC, crate::lightning::ln::msgs::DecodeError>> for CResult_UpdateFulfillHTLCDecodeErrorZ {
11059         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFulfillHTLC, crate::lightning::ln::msgs::DecodeError>) -> Self {
11060                 let contents = if o.result_ok {
11061                         let result = unsafe { o.contents.result };
11062                         unsafe { o.contents.result = std::ptr::null_mut() };
11063                         CResult_UpdateFulfillHTLCDecodeErrorZPtr { result }
11064                 } else {
11065                         let err = unsafe { o.contents.err };
11066                         unsafe { o.contents.err = std::ptr::null_mut(); }
11067                         CResult_UpdateFulfillHTLCDecodeErrorZPtr { err }
11068                 };
11069                 Self {
11070                         contents,
11071                         result_ok: o.result_ok,
11072                 }
11073         }
11074 }
11075 impl Clone for CResult_UpdateFulfillHTLCDecodeErrorZ {
11076         fn clone(&self) -> Self {
11077                 if self.result_ok {
11078                         Self { result_ok: true, contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr {
11079                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UpdateFulfillHTLC>::clone(unsafe { &*self.contents.result })))
11080                         } }
11081                 } else {
11082                         Self { result_ok: false, contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr {
11083                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
11084                         } }
11085                 }
11086         }
11087 }
11088 #[no_mangle]
11089 /// Creates a new CResult_UpdateFulfillHTLCDecodeErrorZ which has the same data as `orig`
11090 /// but with all dynamically-allocated buffers duplicated in new buffers.
11091 pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_clone(orig: &CResult_UpdateFulfillHTLCDecodeErrorZ) -> CResult_UpdateFulfillHTLCDecodeErrorZ { Clone::clone(&orig) }
11092 #[repr(C)]
11093 /// The contents of CResult_UpdateAddHTLCDecodeErrorZ
11094 pub union CResult_UpdateAddHTLCDecodeErrorZPtr {
11095         /// A pointer to the contents in the success state.
11096         /// Reading from this pointer when `result_ok` is not set is undefined.
11097         pub result: *mut crate::lightning::ln::msgs::UpdateAddHTLC,
11098         /// A pointer to the contents in the error state.
11099         /// Reading from this pointer when `result_ok` is set is undefined.
11100         pub err: *mut crate::lightning::ln::msgs::DecodeError,
11101 }
11102 #[repr(C)]
11103 /// A CResult_UpdateAddHTLCDecodeErrorZ represents the result of a fallible operation,
11104 /// containing a crate::lightning::ln::msgs::UpdateAddHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
11105 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11106 pub struct CResult_UpdateAddHTLCDecodeErrorZ {
11107         /// The contents of this CResult_UpdateAddHTLCDecodeErrorZ, accessible via either
11108         /// `err` or `result` depending on the state of `result_ok`.
11109         pub contents: CResult_UpdateAddHTLCDecodeErrorZPtr,
11110         /// Whether this CResult_UpdateAddHTLCDecodeErrorZ represents a success state.
11111         pub result_ok: bool,
11112 }
11113 #[no_mangle]
11114 /// Creates a new CResult_UpdateAddHTLCDecodeErrorZ in the success state.
11115 pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateAddHTLC) -> CResult_UpdateAddHTLCDecodeErrorZ {
11116         CResult_UpdateAddHTLCDecodeErrorZ {
11117                 contents: CResult_UpdateAddHTLCDecodeErrorZPtr {
11118                         result: Box::into_raw(Box::new(o)),
11119                 },
11120                 result_ok: true,
11121         }
11122 }
11123 #[no_mangle]
11124 /// Creates a new CResult_UpdateAddHTLCDecodeErrorZ in the error state.
11125 pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateAddHTLCDecodeErrorZ {
11126         CResult_UpdateAddHTLCDecodeErrorZ {
11127                 contents: CResult_UpdateAddHTLCDecodeErrorZPtr {
11128                         err: Box::into_raw(Box::new(e)),
11129                 },
11130                 result_ok: false,
11131         }
11132 }
11133 #[no_mangle]
11134 /// Frees any resources used by the CResult_UpdateAddHTLCDecodeErrorZ.
11135 pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_free(_res: CResult_UpdateAddHTLCDecodeErrorZ) { }
11136 impl Drop for CResult_UpdateAddHTLCDecodeErrorZ {
11137         fn drop(&mut self) {
11138                 if self.result_ok {
11139                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
11140                                 let _ = unsafe { Box::from_raw(self.contents.result) };
11141                         }
11142                 } else {
11143                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
11144                                 let _ = unsafe { Box::from_raw(self.contents.err) };
11145                         }
11146                 }
11147         }
11148 }
11149 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateAddHTLC, crate::lightning::ln::msgs::DecodeError>> for CResult_UpdateAddHTLCDecodeErrorZ {
11150         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateAddHTLC, crate::lightning::ln::msgs::DecodeError>) -> Self {
11151                 let contents = if o.result_ok {
11152                         let result = unsafe { o.contents.result };
11153                         unsafe { o.contents.result = std::ptr::null_mut() };
11154                         CResult_UpdateAddHTLCDecodeErrorZPtr { result }
11155                 } else {
11156                         let err = unsafe { o.contents.err };
11157                         unsafe { o.contents.err = std::ptr::null_mut(); }
11158                         CResult_UpdateAddHTLCDecodeErrorZPtr { err }
11159                 };
11160                 Self {
11161                         contents,
11162                         result_ok: o.result_ok,
11163                 }
11164         }
11165 }
11166 impl Clone for CResult_UpdateAddHTLCDecodeErrorZ {
11167         fn clone(&self) -> Self {
11168                 if self.result_ok {
11169                         Self { result_ok: true, contents: CResult_UpdateAddHTLCDecodeErrorZPtr {
11170                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UpdateAddHTLC>::clone(unsafe { &*self.contents.result })))
11171                         } }
11172                 } else {
11173                         Self { result_ok: false, contents: CResult_UpdateAddHTLCDecodeErrorZPtr {
11174                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
11175                         } }
11176                 }
11177         }
11178 }
11179 #[no_mangle]
11180 /// Creates a new CResult_UpdateAddHTLCDecodeErrorZ which has the same data as `orig`
11181 /// but with all dynamically-allocated buffers duplicated in new buffers.
11182 pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_clone(orig: &CResult_UpdateAddHTLCDecodeErrorZ) -> CResult_UpdateAddHTLCDecodeErrorZ { Clone::clone(&orig) }
11183 #[repr(C)]
11184 /// The contents of CResult_PingDecodeErrorZ
11185 pub union CResult_PingDecodeErrorZPtr {
11186         /// A pointer to the contents in the success state.
11187         /// Reading from this pointer when `result_ok` is not set is undefined.
11188         pub result: *mut crate::lightning::ln::msgs::Ping,
11189         /// A pointer to the contents in the error state.
11190         /// Reading from this pointer when `result_ok` is set is undefined.
11191         pub err: *mut crate::lightning::ln::msgs::DecodeError,
11192 }
11193 #[repr(C)]
11194 /// A CResult_PingDecodeErrorZ represents the result of a fallible operation,
11195 /// containing a crate::lightning::ln::msgs::Ping on success and a crate::lightning::ln::msgs::DecodeError on failure.
11196 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11197 pub struct CResult_PingDecodeErrorZ {
11198         /// The contents of this CResult_PingDecodeErrorZ, accessible via either
11199         /// `err` or `result` depending on the state of `result_ok`.
11200         pub contents: CResult_PingDecodeErrorZPtr,
11201         /// Whether this CResult_PingDecodeErrorZ represents a success state.
11202         pub result_ok: bool,
11203 }
11204 #[no_mangle]
11205 /// Creates a new CResult_PingDecodeErrorZ in the success state.
11206 pub extern "C" fn CResult_PingDecodeErrorZ_ok(o: crate::lightning::ln::msgs::Ping) -> CResult_PingDecodeErrorZ {
11207         CResult_PingDecodeErrorZ {
11208                 contents: CResult_PingDecodeErrorZPtr {
11209                         result: Box::into_raw(Box::new(o)),
11210                 },
11211                 result_ok: true,
11212         }
11213 }
11214 #[no_mangle]
11215 /// Creates a new CResult_PingDecodeErrorZ in the error state.
11216 pub extern "C" fn CResult_PingDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_PingDecodeErrorZ {
11217         CResult_PingDecodeErrorZ {
11218                 contents: CResult_PingDecodeErrorZPtr {
11219                         err: Box::into_raw(Box::new(e)),
11220                 },
11221                 result_ok: false,
11222         }
11223 }
11224 #[no_mangle]
11225 /// Frees any resources used by the CResult_PingDecodeErrorZ.
11226 pub extern "C" fn CResult_PingDecodeErrorZ_free(_res: CResult_PingDecodeErrorZ) { }
11227 impl Drop for CResult_PingDecodeErrorZ {
11228         fn drop(&mut self) {
11229                 if self.result_ok {
11230                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
11231                                 let _ = unsafe { Box::from_raw(self.contents.result) };
11232                         }
11233                 } else {
11234                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
11235                                 let _ = unsafe { Box::from_raw(self.contents.err) };
11236                         }
11237                 }
11238         }
11239 }
11240 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::Ping, crate::lightning::ln::msgs::DecodeError>> for CResult_PingDecodeErrorZ {
11241         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::Ping, crate::lightning::ln::msgs::DecodeError>) -> Self {
11242                 let contents = if o.result_ok {
11243                         let result = unsafe { o.contents.result };
11244                         unsafe { o.contents.result = std::ptr::null_mut() };
11245                         CResult_PingDecodeErrorZPtr { result }
11246                 } else {
11247                         let err = unsafe { o.contents.err };
11248                         unsafe { o.contents.err = std::ptr::null_mut(); }
11249                         CResult_PingDecodeErrorZPtr { err }
11250                 };
11251                 Self {
11252                         contents,
11253                         result_ok: o.result_ok,
11254                 }
11255         }
11256 }
11257 impl Clone for CResult_PingDecodeErrorZ {
11258         fn clone(&self) -> Self {
11259                 if self.result_ok {
11260                         Self { result_ok: true, contents: CResult_PingDecodeErrorZPtr {
11261                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::Ping>::clone(unsafe { &*self.contents.result })))
11262                         } }
11263                 } else {
11264                         Self { result_ok: false, contents: CResult_PingDecodeErrorZPtr {
11265                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
11266                         } }
11267                 }
11268         }
11269 }
11270 #[no_mangle]
11271 /// Creates a new CResult_PingDecodeErrorZ which has the same data as `orig`
11272 /// but with all dynamically-allocated buffers duplicated in new buffers.
11273 pub extern "C" fn CResult_PingDecodeErrorZ_clone(orig: &CResult_PingDecodeErrorZ) -> CResult_PingDecodeErrorZ { Clone::clone(&orig) }
11274 #[repr(C)]
11275 /// The contents of CResult_PongDecodeErrorZ
11276 pub union CResult_PongDecodeErrorZPtr {
11277         /// A pointer to the contents in the success state.
11278         /// Reading from this pointer when `result_ok` is not set is undefined.
11279         pub result: *mut crate::lightning::ln::msgs::Pong,
11280         /// A pointer to the contents in the error state.
11281         /// Reading from this pointer when `result_ok` is set is undefined.
11282         pub err: *mut crate::lightning::ln::msgs::DecodeError,
11283 }
11284 #[repr(C)]
11285 /// A CResult_PongDecodeErrorZ represents the result of a fallible operation,
11286 /// containing a crate::lightning::ln::msgs::Pong on success and a crate::lightning::ln::msgs::DecodeError on failure.
11287 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11288 pub struct CResult_PongDecodeErrorZ {
11289         /// The contents of this CResult_PongDecodeErrorZ, accessible via either
11290         /// `err` or `result` depending on the state of `result_ok`.
11291         pub contents: CResult_PongDecodeErrorZPtr,
11292         /// Whether this CResult_PongDecodeErrorZ represents a success state.
11293         pub result_ok: bool,
11294 }
11295 #[no_mangle]
11296 /// Creates a new CResult_PongDecodeErrorZ in the success state.
11297 pub extern "C" fn CResult_PongDecodeErrorZ_ok(o: crate::lightning::ln::msgs::Pong) -> CResult_PongDecodeErrorZ {
11298         CResult_PongDecodeErrorZ {
11299                 contents: CResult_PongDecodeErrorZPtr {
11300                         result: Box::into_raw(Box::new(o)),
11301                 },
11302                 result_ok: true,
11303         }
11304 }
11305 #[no_mangle]
11306 /// Creates a new CResult_PongDecodeErrorZ in the error state.
11307 pub extern "C" fn CResult_PongDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_PongDecodeErrorZ {
11308         CResult_PongDecodeErrorZ {
11309                 contents: CResult_PongDecodeErrorZPtr {
11310                         err: Box::into_raw(Box::new(e)),
11311                 },
11312                 result_ok: false,
11313         }
11314 }
11315 #[no_mangle]
11316 /// Frees any resources used by the CResult_PongDecodeErrorZ.
11317 pub extern "C" fn CResult_PongDecodeErrorZ_free(_res: CResult_PongDecodeErrorZ) { }
11318 impl Drop for CResult_PongDecodeErrorZ {
11319         fn drop(&mut self) {
11320                 if self.result_ok {
11321                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
11322                                 let _ = unsafe { Box::from_raw(self.contents.result) };
11323                         }
11324                 } else {
11325                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
11326                                 let _ = unsafe { Box::from_raw(self.contents.err) };
11327                         }
11328                 }
11329         }
11330 }
11331 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::Pong, crate::lightning::ln::msgs::DecodeError>> for CResult_PongDecodeErrorZ {
11332         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::Pong, crate::lightning::ln::msgs::DecodeError>) -> Self {
11333                 let contents = if o.result_ok {
11334                         let result = unsafe { o.contents.result };
11335                         unsafe { o.contents.result = std::ptr::null_mut() };
11336                         CResult_PongDecodeErrorZPtr { result }
11337                 } else {
11338                         let err = unsafe { o.contents.err };
11339                         unsafe { o.contents.err = std::ptr::null_mut(); }
11340                         CResult_PongDecodeErrorZPtr { err }
11341                 };
11342                 Self {
11343                         contents,
11344                         result_ok: o.result_ok,
11345                 }
11346         }
11347 }
11348 impl Clone for CResult_PongDecodeErrorZ {
11349         fn clone(&self) -> Self {
11350                 if self.result_ok {
11351                         Self { result_ok: true, contents: CResult_PongDecodeErrorZPtr {
11352                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::Pong>::clone(unsafe { &*self.contents.result })))
11353                         } }
11354                 } else {
11355                         Self { result_ok: false, contents: CResult_PongDecodeErrorZPtr {
11356                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
11357                         } }
11358                 }
11359         }
11360 }
11361 #[no_mangle]
11362 /// Creates a new CResult_PongDecodeErrorZ which has the same data as `orig`
11363 /// but with all dynamically-allocated buffers duplicated in new buffers.
11364 pub extern "C" fn CResult_PongDecodeErrorZ_clone(orig: &CResult_PongDecodeErrorZ) -> CResult_PongDecodeErrorZ { Clone::clone(&orig) }
11365 #[repr(C)]
11366 /// The contents of CResult_UnsignedChannelAnnouncementDecodeErrorZ
11367 pub union CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
11368         /// A pointer to the contents in the success state.
11369         /// Reading from this pointer when `result_ok` is not set is undefined.
11370         pub result: *mut crate::lightning::ln::msgs::UnsignedChannelAnnouncement,
11371         /// A pointer to the contents in the error state.
11372         /// Reading from this pointer when `result_ok` is set is undefined.
11373         pub err: *mut crate::lightning::ln::msgs::DecodeError,
11374 }
11375 #[repr(C)]
11376 /// A CResult_UnsignedChannelAnnouncementDecodeErrorZ represents the result of a fallible operation,
11377 /// containing a crate::lightning::ln::msgs::UnsignedChannelAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
11378 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11379 pub struct CResult_UnsignedChannelAnnouncementDecodeErrorZ {
11380         /// The contents of this CResult_UnsignedChannelAnnouncementDecodeErrorZ, accessible via either
11381         /// `err` or `result` depending on the state of `result_ok`.
11382         pub contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr,
11383         /// Whether this CResult_UnsignedChannelAnnouncementDecodeErrorZ represents a success state.
11384         pub result_ok: bool,
11385 }
11386 #[no_mangle]
11387 /// Creates a new CResult_UnsignedChannelAnnouncementDecodeErrorZ in the success state.
11388 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UnsignedChannelAnnouncement) -> CResult_UnsignedChannelAnnouncementDecodeErrorZ {
11389         CResult_UnsignedChannelAnnouncementDecodeErrorZ {
11390                 contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
11391                         result: Box::into_raw(Box::new(o)),
11392                 },
11393                 result_ok: true,
11394         }
11395 }
11396 #[no_mangle]
11397 /// Creates a new CResult_UnsignedChannelAnnouncementDecodeErrorZ in the error state.
11398 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UnsignedChannelAnnouncementDecodeErrorZ {
11399         CResult_UnsignedChannelAnnouncementDecodeErrorZ {
11400                 contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
11401                         err: Box::into_raw(Box::new(e)),
11402                 },
11403                 result_ok: false,
11404         }
11405 }
11406 #[no_mangle]
11407 /// Frees any resources used by the CResult_UnsignedChannelAnnouncementDecodeErrorZ.
11408 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_free(_res: CResult_UnsignedChannelAnnouncementDecodeErrorZ) { }
11409 impl Drop for CResult_UnsignedChannelAnnouncementDecodeErrorZ {
11410         fn drop(&mut self) {
11411                 if self.result_ok {
11412                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
11413                                 let _ = unsafe { Box::from_raw(self.contents.result) };
11414                         }
11415                 } else {
11416                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
11417                                 let _ = unsafe { Box::from_raw(self.contents.err) };
11418                         }
11419                 }
11420         }
11421 }
11422 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedChannelAnnouncement, crate::lightning::ln::msgs::DecodeError>> for CResult_UnsignedChannelAnnouncementDecodeErrorZ {
11423         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedChannelAnnouncement, crate::lightning::ln::msgs::DecodeError>) -> Self {
11424                 let contents = if o.result_ok {
11425                         let result = unsafe { o.contents.result };
11426                         unsafe { o.contents.result = std::ptr::null_mut() };
11427                         CResult_UnsignedChannelAnnouncementDecodeErrorZPtr { result }
11428                 } else {
11429                         let err = unsafe { o.contents.err };
11430                         unsafe { o.contents.err = std::ptr::null_mut(); }
11431                         CResult_UnsignedChannelAnnouncementDecodeErrorZPtr { err }
11432                 };
11433                 Self {
11434                         contents,
11435                         result_ok: o.result_ok,
11436                 }
11437         }
11438 }
11439 impl Clone for CResult_UnsignedChannelAnnouncementDecodeErrorZ {
11440         fn clone(&self) -> Self {
11441                 if self.result_ok {
11442                         Self { result_ok: true, contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
11443                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UnsignedChannelAnnouncement>::clone(unsafe { &*self.contents.result })))
11444                         } }
11445                 } else {
11446                         Self { result_ok: false, contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
11447                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
11448                         } }
11449                 }
11450         }
11451 }
11452 #[no_mangle]
11453 /// Creates a new CResult_UnsignedChannelAnnouncementDecodeErrorZ which has the same data as `orig`
11454 /// but with all dynamically-allocated buffers duplicated in new buffers.
11455 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone(orig: &CResult_UnsignedChannelAnnouncementDecodeErrorZ) -> CResult_UnsignedChannelAnnouncementDecodeErrorZ { Clone::clone(&orig) }
11456 #[repr(C)]
11457 /// The contents of CResult_ChannelAnnouncementDecodeErrorZ
11458 pub union CResult_ChannelAnnouncementDecodeErrorZPtr {
11459         /// A pointer to the contents in the success state.
11460         /// Reading from this pointer when `result_ok` is not set is undefined.
11461         pub result: *mut crate::lightning::ln::msgs::ChannelAnnouncement,
11462         /// A pointer to the contents in the error state.
11463         /// Reading from this pointer when `result_ok` is set is undefined.
11464         pub err: *mut crate::lightning::ln::msgs::DecodeError,
11465 }
11466 #[repr(C)]
11467 /// A CResult_ChannelAnnouncementDecodeErrorZ represents the result of a fallible operation,
11468 /// containing a crate::lightning::ln::msgs::ChannelAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
11469 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11470 pub struct CResult_ChannelAnnouncementDecodeErrorZ {
11471         /// The contents of this CResult_ChannelAnnouncementDecodeErrorZ, accessible via either
11472         /// `err` or `result` depending on the state of `result_ok`.
11473         pub contents: CResult_ChannelAnnouncementDecodeErrorZPtr,
11474         /// Whether this CResult_ChannelAnnouncementDecodeErrorZ represents a success state.
11475         pub result_ok: bool,
11476 }
11477 #[no_mangle]
11478 /// Creates a new CResult_ChannelAnnouncementDecodeErrorZ in the success state.
11479 pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ChannelAnnouncement) -> CResult_ChannelAnnouncementDecodeErrorZ {
11480         CResult_ChannelAnnouncementDecodeErrorZ {
11481                 contents: CResult_ChannelAnnouncementDecodeErrorZPtr {
11482                         result: Box::into_raw(Box::new(o)),
11483                 },
11484                 result_ok: true,
11485         }
11486 }
11487 #[no_mangle]
11488 /// Creates a new CResult_ChannelAnnouncementDecodeErrorZ in the error state.
11489 pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelAnnouncementDecodeErrorZ {
11490         CResult_ChannelAnnouncementDecodeErrorZ {
11491                 contents: CResult_ChannelAnnouncementDecodeErrorZPtr {
11492                         err: Box::into_raw(Box::new(e)),
11493                 },
11494                 result_ok: false,
11495         }
11496 }
11497 #[no_mangle]
11498 /// Frees any resources used by the CResult_ChannelAnnouncementDecodeErrorZ.
11499 pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_free(_res: CResult_ChannelAnnouncementDecodeErrorZ) { }
11500 impl Drop for CResult_ChannelAnnouncementDecodeErrorZ {
11501         fn drop(&mut self) {
11502                 if self.result_ok {
11503                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
11504                                 let _ = unsafe { Box::from_raw(self.contents.result) };
11505                         }
11506                 } else {
11507                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
11508                                 let _ = unsafe { Box::from_raw(self.contents.err) };
11509                         }
11510                 }
11511         }
11512 }
11513 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelAnnouncement, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelAnnouncementDecodeErrorZ {
11514         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelAnnouncement, crate::lightning::ln::msgs::DecodeError>) -> Self {
11515                 let contents = if o.result_ok {
11516                         let result = unsafe { o.contents.result };
11517                         unsafe { o.contents.result = std::ptr::null_mut() };
11518                         CResult_ChannelAnnouncementDecodeErrorZPtr { result }
11519                 } else {
11520                         let err = unsafe { o.contents.err };
11521                         unsafe { o.contents.err = std::ptr::null_mut(); }
11522                         CResult_ChannelAnnouncementDecodeErrorZPtr { err }
11523                 };
11524                 Self {
11525                         contents,
11526                         result_ok: o.result_ok,
11527                 }
11528         }
11529 }
11530 impl Clone for CResult_ChannelAnnouncementDecodeErrorZ {
11531         fn clone(&self) -> Self {
11532                 if self.result_ok {
11533                         Self { result_ok: true, contents: CResult_ChannelAnnouncementDecodeErrorZPtr {
11534                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ChannelAnnouncement>::clone(unsafe { &*self.contents.result })))
11535                         } }
11536                 } else {
11537                         Self { result_ok: false, contents: CResult_ChannelAnnouncementDecodeErrorZPtr {
11538                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
11539                         } }
11540                 }
11541         }
11542 }
11543 #[no_mangle]
11544 /// Creates a new CResult_ChannelAnnouncementDecodeErrorZ which has the same data as `orig`
11545 /// but with all dynamically-allocated buffers duplicated in new buffers.
11546 pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_clone(orig: &CResult_ChannelAnnouncementDecodeErrorZ) -> CResult_ChannelAnnouncementDecodeErrorZ { Clone::clone(&orig) }
11547 #[repr(C)]
11548 /// The contents of CResult_UnsignedChannelUpdateDecodeErrorZ
11549 pub union CResult_UnsignedChannelUpdateDecodeErrorZPtr {
11550         /// A pointer to the contents in the success state.
11551         /// Reading from this pointer when `result_ok` is not set is undefined.
11552         pub result: *mut crate::lightning::ln::msgs::UnsignedChannelUpdate,
11553         /// A pointer to the contents in the error state.
11554         /// Reading from this pointer when `result_ok` is set is undefined.
11555         pub err: *mut crate::lightning::ln::msgs::DecodeError,
11556 }
11557 #[repr(C)]
11558 /// A CResult_UnsignedChannelUpdateDecodeErrorZ represents the result of a fallible operation,
11559 /// containing a crate::lightning::ln::msgs::UnsignedChannelUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
11560 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11561 pub struct CResult_UnsignedChannelUpdateDecodeErrorZ {
11562         /// The contents of this CResult_UnsignedChannelUpdateDecodeErrorZ, accessible via either
11563         /// `err` or `result` depending on the state of `result_ok`.
11564         pub contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr,
11565         /// Whether this CResult_UnsignedChannelUpdateDecodeErrorZ represents a success state.
11566         pub result_ok: bool,
11567 }
11568 #[no_mangle]
11569 /// Creates a new CResult_UnsignedChannelUpdateDecodeErrorZ in the success state.
11570 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UnsignedChannelUpdate) -> CResult_UnsignedChannelUpdateDecodeErrorZ {
11571         CResult_UnsignedChannelUpdateDecodeErrorZ {
11572                 contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr {
11573                         result: Box::into_raw(Box::new(o)),
11574                 },
11575                 result_ok: true,
11576         }
11577 }
11578 #[no_mangle]
11579 /// Creates a new CResult_UnsignedChannelUpdateDecodeErrorZ in the error state.
11580 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UnsignedChannelUpdateDecodeErrorZ {
11581         CResult_UnsignedChannelUpdateDecodeErrorZ {
11582                 contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr {
11583                         err: Box::into_raw(Box::new(e)),
11584                 },
11585                 result_ok: false,
11586         }
11587 }
11588 #[no_mangle]
11589 /// Frees any resources used by the CResult_UnsignedChannelUpdateDecodeErrorZ.
11590 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_free(_res: CResult_UnsignedChannelUpdateDecodeErrorZ) { }
11591 impl Drop for CResult_UnsignedChannelUpdateDecodeErrorZ {
11592         fn drop(&mut self) {
11593                 if self.result_ok {
11594                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
11595                                 let _ = unsafe { Box::from_raw(self.contents.result) };
11596                         }
11597                 } else {
11598                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
11599                                 let _ = unsafe { Box::from_raw(self.contents.err) };
11600                         }
11601                 }
11602         }
11603 }
11604 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedChannelUpdate, crate::lightning::ln::msgs::DecodeError>> for CResult_UnsignedChannelUpdateDecodeErrorZ {
11605         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedChannelUpdate, crate::lightning::ln::msgs::DecodeError>) -> Self {
11606                 let contents = if o.result_ok {
11607                         let result = unsafe { o.contents.result };
11608                         unsafe { o.contents.result = std::ptr::null_mut() };
11609                         CResult_UnsignedChannelUpdateDecodeErrorZPtr { result }
11610                 } else {
11611                         let err = unsafe { o.contents.err };
11612                         unsafe { o.contents.err = std::ptr::null_mut(); }
11613                         CResult_UnsignedChannelUpdateDecodeErrorZPtr { err }
11614                 };
11615                 Self {
11616                         contents,
11617                         result_ok: o.result_ok,
11618                 }
11619         }
11620 }
11621 impl Clone for CResult_UnsignedChannelUpdateDecodeErrorZ {
11622         fn clone(&self) -> Self {
11623                 if self.result_ok {
11624                         Self { result_ok: true, contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr {
11625                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UnsignedChannelUpdate>::clone(unsafe { &*self.contents.result })))
11626                         } }
11627                 } else {
11628                         Self { result_ok: false, contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr {
11629                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
11630                         } }
11631                 }
11632         }
11633 }
11634 #[no_mangle]
11635 /// Creates a new CResult_UnsignedChannelUpdateDecodeErrorZ which has the same data as `orig`
11636 /// but with all dynamically-allocated buffers duplicated in new buffers.
11637 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_clone(orig: &CResult_UnsignedChannelUpdateDecodeErrorZ) -> CResult_UnsignedChannelUpdateDecodeErrorZ { Clone::clone(&orig) }
11638 #[repr(C)]
11639 /// The contents of CResult_ChannelUpdateDecodeErrorZ
11640 pub union CResult_ChannelUpdateDecodeErrorZPtr {
11641         /// A pointer to the contents in the success state.
11642         /// Reading from this pointer when `result_ok` is not set is undefined.
11643         pub result: *mut crate::lightning::ln::msgs::ChannelUpdate,
11644         /// A pointer to the contents in the error state.
11645         /// Reading from this pointer when `result_ok` is set is undefined.
11646         pub err: *mut crate::lightning::ln::msgs::DecodeError,
11647 }
11648 #[repr(C)]
11649 /// A CResult_ChannelUpdateDecodeErrorZ represents the result of a fallible operation,
11650 /// containing a crate::lightning::ln::msgs::ChannelUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
11651 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11652 pub struct CResult_ChannelUpdateDecodeErrorZ {
11653         /// The contents of this CResult_ChannelUpdateDecodeErrorZ, accessible via either
11654         /// `err` or `result` depending on the state of `result_ok`.
11655         pub contents: CResult_ChannelUpdateDecodeErrorZPtr,
11656         /// Whether this CResult_ChannelUpdateDecodeErrorZ represents a success state.
11657         pub result_ok: bool,
11658 }
11659 #[no_mangle]
11660 /// Creates a new CResult_ChannelUpdateDecodeErrorZ in the success state.
11661 pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ChannelUpdate) -> CResult_ChannelUpdateDecodeErrorZ {
11662         CResult_ChannelUpdateDecodeErrorZ {
11663                 contents: CResult_ChannelUpdateDecodeErrorZPtr {
11664                         result: Box::into_raw(Box::new(o)),
11665                 },
11666                 result_ok: true,
11667         }
11668 }
11669 #[no_mangle]
11670 /// Creates a new CResult_ChannelUpdateDecodeErrorZ in the error state.
11671 pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelUpdateDecodeErrorZ {
11672         CResult_ChannelUpdateDecodeErrorZ {
11673                 contents: CResult_ChannelUpdateDecodeErrorZPtr {
11674                         err: Box::into_raw(Box::new(e)),
11675                 },
11676                 result_ok: false,
11677         }
11678 }
11679 #[no_mangle]
11680 /// Frees any resources used by the CResult_ChannelUpdateDecodeErrorZ.
11681 pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_free(_res: CResult_ChannelUpdateDecodeErrorZ) { }
11682 impl Drop for CResult_ChannelUpdateDecodeErrorZ {
11683         fn drop(&mut self) {
11684                 if self.result_ok {
11685                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
11686                                 let _ = unsafe { Box::from_raw(self.contents.result) };
11687                         }
11688                 } else {
11689                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
11690                                 let _ = unsafe { Box::from_raw(self.contents.err) };
11691                         }
11692                 }
11693         }
11694 }
11695 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelUpdate, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelUpdateDecodeErrorZ {
11696         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelUpdate, crate::lightning::ln::msgs::DecodeError>) -> Self {
11697                 let contents = if o.result_ok {
11698                         let result = unsafe { o.contents.result };
11699                         unsafe { o.contents.result = std::ptr::null_mut() };
11700                         CResult_ChannelUpdateDecodeErrorZPtr { result }
11701                 } else {
11702                         let err = unsafe { o.contents.err };
11703                         unsafe { o.contents.err = std::ptr::null_mut(); }
11704                         CResult_ChannelUpdateDecodeErrorZPtr { err }
11705                 };
11706                 Self {
11707                         contents,
11708                         result_ok: o.result_ok,
11709                 }
11710         }
11711 }
11712 impl Clone for CResult_ChannelUpdateDecodeErrorZ {
11713         fn clone(&self) -> Self {
11714                 if self.result_ok {
11715                         Self { result_ok: true, contents: CResult_ChannelUpdateDecodeErrorZPtr {
11716                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ChannelUpdate>::clone(unsafe { &*self.contents.result })))
11717                         } }
11718                 } else {
11719                         Self { result_ok: false, contents: CResult_ChannelUpdateDecodeErrorZPtr {
11720                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
11721                         } }
11722                 }
11723         }
11724 }
11725 #[no_mangle]
11726 /// Creates a new CResult_ChannelUpdateDecodeErrorZ which has the same data as `orig`
11727 /// but with all dynamically-allocated buffers duplicated in new buffers.
11728 pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_clone(orig: &CResult_ChannelUpdateDecodeErrorZ) -> CResult_ChannelUpdateDecodeErrorZ { Clone::clone(&orig) }
11729 #[repr(C)]
11730 /// The contents of CResult_ErrorMessageDecodeErrorZ
11731 pub union CResult_ErrorMessageDecodeErrorZPtr {
11732         /// A pointer to the contents in the success state.
11733         /// Reading from this pointer when `result_ok` is not set is undefined.
11734         pub result: *mut crate::lightning::ln::msgs::ErrorMessage,
11735         /// A pointer to the contents in the error state.
11736         /// Reading from this pointer when `result_ok` is set is undefined.
11737         pub err: *mut crate::lightning::ln::msgs::DecodeError,
11738 }
11739 #[repr(C)]
11740 /// A CResult_ErrorMessageDecodeErrorZ represents the result of a fallible operation,
11741 /// containing a crate::lightning::ln::msgs::ErrorMessage on success and a crate::lightning::ln::msgs::DecodeError on failure.
11742 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11743 pub struct CResult_ErrorMessageDecodeErrorZ {
11744         /// The contents of this CResult_ErrorMessageDecodeErrorZ, accessible via either
11745         /// `err` or `result` depending on the state of `result_ok`.
11746         pub contents: CResult_ErrorMessageDecodeErrorZPtr,
11747         /// Whether this CResult_ErrorMessageDecodeErrorZ represents a success state.
11748         pub result_ok: bool,
11749 }
11750 #[no_mangle]
11751 /// Creates a new CResult_ErrorMessageDecodeErrorZ in the success state.
11752 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ErrorMessage) -> CResult_ErrorMessageDecodeErrorZ {
11753         CResult_ErrorMessageDecodeErrorZ {
11754                 contents: CResult_ErrorMessageDecodeErrorZPtr {
11755                         result: Box::into_raw(Box::new(o)),
11756                 },
11757                 result_ok: true,
11758         }
11759 }
11760 #[no_mangle]
11761 /// Creates a new CResult_ErrorMessageDecodeErrorZ in the error state.
11762 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ErrorMessageDecodeErrorZ {
11763         CResult_ErrorMessageDecodeErrorZ {
11764                 contents: CResult_ErrorMessageDecodeErrorZPtr {
11765                         err: Box::into_raw(Box::new(e)),
11766                 },
11767                 result_ok: false,
11768         }
11769 }
11770 #[no_mangle]
11771 /// Frees any resources used by the CResult_ErrorMessageDecodeErrorZ.
11772 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_free(_res: CResult_ErrorMessageDecodeErrorZ) { }
11773 impl Drop for CResult_ErrorMessageDecodeErrorZ {
11774         fn drop(&mut self) {
11775                 if self.result_ok {
11776                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
11777                                 let _ = unsafe { Box::from_raw(self.contents.result) };
11778                         }
11779                 } else {
11780                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
11781                                 let _ = unsafe { Box::from_raw(self.contents.err) };
11782                         }
11783                 }
11784         }
11785 }
11786 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ErrorMessage, crate::lightning::ln::msgs::DecodeError>> for CResult_ErrorMessageDecodeErrorZ {
11787         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ErrorMessage, crate::lightning::ln::msgs::DecodeError>) -> Self {
11788                 let contents = if o.result_ok {
11789                         let result = unsafe { o.contents.result };
11790                         unsafe { o.contents.result = std::ptr::null_mut() };
11791                         CResult_ErrorMessageDecodeErrorZPtr { result }
11792                 } else {
11793                         let err = unsafe { o.contents.err };
11794                         unsafe { o.contents.err = std::ptr::null_mut(); }
11795                         CResult_ErrorMessageDecodeErrorZPtr { err }
11796                 };
11797                 Self {
11798                         contents,
11799                         result_ok: o.result_ok,
11800                 }
11801         }
11802 }
11803 impl Clone for CResult_ErrorMessageDecodeErrorZ {
11804         fn clone(&self) -> Self {
11805                 if self.result_ok {
11806                         Self { result_ok: true, contents: CResult_ErrorMessageDecodeErrorZPtr {
11807                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ErrorMessage>::clone(unsafe { &*self.contents.result })))
11808                         } }
11809                 } else {
11810                         Self { result_ok: false, contents: CResult_ErrorMessageDecodeErrorZPtr {
11811                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
11812                         } }
11813                 }
11814         }
11815 }
11816 #[no_mangle]
11817 /// Creates a new CResult_ErrorMessageDecodeErrorZ which has the same data as `orig`
11818 /// but with all dynamically-allocated buffers duplicated in new buffers.
11819 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_clone(orig: &CResult_ErrorMessageDecodeErrorZ) -> CResult_ErrorMessageDecodeErrorZ { Clone::clone(&orig) }
11820 #[repr(C)]
11821 /// The contents of CResult_UnsignedNodeAnnouncementDecodeErrorZ
11822 pub union CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
11823         /// A pointer to the contents in the success state.
11824         /// Reading from this pointer when `result_ok` is not set is undefined.
11825         pub result: *mut crate::lightning::ln::msgs::UnsignedNodeAnnouncement,
11826         /// A pointer to the contents in the error state.
11827         /// Reading from this pointer when `result_ok` is set is undefined.
11828         pub err: *mut crate::lightning::ln::msgs::DecodeError,
11829 }
11830 #[repr(C)]
11831 /// A CResult_UnsignedNodeAnnouncementDecodeErrorZ represents the result of a fallible operation,
11832 /// containing a crate::lightning::ln::msgs::UnsignedNodeAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
11833 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11834 pub struct CResult_UnsignedNodeAnnouncementDecodeErrorZ {
11835         /// The contents of this CResult_UnsignedNodeAnnouncementDecodeErrorZ, accessible via either
11836         /// `err` or `result` depending on the state of `result_ok`.
11837         pub contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr,
11838         /// Whether this CResult_UnsignedNodeAnnouncementDecodeErrorZ represents a success state.
11839         pub result_ok: bool,
11840 }
11841 #[no_mangle]
11842 /// Creates a new CResult_UnsignedNodeAnnouncementDecodeErrorZ in the success state.
11843 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UnsignedNodeAnnouncement) -> CResult_UnsignedNodeAnnouncementDecodeErrorZ {
11844         CResult_UnsignedNodeAnnouncementDecodeErrorZ {
11845                 contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
11846                         result: Box::into_raw(Box::new(o)),
11847                 },
11848                 result_ok: true,
11849         }
11850 }
11851 #[no_mangle]
11852 /// Creates a new CResult_UnsignedNodeAnnouncementDecodeErrorZ in the error state.
11853 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UnsignedNodeAnnouncementDecodeErrorZ {
11854         CResult_UnsignedNodeAnnouncementDecodeErrorZ {
11855                 contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
11856                         err: Box::into_raw(Box::new(e)),
11857                 },
11858                 result_ok: false,
11859         }
11860 }
11861 #[no_mangle]
11862 /// Frees any resources used by the CResult_UnsignedNodeAnnouncementDecodeErrorZ.
11863 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_free(_res: CResult_UnsignedNodeAnnouncementDecodeErrorZ) { }
11864 impl Drop for CResult_UnsignedNodeAnnouncementDecodeErrorZ {
11865         fn drop(&mut self) {
11866                 if self.result_ok {
11867                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
11868                                 let _ = unsafe { Box::from_raw(self.contents.result) };
11869                         }
11870                 } else {
11871                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
11872                                 let _ = unsafe { Box::from_raw(self.contents.err) };
11873                         }
11874                 }
11875         }
11876 }
11877 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedNodeAnnouncement, crate::lightning::ln::msgs::DecodeError>> for CResult_UnsignedNodeAnnouncementDecodeErrorZ {
11878         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedNodeAnnouncement, crate::lightning::ln::msgs::DecodeError>) -> Self {
11879                 let contents = if o.result_ok {
11880                         let result = unsafe { o.contents.result };
11881                         unsafe { o.contents.result = std::ptr::null_mut() };
11882                         CResult_UnsignedNodeAnnouncementDecodeErrorZPtr { result }
11883                 } else {
11884                         let err = unsafe { o.contents.err };
11885                         unsafe { o.contents.err = std::ptr::null_mut(); }
11886                         CResult_UnsignedNodeAnnouncementDecodeErrorZPtr { err }
11887                 };
11888                 Self {
11889                         contents,
11890                         result_ok: o.result_ok,
11891                 }
11892         }
11893 }
11894 impl Clone for CResult_UnsignedNodeAnnouncementDecodeErrorZ {
11895         fn clone(&self) -> Self {
11896                 if self.result_ok {
11897                         Self { result_ok: true, contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
11898                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UnsignedNodeAnnouncement>::clone(unsafe { &*self.contents.result })))
11899                         } }
11900                 } else {
11901                         Self { result_ok: false, contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
11902                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
11903                         } }
11904                 }
11905         }
11906 }
11907 #[no_mangle]
11908 /// Creates a new CResult_UnsignedNodeAnnouncementDecodeErrorZ which has the same data as `orig`
11909 /// but with all dynamically-allocated buffers duplicated in new buffers.
11910 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone(orig: &CResult_UnsignedNodeAnnouncementDecodeErrorZ) -> CResult_UnsignedNodeAnnouncementDecodeErrorZ { Clone::clone(&orig) }
11911 #[repr(C)]
11912 /// The contents of CResult_NodeAnnouncementDecodeErrorZ
11913 pub union CResult_NodeAnnouncementDecodeErrorZPtr {
11914         /// A pointer to the contents in the success state.
11915         /// Reading from this pointer when `result_ok` is not set is undefined.
11916         pub result: *mut crate::lightning::ln::msgs::NodeAnnouncement,
11917         /// A pointer to the contents in the error state.
11918         /// Reading from this pointer when `result_ok` is set is undefined.
11919         pub err: *mut crate::lightning::ln::msgs::DecodeError,
11920 }
11921 #[repr(C)]
11922 /// A CResult_NodeAnnouncementDecodeErrorZ represents the result of a fallible operation,
11923 /// containing a crate::lightning::ln::msgs::NodeAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
11924 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11925 pub struct CResult_NodeAnnouncementDecodeErrorZ {
11926         /// The contents of this CResult_NodeAnnouncementDecodeErrorZ, accessible via either
11927         /// `err` or `result` depending on the state of `result_ok`.
11928         pub contents: CResult_NodeAnnouncementDecodeErrorZPtr,
11929         /// Whether this CResult_NodeAnnouncementDecodeErrorZ represents a success state.
11930         pub result_ok: bool,
11931 }
11932 #[no_mangle]
11933 /// Creates a new CResult_NodeAnnouncementDecodeErrorZ in the success state.
11934 pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_ok(o: crate::lightning::ln::msgs::NodeAnnouncement) -> CResult_NodeAnnouncementDecodeErrorZ {
11935         CResult_NodeAnnouncementDecodeErrorZ {
11936                 contents: CResult_NodeAnnouncementDecodeErrorZPtr {
11937                         result: Box::into_raw(Box::new(o)),
11938                 },
11939                 result_ok: true,
11940         }
11941 }
11942 #[no_mangle]
11943 /// Creates a new CResult_NodeAnnouncementDecodeErrorZ in the error state.
11944 pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeAnnouncementDecodeErrorZ {
11945         CResult_NodeAnnouncementDecodeErrorZ {
11946                 contents: CResult_NodeAnnouncementDecodeErrorZPtr {
11947                         err: Box::into_raw(Box::new(e)),
11948                 },
11949                 result_ok: false,
11950         }
11951 }
11952 #[no_mangle]
11953 /// Frees any resources used by the CResult_NodeAnnouncementDecodeErrorZ.
11954 pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_free(_res: CResult_NodeAnnouncementDecodeErrorZ) { }
11955 impl Drop for CResult_NodeAnnouncementDecodeErrorZ {
11956         fn drop(&mut self) {
11957                 if self.result_ok {
11958                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
11959                                 let _ = unsafe { Box::from_raw(self.contents.result) };
11960                         }
11961                 } else {
11962                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
11963                                 let _ = unsafe { Box::from_raw(self.contents.err) };
11964                         }
11965                 }
11966         }
11967 }
11968 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::NodeAnnouncement, crate::lightning::ln::msgs::DecodeError>> for CResult_NodeAnnouncementDecodeErrorZ {
11969         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::NodeAnnouncement, crate::lightning::ln::msgs::DecodeError>) -> Self {
11970                 let contents = if o.result_ok {
11971                         let result = unsafe { o.contents.result };
11972                         unsafe { o.contents.result = std::ptr::null_mut() };
11973                         CResult_NodeAnnouncementDecodeErrorZPtr { result }
11974                 } else {
11975                         let err = unsafe { o.contents.err };
11976                         unsafe { o.contents.err = std::ptr::null_mut(); }
11977                         CResult_NodeAnnouncementDecodeErrorZPtr { err }
11978                 };
11979                 Self {
11980                         contents,
11981                         result_ok: o.result_ok,
11982                 }
11983         }
11984 }
11985 impl Clone for CResult_NodeAnnouncementDecodeErrorZ {
11986         fn clone(&self) -> Self {
11987                 if self.result_ok {
11988                         Self { result_ok: true, contents: CResult_NodeAnnouncementDecodeErrorZPtr {
11989                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::NodeAnnouncement>::clone(unsafe { &*self.contents.result })))
11990                         } }
11991                 } else {
11992                         Self { result_ok: false, contents: CResult_NodeAnnouncementDecodeErrorZPtr {
11993                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
11994                         } }
11995                 }
11996         }
11997 }
11998 #[no_mangle]
11999 /// Creates a new CResult_NodeAnnouncementDecodeErrorZ which has the same data as `orig`
12000 /// but with all dynamically-allocated buffers duplicated in new buffers.
12001 pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_clone(orig: &CResult_NodeAnnouncementDecodeErrorZ) -> CResult_NodeAnnouncementDecodeErrorZ { Clone::clone(&orig) }
12002 #[repr(C)]
12003 /// The contents of CResult_QueryShortChannelIdsDecodeErrorZ
12004 pub union CResult_QueryShortChannelIdsDecodeErrorZPtr {
12005         /// A pointer to the contents in the success state.
12006         /// Reading from this pointer when `result_ok` is not set is undefined.
12007         pub result: *mut crate::lightning::ln::msgs::QueryShortChannelIds,
12008         /// A pointer to the contents in the error state.
12009         /// Reading from this pointer when `result_ok` is set is undefined.
12010         pub err: *mut crate::lightning::ln::msgs::DecodeError,
12011 }
12012 #[repr(C)]
12013 /// A CResult_QueryShortChannelIdsDecodeErrorZ represents the result of a fallible operation,
12014 /// containing a crate::lightning::ln::msgs::QueryShortChannelIds on success and a crate::lightning::ln::msgs::DecodeError on failure.
12015 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12016 pub struct CResult_QueryShortChannelIdsDecodeErrorZ {
12017         /// The contents of this CResult_QueryShortChannelIdsDecodeErrorZ, accessible via either
12018         /// `err` or `result` depending on the state of `result_ok`.
12019         pub contents: CResult_QueryShortChannelIdsDecodeErrorZPtr,
12020         /// Whether this CResult_QueryShortChannelIdsDecodeErrorZ represents a success state.
12021         pub result_ok: bool,
12022 }
12023 #[no_mangle]
12024 /// Creates a new CResult_QueryShortChannelIdsDecodeErrorZ in the success state.
12025 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_ok(o: crate::lightning::ln::msgs::QueryShortChannelIds) -> CResult_QueryShortChannelIdsDecodeErrorZ {
12026         CResult_QueryShortChannelIdsDecodeErrorZ {
12027                 contents: CResult_QueryShortChannelIdsDecodeErrorZPtr {
12028                         result: Box::into_raw(Box::new(o)),
12029                 },
12030                 result_ok: true,
12031         }
12032 }
12033 #[no_mangle]
12034 /// Creates a new CResult_QueryShortChannelIdsDecodeErrorZ in the error state.
12035 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_QueryShortChannelIdsDecodeErrorZ {
12036         CResult_QueryShortChannelIdsDecodeErrorZ {
12037                 contents: CResult_QueryShortChannelIdsDecodeErrorZPtr {
12038                         err: Box::into_raw(Box::new(e)),
12039                 },
12040                 result_ok: false,
12041         }
12042 }
12043 #[no_mangle]
12044 /// Frees any resources used by the CResult_QueryShortChannelIdsDecodeErrorZ.
12045 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_free(_res: CResult_QueryShortChannelIdsDecodeErrorZ) { }
12046 impl Drop for CResult_QueryShortChannelIdsDecodeErrorZ {
12047         fn drop(&mut self) {
12048                 if self.result_ok {
12049                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
12050                                 let _ = unsafe { Box::from_raw(self.contents.result) };
12051                         }
12052                 } else {
12053                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
12054                                 let _ = unsafe { Box::from_raw(self.contents.err) };
12055                         }
12056                 }
12057         }
12058 }
12059 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::QueryShortChannelIds, crate::lightning::ln::msgs::DecodeError>> for CResult_QueryShortChannelIdsDecodeErrorZ {
12060         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::QueryShortChannelIds, crate::lightning::ln::msgs::DecodeError>) -> Self {
12061                 let contents = if o.result_ok {
12062                         let result = unsafe { o.contents.result };
12063                         unsafe { o.contents.result = std::ptr::null_mut() };
12064                         CResult_QueryShortChannelIdsDecodeErrorZPtr { result }
12065                 } else {
12066                         let err = unsafe { o.contents.err };
12067                         unsafe { o.contents.err = std::ptr::null_mut(); }
12068                         CResult_QueryShortChannelIdsDecodeErrorZPtr { err }
12069                 };
12070                 Self {
12071                         contents,
12072                         result_ok: o.result_ok,
12073                 }
12074         }
12075 }
12076 impl Clone for CResult_QueryShortChannelIdsDecodeErrorZ {
12077         fn clone(&self) -> Self {
12078                 if self.result_ok {
12079                         Self { result_ok: true, contents: CResult_QueryShortChannelIdsDecodeErrorZPtr {
12080                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::QueryShortChannelIds>::clone(unsafe { &*self.contents.result })))
12081                         } }
12082                 } else {
12083                         Self { result_ok: false, contents: CResult_QueryShortChannelIdsDecodeErrorZPtr {
12084                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
12085                         } }
12086                 }
12087         }
12088 }
12089 #[no_mangle]
12090 /// Creates a new CResult_QueryShortChannelIdsDecodeErrorZ which has the same data as `orig`
12091 /// but with all dynamically-allocated buffers duplicated in new buffers.
12092 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_clone(orig: &CResult_QueryShortChannelIdsDecodeErrorZ) -> CResult_QueryShortChannelIdsDecodeErrorZ { Clone::clone(&orig) }
12093 #[repr(C)]
12094 /// The contents of CResult_ReplyShortChannelIdsEndDecodeErrorZ
12095 pub union CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
12096         /// A pointer to the contents in the success state.
12097         /// Reading from this pointer when `result_ok` is not set is undefined.
12098         pub result: *mut crate::lightning::ln::msgs::ReplyShortChannelIdsEnd,
12099         /// A pointer to the contents in the error state.
12100         /// Reading from this pointer when `result_ok` is set is undefined.
12101         pub err: *mut crate::lightning::ln::msgs::DecodeError,
12102 }
12103 #[repr(C)]
12104 /// A CResult_ReplyShortChannelIdsEndDecodeErrorZ represents the result of a fallible operation,
12105 /// containing a crate::lightning::ln::msgs::ReplyShortChannelIdsEnd on success and a crate::lightning::ln::msgs::DecodeError on failure.
12106 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12107 pub struct CResult_ReplyShortChannelIdsEndDecodeErrorZ {
12108         /// The contents of this CResult_ReplyShortChannelIdsEndDecodeErrorZ, accessible via either
12109         /// `err` or `result` depending on the state of `result_ok`.
12110         pub contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr,
12111         /// Whether this CResult_ReplyShortChannelIdsEndDecodeErrorZ represents a success state.
12112         pub result_ok: bool,
12113 }
12114 #[no_mangle]
12115 /// Creates a new CResult_ReplyShortChannelIdsEndDecodeErrorZ in the success state.
12116 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ReplyShortChannelIdsEnd) -> CResult_ReplyShortChannelIdsEndDecodeErrorZ {
12117         CResult_ReplyShortChannelIdsEndDecodeErrorZ {
12118                 contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
12119                         result: Box::into_raw(Box::new(o)),
12120                 },
12121                 result_ok: true,
12122         }
12123 }
12124 #[no_mangle]
12125 /// Creates a new CResult_ReplyShortChannelIdsEndDecodeErrorZ in the error state.
12126 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ReplyShortChannelIdsEndDecodeErrorZ {
12127         CResult_ReplyShortChannelIdsEndDecodeErrorZ {
12128                 contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
12129                         err: Box::into_raw(Box::new(e)),
12130                 },
12131                 result_ok: false,
12132         }
12133 }
12134 #[no_mangle]
12135 /// Frees any resources used by the CResult_ReplyShortChannelIdsEndDecodeErrorZ.
12136 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_free(_res: CResult_ReplyShortChannelIdsEndDecodeErrorZ) { }
12137 impl Drop for CResult_ReplyShortChannelIdsEndDecodeErrorZ {
12138         fn drop(&mut self) {
12139                 if self.result_ok {
12140                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
12141                                 let _ = unsafe { Box::from_raw(self.contents.result) };
12142                         }
12143                 } else {
12144                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
12145                                 let _ = unsafe { Box::from_raw(self.contents.err) };
12146                         }
12147                 }
12148         }
12149 }
12150 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ReplyShortChannelIdsEnd, crate::lightning::ln::msgs::DecodeError>> for CResult_ReplyShortChannelIdsEndDecodeErrorZ {
12151         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ReplyShortChannelIdsEnd, crate::lightning::ln::msgs::DecodeError>) -> Self {
12152                 let contents = if o.result_ok {
12153                         let result = unsafe { o.contents.result };
12154                         unsafe { o.contents.result = std::ptr::null_mut() };
12155                         CResult_ReplyShortChannelIdsEndDecodeErrorZPtr { result }
12156                 } else {
12157                         let err = unsafe { o.contents.err };
12158                         unsafe { o.contents.err = std::ptr::null_mut(); }
12159                         CResult_ReplyShortChannelIdsEndDecodeErrorZPtr { err }
12160                 };
12161                 Self {
12162                         contents,
12163                         result_ok: o.result_ok,
12164                 }
12165         }
12166 }
12167 impl Clone for CResult_ReplyShortChannelIdsEndDecodeErrorZ {
12168         fn clone(&self) -> Self {
12169                 if self.result_ok {
12170                         Self { result_ok: true, contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
12171                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ReplyShortChannelIdsEnd>::clone(unsafe { &*self.contents.result })))
12172                         } }
12173                 } else {
12174                         Self { result_ok: false, contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
12175                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
12176                         } }
12177                 }
12178         }
12179 }
12180 #[no_mangle]
12181 /// Creates a new CResult_ReplyShortChannelIdsEndDecodeErrorZ which has the same data as `orig`
12182 /// but with all dynamically-allocated buffers duplicated in new buffers.
12183 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone(orig: &CResult_ReplyShortChannelIdsEndDecodeErrorZ) -> CResult_ReplyShortChannelIdsEndDecodeErrorZ { Clone::clone(&orig) }
12184 #[repr(C)]
12185 /// The contents of CResult_QueryChannelRangeDecodeErrorZ
12186 pub union CResult_QueryChannelRangeDecodeErrorZPtr {
12187         /// A pointer to the contents in the success state.
12188         /// Reading from this pointer when `result_ok` is not set is undefined.
12189         pub result: *mut crate::lightning::ln::msgs::QueryChannelRange,
12190         /// A pointer to the contents in the error state.
12191         /// Reading from this pointer when `result_ok` is set is undefined.
12192         pub err: *mut crate::lightning::ln::msgs::DecodeError,
12193 }
12194 #[repr(C)]
12195 /// A CResult_QueryChannelRangeDecodeErrorZ represents the result of a fallible operation,
12196 /// containing a crate::lightning::ln::msgs::QueryChannelRange on success and a crate::lightning::ln::msgs::DecodeError on failure.
12197 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12198 pub struct CResult_QueryChannelRangeDecodeErrorZ {
12199         /// The contents of this CResult_QueryChannelRangeDecodeErrorZ, accessible via either
12200         /// `err` or `result` depending on the state of `result_ok`.
12201         pub contents: CResult_QueryChannelRangeDecodeErrorZPtr,
12202         /// Whether this CResult_QueryChannelRangeDecodeErrorZ represents a success state.
12203         pub result_ok: bool,
12204 }
12205 #[no_mangle]
12206 /// Creates a new CResult_QueryChannelRangeDecodeErrorZ in the success state.
12207 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_ok(o: crate::lightning::ln::msgs::QueryChannelRange) -> CResult_QueryChannelRangeDecodeErrorZ {
12208         CResult_QueryChannelRangeDecodeErrorZ {
12209                 contents: CResult_QueryChannelRangeDecodeErrorZPtr {
12210                         result: Box::into_raw(Box::new(o)),
12211                 },
12212                 result_ok: true,
12213         }
12214 }
12215 #[no_mangle]
12216 /// Creates a new CResult_QueryChannelRangeDecodeErrorZ in the error state.
12217 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_QueryChannelRangeDecodeErrorZ {
12218         CResult_QueryChannelRangeDecodeErrorZ {
12219                 contents: CResult_QueryChannelRangeDecodeErrorZPtr {
12220                         err: Box::into_raw(Box::new(e)),
12221                 },
12222                 result_ok: false,
12223         }
12224 }
12225 #[no_mangle]
12226 /// Frees any resources used by the CResult_QueryChannelRangeDecodeErrorZ.
12227 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_free(_res: CResult_QueryChannelRangeDecodeErrorZ) { }
12228 impl Drop for CResult_QueryChannelRangeDecodeErrorZ {
12229         fn drop(&mut self) {
12230                 if self.result_ok {
12231                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
12232                                 let _ = unsafe { Box::from_raw(self.contents.result) };
12233                         }
12234                 } else {
12235                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
12236                                 let _ = unsafe { Box::from_raw(self.contents.err) };
12237                         }
12238                 }
12239         }
12240 }
12241 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::QueryChannelRange, crate::lightning::ln::msgs::DecodeError>> for CResult_QueryChannelRangeDecodeErrorZ {
12242         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::QueryChannelRange, crate::lightning::ln::msgs::DecodeError>) -> Self {
12243                 let contents = if o.result_ok {
12244                         let result = unsafe { o.contents.result };
12245                         unsafe { o.contents.result = std::ptr::null_mut() };
12246                         CResult_QueryChannelRangeDecodeErrorZPtr { result }
12247                 } else {
12248                         let err = unsafe { o.contents.err };
12249                         unsafe { o.contents.err = std::ptr::null_mut(); }
12250                         CResult_QueryChannelRangeDecodeErrorZPtr { err }
12251                 };
12252                 Self {
12253                         contents,
12254                         result_ok: o.result_ok,
12255                 }
12256         }
12257 }
12258 impl Clone for CResult_QueryChannelRangeDecodeErrorZ {
12259         fn clone(&self) -> Self {
12260                 if self.result_ok {
12261                         Self { result_ok: true, contents: CResult_QueryChannelRangeDecodeErrorZPtr {
12262                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::QueryChannelRange>::clone(unsafe { &*self.contents.result })))
12263                         } }
12264                 } else {
12265                         Self { result_ok: false, contents: CResult_QueryChannelRangeDecodeErrorZPtr {
12266                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
12267                         } }
12268                 }
12269         }
12270 }
12271 #[no_mangle]
12272 /// Creates a new CResult_QueryChannelRangeDecodeErrorZ which has the same data as `orig`
12273 /// but with all dynamically-allocated buffers duplicated in new buffers.
12274 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_clone(orig: &CResult_QueryChannelRangeDecodeErrorZ) -> CResult_QueryChannelRangeDecodeErrorZ { Clone::clone(&orig) }
12275 #[repr(C)]
12276 /// The contents of CResult_ReplyChannelRangeDecodeErrorZ
12277 pub union CResult_ReplyChannelRangeDecodeErrorZPtr {
12278         /// A pointer to the contents in the success state.
12279         /// Reading from this pointer when `result_ok` is not set is undefined.
12280         pub result: *mut crate::lightning::ln::msgs::ReplyChannelRange,
12281         /// A pointer to the contents in the error state.
12282         /// Reading from this pointer when `result_ok` is set is undefined.
12283         pub err: *mut crate::lightning::ln::msgs::DecodeError,
12284 }
12285 #[repr(C)]
12286 /// A CResult_ReplyChannelRangeDecodeErrorZ represents the result of a fallible operation,
12287 /// containing a crate::lightning::ln::msgs::ReplyChannelRange on success and a crate::lightning::ln::msgs::DecodeError on failure.
12288 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12289 pub struct CResult_ReplyChannelRangeDecodeErrorZ {
12290         /// The contents of this CResult_ReplyChannelRangeDecodeErrorZ, accessible via either
12291         /// `err` or `result` depending on the state of `result_ok`.
12292         pub contents: CResult_ReplyChannelRangeDecodeErrorZPtr,
12293         /// Whether this CResult_ReplyChannelRangeDecodeErrorZ represents a success state.
12294         pub result_ok: bool,
12295 }
12296 #[no_mangle]
12297 /// Creates a new CResult_ReplyChannelRangeDecodeErrorZ in the success state.
12298 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ReplyChannelRange) -> CResult_ReplyChannelRangeDecodeErrorZ {
12299         CResult_ReplyChannelRangeDecodeErrorZ {
12300                 contents: CResult_ReplyChannelRangeDecodeErrorZPtr {
12301                         result: Box::into_raw(Box::new(o)),
12302                 },
12303                 result_ok: true,
12304         }
12305 }
12306 #[no_mangle]
12307 /// Creates a new CResult_ReplyChannelRangeDecodeErrorZ in the error state.
12308 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ReplyChannelRangeDecodeErrorZ {
12309         CResult_ReplyChannelRangeDecodeErrorZ {
12310                 contents: CResult_ReplyChannelRangeDecodeErrorZPtr {
12311                         err: Box::into_raw(Box::new(e)),
12312                 },
12313                 result_ok: false,
12314         }
12315 }
12316 #[no_mangle]
12317 /// Frees any resources used by the CResult_ReplyChannelRangeDecodeErrorZ.
12318 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_free(_res: CResult_ReplyChannelRangeDecodeErrorZ) { }
12319 impl Drop for CResult_ReplyChannelRangeDecodeErrorZ {
12320         fn drop(&mut self) {
12321                 if self.result_ok {
12322                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
12323                                 let _ = unsafe { Box::from_raw(self.contents.result) };
12324                         }
12325                 } else {
12326                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
12327                                 let _ = unsafe { Box::from_raw(self.contents.err) };
12328                         }
12329                 }
12330         }
12331 }
12332 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ReplyChannelRange, crate::lightning::ln::msgs::DecodeError>> for CResult_ReplyChannelRangeDecodeErrorZ {
12333         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ReplyChannelRange, crate::lightning::ln::msgs::DecodeError>) -> Self {
12334                 let contents = if o.result_ok {
12335                         let result = unsafe { o.contents.result };
12336                         unsafe { o.contents.result = std::ptr::null_mut() };
12337                         CResult_ReplyChannelRangeDecodeErrorZPtr { result }
12338                 } else {
12339                         let err = unsafe { o.contents.err };
12340                         unsafe { o.contents.err = std::ptr::null_mut(); }
12341                         CResult_ReplyChannelRangeDecodeErrorZPtr { err }
12342                 };
12343                 Self {
12344                         contents,
12345                         result_ok: o.result_ok,
12346                 }
12347         }
12348 }
12349 impl Clone for CResult_ReplyChannelRangeDecodeErrorZ {
12350         fn clone(&self) -> Self {
12351                 if self.result_ok {
12352                         Self { result_ok: true, contents: CResult_ReplyChannelRangeDecodeErrorZPtr {
12353                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ReplyChannelRange>::clone(unsafe { &*self.contents.result })))
12354                         } }
12355                 } else {
12356                         Self { result_ok: false, contents: CResult_ReplyChannelRangeDecodeErrorZPtr {
12357                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
12358                         } }
12359                 }
12360         }
12361 }
12362 #[no_mangle]
12363 /// Creates a new CResult_ReplyChannelRangeDecodeErrorZ which has the same data as `orig`
12364 /// but with all dynamically-allocated buffers duplicated in new buffers.
12365 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_clone(orig: &CResult_ReplyChannelRangeDecodeErrorZ) -> CResult_ReplyChannelRangeDecodeErrorZ { Clone::clone(&orig) }
12366 #[repr(C)]
12367 /// The contents of CResult_GossipTimestampFilterDecodeErrorZ
12368 pub union CResult_GossipTimestampFilterDecodeErrorZPtr {
12369         /// A pointer to the contents in the success state.
12370         /// Reading from this pointer when `result_ok` is not set is undefined.
12371         pub result: *mut crate::lightning::ln::msgs::GossipTimestampFilter,
12372         /// A pointer to the contents in the error state.
12373         /// Reading from this pointer when `result_ok` is set is undefined.
12374         pub err: *mut crate::lightning::ln::msgs::DecodeError,
12375 }
12376 #[repr(C)]
12377 /// A CResult_GossipTimestampFilterDecodeErrorZ represents the result of a fallible operation,
12378 /// containing a crate::lightning::ln::msgs::GossipTimestampFilter on success and a crate::lightning::ln::msgs::DecodeError on failure.
12379 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12380 pub struct CResult_GossipTimestampFilterDecodeErrorZ {
12381         /// The contents of this CResult_GossipTimestampFilterDecodeErrorZ, accessible via either
12382         /// `err` or `result` depending on the state of `result_ok`.
12383         pub contents: CResult_GossipTimestampFilterDecodeErrorZPtr,
12384         /// Whether this CResult_GossipTimestampFilterDecodeErrorZ represents a success state.
12385         pub result_ok: bool,
12386 }
12387 #[no_mangle]
12388 /// Creates a new CResult_GossipTimestampFilterDecodeErrorZ in the success state.
12389 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_ok(o: crate::lightning::ln::msgs::GossipTimestampFilter) -> CResult_GossipTimestampFilterDecodeErrorZ {
12390         CResult_GossipTimestampFilterDecodeErrorZ {
12391                 contents: CResult_GossipTimestampFilterDecodeErrorZPtr {
12392                         result: Box::into_raw(Box::new(o)),
12393                 },
12394                 result_ok: true,
12395         }
12396 }
12397 #[no_mangle]
12398 /// Creates a new CResult_GossipTimestampFilterDecodeErrorZ in the error state.
12399 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_GossipTimestampFilterDecodeErrorZ {
12400         CResult_GossipTimestampFilterDecodeErrorZ {
12401                 contents: CResult_GossipTimestampFilterDecodeErrorZPtr {
12402                         err: Box::into_raw(Box::new(e)),
12403                 },
12404                 result_ok: false,
12405         }
12406 }
12407 #[no_mangle]
12408 /// Frees any resources used by the CResult_GossipTimestampFilterDecodeErrorZ.
12409 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_free(_res: CResult_GossipTimestampFilterDecodeErrorZ) { }
12410 impl Drop for CResult_GossipTimestampFilterDecodeErrorZ {
12411         fn drop(&mut self) {
12412                 if self.result_ok {
12413                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
12414                                 let _ = unsafe { Box::from_raw(self.contents.result) };
12415                         }
12416                 } else {
12417                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
12418                                 let _ = unsafe { Box::from_raw(self.contents.err) };
12419                         }
12420                 }
12421         }
12422 }
12423 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::GossipTimestampFilter, crate::lightning::ln::msgs::DecodeError>> for CResult_GossipTimestampFilterDecodeErrorZ {
12424         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::GossipTimestampFilter, crate::lightning::ln::msgs::DecodeError>) -> Self {
12425                 let contents = if o.result_ok {
12426                         let result = unsafe { o.contents.result };
12427                         unsafe { o.contents.result = std::ptr::null_mut() };
12428                         CResult_GossipTimestampFilterDecodeErrorZPtr { result }
12429                 } else {
12430                         let err = unsafe { o.contents.err };
12431                         unsafe { o.contents.err = std::ptr::null_mut(); }
12432                         CResult_GossipTimestampFilterDecodeErrorZPtr { err }
12433                 };
12434                 Self {
12435                         contents,
12436                         result_ok: o.result_ok,
12437                 }
12438         }
12439 }
12440 impl Clone for CResult_GossipTimestampFilterDecodeErrorZ {
12441         fn clone(&self) -> Self {
12442                 if self.result_ok {
12443                         Self { result_ok: true, contents: CResult_GossipTimestampFilterDecodeErrorZPtr {
12444                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::GossipTimestampFilter>::clone(unsafe { &*self.contents.result })))
12445                         } }
12446                 } else {
12447                         Self { result_ok: false, contents: CResult_GossipTimestampFilterDecodeErrorZPtr {
12448                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
12449                         } }
12450                 }
12451         }
12452 }
12453 #[no_mangle]
12454 /// Creates a new CResult_GossipTimestampFilterDecodeErrorZ which has the same data as `orig`
12455 /// but with all dynamically-allocated buffers duplicated in new buffers.
12456 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_clone(orig: &CResult_GossipTimestampFilterDecodeErrorZ) -> CResult_GossipTimestampFilterDecodeErrorZ { Clone::clone(&orig) }
12457 #[repr(C)]
12458 /// The contents of CResult_InvoiceSignOrCreationErrorZ
12459 pub union CResult_InvoiceSignOrCreationErrorZPtr {
12460         /// A pointer to the contents in the success state.
12461         /// Reading from this pointer when `result_ok` is not set is undefined.
12462         pub result: *mut crate::lightning_invoice::Invoice,
12463         /// A pointer to the contents in the error state.
12464         /// Reading from this pointer when `result_ok` is set is undefined.
12465         pub err: *mut crate::lightning_invoice::SignOrCreationError,
12466 }
12467 #[repr(C)]
12468 /// A CResult_InvoiceSignOrCreationErrorZ represents the result of a fallible operation,
12469 /// containing a crate::lightning_invoice::Invoice on success and a crate::lightning_invoice::SignOrCreationError on failure.
12470 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12471 pub struct CResult_InvoiceSignOrCreationErrorZ {
12472         /// The contents of this CResult_InvoiceSignOrCreationErrorZ, accessible via either
12473         /// `err` or `result` depending on the state of `result_ok`.
12474         pub contents: CResult_InvoiceSignOrCreationErrorZPtr,
12475         /// Whether this CResult_InvoiceSignOrCreationErrorZ represents a success state.
12476         pub result_ok: bool,
12477 }
12478 #[no_mangle]
12479 /// Creates a new CResult_InvoiceSignOrCreationErrorZ in the success state.
12480 pub extern "C" fn CResult_InvoiceSignOrCreationErrorZ_ok(o: crate::lightning_invoice::Invoice) -> CResult_InvoiceSignOrCreationErrorZ {
12481         CResult_InvoiceSignOrCreationErrorZ {
12482                 contents: CResult_InvoiceSignOrCreationErrorZPtr {
12483                         result: Box::into_raw(Box::new(o)),
12484                 },
12485                 result_ok: true,
12486         }
12487 }
12488 #[no_mangle]
12489 /// Creates a new CResult_InvoiceSignOrCreationErrorZ in the error state.
12490 pub extern "C" fn CResult_InvoiceSignOrCreationErrorZ_err(e: crate::lightning_invoice::SignOrCreationError) -> CResult_InvoiceSignOrCreationErrorZ {
12491         CResult_InvoiceSignOrCreationErrorZ {
12492                 contents: CResult_InvoiceSignOrCreationErrorZPtr {
12493                         err: Box::into_raw(Box::new(e)),
12494                 },
12495                 result_ok: false,
12496         }
12497 }
12498 #[no_mangle]
12499 /// Frees any resources used by the CResult_InvoiceSignOrCreationErrorZ.
12500 pub extern "C" fn CResult_InvoiceSignOrCreationErrorZ_free(_res: CResult_InvoiceSignOrCreationErrorZ) { }
12501 impl Drop for CResult_InvoiceSignOrCreationErrorZ {
12502         fn drop(&mut self) {
12503                 if self.result_ok {
12504                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
12505                                 let _ = unsafe { Box::from_raw(self.contents.result) };
12506                         }
12507                 } else {
12508                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
12509                                 let _ = unsafe { Box::from_raw(self.contents.err) };
12510                         }
12511                 }
12512         }
12513 }
12514 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::Invoice, crate::lightning_invoice::SignOrCreationError>> for CResult_InvoiceSignOrCreationErrorZ {
12515         fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::Invoice, crate::lightning_invoice::SignOrCreationError>) -> Self {
12516                 let contents = if o.result_ok {
12517                         let result = unsafe { o.contents.result };
12518                         unsafe { o.contents.result = std::ptr::null_mut() };
12519                         CResult_InvoiceSignOrCreationErrorZPtr { result }
12520                 } else {
12521                         let err = unsafe { o.contents.err };
12522                         unsafe { o.contents.err = std::ptr::null_mut(); }
12523                         CResult_InvoiceSignOrCreationErrorZPtr { err }
12524                 };
12525                 Self {
12526                         contents,
12527                         result_ok: o.result_ok,
12528                 }
12529         }
12530 }
12531 impl Clone for CResult_InvoiceSignOrCreationErrorZ {
12532         fn clone(&self) -> Self {
12533                 if self.result_ok {
12534                         Self { result_ok: true, contents: CResult_InvoiceSignOrCreationErrorZPtr {
12535                                 result: Box::into_raw(Box::new(<crate::lightning_invoice::Invoice>::clone(unsafe { &*self.contents.result })))
12536                         } }
12537                 } else {
12538                         Self { result_ok: false, contents: CResult_InvoiceSignOrCreationErrorZPtr {
12539                                 err: Box::into_raw(Box::new(<crate::lightning_invoice::SignOrCreationError>::clone(unsafe { &*self.contents.err })))
12540                         } }
12541                 }
12542         }
12543 }
12544 #[no_mangle]
12545 /// Creates a new CResult_InvoiceSignOrCreationErrorZ which has the same data as `orig`
12546 /// but with all dynamically-allocated buffers duplicated in new buffers.
12547 pub extern "C" fn CResult_InvoiceSignOrCreationErrorZ_clone(orig: &CResult_InvoiceSignOrCreationErrorZ) -> CResult_InvoiceSignOrCreationErrorZ { Clone::clone(&orig) }
12548 #[repr(C)]
12549 /// An enum which can either contain a crate::lightning::chain::Filter or not
12550 pub enum COption_FilterZ {
12551         /// When we're in this state, this COption_FilterZ contains a crate::lightning::chain::Filter
12552         Some(crate::lightning::chain::Filter),
12553         /// When we're in this state, this COption_FilterZ contains nothing
12554         None
12555 }
12556 impl COption_FilterZ {
12557         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
12558                 if let Self::Some(_) = self { true } else { false }
12559         }
12560         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
12561                 !self.is_some()
12562         }
12563         #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::chain::Filter {
12564                 if let Self::Some(v) = self { v } else { unreachable!() }
12565         }
12566 }
12567 #[no_mangle]
12568 /// Constructs a new COption_FilterZ containing a crate::lightning::chain::Filter
12569 pub extern "C" fn COption_FilterZ_some(o: crate::lightning::chain::Filter) -> COption_FilterZ {
12570         COption_FilterZ::Some(o)
12571 }
12572 #[no_mangle]
12573 /// Constructs a new COption_FilterZ containing nothing
12574 pub extern "C" fn COption_FilterZ_none() -> COption_FilterZ {
12575         COption_FilterZ::None
12576 }
12577 #[no_mangle]
12578 /// Frees any resources associated with the crate::lightning::chain::Filter, if we are in the Some state
12579 pub extern "C" fn COption_FilterZ_free(_res: COption_FilterZ) { }
12580 #[repr(C)]
12581 /// The contents of CResult_LockedChannelMonitorNoneZ
12582 pub union CResult_LockedChannelMonitorNoneZPtr {
12583         /// A pointer to the contents in the success state.
12584         /// Reading from this pointer when `result_ok` is not set is undefined.
12585         pub result: *mut crate::lightning::chain::chainmonitor::LockedChannelMonitor,
12586         /// Note that this value is always NULL, as there are no contents in the Err variant
12587         pub err: *mut std::ffi::c_void,
12588 }
12589 #[repr(C)]
12590 /// A CResult_LockedChannelMonitorNoneZ represents the result of a fallible operation,
12591 /// containing a crate::lightning::chain::chainmonitor::LockedChannelMonitor on success and a () on failure.
12592 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12593 pub struct CResult_LockedChannelMonitorNoneZ {
12594         /// The contents of this CResult_LockedChannelMonitorNoneZ, accessible via either
12595         /// `err` or `result` depending on the state of `result_ok`.
12596         pub contents: CResult_LockedChannelMonitorNoneZPtr,
12597         /// Whether this CResult_LockedChannelMonitorNoneZ represents a success state.
12598         pub result_ok: bool,
12599 }
12600 #[no_mangle]
12601 /// Creates a new CResult_LockedChannelMonitorNoneZ in the success state.
12602 pub extern "C" fn CResult_LockedChannelMonitorNoneZ_ok(o: crate::lightning::chain::chainmonitor::LockedChannelMonitor) -> CResult_LockedChannelMonitorNoneZ {
12603         CResult_LockedChannelMonitorNoneZ {
12604                 contents: CResult_LockedChannelMonitorNoneZPtr {
12605                         result: Box::into_raw(Box::new(o)),
12606                 },
12607                 result_ok: true,
12608         }
12609 }
12610 #[no_mangle]
12611 /// Creates a new CResult_LockedChannelMonitorNoneZ in the error state.
12612 pub extern "C" fn CResult_LockedChannelMonitorNoneZ_err() -> CResult_LockedChannelMonitorNoneZ {
12613         CResult_LockedChannelMonitorNoneZ {
12614                 contents: CResult_LockedChannelMonitorNoneZPtr {
12615                         err: std::ptr::null_mut(),
12616                 },
12617                 result_ok: false,
12618         }
12619 }
12620 #[no_mangle]
12621 /// Frees any resources used by the CResult_LockedChannelMonitorNoneZ.
12622 pub extern "C" fn CResult_LockedChannelMonitorNoneZ_free(_res: CResult_LockedChannelMonitorNoneZ) { }
12623 impl Drop for CResult_LockedChannelMonitorNoneZ {
12624         fn drop(&mut self) {
12625                 if self.result_ok {
12626                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
12627                                 let _ = unsafe { Box::from_raw(self.contents.result) };
12628                         }
12629                 } else {
12630                 }
12631         }
12632 }
12633 impl From<crate::c_types::CResultTempl<crate::lightning::chain::chainmonitor::LockedChannelMonitor, ()>> for CResult_LockedChannelMonitorNoneZ {
12634         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::chainmonitor::LockedChannelMonitor, ()>) -> Self {
12635                 let contents = if o.result_ok {
12636                         let result = unsafe { o.contents.result };
12637                         unsafe { o.contents.result = std::ptr::null_mut() };
12638                         CResult_LockedChannelMonitorNoneZPtr { result }
12639                 } else {
12640                         let _ = unsafe { Box::from_raw(o.contents.err) };
12641                         o.contents.err = std::ptr::null_mut();
12642                         CResult_LockedChannelMonitorNoneZPtr { err: std::ptr::null_mut() }
12643                 };
12644                 Self {
12645                         contents,
12646                         result_ok: o.result_ok,
12647                 }
12648         }
12649 }
12650 #[repr(C)]
12651 /// A dynamically-allocated array of crate::lightning::chain::transaction::OutPoints of arbitrary size.
12652 /// This corresponds to std::vector in C++
12653 pub struct CVec_OutPointZ {
12654         /// The elements in the array.
12655         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
12656         pub data: *mut crate::lightning::chain::transaction::OutPoint,
12657         /// The number of elements pointed to by `data`.
12658         pub datalen: usize
12659 }
12660 impl CVec_OutPointZ {
12661         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::chain::transaction::OutPoint> {
12662                 if self.datalen == 0 { return Vec::new(); }
12663                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
12664                 self.data = std::ptr::null_mut();
12665                 self.datalen = 0;
12666                 ret
12667         }
12668         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::chain::transaction::OutPoint] {
12669                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
12670         }
12671 }
12672 impl From<Vec<crate::lightning::chain::transaction::OutPoint>> for CVec_OutPointZ {
12673         fn from(v: Vec<crate::lightning::chain::transaction::OutPoint>) -> Self {
12674                 let datalen = v.len();
12675                 let data = Box::into_raw(v.into_boxed_slice());
12676                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
12677         }
12678 }
12679 #[no_mangle]
12680 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
12681 pub extern "C" fn CVec_OutPointZ_free(_res: CVec_OutPointZ) { }
12682 impl Drop for CVec_OutPointZ {
12683         fn drop(&mut self) {
12684                 if self.datalen == 0 { return; }
12685                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
12686         }
12687 }
12688 impl Clone for CVec_OutPointZ {
12689         fn clone(&self) -> Self {
12690                 let mut res = Vec::new();
12691                 if self.datalen == 0 { return Self::from(res); }
12692                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
12693                 Self::from(res)
12694         }
12695 }