Merge pull request #39 from TheBlueMatt/main
[ldk-c-bindings] / lightning-c-bindings / src / c_types / derived.rs
1 #[repr(C)]
2 /// The contents of CResult_SecretKeyErrorZ
3 pub union CResult_SecretKeyErrorZPtr {
4         /// A pointer to the contents in the success state.
5         /// Reading from this pointer when `result_ok` is not set is undefined.
6         pub result: *mut crate::c_types::SecretKey,
7         /// A pointer to the contents in the error state.
8         /// Reading from this pointer when `result_ok` is set is undefined.
9         pub err: *mut crate::c_types::Secp256k1Error,
10 }
11 #[repr(C)]
12 /// A CResult_SecretKeyErrorZ represents the result of a fallible operation,
13 /// containing a crate::c_types::SecretKey on success and a crate::c_types::Secp256k1Error on failure.
14 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
15 pub struct CResult_SecretKeyErrorZ {
16         /// The contents of this CResult_SecretKeyErrorZ, accessible via either
17         /// `err` or `result` depending on the state of `result_ok`.
18         pub contents: CResult_SecretKeyErrorZPtr,
19         /// Whether this CResult_SecretKeyErrorZ represents a success state.
20         pub result_ok: bool,
21 }
22 #[no_mangle]
23 /// Creates a new CResult_SecretKeyErrorZ in the success state.
24 pub extern "C" fn CResult_SecretKeyErrorZ_ok(o: crate::c_types::SecretKey) -> CResult_SecretKeyErrorZ {
25         CResult_SecretKeyErrorZ {
26                 contents: CResult_SecretKeyErrorZPtr {
27                         result: Box::into_raw(Box::new(o)),
28                 },
29                 result_ok: true,
30         }
31 }
32 #[no_mangle]
33 /// Creates a new CResult_SecretKeyErrorZ in the error state.
34 pub extern "C" fn CResult_SecretKeyErrorZ_err(e: crate::c_types::Secp256k1Error) -> CResult_SecretKeyErrorZ {
35         CResult_SecretKeyErrorZ {
36                 contents: CResult_SecretKeyErrorZPtr {
37                         err: Box::into_raw(Box::new(e)),
38                 },
39                 result_ok: false,
40         }
41 }
42 #[no_mangle]
43 /// Frees any resources used by the CResult_SecretKeyErrorZ.
44 pub extern "C" fn CResult_SecretKeyErrorZ_free(_res: CResult_SecretKeyErrorZ) { }
45 impl Drop for CResult_SecretKeyErrorZ {
46         fn drop(&mut self) {
47                 if self.result_ok {
48                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
49                                 let _ = unsafe { Box::from_raw(self.contents.result) };
50                         }
51                 } else {
52                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
53                                 let _ = unsafe { Box::from_raw(self.contents.err) };
54                         }
55                 }
56         }
57 }
58 impl From<crate::c_types::CResultTempl<crate::c_types::SecretKey, crate::c_types::Secp256k1Error>> for CResult_SecretKeyErrorZ {
59         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::SecretKey, crate::c_types::Secp256k1Error>) -> Self {
60                 let contents = if o.result_ok {
61                         let result = unsafe { o.contents.result };
62                         unsafe { o.contents.result = std::ptr::null_mut() };
63                         CResult_SecretKeyErrorZPtr { result }
64                 } else {
65                         let err = unsafe { o.contents.err };
66                         unsafe { o.contents.err = std::ptr::null_mut(); }
67                         CResult_SecretKeyErrorZPtr { err }
68                 };
69                 Self {
70                         contents,
71                         result_ok: o.result_ok,
72                 }
73         }
74 }
75 #[repr(C)]
76 /// The contents of CResult_PublicKeyErrorZ
77 pub union CResult_PublicKeyErrorZPtr {
78         /// A pointer to the contents in the success state.
79         /// Reading from this pointer when `result_ok` is not set is undefined.
80         pub result: *mut crate::c_types::PublicKey,
81         /// A pointer to the contents in the error state.
82         /// Reading from this pointer when `result_ok` is set is undefined.
83         pub err: *mut crate::c_types::Secp256k1Error,
84 }
85 #[repr(C)]
86 /// A CResult_PublicKeyErrorZ represents the result of a fallible operation,
87 /// containing a crate::c_types::PublicKey on success and a crate::c_types::Secp256k1Error on failure.
88 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
89 pub struct CResult_PublicKeyErrorZ {
90         /// The contents of this CResult_PublicKeyErrorZ, accessible via either
91         /// `err` or `result` depending on the state of `result_ok`.
92         pub contents: CResult_PublicKeyErrorZPtr,
93         /// Whether this CResult_PublicKeyErrorZ represents a success state.
94         pub result_ok: bool,
95 }
96 #[no_mangle]
97 /// Creates a new CResult_PublicKeyErrorZ in the success state.
98 pub extern "C" fn CResult_PublicKeyErrorZ_ok(o: crate::c_types::PublicKey) -> CResult_PublicKeyErrorZ {
99         CResult_PublicKeyErrorZ {
100                 contents: CResult_PublicKeyErrorZPtr {
101                         result: Box::into_raw(Box::new(o)),
102                 },
103                 result_ok: true,
104         }
105 }
106 #[no_mangle]
107 /// Creates a new CResult_PublicKeyErrorZ in the error state.
108 pub extern "C" fn CResult_PublicKeyErrorZ_err(e: crate::c_types::Secp256k1Error) -> CResult_PublicKeyErrorZ {
109         CResult_PublicKeyErrorZ {
110                 contents: CResult_PublicKeyErrorZPtr {
111                         err: Box::into_raw(Box::new(e)),
112                 },
113                 result_ok: false,
114         }
115 }
116 #[no_mangle]
117 /// Frees any resources used by the CResult_PublicKeyErrorZ.
118 pub extern "C" fn CResult_PublicKeyErrorZ_free(_res: CResult_PublicKeyErrorZ) { }
119 impl Drop for CResult_PublicKeyErrorZ {
120         fn drop(&mut self) {
121                 if self.result_ok {
122                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
123                                 let _ = unsafe { Box::from_raw(self.contents.result) };
124                         }
125                 } else {
126                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
127                                 let _ = unsafe { Box::from_raw(self.contents.err) };
128                         }
129                 }
130         }
131 }
132 impl From<crate::c_types::CResultTempl<crate::c_types::PublicKey, crate::c_types::Secp256k1Error>> for CResult_PublicKeyErrorZ {
133         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::PublicKey, crate::c_types::Secp256k1Error>) -> Self {
134                 let contents = if o.result_ok {
135                         let result = unsafe { o.contents.result };
136                         unsafe { o.contents.result = std::ptr::null_mut() };
137                         CResult_PublicKeyErrorZPtr { result }
138                 } else {
139                         let err = unsafe { o.contents.err };
140                         unsafe { o.contents.err = std::ptr::null_mut(); }
141                         CResult_PublicKeyErrorZPtr { err }
142                 };
143                 Self {
144                         contents,
145                         result_ok: o.result_ok,
146                 }
147         }
148 }
149 impl Clone for CResult_PublicKeyErrorZ {
150         fn clone(&self) -> Self {
151                 if self.result_ok {
152                         Self { result_ok: true, contents: CResult_PublicKeyErrorZPtr {
153                                 result: Box::into_raw(Box::new(<crate::c_types::PublicKey>::clone(unsafe { &*self.contents.result })))
154                         } }
155                 } else {
156                         Self { result_ok: false, contents: CResult_PublicKeyErrorZPtr {
157                                 err: Box::into_raw(Box::new(<crate::c_types::Secp256k1Error>::clone(unsafe { &*self.contents.err })))
158                         } }
159                 }
160         }
161 }
162 #[no_mangle]
163 /// Creates a new CResult_PublicKeyErrorZ which has the same data as `orig`
164 /// but with all dynamically-allocated buffers duplicated in new buffers.
165 pub extern "C" fn CResult_PublicKeyErrorZ_clone(orig: &CResult_PublicKeyErrorZ) -> CResult_PublicKeyErrorZ { orig.clone() }
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 { orig.clone() }
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 { orig.clone() }
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 { orig.clone() }
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 take(mut self) -> u32 {
453                 if let Self::Some(v) = self { v } else { unreachable!() }
454         }
455 }
456 #[no_mangle]
457 /// Constructs a new COption_u32Z containing a u32
458 pub extern "C" fn COption_u32Z_some(o: u32) -> COption_u32Z {
459         COption_u32Z::Some(o)
460 }
461 #[no_mangle]
462 /// Constructs a new COption_u32Z containing nothing
463 pub extern "C" fn COption_u32Z_none() -> COption_u32Z {
464         COption_u32Z::None
465 }
466 #[no_mangle]
467 /// Frees any resources associated with the u32, if we are in the Some state
468 pub extern "C" fn COption_u32Z_free(_res: COption_u32Z) { }
469 #[no_mangle]
470 /// Creates a new COption_u32Z which has the same data as `orig`
471 /// but with all dynamically-allocated buffers duplicated in new buffers.
472 pub extern "C" fn COption_u32Z_clone(orig: &COption_u32Z) -> COption_u32Z { orig.clone() }
473 #[repr(C)]
474 /// The contents of CResult_HTLCOutputInCommitmentDecodeErrorZ
475 pub union CResult_HTLCOutputInCommitmentDecodeErrorZPtr {
476         /// A pointer to the contents in the success state.
477         /// Reading from this pointer when `result_ok` is not set is undefined.
478         pub result: *mut crate::lightning::ln::chan_utils::HTLCOutputInCommitment,
479         /// A pointer to the contents in the error state.
480         /// Reading from this pointer when `result_ok` is set is undefined.
481         pub err: *mut crate::lightning::ln::msgs::DecodeError,
482 }
483 #[repr(C)]
484 /// A CResult_HTLCOutputInCommitmentDecodeErrorZ represents the result of a fallible operation,
485 /// containing a crate::lightning::ln::chan_utils::HTLCOutputInCommitment on success and a crate::lightning::ln::msgs::DecodeError on failure.
486 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
487 pub struct CResult_HTLCOutputInCommitmentDecodeErrorZ {
488         /// The contents of this CResult_HTLCOutputInCommitmentDecodeErrorZ, accessible via either
489         /// `err` or `result` depending on the state of `result_ok`.
490         pub contents: CResult_HTLCOutputInCommitmentDecodeErrorZPtr,
491         /// Whether this CResult_HTLCOutputInCommitmentDecodeErrorZ represents a success state.
492         pub result_ok: bool,
493 }
494 #[no_mangle]
495 /// Creates a new CResult_HTLCOutputInCommitmentDecodeErrorZ in the success state.
496 pub extern "C" fn CResult_HTLCOutputInCommitmentDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::HTLCOutputInCommitment) -> CResult_HTLCOutputInCommitmentDecodeErrorZ {
497         CResult_HTLCOutputInCommitmentDecodeErrorZ {
498                 contents: CResult_HTLCOutputInCommitmentDecodeErrorZPtr {
499                         result: Box::into_raw(Box::new(o)),
500                 },
501                 result_ok: true,
502         }
503 }
504 #[no_mangle]
505 /// Creates a new CResult_HTLCOutputInCommitmentDecodeErrorZ in the error state.
506 pub extern "C" fn CResult_HTLCOutputInCommitmentDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_HTLCOutputInCommitmentDecodeErrorZ {
507         CResult_HTLCOutputInCommitmentDecodeErrorZ {
508                 contents: CResult_HTLCOutputInCommitmentDecodeErrorZPtr {
509                         err: Box::into_raw(Box::new(e)),
510                 },
511                 result_ok: false,
512         }
513 }
514 #[no_mangle]
515 /// Frees any resources used by the CResult_HTLCOutputInCommitmentDecodeErrorZ.
516 pub extern "C" fn CResult_HTLCOutputInCommitmentDecodeErrorZ_free(_res: CResult_HTLCOutputInCommitmentDecodeErrorZ) { }
517 impl Drop for CResult_HTLCOutputInCommitmentDecodeErrorZ {
518         fn drop(&mut self) {
519                 if self.result_ok {
520                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
521                                 let _ = unsafe { Box::from_raw(self.contents.result) };
522                         }
523                 } else {
524                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
525                                 let _ = unsafe { Box::from_raw(self.contents.err) };
526                         }
527                 }
528         }
529 }
530 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::HTLCOutputInCommitment, crate::lightning::ln::msgs::DecodeError>> for CResult_HTLCOutputInCommitmentDecodeErrorZ {
531         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::HTLCOutputInCommitment, crate::lightning::ln::msgs::DecodeError>) -> Self {
532                 let contents = if o.result_ok {
533                         let result = unsafe { o.contents.result };
534                         unsafe { o.contents.result = std::ptr::null_mut() };
535                         CResult_HTLCOutputInCommitmentDecodeErrorZPtr { result }
536                 } else {
537                         let err = unsafe { o.contents.err };
538                         unsafe { o.contents.err = std::ptr::null_mut(); }
539                         CResult_HTLCOutputInCommitmentDecodeErrorZPtr { err }
540                 };
541                 Self {
542                         contents,
543                         result_ok: o.result_ok,
544                 }
545         }
546 }
547 impl Clone for CResult_HTLCOutputInCommitmentDecodeErrorZ {
548         fn clone(&self) -> Self {
549                 if self.result_ok {
550                         Self { result_ok: true, contents: CResult_HTLCOutputInCommitmentDecodeErrorZPtr {
551                                 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::HTLCOutputInCommitment>::clone(unsafe { &*self.contents.result })))
552                         } }
553                 } else {
554                         Self { result_ok: false, contents: CResult_HTLCOutputInCommitmentDecodeErrorZPtr {
555                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
556                         } }
557                 }
558         }
559 }
560 #[no_mangle]
561 /// Creates a new CResult_HTLCOutputInCommitmentDecodeErrorZ which has the same data as `orig`
562 /// but with all dynamically-allocated buffers duplicated in new buffers.
563 pub extern "C" fn CResult_HTLCOutputInCommitmentDecodeErrorZ_clone(orig: &CResult_HTLCOutputInCommitmentDecodeErrorZ) -> CResult_HTLCOutputInCommitmentDecodeErrorZ { orig.clone() }
564 #[repr(C)]
565 /// The contents of CResult_CounterpartyChannelTransactionParametersDecodeErrorZ
566 pub union CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr {
567         /// A pointer to the contents in the success state.
568         /// Reading from this pointer when `result_ok` is not set is undefined.
569         pub result: *mut crate::lightning::ln::chan_utils::CounterpartyChannelTransactionParameters,
570         /// A pointer to the contents in the error state.
571         /// Reading from this pointer when `result_ok` is set is undefined.
572         pub err: *mut crate::lightning::ln::msgs::DecodeError,
573 }
574 #[repr(C)]
575 /// A CResult_CounterpartyChannelTransactionParametersDecodeErrorZ represents the result of a fallible operation,
576 /// containing a crate::lightning::ln::chan_utils::CounterpartyChannelTransactionParameters on success and a crate::lightning::ln::msgs::DecodeError on failure.
577 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
578 pub struct CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
579         /// The contents of this CResult_CounterpartyChannelTransactionParametersDecodeErrorZ, accessible via either
580         /// `err` or `result` depending on the state of `result_ok`.
581         pub contents: CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr,
582         /// Whether this CResult_CounterpartyChannelTransactionParametersDecodeErrorZ represents a success state.
583         pub result_ok: bool,
584 }
585 #[no_mangle]
586 /// Creates a new CResult_CounterpartyChannelTransactionParametersDecodeErrorZ in the success state.
587 pub extern "C" fn CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::CounterpartyChannelTransactionParameters) -> CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
588         CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
589                 contents: CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr {
590                         result: Box::into_raw(Box::new(o)),
591                 },
592                 result_ok: true,
593         }
594 }
595 #[no_mangle]
596 /// Creates a new CResult_CounterpartyChannelTransactionParametersDecodeErrorZ in the error state.
597 pub extern "C" fn CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
598         CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
599                 contents: CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr {
600                         err: Box::into_raw(Box::new(e)),
601                 },
602                 result_ok: false,
603         }
604 }
605 #[no_mangle]
606 /// Frees any resources used by the CResult_CounterpartyChannelTransactionParametersDecodeErrorZ.
607 pub extern "C" fn CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_free(_res: CResult_CounterpartyChannelTransactionParametersDecodeErrorZ) { }
608 impl Drop for CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
609         fn drop(&mut self) {
610                 if self.result_ok {
611                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
612                                 let _ = unsafe { Box::from_raw(self.contents.result) };
613                         }
614                 } else {
615                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
616                                 let _ = unsafe { Box::from_raw(self.contents.err) };
617                         }
618                 }
619         }
620 }
621 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::CounterpartyChannelTransactionParameters, crate::lightning::ln::msgs::DecodeError>> for CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
622         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::CounterpartyChannelTransactionParameters, crate::lightning::ln::msgs::DecodeError>) -> Self {
623                 let contents = if o.result_ok {
624                         let result = unsafe { o.contents.result };
625                         unsafe { o.contents.result = std::ptr::null_mut() };
626                         CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr { result }
627                 } else {
628                         let err = unsafe { o.contents.err };
629                         unsafe { o.contents.err = std::ptr::null_mut(); }
630                         CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr { err }
631                 };
632                 Self {
633                         contents,
634                         result_ok: o.result_ok,
635                 }
636         }
637 }
638 impl Clone for CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
639         fn clone(&self) -> Self {
640                 if self.result_ok {
641                         Self { result_ok: true, contents: CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr {
642                                 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::CounterpartyChannelTransactionParameters>::clone(unsafe { &*self.contents.result })))
643                         } }
644                 } else {
645                         Self { result_ok: false, contents: CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr {
646                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
647                         } }
648                 }
649         }
650 }
651 #[no_mangle]
652 /// Creates a new CResult_CounterpartyChannelTransactionParametersDecodeErrorZ which has the same data as `orig`
653 /// but with all dynamically-allocated buffers duplicated in new buffers.
654 pub extern "C" fn CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone(orig: &CResult_CounterpartyChannelTransactionParametersDecodeErrorZ) -> CResult_CounterpartyChannelTransactionParametersDecodeErrorZ { orig.clone() }
655 #[repr(C)]
656 /// The contents of CResult_ChannelTransactionParametersDecodeErrorZ
657 pub union CResult_ChannelTransactionParametersDecodeErrorZPtr {
658         /// A pointer to the contents in the success state.
659         /// Reading from this pointer when `result_ok` is not set is undefined.
660         pub result: *mut crate::lightning::ln::chan_utils::ChannelTransactionParameters,
661         /// A pointer to the contents in the error state.
662         /// Reading from this pointer when `result_ok` is set is undefined.
663         pub err: *mut crate::lightning::ln::msgs::DecodeError,
664 }
665 #[repr(C)]
666 /// A CResult_ChannelTransactionParametersDecodeErrorZ represents the result of a fallible operation,
667 /// containing a crate::lightning::ln::chan_utils::ChannelTransactionParameters on success and a crate::lightning::ln::msgs::DecodeError on failure.
668 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
669 pub struct CResult_ChannelTransactionParametersDecodeErrorZ {
670         /// The contents of this CResult_ChannelTransactionParametersDecodeErrorZ, accessible via either
671         /// `err` or `result` depending on the state of `result_ok`.
672         pub contents: CResult_ChannelTransactionParametersDecodeErrorZPtr,
673         /// Whether this CResult_ChannelTransactionParametersDecodeErrorZ represents a success state.
674         pub result_ok: bool,
675 }
676 #[no_mangle]
677 /// Creates a new CResult_ChannelTransactionParametersDecodeErrorZ in the success state.
678 pub extern "C" fn CResult_ChannelTransactionParametersDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::ChannelTransactionParameters) -> CResult_ChannelTransactionParametersDecodeErrorZ {
679         CResult_ChannelTransactionParametersDecodeErrorZ {
680                 contents: CResult_ChannelTransactionParametersDecodeErrorZPtr {
681                         result: Box::into_raw(Box::new(o)),
682                 },
683                 result_ok: true,
684         }
685 }
686 #[no_mangle]
687 /// Creates a new CResult_ChannelTransactionParametersDecodeErrorZ in the error state.
688 pub extern "C" fn CResult_ChannelTransactionParametersDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelTransactionParametersDecodeErrorZ {
689         CResult_ChannelTransactionParametersDecodeErrorZ {
690                 contents: CResult_ChannelTransactionParametersDecodeErrorZPtr {
691                         err: Box::into_raw(Box::new(e)),
692                 },
693                 result_ok: false,
694         }
695 }
696 #[no_mangle]
697 /// Frees any resources used by the CResult_ChannelTransactionParametersDecodeErrorZ.
698 pub extern "C" fn CResult_ChannelTransactionParametersDecodeErrorZ_free(_res: CResult_ChannelTransactionParametersDecodeErrorZ) { }
699 impl Drop for CResult_ChannelTransactionParametersDecodeErrorZ {
700         fn drop(&mut self) {
701                 if self.result_ok {
702                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
703                                 let _ = unsafe { Box::from_raw(self.contents.result) };
704                         }
705                 } else {
706                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
707                                 let _ = unsafe { Box::from_raw(self.contents.err) };
708                         }
709                 }
710         }
711 }
712 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::ChannelTransactionParameters, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelTransactionParametersDecodeErrorZ {
713         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::ChannelTransactionParameters, crate::lightning::ln::msgs::DecodeError>) -> Self {
714                 let contents = if o.result_ok {
715                         let result = unsafe { o.contents.result };
716                         unsafe { o.contents.result = std::ptr::null_mut() };
717                         CResult_ChannelTransactionParametersDecodeErrorZPtr { result }
718                 } else {
719                         let err = unsafe { o.contents.err };
720                         unsafe { o.contents.err = std::ptr::null_mut(); }
721                         CResult_ChannelTransactionParametersDecodeErrorZPtr { err }
722                 };
723                 Self {
724                         contents,
725                         result_ok: o.result_ok,
726                 }
727         }
728 }
729 impl Clone for CResult_ChannelTransactionParametersDecodeErrorZ {
730         fn clone(&self) -> Self {
731                 if self.result_ok {
732                         Self { result_ok: true, contents: CResult_ChannelTransactionParametersDecodeErrorZPtr {
733                                 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::ChannelTransactionParameters>::clone(unsafe { &*self.contents.result })))
734                         } }
735                 } else {
736                         Self { result_ok: false, contents: CResult_ChannelTransactionParametersDecodeErrorZPtr {
737                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
738                         } }
739                 }
740         }
741 }
742 #[no_mangle]
743 /// Creates a new CResult_ChannelTransactionParametersDecodeErrorZ which has the same data as `orig`
744 /// but with all dynamically-allocated buffers duplicated in new buffers.
745 pub extern "C" fn CResult_ChannelTransactionParametersDecodeErrorZ_clone(orig: &CResult_ChannelTransactionParametersDecodeErrorZ) -> CResult_ChannelTransactionParametersDecodeErrorZ { orig.clone() }
746 #[repr(C)]
747 /// A dynamically-allocated array of crate::c_types::Signatures of arbitrary size.
748 /// This corresponds to std::vector in C++
749 pub struct CVec_SignatureZ {
750         /// The elements in the array.
751         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
752         pub data: *mut crate::c_types::Signature,
753         /// The number of elements pointed to by `data`.
754         pub datalen: usize
755 }
756 impl CVec_SignatureZ {
757         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::Signature> {
758                 if self.datalen == 0 { return Vec::new(); }
759                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
760                 self.data = std::ptr::null_mut();
761                 self.datalen = 0;
762                 ret
763         }
764         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::Signature] {
765                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
766         }
767 }
768 impl From<Vec<crate::c_types::Signature>> for CVec_SignatureZ {
769         fn from(v: Vec<crate::c_types::Signature>) -> Self {
770                 let datalen = v.len();
771                 let data = Box::into_raw(v.into_boxed_slice());
772                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
773         }
774 }
775 #[no_mangle]
776 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
777 pub extern "C" fn CVec_SignatureZ_free(_res: CVec_SignatureZ) { }
778 impl Drop for CVec_SignatureZ {
779         fn drop(&mut self) {
780                 if self.datalen == 0 { return; }
781                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
782         }
783 }
784 impl Clone for CVec_SignatureZ {
785         fn clone(&self) -> Self {
786                 let mut res = Vec::new();
787                 if self.datalen == 0 { return Self::from(res); }
788                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
789                 Self::from(res)
790         }
791 }
792 #[repr(C)]
793 /// The contents of CResult_HolderCommitmentTransactionDecodeErrorZ
794 pub union CResult_HolderCommitmentTransactionDecodeErrorZPtr {
795         /// A pointer to the contents in the success state.
796         /// Reading from this pointer when `result_ok` is not set is undefined.
797         pub result: *mut crate::lightning::ln::chan_utils::HolderCommitmentTransaction,
798         /// A pointer to the contents in the error state.
799         /// Reading from this pointer when `result_ok` is set is undefined.
800         pub err: *mut crate::lightning::ln::msgs::DecodeError,
801 }
802 #[repr(C)]
803 /// A CResult_HolderCommitmentTransactionDecodeErrorZ represents the result of a fallible operation,
804 /// containing a crate::lightning::ln::chan_utils::HolderCommitmentTransaction on success and a crate::lightning::ln::msgs::DecodeError on failure.
805 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
806 pub struct CResult_HolderCommitmentTransactionDecodeErrorZ {
807         /// The contents of this CResult_HolderCommitmentTransactionDecodeErrorZ, accessible via either
808         /// `err` or `result` depending on the state of `result_ok`.
809         pub contents: CResult_HolderCommitmentTransactionDecodeErrorZPtr,
810         /// Whether this CResult_HolderCommitmentTransactionDecodeErrorZ represents a success state.
811         pub result_ok: bool,
812 }
813 #[no_mangle]
814 /// Creates a new CResult_HolderCommitmentTransactionDecodeErrorZ in the success state.
815 pub extern "C" fn CResult_HolderCommitmentTransactionDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::HolderCommitmentTransaction) -> CResult_HolderCommitmentTransactionDecodeErrorZ {
816         CResult_HolderCommitmentTransactionDecodeErrorZ {
817                 contents: CResult_HolderCommitmentTransactionDecodeErrorZPtr {
818                         result: Box::into_raw(Box::new(o)),
819                 },
820                 result_ok: true,
821         }
822 }
823 #[no_mangle]
824 /// Creates a new CResult_HolderCommitmentTransactionDecodeErrorZ in the error state.
825 pub extern "C" fn CResult_HolderCommitmentTransactionDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_HolderCommitmentTransactionDecodeErrorZ {
826         CResult_HolderCommitmentTransactionDecodeErrorZ {
827                 contents: CResult_HolderCommitmentTransactionDecodeErrorZPtr {
828                         err: Box::into_raw(Box::new(e)),
829                 },
830                 result_ok: false,
831         }
832 }
833 #[no_mangle]
834 /// Frees any resources used by the CResult_HolderCommitmentTransactionDecodeErrorZ.
835 pub extern "C" fn CResult_HolderCommitmentTransactionDecodeErrorZ_free(_res: CResult_HolderCommitmentTransactionDecodeErrorZ) { }
836 impl Drop for CResult_HolderCommitmentTransactionDecodeErrorZ {
837         fn drop(&mut self) {
838                 if self.result_ok {
839                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
840                                 let _ = unsafe { Box::from_raw(self.contents.result) };
841                         }
842                 } else {
843                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
844                                 let _ = unsafe { Box::from_raw(self.contents.err) };
845                         }
846                 }
847         }
848 }
849 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::HolderCommitmentTransaction, crate::lightning::ln::msgs::DecodeError>> for CResult_HolderCommitmentTransactionDecodeErrorZ {
850         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::HolderCommitmentTransaction, crate::lightning::ln::msgs::DecodeError>) -> Self {
851                 let contents = if o.result_ok {
852                         let result = unsafe { o.contents.result };
853                         unsafe { o.contents.result = std::ptr::null_mut() };
854                         CResult_HolderCommitmentTransactionDecodeErrorZPtr { result }
855                 } else {
856                         let err = unsafe { o.contents.err };
857                         unsafe { o.contents.err = std::ptr::null_mut(); }
858                         CResult_HolderCommitmentTransactionDecodeErrorZPtr { err }
859                 };
860                 Self {
861                         contents,
862                         result_ok: o.result_ok,
863                 }
864         }
865 }
866 impl Clone for CResult_HolderCommitmentTransactionDecodeErrorZ {
867         fn clone(&self) -> Self {
868                 if self.result_ok {
869                         Self { result_ok: true, contents: CResult_HolderCommitmentTransactionDecodeErrorZPtr {
870                                 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::HolderCommitmentTransaction>::clone(unsafe { &*self.contents.result })))
871                         } }
872                 } else {
873                         Self { result_ok: false, contents: CResult_HolderCommitmentTransactionDecodeErrorZPtr {
874                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
875                         } }
876                 }
877         }
878 }
879 #[no_mangle]
880 /// Creates a new CResult_HolderCommitmentTransactionDecodeErrorZ which has the same data as `orig`
881 /// but with all dynamically-allocated buffers duplicated in new buffers.
882 pub extern "C" fn CResult_HolderCommitmentTransactionDecodeErrorZ_clone(orig: &CResult_HolderCommitmentTransactionDecodeErrorZ) -> CResult_HolderCommitmentTransactionDecodeErrorZ { orig.clone() }
883 #[repr(C)]
884 /// The contents of CResult_BuiltCommitmentTransactionDecodeErrorZ
885 pub union CResult_BuiltCommitmentTransactionDecodeErrorZPtr {
886         /// A pointer to the contents in the success state.
887         /// Reading from this pointer when `result_ok` is not set is undefined.
888         pub result: *mut crate::lightning::ln::chan_utils::BuiltCommitmentTransaction,
889         /// A pointer to the contents in the error state.
890         /// Reading from this pointer when `result_ok` is set is undefined.
891         pub err: *mut crate::lightning::ln::msgs::DecodeError,
892 }
893 #[repr(C)]
894 /// A CResult_BuiltCommitmentTransactionDecodeErrorZ represents the result of a fallible operation,
895 /// containing a crate::lightning::ln::chan_utils::BuiltCommitmentTransaction on success and a crate::lightning::ln::msgs::DecodeError on failure.
896 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
897 pub struct CResult_BuiltCommitmentTransactionDecodeErrorZ {
898         /// The contents of this CResult_BuiltCommitmentTransactionDecodeErrorZ, accessible via either
899         /// `err` or `result` depending on the state of `result_ok`.
900         pub contents: CResult_BuiltCommitmentTransactionDecodeErrorZPtr,
901         /// Whether this CResult_BuiltCommitmentTransactionDecodeErrorZ represents a success state.
902         pub result_ok: bool,
903 }
904 #[no_mangle]
905 /// Creates a new CResult_BuiltCommitmentTransactionDecodeErrorZ in the success state.
906 pub extern "C" fn CResult_BuiltCommitmentTransactionDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::BuiltCommitmentTransaction) -> CResult_BuiltCommitmentTransactionDecodeErrorZ {
907         CResult_BuiltCommitmentTransactionDecodeErrorZ {
908                 contents: CResult_BuiltCommitmentTransactionDecodeErrorZPtr {
909                         result: Box::into_raw(Box::new(o)),
910                 },
911                 result_ok: true,
912         }
913 }
914 #[no_mangle]
915 /// Creates a new CResult_BuiltCommitmentTransactionDecodeErrorZ in the error state.
916 pub extern "C" fn CResult_BuiltCommitmentTransactionDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_BuiltCommitmentTransactionDecodeErrorZ {
917         CResult_BuiltCommitmentTransactionDecodeErrorZ {
918                 contents: CResult_BuiltCommitmentTransactionDecodeErrorZPtr {
919                         err: Box::into_raw(Box::new(e)),
920                 },
921                 result_ok: false,
922         }
923 }
924 #[no_mangle]
925 /// Frees any resources used by the CResult_BuiltCommitmentTransactionDecodeErrorZ.
926 pub extern "C" fn CResult_BuiltCommitmentTransactionDecodeErrorZ_free(_res: CResult_BuiltCommitmentTransactionDecodeErrorZ) { }
927 impl Drop for CResult_BuiltCommitmentTransactionDecodeErrorZ {
928         fn drop(&mut self) {
929                 if self.result_ok {
930                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
931                                 let _ = unsafe { Box::from_raw(self.contents.result) };
932                         }
933                 } else {
934                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
935                                 let _ = unsafe { Box::from_raw(self.contents.err) };
936                         }
937                 }
938         }
939 }
940 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::BuiltCommitmentTransaction, crate::lightning::ln::msgs::DecodeError>> for CResult_BuiltCommitmentTransactionDecodeErrorZ {
941         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::BuiltCommitmentTransaction, crate::lightning::ln::msgs::DecodeError>) -> Self {
942                 let contents = if o.result_ok {
943                         let result = unsafe { o.contents.result };
944                         unsafe { o.contents.result = std::ptr::null_mut() };
945                         CResult_BuiltCommitmentTransactionDecodeErrorZPtr { result }
946                 } else {
947                         let err = unsafe { o.contents.err };
948                         unsafe { o.contents.err = std::ptr::null_mut(); }
949                         CResult_BuiltCommitmentTransactionDecodeErrorZPtr { err }
950                 };
951                 Self {
952                         contents,
953                         result_ok: o.result_ok,
954                 }
955         }
956 }
957 impl Clone for CResult_BuiltCommitmentTransactionDecodeErrorZ {
958         fn clone(&self) -> Self {
959                 if self.result_ok {
960                         Self { result_ok: true, contents: CResult_BuiltCommitmentTransactionDecodeErrorZPtr {
961                                 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::BuiltCommitmentTransaction>::clone(unsafe { &*self.contents.result })))
962                         } }
963                 } else {
964                         Self { result_ok: false, contents: CResult_BuiltCommitmentTransactionDecodeErrorZPtr {
965                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
966                         } }
967                 }
968         }
969 }
970 #[no_mangle]
971 /// Creates a new CResult_BuiltCommitmentTransactionDecodeErrorZ which has the same data as `orig`
972 /// but with all dynamically-allocated buffers duplicated in new buffers.
973 pub extern "C" fn CResult_BuiltCommitmentTransactionDecodeErrorZ_clone(orig: &CResult_BuiltCommitmentTransactionDecodeErrorZ) -> CResult_BuiltCommitmentTransactionDecodeErrorZ { orig.clone() }
974 #[repr(C)]
975 /// The contents of CResult_CommitmentTransactionDecodeErrorZ
976 pub union CResult_CommitmentTransactionDecodeErrorZPtr {
977         /// A pointer to the contents in the success state.
978         /// Reading from this pointer when `result_ok` is not set is undefined.
979         pub result: *mut crate::lightning::ln::chan_utils::CommitmentTransaction,
980         /// A pointer to the contents in the error state.
981         /// Reading from this pointer when `result_ok` is set is undefined.
982         pub err: *mut crate::lightning::ln::msgs::DecodeError,
983 }
984 #[repr(C)]
985 /// A CResult_CommitmentTransactionDecodeErrorZ represents the result of a fallible operation,
986 /// containing a crate::lightning::ln::chan_utils::CommitmentTransaction on success and a crate::lightning::ln::msgs::DecodeError on failure.
987 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
988 pub struct CResult_CommitmentTransactionDecodeErrorZ {
989         /// The contents of this CResult_CommitmentTransactionDecodeErrorZ, accessible via either
990         /// `err` or `result` depending on the state of `result_ok`.
991         pub contents: CResult_CommitmentTransactionDecodeErrorZPtr,
992         /// Whether this CResult_CommitmentTransactionDecodeErrorZ represents a success state.
993         pub result_ok: bool,
994 }
995 #[no_mangle]
996 /// Creates a new CResult_CommitmentTransactionDecodeErrorZ in the success state.
997 pub extern "C" fn CResult_CommitmentTransactionDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::CommitmentTransaction) -> CResult_CommitmentTransactionDecodeErrorZ {
998         CResult_CommitmentTransactionDecodeErrorZ {
999                 contents: CResult_CommitmentTransactionDecodeErrorZPtr {
1000                         result: Box::into_raw(Box::new(o)),
1001                 },
1002                 result_ok: true,
1003         }
1004 }
1005 #[no_mangle]
1006 /// Creates a new CResult_CommitmentTransactionDecodeErrorZ in the error state.
1007 pub extern "C" fn CResult_CommitmentTransactionDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_CommitmentTransactionDecodeErrorZ {
1008         CResult_CommitmentTransactionDecodeErrorZ {
1009                 contents: CResult_CommitmentTransactionDecodeErrorZPtr {
1010                         err: Box::into_raw(Box::new(e)),
1011                 },
1012                 result_ok: false,
1013         }
1014 }
1015 #[no_mangle]
1016 /// Frees any resources used by the CResult_CommitmentTransactionDecodeErrorZ.
1017 pub extern "C" fn CResult_CommitmentTransactionDecodeErrorZ_free(_res: CResult_CommitmentTransactionDecodeErrorZ) { }
1018 impl Drop for CResult_CommitmentTransactionDecodeErrorZ {
1019         fn drop(&mut self) {
1020                 if self.result_ok {
1021                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
1022                                 let _ = unsafe { Box::from_raw(self.contents.result) };
1023                         }
1024                 } else {
1025                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
1026                                 let _ = unsafe { Box::from_raw(self.contents.err) };
1027                         }
1028                 }
1029         }
1030 }
1031 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::CommitmentTransaction, crate::lightning::ln::msgs::DecodeError>> for CResult_CommitmentTransactionDecodeErrorZ {
1032         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::CommitmentTransaction, crate::lightning::ln::msgs::DecodeError>) -> Self {
1033                 let contents = if o.result_ok {
1034                         let result = unsafe { o.contents.result };
1035                         unsafe { o.contents.result = std::ptr::null_mut() };
1036                         CResult_CommitmentTransactionDecodeErrorZPtr { result }
1037                 } else {
1038                         let err = unsafe { o.contents.err };
1039                         unsafe { o.contents.err = std::ptr::null_mut(); }
1040                         CResult_CommitmentTransactionDecodeErrorZPtr { err }
1041                 };
1042                 Self {
1043                         contents,
1044                         result_ok: o.result_ok,
1045                 }
1046         }
1047 }
1048 impl Clone for CResult_CommitmentTransactionDecodeErrorZ {
1049         fn clone(&self) -> Self {
1050                 if self.result_ok {
1051                         Self { result_ok: true, contents: CResult_CommitmentTransactionDecodeErrorZPtr {
1052                                 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::CommitmentTransaction>::clone(unsafe { &*self.contents.result })))
1053                         } }
1054                 } else {
1055                         Self { result_ok: false, contents: CResult_CommitmentTransactionDecodeErrorZPtr {
1056                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
1057                         } }
1058                 }
1059         }
1060 }
1061 #[no_mangle]
1062 /// Creates a new CResult_CommitmentTransactionDecodeErrorZ which has the same data as `orig`
1063 /// but with all dynamically-allocated buffers duplicated in new buffers.
1064 pub extern "C" fn CResult_CommitmentTransactionDecodeErrorZ_clone(orig: &CResult_CommitmentTransactionDecodeErrorZ) -> CResult_CommitmentTransactionDecodeErrorZ { orig.clone() }
1065 #[repr(C)]
1066 /// The contents of CResult_TrustedCommitmentTransactionNoneZ
1067 pub union CResult_TrustedCommitmentTransactionNoneZPtr {
1068         /// A pointer to the contents in the success state.
1069         /// Reading from this pointer when `result_ok` is not set is undefined.
1070         pub result: *mut crate::lightning::ln::chan_utils::TrustedCommitmentTransaction,
1071         /// Note that this value is always NULL, as there are no contents in the Err variant
1072         pub err: *mut std::ffi::c_void,
1073 }
1074 #[repr(C)]
1075 /// A CResult_TrustedCommitmentTransactionNoneZ represents the result of a fallible operation,
1076 /// containing a crate::lightning::ln::chan_utils::TrustedCommitmentTransaction on success and a () on failure.
1077 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1078 pub struct CResult_TrustedCommitmentTransactionNoneZ {
1079         /// The contents of this CResult_TrustedCommitmentTransactionNoneZ, accessible via either
1080         /// `err` or `result` depending on the state of `result_ok`.
1081         pub contents: CResult_TrustedCommitmentTransactionNoneZPtr,
1082         /// Whether this CResult_TrustedCommitmentTransactionNoneZ represents a success state.
1083         pub result_ok: bool,
1084 }
1085 #[no_mangle]
1086 /// Creates a new CResult_TrustedCommitmentTransactionNoneZ in the success state.
1087 pub extern "C" fn CResult_TrustedCommitmentTransactionNoneZ_ok(o: crate::lightning::ln::chan_utils::TrustedCommitmentTransaction) -> CResult_TrustedCommitmentTransactionNoneZ {
1088         CResult_TrustedCommitmentTransactionNoneZ {
1089                 contents: CResult_TrustedCommitmentTransactionNoneZPtr {
1090                         result: Box::into_raw(Box::new(o)),
1091                 },
1092                 result_ok: true,
1093         }
1094 }
1095 #[no_mangle]
1096 /// Creates a new CResult_TrustedCommitmentTransactionNoneZ in the error state.
1097 pub extern "C" fn CResult_TrustedCommitmentTransactionNoneZ_err() -> CResult_TrustedCommitmentTransactionNoneZ {
1098         CResult_TrustedCommitmentTransactionNoneZ {
1099                 contents: CResult_TrustedCommitmentTransactionNoneZPtr {
1100                         err: std::ptr::null_mut(),
1101                 },
1102                 result_ok: false,
1103         }
1104 }
1105 #[no_mangle]
1106 /// Frees any resources used by the CResult_TrustedCommitmentTransactionNoneZ.
1107 pub extern "C" fn CResult_TrustedCommitmentTransactionNoneZ_free(_res: CResult_TrustedCommitmentTransactionNoneZ) { }
1108 impl Drop for CResult_TrustedCommitmentTransactionNoneZ {
1109         fn drop(&mut self) {
1110                 if self.result_ok {
1111                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
1112                                 let _ = unsafe { Box::from_raw(self.contents.result) };
1113                         }
1114                 } else {
1115                 }
1116         }
1117 }
1118 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::TrustedCommitmentTransaction, ()>> for CResult_TrustedCommitmentTransactionNoneZ {
1119         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::TrustedCommitmentTransaction, ()>) -> Self {
1120                 let contents = if o.result_ok {
1121                         let result = unsafe { o.contents.result };
1122                         unsafe { o.contents.result = std::ptr::null_mut() };
1123                         CResult_TrustedCommitmentTransactionNoneZPtr { result }
1124                 } else {
1125                         let _ = unsafe { Box::from_raw(o.contents.err) };
1126                         o.contents.err = std::ptr::null_mut();
1127                         CResult_TrustedCommitmentTransactionNoneZPtr { err: std::ptr::null_mut() }
1128                 };
1129                 Self {
1130                         contents,
1131                         result_ok: o.result_ok,
1132                 }
1133         }
1134 }
1135 #[repr(C)]
1136 /// The contents of CResult_CVec_SignatureZNoneZ
1137 pub union CResult_CVec_SignatureZNoneZPtr {
1138         /// A pointer to the contents in the success state.
1139         /// Reading from this pointer when `result_ok` is not set is undefined.
1140         pub result: *mut crate::c_types::derived::CVec_SignatureZ,
1141         /// Note that this value is always NULL, as there are no contents in the Err variant
1142         pub err: *mut std::ffi::c_void,
1143 }
1144 #[repr(C)]
1145 /// A CResult_CVec_SignatureZNoneZ represents the result of a fallible operation,
1146 /// containing a crate::c_types::derived::CVec_SignatureZ on success and a () on failure.
1147 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1148 pub struct CResult_CVec_SignatureZNoneZ {
1149         /// The contents of this CResult_CVec_SignatureZNoneZ, accessible via either
1150         /// `err` or `result` depending on the state of `result_ok`.
1151         pub contents: CResult_CVec_SignatureZNoneZPtr,
1152         /// Whether this CResult_CVec_SignatureZNoneZ represents a success state.
1153         pub result_ok: bool,
1154 }
1155 #[no_mangle]
1156 /// Creates a new CResult_CVec_SignatureZNoneZ in the success state.
1157 pub extern "C" fn CResult_CVec_SignatureZNoneZ_ok(o: crate::c_types::derived::CVec_SignatureZ) -> CResult_CVec_SignatureZNoneZ {
1158         CResult_CVec_SignatureZNoneZ {
1159                 contents: CResult_CVec_SignatureZNoneZPtr {
1160                         result: Box::into_raw(Box::new(o)),
1161                 },
1162                 result_ok: true,
1163         }
1164 }
1165 #[no_mangle]
1166 /// Creates a new CResult_CVec_SignatureZNoneZ in the error state.
1167 pub extern "C" fn CResult_CVec_SignatureZNoneZ_err() -> CResult_CVec_SignatureZNoneZ {
1168         CResult_CVec_SignatureZNoneZ {
1169                 contents: CResult_CVec_SignatureZNoneZPtr {
1170                         err: std::ptr::null_mut(),
1171                 },
1172                 result_ok: false,
1173         }
1174 }
1175 #[no_mangle]
1176 /// Frees any resources used by the CResult_CVec_SignatureZNoneZ.
1177 pub extern "C" fn CResult_CVec_SignatureZNoneZ_free(_res: CResult_CVec_SignatureZNoneZ) { }
1178 impl Drop for CResult_CVec_SignatureZNoneZ {
1179         fn drop(&mut self) {
1180                 if self.result_ok {
1181                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
1182                                 let _ = unsafe { Box::from_raw(self.contents.result) };
1183                         }
1184                 } else {
1185                 }
1186         }
1187 }
1188 impl From<crate::c_types::CResultTempl<crate::c_types::derived::CVec_SignatureZ, ()>> for CResult_CVec_SignatureZNoneZ {
1189         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CVec_SignatureZ, ()>) -> Self {
1190                 let contents = if o.result_ok {
1191                         let result = unsafe { o.contents.result };
1192                         unsafe { o.contents.result = std::ptr::null_mut() };
1193                         CResult_CVec_SignatureZNoneZPtr { result }
1194                 } else {
1195                         let _ = unsafe { Box::from_raw(o.contents.err) };
1196                         o.contents.err = std::ptr::null_mut();
1197                         CResult_CVec_SignatureZNoneZPtr { err: std::ptr::null_mut() }
1198                 };
1199                 Self {
1200                         contents,
1201                         result_ok: o.result_ok,
1202                 }
1203         }
1204 }
1205 impl Clone for CResult_CVec_SignatureZNoneZ {
1206         fn clone(&self) -> Self {
1207                 if self.result_ok {
1208                         Self { result_ok: true, contents: CResult_CVec_SignatureZNoneZPtr {
1209                                 result: Box::into_raw(Box::new(<crate::c_types::derived::CVec_SignatureZ>::clone(unsafe { &*self.contents.result })))
1210                         } }
1211                 } else {
1212                         Self { result_ok: false, contents: CResult_CVec_SignatureZNoneZPtr {
1213                                 err: std::ptr::null_mut()
1214                         } }
1215                 }
1216         }
1217 }
1218 #[no_mangle]
1219 /// Creates a new CResult_CVec_SignatureZNoneZ which has the same data as `orig`
1220 /// but with all dynamically-allocated buffers duplicated in new buffers.
1221 pub extern "C" fn CResult_CVec_SignatureZNoneZ_clone(orig: &CResult_CVec_SignatureZNoneZ) -> CResult_CVec_SignatureZNoneZ { orig.clone() }
1222 #[repr(C)]
1223 /// The contents of CResult_ShutdownScriptDecodeErrorZ
1224 pub union CResult_ShutdownScriptDecodeErrorZPtr {
1225         /// A pointer to the contents in the success state.
1226         /// Reading from this pointer when `result_ok` is not set is undefined.
1227         pub result: *mut crate::lightning::ln::script::ShutdownScript,
1228         /// A pointer to the contents in the error state.
1229         /// Reading from this pointer when `result_ok` is set is undefined.
1230         pub err: *mut crate::lightning::ln::msgs::DecodeError,
1231 }
1232 #[repr(C)]
1233 /// A CResult_ShutdownScriptDecodeErrorZ represents the result of a fallible operation,
1234 /// containing a crate::lightning::ln::script::ShutdownScript on success and a crate::lightning::ln::msgs::DecodeError on failure.
1235 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1236 pub struct CResult_ShutdownScriptDecodeErrorZ {
1237         /// The contents of this CResult_ShutdownScriptDecodeErrorZ, accessible via either
1238         /// `err` or `result` depending on the state of `result_ok`.
1239         pub contents: CResult_ShutdownScriptDecodeErrorZPtr,
1240         /// Whether this CResult_ShutdownScriptDecodeErrorZ represents a success state.
1241         pub result_ok: bool,
1242 }
1243 #[no_mangle]
1244 /// Creates a new CResult_ShutdownScriptDecodeErrorZ in the success state.
1245 pub extern "C" fn CResult_ShutdownScriptDecodeErrorZ_ok(o: crate::lightning::ln::script::ShutdownScript) -> CResult_ShutdownScriptDecodeErrorZ {
1246         CResult_ShutdownScriptDecodeErrorZ {
1247                 contents: CResult_ShutdownScriptDecodeErrorZPtr {
1248                         result: Box::into_raw(Box::new(o)),
1249                 },
1250                 result_ok: true,
1251         }
1252 }
1253 #[no_mangle]
1254 /// Creates a new CResult_ShutdownScriptDecodeErrorZ in the error state.
1255 pub extern "C" fn CResult_ShutdownScriptDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ShutdownScriptDecodeErrorZ {
1256         CResult_ShutdownScriptDecodeErrorZ {
1257                 contents: CResult_ShutdownScriptDecodeErrorZPtr {
1258                         err: Box::into_raw(Box::new(e)),
1259                 },
1260                 result_ok: false,
1261         }
1262 }
1263 #[no_mangle]
1264 /// Frees any resources used by the CResult_ShutdownScriptDecodeErrorZ.
1265 pub extern "C" fn CResult_ShutdownScriptDecodeErrorZ_free(_res: CResult_ShutdownScriptDecodeErrorZ) { }
1266 impl Drop for CResult_ShutdownScriptDecodeErrorZ {
1267         fn drop(&mut self) {
1268                 if self.result_ok {
1269                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
1270                                 let _ = unsafe { Box::from_raw(self.contents.result) };
1271                         }
1272                 } else {
1273                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
1274                                 let _ = unsafe { Box::from_raw(self.contents.err) };
1275                         }
1276                 }
1277         }
1278 }
1279 impl From<crate::c_types::CResultTempl<crate::lightning::ln::script::ShutdownScript, crate::lightning::ln::msgs::DecodeError>> for CResult_ShutdownScriptDecodeErrorZ {
1280         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::script::ShutdownScript, crate::lightning::ln::msgs::DecodeError>) -> Self {
1281                 let contents = if o.result_ok {
1282                         let result = unsafe { o.contents.result };
1283                         unsafe { o.contents.result = std::ptr::null_mut() };
1284                         CResult_ShutdownScriptDecodeErrorZPtr { result }
1285                 } else {
1286                         let err = unsafe { o.contents.err };
1287                         unsafe { o.contents.err = std::ptr::null_mut(); }
1288                         CResult_ShutdownScriptDecodeErrorZPtr { err }
1289                 };
1290                 Self {
1291                         contents,
1292                         result_ok: o.result_ok,
1293                 }
1294         }
1295 }
1296 impl Clone for CResult_ShutdownScriptDecodeErrorZ {
1297         fn clone(&self) -> Self {
1298                 if self.result_ok {
1299                         Self { result_ok: true, contents: CResult_ShutdownScriptDecodeErrorZPtr {
1300                                 result: Box::into_raw(Box::new(<crate::lightning::ln::script::ShutdownScript>::clone(unsafe { &*self.contents.result })))
1301                         } }
1302                 } else {
1303                         Self { result_ok: false, contents: CResult_ShutdownScriptDecodeErrorZPtr {
1304                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
1305                         } }
1306                 }
1307         }
1308 }
1309 #[no_mangle]
1310 /// Creates a new CResult_ShutdownScriptDecodeErrorZ which has the same data as `orig`
1311 /// but with all dynamically-allocated buffers duplicated in new buffers.
1312 pub extern "C" fn CResult_ShutdownScriptDecodeErrorZ_clone(orig: &CResult_ShutdownScriptDecodeErrorZ) -> CResult_ShutdownScriptDecodeErrorZ { orig.clone() }
1313 #[repr(C)]
1314 /// The contents of CResult_ShutdownScriptInvalidShutdownScriptZ
1315 pub union CResult_ShutdownScriptInvalidShutdownScriptZPtr {
1316         /// A pointer to the contents in the success state.
1317         /// Reading from this pointer when `result_ok` is not set is undefined.
1318         pub result: *mut crate::lightning::ln::script::ShutdownScript,
1319         /// A pointer to the contents in the error state.
1320         /// Reading from this pointer when `result_ok` is set is undefined.
1321         pub err: *mut crate::lightning::ln::script::InvalidShutdownScript,
1322 }
1323 #[repr(C)]
1324 /// A CResult_ShutdownScriptInvalidShutdownScriptZ represents the result of a fallible operation,
1325 /// containing a crate::lightning::ln::script::ShutdownScript on success and a crate::lightning::ln::script::InvalidShutdownScript on failure.
1326 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1327 pub struct CResult_ShutdownScriptInvalidShutdownScriptZ {
1328         /// The contents of this CResult_ShutdownScriptInvalidShutdownScriptZ, accessible via either
1329         /// `err` or `result` depending on the state of `result_ok`.
1330         pub contents: CResult_ShutdownScriptInvalidShutdownScriptZPtr,
1331         /// Whether this CResult_ShutdownScriptInvalidShutdownScriptZ represents a success state.
1332         pub result_ok: bool,
1333 }
1334 #[no_mangle]
1335 /// Creates a new CResult_ShutdownScriptInvalidShutdownScriptZ in the success state.
1336 pub extern "C" fn CResult_ShutdownScriptInvalidShutdownScriptZ_ok(o: crate::lightning::ln::script::ShutdownScript) -> CResult_ShutdownScriptInvalidShutdownScriptZ {
1337         CResult_ShutdownScriptInvalidShutdownScriptZ {
1338                 contents: CResult_ShutdownScriptInvalidShutdownScriptZPtr {
1339                         result: Box::into_raw(Box::new(o)),
1340                 },
1341                 result_ok: true,
1342         }
1343 }
1344 #[no_mangle]
1345 /// Creates a new CResult_ShutdownScriptInvalidShutdownScriptZ in the error state.
1346 pub extern "C" fn CResult_ShutdownScriptInvalidShutdownScriptZ_err(e: crate::lightning::ln::script::InvalidShutdownScript) -> CResult_ShutdownScriptInvalidShutdownScriptZ {
1347         CResult_ShutdownScriptInvalidShutdownScriptZ {
1348                 contents: CResult_ShutdownScriptInvalidShutdownScriptZPtr {
1349                         err: Box::into_raw(Box::new(e)),
1350                 },
1351                 result_ok: false,
1352         }
1353 }
1354 #[no_mangle]
1355 /// Frees any resources used by the CResult_ShutdownScriptInvalidShutdownScriptZ.
1356 pub extern "C" fn CResult_ShutdownScriptInvalidShutdownScriptZ_free(_res: CResult_ShutdownScriptInvalidShutdownScriptZ) { }
1357 impl Drop for CResult_ShutdownScriptInvalidShutdownScriptZ {
1358         fn drop(&mut self) {
1359                 if self.result_ok {
1360                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
1361                                 let _ = unsafe { Box::from_raw(self.contents.result) };
1362                         }
1363                 } else {
1364                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
1365                                 let _ = unsafe { Box::from_raw(self.contents.err) };
1366                         }
1367                 }
1368         }
1369 }
1370 impl From<crate::c_types::CResultTempl<crate::lightning::ln::script::ShutdownScript, crate::lightning::ln::script::InvalidShutdownScript>> for CResult_ShutdownScriptInvalidShutdownScriptZ {
1371         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::script::ShutdownScript, crate::lightning::ln::script::InvalidShutdownScript>) -> Self {
1372                 let contents = if o.result_ok {
1373                         let result = unsafe { o.contents.result };
1374                         unsafe { o.contents.result = std::ptr::null_mut() };
1375                         CResult_ShutdownScriptInvalidShutdownScriptZPtr { result }
1376                 } else {
1377                         let err = unsafe { o.contents.err };
1378                         unsafe { o.contents.err = std::ptr::null_mut(); }
1379                         CResult_ShutdownScriptInvalidShutdownScriptZPtr { err }
1380                 };
1381                 Self {
1382                         contents,
1383                         result_ok: o.result_ok,
1384                 }
1385         }
1386 }
1387 #[repr(C)]
1388 /// The contents of CResult_NoneErrorZ
1389 pub union CResult_NoneErrorZPtr {
1390         /// Note that this value is always NULL, as there are no contents in the OK variant
1391         pub result: *mut std::ffi::c_void,
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::c_types::IOError,
1395 }
1396 #[repr(C)]
1397 /// A CResult_NoneErrorZ represents the result of a fallible operation,
1398 /// containing a () on success and a crate::c_types::IOError on failure.
1399 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1400 pub struct CResult_NoneErrorZ {
1401         /// The contents of this CResult_NoneErrorZ, accessible via either
1402         /// `err` or `result` depending on the state of `result_ok`.
1403         pub contents: CResult_NoneErrorZPtr,
1404         /// Whether this CResult_NoneErrorZ represents a success state.
1405         pub result_ok: bool,
1406 }
1407 #[no_mangle]
1408 /// Creates a new CResult_NoneErrorZ in the success state.
1409 pub extern "C" fn CResult_NoneErrorZ_ok() -> CResult_NoneErrorZ {
1410         CResult_NoneErrorZ {
1411                 contents: CResult_NoneErrorZPtr {
1412                         result: std::ptr::null_mut(),
1413                 },
1414                 result_ok: true,
1415         }
1416 }
1417 #[no_mangle]
1418 /// Creates a new CResult_NoneErrorZ in the error state.
1419 pub extern "C" fn CResult_NoneErrorZ_err(e: crate::c_types::IOError) -> CResult_NoneErrorZ {
1420         CResult_NoneErrorZ {
1421                 contents: CResult_NoneErrorZPtr {
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_NoneErrorZ.
1429 pub extern "C" fn CResult_NoneErrorZ_free(_res: CResult_NoneErrorZ) { }
1430 impl Drop for CResult_NoneErrorZ {
1431         fn drop(&mut self) {
1432                 if self.result_ok {
1433                 } else {
1434                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
1435                                 let _ = unsafe { Box::from_raw(self.contents.err) };
1436                         }
1437                 }
1438         }
1439 }
1440 impl From<crate::c_types::CResultTempl<(), crate::c_types::IOError>> for CResult_NoneErrorZ {
1441         fn from(mut o: crate::c_types::CResultTempl<(), crate::c_types::IOError>) -> Self {
1442                 let contents = if o.result_ok {
1443                         let _ = unsafe { Box::from_raw(o.contents.result) };
1444                         o.contents.result = std::ptr::null_mut();
1445                         CResult_NoneErrorZPtr { result: std::ptr::null_mut() }
1446                 } else {
1447                         let err = unsafe { o.contents.err };
1448                         unsafe { o.contents.err = std::ptr::null_mut(); }
1449                         CResult_NoneErrorZPtr { err }
1450                 };
1451                 Self {
1452                         contents,
1453                         result_ok: o.result_ok,
1454                 }
1455         }
1456 }
1457 impl Clone for CResult_NoneErrorZ {
1458         fn clone(&self) -> Self {
1459                 if self.result_ok {
1460                         Self { result_ok: true, contents: CResult_NoneErrorZPtr {
1461                                 result: std::ptr::null_mut()
1462                         } }
1463                 } else {
1464                         Self { result_ok: false, contents: CResult_NoneErrorZPtr {
1465                                 err: Box::into_raw(Box::new(<crate::c_types::IOError>::clone(unsafe { &*self.contents.err })))
1466                         } }
1467                 }
1468         }
1469 }
1470 #[no_mangle]
1471 /// Creates a new CResult_NoneErrorZ which has the same data as `orig`
1472 /// but with all dynamically-allocated buffers duplicated in new buffers.
1473 pub extern "C" fn CResult_NoneErrorZ_clone(orig: &CResult_NoneErrorZ) -> CResult_NoneErrorZ { orig.clone() }
1474 #[repr(C)]
1475 /// The contents of CResult_RouteHopDecodeErrorZ
1476 pub union CResult_RouteHopDecodeErrorZPtr {
1477         /// A pointer to the contents in the success state.
1478         /// Reading from this pointer when `result_ok` is not set is undefined.
1479         pub result: *mut crate::lightning::routing::router::RouteHop,
1480         /// A pointer to the contents in the error state.
1481         /// Reading from this pointer when `result_ok` is set is undefined.
1482         pub err: *mut crate::lightning::ln::msgs::DecodeError,
1483 }
1484 #[repr(C)]
1485 /// A CResult_RouteHopDecodeErrorZ represents the result of a fallible operation,
1486 /// containing a crate::lightning::routing::router::RouteHop on success and a crate::lightning::ln::msgs::DecodeError on failure.
1487 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1488 pub struct CResult_RouteHopDecodeErrorZ {
1489         /// The contents of this CResult_RouteHopDecodeErrorZ, accessible via either
1490         /// `err` or `result` depending on the state of `result_ok`.
1491         pub contents: CResult_RouteHopDecodeErrorZPtr,
1492         /// Whether this CResult_RouteHopDecodeErrorZ represents a success state.
1493         pub result_ok: bool,
1494 }
1495 #[no_mangle]
1496 /// Creates a new CResult_RouteHopDecodeErrorZ in the success state.
1497 pub extern "C" fn CResult_RouteHopDecodeErrorZ_ok(o: crate::lightning::routing::router::RouteHop) -> CResult_RouteHopDecodeErrorZ {
1498         CResult_RouteHopDecodeErrorZ {
1499                 contents: CResult_RouteHopDecodeErrorZPtr {
1500                         result: Box::into_raw(Box::new(o)),
1501                 },
1502                 result_ok: true,
1503         }
1504 }
1505 #[no_mangle]
1506 /// Creates a new CResult_RouteHopDecodeErrorZ in the error state.
1507 pub extern "C" fn CResult_RouteHopDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RouteHopDecodeErrorZ {
1508         CResult_RouteHopDecodeErrorZ {
1509                 contents: CResult_RouteHopDecodeErrorZPtr {
1510                         err: Box::into_raw(Box::new(e)),
1511                 },
1512                 result_ok: false,
1513         }
1514 }
1515 #[no_mangle]
1516 /// Frees any resources used by the CResult_RouteHopDecodeErrorZ.
1517 pub extern "C" fn CResult_RouteHopDecodeErrorZ_free(_res: CResult_RouteHopDecodeErrorZ) { }
1518 impl Drop for CResult_RouteHopDecodeErrorZ {
1519         fn drop(&mut self) {
1520                 if self.result_ok {
1521                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
1522                                 let _ = unsafe { Box::from_raw(self.contents.result) };
1523                         }
1524                 } else {
1525                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
1526                                 let _ = unsafe { Box::from_raw(self.contents.err) };
1527                         }
1528                 }
1529         }
1530 }
1531 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::RouteHop, crate::lightning::ln::msgs::DecodeError>> for CResult_RouteHopDecodeErrorZ {
1532         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::RouteHop, crate::lightning::ln::msgs::DecodeError>) -> Self {
1533                 let contents = if o.result_ok {
1534                         let result = unsafe { o.contents.result };
1535                         unsafe { o.contents.result = std::ptr::null_mut() };
1536                         CResult_RouteHopDecodeErrorZPtr { result }
1537                 } else {
1538                         let err = unsafe { o.contents.err };
1539                         unsafe { o.contents.err = std::ptr::null_mut(); }
1540                         CResult_RouteHopDecodeErrorZPtr { err }
1541                 };
1542                 Self {
1543                         contents,
1544                         result_ok: o.result_ok,
1545                 }
1546         }
1547 }
1548 impl Clone for CResult_RouteHopDecodeErrorZ {
1549         fn clone(&self) -> Self {
1550                 if self.result_ok {
1551                         Self { result_ok: true, contents: CResult_RouteHopDecodeErrorZPtr {
1552                                 result: Box::into_raw(Box::new(<crate::lightning::routing::router::RouteHop>::clone(unsafe { &*self.contents.result })))
1553                         } }
1554                 } else {
1555                         Self { result_ok: false, contents: CResult_RouteHopDecodeErrorZPtr {
1556                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
1557                         } }
1558                 }
1559         }
1560 }
1561 #[no_mangle]
1562 /// Creates a new CResult_RouteHopDecodeErrorZ which has the same data as `orig`
1563 /// but with all dynamically-allocated buffers duplicated in new buffers.
1564 pub extern "C" fn CResult_RouteHopDecodeErrorZ_clone(orig: &CResult_RouteHopDecodeErrorZ) -> CResult_RouteHopDecodeErrorZ { orig.clone() }
1565 #[repr(C)]
1566 /// A dynamically-allocated array of crate::lightning::routing::router::RouteHops of arbitrary size.
1567 /// This corresponds to std::vector in C++
1568 pub struct CVec_RouteHopZ {
1569         /// The elements in the array.
1570         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
1571         pub data: *mut crate::lightning::routing::router::RouteHop,
1572         /// The number of elements pointed to by `data`.
1573         pub datalen: usize
1574 }
1575 impl CVec_RouteHopZ {
1576         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::routing::router::RouteHop> {
1577                 if self.datalen == 0 { return Vec::new(); }
1578                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
1579                 self.data = std::ptr::null_mut();
1580                 self.datalen = 0;
1581                 ret
1582         }
1583         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::routing::router::RouteHop] {
1584                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
1585         }
1586 }
1587 impl From<Vec<crate::lightning::routing::router::RouteHop>> for CVec_RouteHopZ {
1588         fn from(v: Vec<crate::lightning::routing::router::RouteHop>) -> Self {
1589                 let datalen = v.len();
1590                 let data = Box::into_raw(v.into_boxed_slice());
1591                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
1592         }
1593 }
1594 #[no_mangle]
1595 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
1596 pub extern "C" fn CVec_RouteHopZ_free(_res: CVec_RouteHopZ) { }
1597 impl Drop for CVec_RouteHopZ {
1598         fn drop(&mut self) {
1599                 if self.datalen == 0 { return; }
1600                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
1601         }
1602 }
1603 impl Clone for CVec_RouteHopZ {
1604         fn clone(&self) -> Self {
1605                 let mut res = Vec::new();
1606                 if self.datalen == 0 { return Self::from(res); }
1607                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
1608                 Self::from(res)
1609         }
1610 }
1611 #[repr(C)]
1612 /// A dynamically-allocated array of crate::c_types::derived::CVec_RouteHopZs of arbitrary size.
1613 /// This corresponds to std::vector in C++
1614 pub struct CVec_CVec_RouteHopZZ {
1615         /// The elements in the array.
1616         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
1617         pub data: *mut crate::c_types::derived::CVec_RouteHopZ,
1618         /// The number of elements pointed to by `data`.
1619         pub datalen: usize
1620 }
1621 impl CVec_CVec_RouteHopZZ {
1622         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::CVec_RouteHopZ> {
1623                 if self.datalen == 0 { return Vec::new(); }
1624                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
1625                 self.data = std::ptr::null_mut();
1626                 self.datalen = 0;
1627                 ret
1628         }
1629         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::CVec_RouteHopZ] {
1630                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
1631         }
1632 }
1633 impl From<Vec<crate::c_types::derived::CVec_RouteHopZ>> for CVec_CVec_RouteHopZZ {
1634         fn from(v: Vec<crate::c_types::derived::CVec_RouteHopZ>) -> Self {
1635                 let datalen = v.len();
1636                 let data = Box::into_raw(v.into_boxed_slice());
1637                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
1638         }
1639 }
1640 #[no_mangle]
1641 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
1642 pub extern "C" fn CVec_CVec_RouteHopZZ_free(_res: CVec_CVec_RouteHopZZ) { }
1643 impl Drop for CVec_CVec_RouteHopZZ {
1644         fn drop(&mut self) {
1645                 if self.datalen == 0 { return; }
1646                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
1647         }
1648 }
1649 impl Clone for CVec_CVec_RouteHopZZ {
1650         fn clone(&self) -> Self {
1651                 let mut res = Vec::new();
1652                 if self.datalen == 0 { return Self::from(res); }
1653                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
1654                 Self::from(res)
1655         }
1656 }
1657 #[repr(C)]
1658 /// The contents of CResult_RouteDecodeErrorZ
1659 pub union CResult_RouteDecodeErrorZPtr {
1660         /// A pointer to the contents in the success state.
1661         /// Reading from this pointer when `result_ok` is not set is undefined.
1662         pub result: *mut crate::lightning::routing::router::Route,
1663         /// A pointer to the contents in the error state.
1664         /// Reading from this pointer when `result_ok` is set is undefined.
1665         pub err: *mut crate::lightning::ln::msgs::DecodeError,
1666 }
1667 #[repr(C)]
1668 /// A CResult_RouteDecodeErrorZ represents the result of a fallible operation,
1669 /// containing a crate::lightning::routing::router::Route on success and a crate::lightning::ln::msgs::DecodeError on failure.
1670 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1671 pub struct CResult_RouteDecodeErrorZ {
1672         /// The contents of this CResult_RouteDecodeErrorZ, accessible via either
1673         /// `err` or `result` depending on the state of `result_ok`.
1674         pub contents: CResult_RouteDecodeErrorZPtr,
1675         /// Whether this CResult_RouteDecodeErrorZ represents a success state.
1676         pub result_ok: bool,
1677 }
1678 #[no_mangle]
1679 /// Creates a new CResult_RouteDecodeErrorZ in the success state.
1680 pub extern "C" fn CResult_RouteDecodeErrorZ_ok(o: crate::lightning::routing::router::Route) -> CResult_RouteDecodeErrorZ {
1681         CResult_RouteDecodeErrorZ {
1682                 contents: CResult_RouteDecodeErrorZPtr {
1683                         result: Box::into_raw(Box::new(o)),
1684                 },
1685                 result_ok: true,
1686         }
1687 }
1688 #[no_mangle]
1689 /// Creates a new CResult_RouteDecodeErrorZ in the error state.
1690 pub extern "C" fn CResult_RouteDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RouteDecodeErrorZ {
1691         CResult_RouteDecodeErrorZ {
1692                 contents: CResult_RouteDecodeErrorZPtr {
1693                         err: Box::into_raw(Box::new(e)),
1694                 },
1695                 result_ok: false,
1696         }
1697 }
1698 #[no_mangle]
1699 /// Frees any resources used by the CResult_RouteDecodeErrorZ.
1700 pub extern "C" fn CResult_RouteDecodeErrorZ_free(_res: CResult_RouteDecodeErrorZ) { }
1701 impl Drop for CResult_RouteDecodeErrorZ {
1702         fn drop(&mut self) {
1703                 if self.result_ok {
1704                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
1705                                 let _ = unsafe { Box::from_raw(self.contents.result) };
1706                         }
1707                 } else {
1708                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
1709                                 let _ = unsafe { Box::from_raw(self.contents.err) };
1710                         }
1711                 }
1712         }
1713 }
1714 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::Route, crate::lightning::ln::msgs::DecodeError>> for CResult_RouteDecodeErrorZ {
1715         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::Route, crate::lightning::ln::msgs::DecodeError>) -> Self {
1716                 let contents = if o.result_ok {
1717                         let result = unsafe { o.contents.result };
1718                         unsafe { o.contents.result = std::ptr::null_mut() };
1719                         CResult_RouteDecodeErrorZPtr { result }
1720                 } else {
1721                         let err = unsafe { o.contents.err };
1722                         unsafe { o.contents.err = std::ptr::null_mut(); }
1723                         CResult_RouteDecodeErrorZPtr { err }
1724                 };
1725                 Self {
1726                         contents,
1727                         result_ok: o.result_ok,
1728                 }
1729         }
1730 }
1731 impl Clone for CResult_RouteDecodeErrorZ {
1732         fn clone(&self) -> Self {
1733                 if self.result_ok {
1734                         Self { result_ok: true, contents: CResult_RouteDecodeErrorZPtr {
1735                                 result: Box::into_raw(Box::new(<crate::lightning::routing::router::Route>::clone(unsafe { &*self.contents.result })))
1736                         } }
1737                 } else {
1738                         Self { result_ok: false, contents: CResult_RouteDecodeErrorZPtr {
1739                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
1740                         } }
1741                 }
1742         }
1743 }
1744 #[no_mangle]
1745 /// Creates a new CResult_RouteDecodeErrorZ which has the same data as `orig`
1746 /// but with all dynamically-allocated buffers duplicated in new buffers.
1747 pub extern "C" fn CResult_RouteDecodeErrorZ_clone(orig: &CResult_RouteDecodeErrorZ) -> CResult_RouteDecodeErrorZ { orig.clone() }
1748 #[repr(C)]
1749 #[derive(Clone)]
1750 /// An enum which can either contain a u64 or not
1751 pub enum COption_u64Z {
1752         /// When we're in this state, this COption_u64Z contains a u64
1753         Some(u64),
1754         /// When we're in this state, this COption_u64Z contains nothing
1755         None
1756 }
1757 impl COption_u64Z {
1758         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
1759                 if let Self::Some(_) = self { true } else { false }
1760         }
1761         #[allow(unused)] pub(crate) fn take(mut self) -> u64 {
1762                 if let Self::Some(v) = self { v } else { unreachable!() }
1763         }
1764 }
1765 #[no_mangle]
1766 /// Constructs a new COption_u64Z containing a u64
1767 pub extern "C" fn COption_u64Z_some(o: u64) -> COption_u64Z {
1768         COption_u64Z::Some(o)
1769 }
1770 #[no_mangle]
1771 /// Constructs a new COption_u64Z containing nothing
1772 pub extern "C" fn COption_u64Z_none() -> COption_u64Z {
1773         COption_u64Z::None
1774 }
1775 #[no_mangle]
1776 /// Frees any resources associated with the u64, if we are in the Some state
1777 pub extern "C" fn COption_u64Z_free(_res: COption_u64Z) { }
1778 #[no_mangle]
1779 /// Creates a new COption_u64Z which has the same data as `orig`
1780 /// but with all dynamically-allocated buffers duplicated in new buffers.
1781 pub extern "C" fn COption_u64Z_clone(orig: &COption_u64Z) -> COption_u64Z { orig.clone() }
1782 #[repr(C)]
1783 /// A dynamically-allocated array of crate::lightning::ln::channelmanager::ChannelDetailss of arbitrary size.
1784 /// This corresponds to std::vector in C++
1785 pub struct CVec_ChannelDetailsZ {
1786         /// The elements in the array.
1787         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
1788         pub data: *mut crate::lightning::ln::channelmanager::ChannelDetails,
1789         /// The number of elements pointed to by `data`.
1790         pub datalen: usize
1791 }
1792 impl CVec_ChannelDetailsZ {
1793         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::channelmanager::ChannelDetails> {
1794                 if self.datalen == 0 { return Vec::new(); }
1795                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
1796                 self.data = std::ptr::null_mut();
1797                 self.datalen = 0;
1798                 ret
1799         }
1800         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::channelmanager::ChannelDetails] {
1801                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
1802         }
1803 }
1804 impl From<Vec<crate::lightning::ln::channelmanager::ChannelDetails>> for CVec_ChannelDetailsZ {
1805         fn from(v: Vec<crate::lightning::ln::channelmanager::ChannelDetails>) -> Self {
1806                 let datalen = v.len();
1807                 let data = Box::into_raw(v.into_boxed_slice());
1808                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
1809         }
1810 }
1811 #[no_mangle]
1812 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
1813 pub extern "C" fn CVec_ChannelDetailsZ_free(_res: CVec_ChannelDetailsZ) { }
1814 impl Drop for CVec_ChannelDetailsZ {
1815         fn drop(&mut self) {
1816                 if self.datalen == 0 { return; }
1817                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
1818         }
1819 }
1820 impl Clone for CVec_ChannelDetailsZ {
1821         fn clone(&self) -> Self {
1822                 let mut res = Vec::new();
1823                 if self.datalen == 0 { return Self::from(res); }
1824                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
1825                 Self::from(res)
1826         }
1827 }
1828 #[repr(C)]
1829 /// A dynamically-allocated array of crate::lightning::routing::router::RouteHints of arbitrary size.
1830 /// This corresponds to std::vector in C++
1831 pub struct CVec_RouteHintZ {
1832         /// The elements in the array.
1833         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
1834         pub data: *mut crate::lightning::routing::router::RouteHint,
1835         /// The number of elements pointed to by `data`.
1836         pub datalen: usize
1837 }
1838 impl CVec_RouteHintZ {
1839         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::routing::router::RouteHint> {
1840                 if self.datalen == 0 { return Vec::new(); }
1841                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
1842                 self.data = std::ptr::null_mut();
1843                 self.datalen = 0;
1844                 ret
1845         }
1846         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::routing::router::RouteHint] {
1847                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
1848         }
1849 }
1850 impl From<Vec<crate::lightning::routing::router::RouteHint>> for CVec_RouteHintZ {
1851         fn from(v: Vec<crate::lightning::routing::router::RouteHint>) -> Self {
1852                 let datalen = v.len();
1853                 let data = Box::into_raw(v.into_boxed_slice());
1854                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
1855         }
1856 }
1857 #[no_mangle]
1858 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
1859 pub extern "C" fn CVec_RouteHintZ_free(_res: CVec_RouteHintZ) { }
1860 impl Drop for CVec_RouteHintZ {
1861         fn drop(&mut self) {
1862                 if self.datalen == 0 { return; }
1863                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
1864         }
1865 }
1866 impl Clone for CVec_RouteHintZ {
1867         fn clone(&self) -> Self {
1868                 let mut res = Vec::new();
1869                 if self.datalen == 0 { return Self::from(res); }
1870                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
1871                 Self::from(res)
1872         }
1873 }
1874 #[repr(C)]
1875 /// The contents of CResult_RouteLightningErrorZ
1876 pub union CResult_RouteLightningErrorZPtr {
1877         /// A pointer to the contents in the success state.
1878         /// Reading from this pointer when `result_ok` is not set is undefined.
1879         pub result: *mut crate::lightning::routing::router::Route,
1880         /// A pointer to the contents in the error state.
1881         /// Reading from this pointer when `result_ok` is set is undefined.
1882         pub err: *mut crate::lightning::ln::msgs::LightningError,
1883 }
1884 #[repr(C)]
1885 /// A CResult_RouteLightningErrorZ represents the result of a fallible operation,
1886 /// containing a crate::lightning::routing::router::Route on success and a crate::lightning::ln::msgs::LightningError on failure.
1887 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1888 pub struct CResult_RouteLightningErrorZ {
1889         /// The contents of this CResult_RouteLightningErrorZ, accessible via either
1890         /// `err` or `result` depending on the state of `result_ok`.
1891         pub contents: CResult_RouteLightningErrorZPtr,
1892         /// Whether this CResult_RouteLightningErrorZ represents a success state.
1893         pub result_ok: bool,
1894 }
1895 #[no_mangle]
1896 /// Creates a new CResult_RouteLightningErrorZ in the success state.
1897 pub extern "C" fn CResult_RouteLightningErrorZ_ok(o: crate::lightning::routing::router::Route) -> CResult_RouteLightningErrorZ {
1898         CResult_RouteLightningErrorZ {
1899                 contents: CResult_RouteLightningErrorZPtr {
1900                         result: Box::into_raw(Box::new(o)),
1901                 },
1902                 result_ok: true,
1903         }
1904 }
1905 #[no_mangle]
1906 /// Creates a new CResult_RouteLightningErrorZ in the error state.
1907 pub extern "C" fn CResult_RouteLightningErrorZ_err(e: crate::lightning::ln::msgs::LightningError) -> CResult_RouteLightningErrorZ {
1908         CResult_RouteLightningErrorZ {
1909                 contents: CResult_RouteLightningErrorZPtr {
1910                         err: Box::into_raw(Box::new(e)),
1911                 },
1912                 result_ok: false,
1913         }
1914 }
1915 #[no_mangle]
1916 /// Frees any resources used by the CResult_RouteLightningErrorZ.
1917 pub extern "C" fn CResult_RouteLightningErrorZ_free(_res: CResult_RouteLightningErrorZ) { }
1918 impl Drop for CResult_RouteLightningErrorZ {
1919         fn drop(&mut self) {
1920                 if self.result_ok {
1921                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
1922                                 let _ = unsafe { Box::from_raw(self.contents.result) };
1923                         }
1924                 } else {
1925                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
1926                                 let _ = unsafe { Box::from_raw(self.contents.err) };
1927                         }
1928                 }
1929         }
1930 }
1931 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::Route, crate::lightning::ln::msgs::LightningError>> for CResult_RouteLightningErrorZ {
1932         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::Route, crate::lightning::ln::msgs::LightningError>) -> Self {
1933                 let contents = if o.result_ok {
1934                         let result = unsafe { o.contents.result };
1935                         unsafe { o.contents.result = std::ptr::null_mut() };
1936                         CResult_RouteLightningErrorZPtr { result }
1937                 } else {
1938                         let err = unsafe { o.contents.err };
1939                         unsafe { o.contents.err = std::ptr::null_mut(); }
1940                         CResult_RouteLightningErrorZPtr { err }
1941                 };
1942                 Self {
1943                         contents,
1944                         result_ok: o.result_ok,
1945                 }
1946         }
1947 }
1948 impl Clone for CResult_RouteLightningErrorZ {
1949         fn clone(&self) -> Self {
1950                 if self.result_ok {
1951                         Self { result_ok: true, contents: CResult_RouteLightningErrorZPtr {
1952                                 result: Box::into_raw(Box::new(<crate::lightning::routing::router::Route>::clone(unsafe { &*self.contents.result })))
1953                         } }
1954                 } else {
1955                         Self { result_ok: false, contents: CResult_RouteLightningErrorZPtr {
1956                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::LightningError>::clone(unsafe { &*self.contents.err })))
1957                         } }
1958                 }
1959         }
1960 }
1961 #[no_mangle]
1962 /// Creates a new CResult_RouteLightningErrorZ which has the same data as `orig`
1963 /// but with all dynamically-allocated buffers duplicated in new buffers.
1964 pub extern "C" fn CResult_RouteLightningErrorZ_clone(orig: &CResult_RouteLightningErrorZ) -> CResult_RouteLightningErrorZ { orig.clone() }
1965 #[repr(C)]
1966 /// The contents of CResult_TxOutAccessErrorZ
1967 pub union CResult_TxOutAccessErrorZPtr {
1968         /// A pointer to the contents in the success state.
1969         /// Reading from this pointer when `result_ok` is not set is undefined.
1970         pub result: *mut crate::c_types::TxOut,
1971         /// A pointer to the contents in the error state.
1972         /// Reading from this pointer when `result_ok` is set is undefined.
1973         pub err: *mut crate::lightning::chain::AccessError,
1974 }
1975 #[repr(C)]
1976 /// A CResult_TxOutAccessErrorZ represents the result of a fallible operation,
1977 /// containing a crate::c_types::TxOut on success and a crate::lightning::chain::AccessError on failure.
1978 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1979 pub struct CResult_TxOutAccessErrorZ {
1980         /// The contents of this CResult_TxOutAccessErrorZ, accessible via either
1981         /// `err` or `result` depending on the state of `result_ok`.
1982         pub contents: CResult_TxOutAccessErrorZPtr,
1983         /// Whether this CResult_TxOutAccessErrorZ represents a success state.
1984         pub result_ok: bool,
1985 }
1986 #[no_mangle]
1987 /// Creates a new CResult_TxOutAccessErrorZ in the success state.
1988 pub extern "C" fn CResult_TxOutAccessErrorZ_ok(o: crate::c_types::TxOut) -> CResult_TxOutAccessErrorZ {
1989         CResult_TxOutAccessErrorZ {
1990                 contents: CResult_TxOutAccessErrorZPtr {
1991                         result: Box::into_raw(Box::new(o)),
1992                 },
1993                 result_ok: true,
1994         }
1995 }
1996 #[no_mangle]
1997 /// Creates a new CResult_TxOutAccessErrorZ in the error state.
1998 pub extern "C" fn CResult_TxOutAccessErrorZ_err(e: crate::lightning::chain::AccessError) -> CResult_TxOutAccessErrorZ {
1999         CResult_TxOutAccessErrorZ {
2000                 contents: CResult_TxOutAccessErrorZPtr {
2001                         err: Box::into_raw(Box::new(e)),
2002                 },
2003                 result_ok: false,
2004         }
2005 }
2006 #[no_mangle]
2007 /// Frees any resources used by the CResult_TxOutAccessErrorZ.
2008 pub extern "C" fn CResult_TxOutAccessErrorZ_free(_res: CResult_TxOutAccessErrorZ) { }
2009 impl Drop for CResult_TxOutAccessErrorZ {
2010         fn drop(&mut self) {
2011                 if self.result_ok {
2012                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
2013                                 let _ = unsafe { Box::from_raw(self.contents.result) };
2014                         }
2015                 } else {
2016                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
2017                                 let _ = unsafe { Box::from_raw(self.contents.err) };
2018                         }
2019                 }
2020         }
2021 }
2022 impl From<crate::c_types::CResultTempl<crate::c_types::TxOut, crate::lightning::chain::AccessError>> for CResult_TxOutAccessErrorZ {
2023         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::TxOut, crate::lightning::chain::AccessError>) -> Self {
2024                 let contents = if o.result_ok {
2025                         let result = unsafe { o.contents.result };
2026                         unsafe { o.contents.result = std::ptr::null_mut() };
2027                         CResult_TxOutAccessErrorZPtr { result }
2028                 } else {
2029                         let err = unsafe { o.contents.err };
2030                         unsafe { o.contents.err = std::ptr::null_mut(); }
2031                         CResult_TxOutAccessErrorZPtr { err }
2032                 };
2033                 Self {
2034                         contents,
2035                         result_ok: o.result_ok,
2036                 }
2037         }
2038 }
2039 impl Clone for CResult_TxOutAccessErrorZ {
2040         fn clone(&self) -> Self {
2041                 if self.result_ok {
2042                         Self { result_ok: true, contents: CResult_TxOutAccessErrorZPtr {
2043                                 result: Box::into_raw(Box::new(<crate::c_types::TxOut>::clone(unsafe { &*self.contents.result })))
2044                         } }
2045                 } else {
2046                         Self { result_ok: false, contents: CResult_TxOutAccessErrorZPtr {
2047                                 err: Box::into_raw(Box::new(<crate::lightning::chain::AccessError>::clone(unsafe { &*self.contents.err })))
2048                         } }
2049                 }
2050         }
2051 }
2052 #[no_mangle]
2053 /// Creates a new CResult_TxOutAccessErrorZ which has the same data as `orig`
2054 /// but with all dynamically-allocated buffers duplicated in new buffers.
2055 pub extern "C" fn CResult_TxOutAccessErrorZ_clone(orig: &CResult_TxOutAccessErrorZ) -> CResult_TxOutAccessErrorZ { orig.clone() }
2056 #[repr(C)]
2057 /// A tuple of 2 elements. See the individual fields for the types contained.
2058 pub struct C2Tuple_usizeTransactionZ {
2059         /// The element at position 0
2060         pub a: usize,
2061         /// The element at position 1
2062         pub b: crate::c_types::Transaction,
2063 }
2064 impl From<(usize, crate::c_types::Transaction)> for C2Tuple_usizeTransactionZ {
2065         fn from (tup: (usize, crate::c_types::Transaction)) -> Self {
2066                 Self {
2067                         a: tup.0,
2068                         b: tup.1,
2069                 }
2070         }
2071 }
2072 impl C2Tuple_usizeTransactionZ {
2073         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (usize, crate::c_types::Transaction) {
2074                 (self.a, self.b)
2075         }
2076 }
2077 impl Clone for C2Tuple_usizeTransactionZ {
2078         fn clone(&self) -> Self {
2079                 Self {
2080                         a: self.a.clone(),
2081                         b: self.b.clone(),
2082                 }
2083         }
2084 }
2085 #[no_mangle]
2086 /// Creates a new tuple which has the same data as `orig`
2087 /// but with all dynamically-allocated buffers duplicated in new buffers.
2088 pub extern "C" fn C2Tuple_usizeTransactionZ_clone(orig: &C2Tuple_usizeTransactionZ) -> C2Tuple_usizeTransactionZ { orig.clone() }
2089 /// Creates a new C2Tuple_usizeTransactionZ from the contained elements.
2090 #[no_mangle]
2091 pub extern "C" fn C2Tuple_usizeTransactionZ_new(a: usize, b: crate::c_types::Transaction) -> C2Tuple_usizeTransactionZ {
2092         C2Tuple_usizeTransactionZ { a, b, }
2093 }
2094
2095 #[no_mangle]
2096 /// Frees any resources used by the C2Tuple_usizeTransactionZ.
2097 pub extern "C" fn C2Tuple_usizeTransactionZ_free(_res: C2Tuple_usizeTransactionZ) { }
2098 #[repr(C)]
2099 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_usizeTransactionZs of arbitrary size.
2100 /// This corresponds to std::vector in C++
2101 pub struct CVec_C2Tuple_usizeTransactionZZ {
2102         /// The elements in the array.
2103         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2104         pub data: *mut crate::c_types::derived::C2Tuple_usizeTransactionZ,
2105         /// The number of elements pointed to by `data`.
2106         pub datalen: usize
2107 }
2108 impl CVec_C2Tuple_usizeTransactionZZ {
2109         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_usizeTransactionZ> {
2110                 if self.datalen == 0 { return Vec::new(); }
2111                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
2112                 self.data = std::ptr::null_mut();
2113                 self.datalen = 0;
2114                 ret
2115         }
2116         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_usizeTransactionZ] {
2117                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
2118         }
2119 }
2120 impl From<Vec<crate::c_types::derived::C2Tuple_usizeTransactionZ>> for CVec_C2Tuple_usizeTransactionZZ {
2121         fn from(v: Vec<crate::c_types::derived::C2Tuple_usizeTransactionZ>) -> Self {
2122                 let datalen = v.len();
2123                 let data = Box::into_raw(v.into_boxed_slice());
2124                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
2125         }
2126 }
2127 #[no_mangle]
2128 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
2129 pub extern "C" fn CVec_C2Tuple_usizeTransactionZZ_free(_res: CVec_C2Tuple_usizeTransactionZZ) { }
2130 impl Drop for CVec_C2Tuple_usizeTransactionZZ {
2131         fn drop(&mut self) {
2132                 if self.datalen == 0 { return; }
2133                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
2134         }
2135 }
2136 impl Clone for CVec_C2Tuple_usizeTransactionZZ {
2137         fn clone(&self) -> Self {
2138                 let mut res = Vec::new();
2139                 if self.datalen == 0 { return Self::from(res); }
2140                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
2141                 Self::from(res)
2142         }
2143 }
2144 #[repr(C)]
2145 /// A dynamically-allocated array of crate::c_types::ThirtyTwoBytess of arbitrary size.
2146 /// This corresponds to std::vector in C++
2147 pub struct CVec_TxidZ {
2148         /// The elements in the array.
2149         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2150         pub data: *mut crate::c_types::ThirtyTwoBytes,
2151         /// The number of elements pointed to by `data`.
2152         pub datalen: usize
2153 }
2154 impl CVec_TxidZ {
2155         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::ThirtyTwoBytes> {
2156                 if self.datalen == 0 { return Vec::new(); }
2157                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
2158                 self.data = std::ptr::null_mut();
2159                 self.datalen = 0;
2160                 ret
2161         }
2162         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::ThirtyTwoBytes] {
2163                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
2164         }
2165 }
2166 impl From<Vec<crate::c_types::ThirtyTwoBytes>> for CVec_TxidZ {
2167         fn from(v: Vec<crate::c_types::ThirtyTwoBytes>) -> Self {
2168                 let datalen = v.len();
2169                 let data = Box::into_raw(v.into_boxed_slice());
2170                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
2171         }
2172 }
2173 #[no_mangle]
2174 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
2175 pub extern "C" fn CVec_TxidZ_free(_res: CVec_TxidZ) { }
2176 impl Drop for CVec_TxidZ {
2177         fn drop(&mut self) {
2178                 if self.datalen == 0 { return; }
2179                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
2180         }
2181 }
2182 impl Clone for CVec_TxidZ {
2183         fn clone(&self) -> Self {
2184                 let mut res = Vec::new();
2185                 if self.datalen == 0 { return Self::from(res); }
2186                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
2187                 Self::from(res)
2188         }
2189 }
2190 #[repr(C)]
2191 /// The contents of CResult_NoneChannelMonitorUpdateErrZ
2192 pub union CResult_NoneChannelMonitorUpdateErrZPtr {
2193         /// Note that this value is always NULL, as there are no contents in the OK variant
2194         pub result: *mut std::ffi::c_void,
2195         /// A pointer to the contents in the error state.
2196         /// Reading from this pointer when `result_ok` is set is undefined.
2197         pub err: *mut crate::lightning::chain::channelmonitor::ChannelMonitorUpdateErr,
2198 }
2199 #[repr(C)]
2200 /// A CResult_NoneChannelMonitorUpdateErrZ represents the result of a fallible operation,
2201 /// containing a () on success and a crate::lightning::chain::channelmonitor::ChannelMonitorUpdateErr on failure.
2202 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2203 pub struct CResult_NoneChannelMonitorUpdateErrZ {
2204         /// The contents of this CResult_NoneChannelMonitorUpdateErrZ, accessible via either
2205         /// `err` or `result` depending on the state of `result_ok`.
2206         pub contents: CResult_NoneChannelMonitorUpdateErrZPtr,
2207         /// Whether this CResult_NoneChannelMonitorUpdateErrZ represents a success state.
2208         pub result_ok: bool,
2209 }
2210 #[no_mangle]
2211 /// Creates a new CResult_NoneChannelMonitorUpdateErrZ in the success state.
2212 pub extern "C" fn CResult_NoneChannelMonitorUpdateErrZ_ok() -> CResult_NoneChannelMonitorUpdateErrZ {
2213         CResult_NoneChannelMonitorUpdateErrZ {
2214                 contents: CResult_NoneChannelMonitorUpdateErrZPtr {
2215                         result: std::ptr::null_mut(),
2216                 },
2217                 result_ok: true,
2218         }
2219 }
2220 #[no_mangle]
2221 /// Creates a new CResult_NoneChannelMonitorUpdateErrZ in the error state.
2222 pub extern "C" fn CResult_NoneChannelMonitorUpdateErrZ_err(e: crate::lightning::chain::channelmonitor::ChannelMonitorUpdateErr) -> CResult_NoneChannelMonitorUpdateErrZ {
2223         CResult_NoneChannelMonitorUpdateErrZ {
2224                 contents: CResult_NoneChannelMonitorUpdateErrZPtr {
2225                         err: Box::into_raw(Box::new(e)),
2226                 },
2227                 result_ok: false,
2228         }
2229 }
2230 #[no_mangle]
2231 /// Frees any resources used by the CResult_NoneChannelMonitorUpdateErrZ.
2232 pub extern "C" fn CResult_NoneChannelMonitorUpdateErrZ_free(_res: CResult_NoneChannelMonitorUpdateErrZ) { }
2233 impl Drop for CResult_NoneChannelMonitorUpdateErrZ {
2234         fn drop(&mut self) {
2235                 if self.result_ok {
2236                 } else {
2237                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
2238                                 let _ = unsafe { Box::from_raw(self.contents.err) };
2239                         }
2240                 }
2241         }
2242 }
2243 impl From<crate::c_types::CResultTempl<(), crate::lightning::chain::channelmonitor::ChannelMonitorUpdateErr>> for CResult_NoneChannelMonitorUpdateErrZ {
2244         fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::chain::channelmonitor::ChannelMonitorUpdateErr>) -> Self {
2245                 let contents = if o.result_ok {
2246                         let _ = unsafe { Box::from_raw(o.contents.result) };
2247                         o.contents.result = std::ptr::null_mut();
2248                         CResult_NoneChannelMonitorUpdateErrZPtr { result: std::ptr::null_mut() }
2249                 } else {
2250                         let err = unsafe { o.contents.err };
2251                         unsafe { o.contents.err = std::ptr::null_mut(); }
2252                         CResult_NoneChannelMonitorUpdateErrZPtr { err }
2253                 };
2254                 Self {
2255                         contents,
2256                         result_ok: o.result_ok,
2257                 }
2258         }
2259 }
2260 impl Clone for CResult_NoneChannelMonitorUpdateErrZ {
2261         fn clone(&self) -> Self {
2262                 if self.result_ok {
2263                         Self { result_ok: true, contents: CResult_NoneChannelMonitorUpdateErrZPtr {
2264                                 result: std::ptr::null_mut()
2265                         } }
2266                 } else {
2267                         Self { result_ok: false, contents: CResult_NoneChannelMonitorUpdateErrZPtr {
2268                                 err: Box::into_raw(Box::new(<crate::lightning::chain::channelmonitor::ChannelMonitorUpdateErr>::clone(unsafe { &*self.contents.err })))
2269                         } }
2270                 }
2271         }
2272 }
2273 #[no_mangle]
2274 /// Creates a new CResult_NoneChannelMonitorUpdateErrZ which has the same data as `orig`
2275 /// but with all dynamically-allocated buffers duplicated in new buffers.
2276 pub extern "C" fn CResult_NoneChannelMonitorUpdateErrZ_clone(orig: &CResult_NoneChannelMonitorUpdateErrZ) -> CResult_NoneChannelMonitorUpdateErrZ { orig.clone() }
2277 #[repr(C)]
2278 /// A dynamically-allocated array of crate::lightning::chain::channelmonitor::MonitorEvents of arbitrary size.
2279 /// This corresponds to std::vector in C++
2280 pub struct CVec_MonitorEventZ {
2281         /// The elements in the array.
2282         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2283         pub data: *mut crate::lightning::chain::channelmonitor::MonitorEvent,
2284         /// The number of elements pointed to by `data`.
2285         pub datalen: usize
2286 }
2287 impl CVec_MonitorEventZ {
2288         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::chain::channelmonitor::MonitorEvent> {
2289                 if self.datalen == 0 { return Vec::new(); }
2290                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
2291                 self.data = std::ptr::null_mut();
2292                 self.datalen = 0;
2293                 ret
2294         }
2295         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::chain::channelmonitor::MonitorEvent] {
2296                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
2297         }
2298 }
2299 impl From<Vec<crate::lightning::chain::channelmonitor::MonitorEvent>> for CVec_MonitorEventZ {
2300         fn from(v: Vec<crate::lightning::chain::channelmonitor::MonitorEvent>) -> Self {
2301                 let datalen = v.len();
2302                 let data = Box::into_raw(v.into_boxed_slice());
2303                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
2304         }
2305 }
2306 #[no_mangle]
2307 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
2308 pub extern "C" fn CVec_MonitorEventZ_free(_res: CVec_MonitorEventZ) { }
2309 impl Drop for CVec_MonitorEventZ {
2310         fn drop(&mut self) {
2311                 if self.datalen == 0 { return; }
2312                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
2313         }
2314 }
2315 impl Clone for CVec_MonitorEventZ {
2316         fn clone(&self) -> Self {
2317                 let mut res = Vec::new();
2318                 if self.datalen == 0 { return Self::from(res); }
2319                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
2320                 Self::from(res)
2321         }
2322 }
2323 #[repr(C)]
2324 #[derive(Clone)]
2325 /// An enum which can either contain a crate::c_types::derived::C2Tuple_usizeTransactionZ or not
2326 pub enum COption_C2Tuple_usizeTransactionZZ {
2327         /// When we're in this state, this COption_C2Tuple_usizeTransactionZZ contains a crate::c_types::derived::C2Tuple_usizeTransactionZ
2328         Some(crate::c_types::derived::C2Tuple_usizeTransactionZ),
2329         /// When we're in this state, this COption_C2Tuple_usizeTransactionZZ contains nothing
2330         None
2331 }
2332 impl COption_C2Tuple_usizeTransactionZZ {
2333         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
2334                 if let Self::Some(_) = self { true } else { false }
2335         }
2336         #[allow(unused)] pub(crate) fn take(mut self) -> crate::c_types::derived::C2Tuple_usizeTransactionZ {
2337                 if let Self::Some(v) = self { v } else { unreachable!() }
2338         }
2339 }
2340 #[no_mangle]
2341 /// Constructs a new COption_C2Tuple_usizeTransactionZZ containing a crate::c_types::derived::C2Tuple_usizeTransactionZ
2342 pub extern "C" fn COption_C2Tuple_usizeTransactionZZ_some(o: crate::c_types::derived::C2Tuple_usizeTransactionZ) -> COption_C2Tuple_usizeTransactionZZ {
2343         COption_C2Tuple_usizeTransactionZZ::Some(o)
2344 }
2345 #[no_mangle]
2346 /// Constructs a new COption_C2Tuple_usizeTransactionZZ containing nothing
2347 pub extern "C" fn COption_C2Tuple_usizeTransactionZZ_none() -> COption_C2Tuple_usizeTransactionZZ {
2348         COption_C2Tuple_usizeTransactionZZ::None
2349 }
2350 #[no_mangle]
2351 /// Frees any resources associated with the crate::c_types::derived::C2Tuple_usizeTransactionZ, if we are in the Some state
2352 pub extern "C" fn COption_C2Tuple_usizeTransactionZZ_free(_res: COption_C2Tuple_usizeTransactionZZ) { }
2353 #[no_mangle]
2354 /// Creates a new COption_C2Tuple_usizeTransactionZZ which has the same data as `orig`
2355 /// but with all dynamically-allocated buffers duplicated in new buffers.
2356 pub extern "C" fn COption_C2Tuple_usizeTransactionZZ_clone(orig: &COption_C2Tuple_usizeTransactionZZ) -> COption_C2Tuple_usizeTransactionZZ { orig.clone() }
2357 #[repr(C)]
2358 /// A dynamically-allocated array of crate::lightning::chain::keysinterface::SpendableOutputDescriptors of arbitrary size.
2359 /// This corresponds to std::vector in C++
2360 pub struct CVec_SpendableOutputDescriptorZ {
2361         /// The elements in the array.
2362         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2363         pub data: *mut crate::lightning::chain::keysinterface::SpendableOutputDescriptor,
2364         /// The number of elements pointed to by `data`.
2365         pub datalen: usize
2366 }
2367 impl CVec_SpendableOutputDescriptorZ {
2368         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::chain::keysinterface::SpendableOutputDescriptor> {
2369                 if self.datalen == 0 { return Vec::new(); }
2370                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
2371                 self.data = std::ptr::null_mut();
2372                 self.datalen = 0;
2373                 ret
2374         }
2375         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::chain::keysinterface::SpendableOutputDescriptor] {
2376                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
2377         }
2378 }
2379 impl From<Vec<crate::lightning::chain::keysinterface::SpendableOutputDescriptor>> for CVec_SpendableOutputDescriptorZ {
2380         fn from(v: Vec<crate::lightning::chain::keysinterface::SpendableOutputDescriptor>) -> Self {
2381                 let datalen = v.len();
2382                 let data = Box::into_raw(v.into_boxed_slice());
2383                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
2384         }
2385 }
2386 #[no_mangle]
2387 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
2388 pub extern "C" fn CVec_SpendableOutputDescriptorZ_free(_res: CVec_SpendableOutputDescriptorZ) { }
2389 impl Drop for CVec_SpendableOutputDescriptorZ {
2390         fn drop(&mut self) {
2391                 if self.datalen == 0 { return; }
2392                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
2393         }
2394 }
2395 impl Clone for CVec_SpendableOutputDescriptorZ {
2396         fn clone(&self) -> Self {
2397                 let mut res = Vec::new();
2398                 if self.datalen == 0 { return Self::from(res); }
2399                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
2400                 Self::from(res)
2401         }
2402 }
2403 #[repr(C)]
2404 /// A dynamically-allocated array of crate::lightning::util::events::MessageSendEvents of arbitrary size.
2405 /// This corresponds to std::vector in C++
2406 pub struct CVec_MessageSendEventZ {
2407         /// The elements in the array.
2408         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2409         pub data: *mut crate::lightning::util::events::MessageSendEvent,
2410         /// The number of elements pointed to by `data`.
2411         pub datalen: usize
2412 }
2413 impl CVec_MessageSendEventZ {
2414         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::util::events::MessageSendEvent> {
2415                 if self.datalen == 0 { return Vec::new(); }
2416                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
2417                 self.data = std::ptr::null_mut();
2418                 self.datalen = 0;
2419                 ret
2420         }
2421         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::util::events::MessageSendEvent] {
2422                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
2423         }
2424 }
2425 impl From<Vec<crate::lightning::util::events::MessageSendEvent>> for CVec_MessageSendEventZ {
2426         fn from(v: Vec<crate::lightning::util::events::MessageSendEvent>) -> Self {
2427                 let datalen = v.len();
2428                 let data = Box::into_raw(v.into_boxed_slice());
2429                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
2430         }
2431 }
2432 #[no_mangle]
2433 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
2434 pub extern "C" fn CVec_MessageSendEventZ_free(_res: CVec_MessageSendEventZ) { }
2435 impl Drop for CVec_MessageSendEventZ {
2436         fn drop(&mut self) {
2437                 if self.datalen == 0 { return; }
2438                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
2439         }
2440 }
2441 impl Clone for CVec_MessageSendEventZ {
2442         fn clone(&self) -> Self {
2443                 let mut res = Vec::new();
2444                 if self.datalen == 0 { return Self::from(res); }
2445                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
2446                 Self::from(res)
2447         }
2448 }
2449 #[repr(C)]
2450 /// The contents of CResult_InitFeaturesDecodeErrorZ
2451 pub union CResult_InitFeaturesDecodeErrorZPtr {
2452         /// A pointer to the contents in the success state.
2453         /// Reading from this pointer when `result_ok` is not set is undefined.
2454         pub result: *mut crate::lightning::ln::features::InitFeatures,
2455         /// A pointer to the contents in the error state.
2456         /// Reading from this pointer when `result_ok` is set is undefined.
2457         pub err: *mut crate::lightning::ln::msgs::DecodeError,
2458 }
2459 #[repr(C)]
2460 /// A CResult_InitFeaturesDecodeErrorZ represents the result of a fallible operation,
2461 /// containing a crate::lightning::ln::features::InitFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
2462 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2463 pub struct CResult_InitFeaturesDecodeErrorZ {
2464         /// The contents of this CResult_InitFeaturesDecodeErrorZ, accessible via either
2465         /// `err` or `result` depending on the state of `result_ok`.
2466         pub contents: CResult_InitFeaturesDecodeErrorZPtr,
2467         /// Whether this CResult_InitFeaturesDecodeErrorZ represents a success state.
2468         pub result_ok: bool,
2469 }
2470 #[no_mangle]
2471 /// Creates a new CResult_InitFeaturesDecodeErrorZ in the success state.
2472 pub extern "C" fn CResult_InitFeaturesDecodeErrorZ_ok(o: crate::lightning::ln::features::InitFeatures) -> CResult_InitFeaturesDecodeErrorZ {
2473         CResult_InitFeaturesDecodeErrorZ {
2474                 contents: CResult_InitFeaturesDecodeErrorZPtr {
2475                         result: Box::into_raw(Box::new(o)),
2476                 },
2477                 result_ok: true,
2478         }
2479 }
2480 #[no_mangle]
2481 /// Creates a new CResult_InitFeaturesDecodeErrorZ in the error state.
2482 pub extern "C" fn CResult_InitFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_InitFeaturesDecodeErrorZ {
2483         CResult_InitFeaturesDecodeErrorZ {
2484                 contents: CResult_InitFeaturesDecodeErrorZPtr {
2485                         err: Box::into_raw(Box::new(e)),
2486                 },
2487                 result_ok: false,
2488         }
2489 }
2490 #[no_mangle]
2491 /// Frees any resources used by the CResult_InitFeaturesDecodeErrorZ.
2492 pub extern "C" fn CResult_InitFeaturesDecodeErrorZ_free(_res: CResult_InitFeaturesDecodeErrorZ) { }
2493 impl Drop for CResult_InitFeaturesDecodeErrorZ {
2494         fn drop(&mut self) {
2495                 if self.result_ok {
2496                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
2497                                 let _ = unsafe { Box::from_raw(self.contents.result) };
2498                         }
2499                 } else {
2500                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
2501                                 let _ = unsafe { Box::from_raw(self.contents.err) };
2502                         }
2503                 }
2504         }
2505 }
2506 impl From<crate::c_types::CResultTempl<crate::lightning::ln::features::InitFeatures, crate::lightning::ln::msgs::DecodeError>> for CResult_InitFeaturesDecodeErrorZ {
2507         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::features::InitFeatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
2508                 let contents = if o.result_ok {
2509                         let result = unsafe { o.contents.result };
2510                         unsafe { o.contents.result = std::ptr::null_mut() };
2511                         CResult_InitFeaturesDecodeErrorZPtr { result }
2512                 } else {
2513                         let err = unsafe { o.contents.err };
2514                         unsafe { o.contents.err = std::ptr::null_mut(); }
2515                         CResult_InitFeaturesDecodeErrorZPtr { err }
2516                 };
2517                 Self {
2518                         contents,
2519                         result_ok: o.result_ok,
2520                 }
2521         }
2522 }
2523 #[repr(C)]
2524 /// The contents of CResult_NodeFeaturesDecodeErrorZ
2525 pub union CResult_NodeFeaturesDecodeErrorZPtr {
2526         /// A pointer to the contents in the success state.
2527         /// Reading from this pointer when `result_ok` is not set is undefined.
2528         pub result: *mut crate::lightning::ln::features::NodeFeatures,
2529         /// A pointer to the contents in the error state.
2530         /// Reading from this pointer when `result_ok` is set is undefined.
2531         pub err: *mut crate::lightning::ln::msgs::DecodeError,
2532 }
2533 #[repr(C)]
2534 /// A CResult_NodeFeaturesDecodeErrorZ represents the result of a fallible operation,
2535 /// containing a crate::lightning::ln::features::NodeFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
2536 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2537 pub struct CResult_NodeFeaturesDecodeErrorZ {
2538         /// The contents of this CResult_NodeFeaturesDecodeErrorZ, accessible via either
2539         /// `err` or `result` depending on the state of `result_ok`.
2540         pub contents: CResult_NodeFeaturesDecodeErrorZPtr,
2541         /// Whether this CResult_NodeFeaturesDecodeErrorZ represents a success state.
2542         pub result_ok: bool,
2543 }
2544 #[no_mangle]
2545 /// Creates a new CResult_NodeFeaturesDecodeErrorZ in the success state.
2546 pub extern "C" fn CResult_NodeFeaturesDecodeErrorZ_ok(o: crate::lightning::ln::features::NodeFeatures) -> CResult_NodeFeaturesDecodeErrorZ {
2547         CResult_NodeFeaturesDecodeErrorZ {
2548                 contents: CResult_NodeFeaturesDecodeErrorZPtr {
2549                         result: Box::into_raw(Box::new(o)),
2550                 },
2551                 result_ok: true,
2552         }
2553 }
2554 #[no_mangle]
2555 /// Creates a new CResult_NodeFeaturesDecodeErrorZ in the error state.
2556 pub extern "C" fn CResult_NodeFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeFeaturesDecodeErrorZ {
2557         CResult_NodeFeaturesDecodeErrorZ {
2558                 contents: CResult_NodeFeaturesDecodeErrorZPtr {
2559                         err: Box::into_raw(Box::new(e)),
2560                 },
2561                 result_ok: false,
2562         }
2563 }
2564 #[no_mangle]
2565 /// Frees any resources used by the CResult_NodeFeaturesDecodeErrorZ.
2566 pub extern "C" fn CResult_NodeFeaturesDecodeErrorZ_free(_res: CResult_NodeFeaturesDecodeErrorZ) { }
2567 impl Drop for CResult_NodeFeaturesDecodeErrorZ {
2568         fn drop(&mut self) {
2569                 if self.result_ok {
2570                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
2571                                 let _ = unsafe { Box::from_raw(self.contents.result) };
2572                         }
2573                 } else {
2574                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
2575                                 let _ = unsafe { Box::from_raw(self.contents.err) };
2576                         }
2577                 }
2578         }
2579 }
2580 impl From<crate::c_types::CResultTempl<crate::lightning::ln::features::NodeFeatures, crate::lightning::ln::msgs::DecodeError>> for CResult_NodeFeaturesDecodeErrorZ {
2581         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::features::NodeFeatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
2582                 let contents = if o.result_ok {
2583                         let result = unsafe { o.contents.result };
2584                         unsafe { o.contents.result = std::ptr::null_mut() };
2585                         CResult_NodeFeaturesDecodeErrorZPtr { result }
2586                 } else {
2587                         let err = unsafe { o.contents.err };
2588                         unsafe { o.contents.err = std::ptr::null_mut(); }
2589                         CResult_NodeFeaturesDecodeErrorZPtr { err }
2590                 };
2591                 Self {
2592                         contents,
2593                         result_ok: o.result_ok,
2594                 }
2595         }
2596 }
2597 #[repr(C)]
2598 /// The contents of CResult_ChannelFeaturesDecodeErrorZ
2599 pub union CResult_ChannelFeaturesDecodeErrorZPtr {
2600         /// A pointer to the contents in the success state.
2601         /// Reading from this pointer when `result_ok` is not set is undefined.
2602         pub result: *mut crate::lightning::ln::features::ChannelFeatures,
2603         /// A pointer to the contents in the error state.
2604         /// Reading from this pointer when `result_ok` is set is undefined.
2605         pub err: *mut crate::lightning::ln::msgs::DecodeError,
2606 }
2607 #[repr(C)]
2608 /// A CResult_ChannelFeaturesDecodeErrorZ represents the result of a fallible operation,
2609 /// containing a crate::lightning::ln::features::ChannelFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
2610 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2611 pub struct CResult_ChannelFeaturesDecodeErrorZ {
2612         /// The contents of this CResult_ChannelFeaturesDecodeErrorZ, accessible via either
2613         /// `err` or `result` depending on the state of `result_ok`.
2614         pub contents: CResult_ChannelFeaturesDecodeErrorZPtr,
2615         /// Whether this CResult_ChannelFeaturesDecodeErrorZ represents a success state.
2616         pub result_ok: bool,
2617 }
2618 #[no_mangle]
2619 /// Creates a new CResult_ChannelFeaturesDecodeErrorZ in the success state.
2620 pub extern "C" fn CResult_ChannelFeaturesDecodeErrorZ_ok(o: crate::lightning::ln::features::ChannelFeatures) -> CResult_ChannelFeaturesDecodeErrorZ {
2621         CResult_ChannelFeaturesDecodeErrorZ {
2622                 contents: CResult_ChannelFeaturesDecodeErrorZPtr {
2623                         result: Box::into_raw(Box::new(o)),
2624                 },
2625                 result_ok: true,
2626         }
2627 }
2628 #[no_mangle]
2629 /// Creates a new CResult_ChannelFeaturesDecodeErrorZ in the error state.
2630 pub extern "C" fn CResult_ChannelFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelFeaturesDecodeErrorZ {
2631         CResult_ChannelFeaturesDecodeErrorZ {
2632                 contents: CResult_ChannelFeaturesDecodeErrorZPtr {
2633                         err: Box::into_raw(Box::new(e)),
2634                 },
2635                 result_ok: false,
2636         }
2637 }
2638 #[no_mangle]
2639 /// Frees any resources used by the CResult_ChannelFeaturesDecodeErrorZ.
2640 pub extern "C" fn CResult_ChannelFeaturesDecodeErrorZ_free(_res: CResult_ChannelFeaturesDecodeErrorZ) { }
2641 impl Drop for CResult_ChannelFeaturesDecodeErrorZ {
2642         fn drop(&mut self) {
2643                 if self.result_ok {
2644                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
2645                                 let _ = unsafe { Box::from_raw(self.contents.result) };
2646                         }
2647                 } else {
2648                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
2649                                 let _ = unsafe { Box::from_raw(self.contents.err) };
2650                         }
2651                 }
2652         }
2653 }
2654 impl From<crate::c_types::CResultTempl<crate::lightning::ln::features::ChannelFeatures, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelFeaturesDecodeErrorZ {
2655         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::features::ChannelFeatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
2656                 let contents = if o.result_ok {
2657                         let result = unsafe { o.contents.result };
2658                         unsafe { o.contents.result = std::ptr::null_mut() };
2659                         CResult_ChannelFeaturesDecodeErrorZPtr { result }
2660                 } else {
2661                         let err = unsafe { o.contents.err };
2662                         unsafe { o.contents.err = std::ptr::null_mut(); }
2663                         CResult_ChannelFeaturesDecodeErrorZPtr { err }
2664                 };
2665                 Self {
2666                         contents,
2667                         result_ok: o.result_ok,
2668                 }
2669         }
2670 }
2671 #[repr(C)]
2672 /// The contents of CResult_InvoiceFeaturesDecodeErrorZ
2673 pub union CResult_InvoiceFeaturesDecodeErrorZPtr {
2674         /// A pointer to the contents in the success state.
2675         /// Reading from this pointer when `result_ok` is not set is undefined.
2676         pub result: *mut crate::lightning::ln::features::InvoiceFeatures,
2677         /// A pointer to the contents in the error state.
2678         /// Reading from this pointer when `result_ok` is set is undefined.
2679         pub err: *mut crate::lightning::ln::msgs::DecodeError,
2680 }
2681 #[repr(C)]
2682 /// A CResult_InvoiceFeaturesDecodeErrorZ represents the result of a fallible operation,
2683 /// containing a crate::lightning::ln::features::InvoiceFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
2684 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2685 pub struct CResult_InvoiceFeaturesDecodeErrorZ {
2686         /// The contents of this CResult_InvoiceFeaturesDecodeErrorZ, accessible via either
2687         /// `err` or `result` depending on the state of `result_ok`.
2688         pub contents: CResult_InvoiceFeaturesDecodeErrorZPtr,
2689         /// Whether this CResult_InvoiceFeaturesDecodeErrorZ represents a success state.
2690         pub result_ok: bool,
2691 }
2692 #[no_mangle]
2693 /// Creates a new CResult_InvoiceFeaturesDecodeErrorZ in the success state.
2694 pub extern "C" fn CResult_InvoiceFeaturesDecodeErrorZ_ok(o: crate::lightning::ln::features::InvoiceFeatures) -> CResult_InvoiceFeaturesDecodeErrorZ {
2695         CResult_InvoiceFeaturesDecodeErrorZ {
2696                 contents: CResult_InvoiceFeaturesDecodeErrorZPtr {
2697                         result: Box::into_raw(Box::new(o)),
2698                 },
2699                 result_ok: true,
2700         }
2701 }
2702 #[no_mangle]
2703 /// Creates a new CResult_InvoiceFeaturesDecodeErrorZ in the error state.
2704 pub extern "C" fn CResult_InvoiceFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_InvoiceFeaturesDecodeErrorZ {
2705         CResult_InvoiceFeaturesDecodeErrorZ {
2706                 contents: CResult_InvoiceFeaturesDecodeErrorZPtr {
2707                         err: Box::into_raw(Box::new(e)),
2708                 },
2709                 result_ok: false,
2710         }
2711 }
2712 #[no_mangle]
2713 /// Frees any resources used by the CResult_InvoiceFeaturesDecodeErrorZ.
2714 pub extern "C" fn CResult_InvoiceFeaturesDecodeErrorZ_free(_res: CResult_InvoiceFeaturesDecodeErrorZ) { }
2715 impl Drop for CResult_InvoiceFeaturesDecodeErrorZ {
2716         fn drop(&mut self) {
2717                 if self.result_ok {
2718                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
2719                                 let _ = unsafe { Box::from_raw(self.contents.result) };
2720                         }
2721                 } else {
2722                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
2723                                 let _ = unsafe { Box::from_raw(self.contents.err) };
2724                         }
2725                 }
2726         }
2727 }
2728 impl From<crate::c_types::CResultTempl<crate::lightning::ln::features::InvoiceFeatures, crate::lightning::ln::msgs::DecodeError>> for CResult_InvoiceFeaturesDecodeErrorZ {
2729         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::features::InvoiceFeatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
2730                 let contents = if o.result_ok {
2731                         let result = unsafe { o.contents.result };
2732                         unsafe { o.contents.result = std::ptr::null_mut() };
2733                         CResult_InvoiceFeaturesDecodeErrorZPtr { result }
2734                 } else {
2735                         let err = unsafe { o.contents.err };
2736                         unsafe { o.contents.err = std::ptr::null_mut(); }
2737                         CResult_InvoiceFeaturesDecodeErrorZPtr { err }
2738                 };
2739                 Self {
2740                         contents,
2741                         result_ok: o.result_ok,
2742                 }
2743         }
2744 }
2745 #[repr(C)]
2746 /// The contents of CResult_DelayedPaymentOutputDescriptorDecodeErrorZ
2747 pub union CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr {
2748         /// A pointer to the contents in the success state.
2749         /// Reading from this pointer when `result_ok` is not set is undefined.
2750         pub result: *mut crate::lightning::chain::keysinterface::DelayedPaymentOutputDescriptor,
2751         /// A pointer to the contents in the error state.
2752         /// Reading from this pointer when `result_ok` is set is undefined.
2753         pub err: *mut crate::lightning::ln::msgs::DecodeError,
2754 }
2755 #[repr(C)]
2756 /// A CResult_DelayedPaymentOutputDescriptorDecodeErrorZ represents the result of a fallible operation,
2757 /// containing a crate::lightning::chain::keysinterface::DelayedPaymentOutputDescriptor on success and a crate::lightning::ln::msgs::DecodeError on failure.
2758 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2759 pub struct CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
2760         /// The contents of this CResult_DelayedPaymentOutputDescriptorDecodeErrorZ, accessible via either
2761         /// `err` or `result` depending on the state of `result_ok`.
2762         pub contents: CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr,
2763         /// Whether this CResult_DelayedPaymentOutputDescriptorDecodeErrorZ represents a success state.
2764         pub result_ok: bool,
2765 }
2766 #[no_mangle]
2767 /// Creates a new CResult_DelayedPaymentOutputDescriptorDecodeErrorZ in the success state.
2768 pub extern "C" fn CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_ok(o: crate::lightning::chain::keysinterface::DelayedPaymentOutputDescriptor) -> CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
2769         CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
2770                 contents: CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr {
2771                         result: Box::into_raw(Box::new(o)),
2772                 },
2773                 result_ok: true,
2774         }
2775 }
2776 #[no_mangle]
2777 /// Creates a new CResult_DelayedPaymentOutputDescriptorDecodeErrorZ in the error state.
2778 pub extern "C" fn CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
2779         CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
2780                 contents: CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr {
2781                         err: Box::into_raw(Box::new(e)),
2782                 },
2783                 result_ok: false,
2784         }
2785 }
2786 #[no_mangle]
2787 /// Frees any resources used by the CResult_DelayedPaymentOutputDescriptorDecodeErrorZ.
2788 pub extern "C" fn CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_free(_res: CResult_DelayedPaymentOutputDescriptorDecodeErrorZ) { }
2789 impl Drop for CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
2790         fn drop(&mut self) {
2791                 if self.result_ok {
2792                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
2793                                 let _ = unsafe { Box::from_raw(self.contents.result) };
2794                         }
2795                 } else {
2796                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
2797                                 let _ = unsafe { Box::from_raw(self.contents.err) };
2798                         }
2799                 }
2800         }
2801 }
2802 impl From<crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::DelayedPaymentOutputDescriptor, crate::lightning::ln::msgs::DecodeError>> for CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
2803         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::DelayedPaymentOutputDescriptor, crate::lightning::ln::msgs::DecodeError>) -> Self {
2804                 let contents = if o.result_ok {
2805                         let result = unsafe { o.contents.result };
2806                         unsafe { o.contents.result = std::ptr::null_mut() };
2807                         CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr { result }
2808                 } else {
2809                         let err = unsafe { o.contents.err };
2810                         unsafe { o.contents.err = std::ptr::null_mut(); }
2811                         CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr { err }
2812                 };
2813                 Self {
2814                         contents,
2815                         result_ok: o.result_ok,
2816                 }
2817         }
2818 }
2819 impl Clone for CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
2820         fn clone(&self) -> Self {
2821                 if self.result_ok {
2822                         Self { result_ok: true, contents: CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr {
2823                                 result: Box::into_raw(Box::new(<crate::lightning::chain::keysinterface::DelayedPaymentOutputDescriptor>::clone(unsafe { &*self.contents.result })))
2824                         } }
2825                 } else {
2826                         Self { result_ok: false, contents: CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr {
2827                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
2828                         } }
2829                 }
2830         }
2831 }
2832 #[no_mangle]
2833 /// Creates a new CResult_DelayedPaymentOutputDescriptorDecodeErrorZ which has the same data as `orig`
2834 /// but with all dynamically-allocated buffers duplicated in new buffers.
2835 pub extern "C" fn CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone(orig: &CResult_DelayedPaymentOutputDescriptorDecodeErrorZ) -> CResult_DelayedPaymentOutputDescriptorDecodeErrorZ { orig.clone() }
2836 #[repr(C)]
2837 /// The contents of CResult_StaticPaymentOutputDescriptorDecodeErrorZ
2838 pub union CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr {
2839         /// A pointer to the contents in the success state.
2840         /// Reading from this pointer when `result_ok` is not set is undefined.
2841         pub result: *mut crate::lightning::chain::keysinterface::StaticPaymentOutputDescriptor,
2842         /// A pointer to the contents in the error state.
2843         /// Reading from this pointer when `result_ok` is set is undefined.
2844         pub err: *mut crate::lightning::ln::msgs::DecodeError,
2845 }
2846 #[repr(C)]
2847 /// A CResult_StaticPaymentOutputDescriptorDecodeErrorZ represents the result of a fallible operation,
2848 /// containing a crate::lightning::chain::keysinterface::StaticPaymentOutputDescriptor on success and a crate::lightning::ln::msgs::DecodeError on failure.
2849 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2850 pub struct CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
2851         /// The contents of this CResult_StaticPaymentOutputDescriptorDecodeErrorZ, accessible via either
2852         /// `err` or `result` depending on the state of `result_ok`.
2853         pub contents: CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr,
2854         /// Whether this CResult_StaticPaymentOutputDescriptorDecodeErrorZ represents a success state.
2855         pub result_ok: bool,
2856 }
2857 #[no_mangle]
2858 /// Creates a new CResult_StaticPaymentOutputDescriptorDecodeErrorZ in the success state.
2859 pub extern "C" fn CResult_StaticPaymentOutputDescriptorDecodeErrorZ_ok(o: crate::lightning::chain::keysinterface::StaticPaymentOutputDescriptor) -> CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
2860         CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
2861                 contents: CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr {
2862                         result: Box::into_raw(Box::new(o)),
2863                 },
2864                 result_ok: true,
2865         }
2866 }
2867 #[no_mangle]
2868 /// Creates a new CResult_StaticPaymentOutputDescriptorDecodeErrorZ in the error state.
2869 pub extern "C" fn CResult_StaticPaymentOutputDescriptorDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
2870         CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
2871                 contents: CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr {
2872                         err: Box::into_raw(Box::new(e)),
2873                 },
2874                 result_ok: false,
2875         }
2876 }
2877 #[no_mangle]
2878 /// Frees any resources used by the CResult_StaticPaymentOutputDescriptorDecodeErrorZ.
2879 pub extern "C" fn CResult_StaticPaymentOutputDescriptorDecodeErrorZ_free(_res: CResult_StaticPaymentOutputDescriptorDecodeErrorZ) { }
2880 impl Drop for CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
2881         fn drop(&mut self) {
2882                 if self.result_ok {
2883                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
2884                                 let _ = unsafe { Box::from_raw(self.contents.result) };
2885                         }
2886                 } else {
2887                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
2888                                 let _ = unsafe { Box::from_raw(self.contents.err) };
2889                         }
2890                 }
2891         }
2892 }
2893 impl From<crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::StaticPaymentOutputDescriptor, crate::lightning::ln::msgs::DecodeError>> for CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
2894         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::StaticPaymentOutputDescriptor, crate::lightning::ln::msgs::DecodeError>) -> Self {
2895                 let contents = if o.result_ok {
2896                         let result = unsafe { o.contents.result };
2897                         unsafe { o.contents.result = std::ptr::null_mut() };
2898                         CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr { result }
2899                 } else {
2900                         let err = unsafe { o.contents.err };
2901                         unsafe { o.contents.err = std::ptr::null_mut(); }
2902                         CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr { err }
2903                 };
2904                 Self {
2905                         contents,
2906                         result_ok: o.result_ok,
2907                 }
2908         }
2909 }
2910 impl Clone for CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
2911         fn clone(&self) -> Self {
2912                 if self.result_ok {
2913                         Self { result_ok: true, contents: CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr {
2914                                 result: Box::into_raw(Box::new(<crate::lightning::chain::keysinterface::StaticPaymentOutputDescriptor>::clone(unsafe { &*self.contents.result })))
2915                         } }
2916                 } else {
2917                         Self { result_ok: false, contents: CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr {
2918                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
2919                         } }
2920                 }
2921         }
2922 }
2923 #[no_mangle]
2924 /// Creates a new CResult_StaticPaymentOutputDescriptorDecodeErrorZ which has the same data as `orig`
2925 /// but with all dynamically-allocated buffers duplicated in new buffers.
2926 pub extern "C" fn CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone(orig: &CResult_StaticPaymentOutputDescriptorDecodeErrorZ) -> CResult_StaticPaymentOutputDescriptorDecodeErrorZ { orig.clone() }
2927 #[repr(C)]
2928 /// The contents of CResult_SpendableOutputDescriptorDecodeErrorZ
2929 pub union CResult_SpendableOutputDescriptorDecodeErrorZPtr {
2930         /// A pointer to the contents in the success state.
2931         /// Reading from this pointer when `result_ok` is not set is undefined.
2932         pub result: *mut crate::lightning::chain::keysinterface::SpendableOutputDescriptor,
2933         /// A pointer to the contents in the error state.
2934         /// Reading from this pointer when `result_ok` is set is undefined.
2935         pub err: *mut crate::lightning::ln::msgs::DecodeError,
2936 }
2937 #[repr(C)]
2938 /// A CResult_SpendableOutputDescriptorDecodeErrorZ represents the result of a fallible operation,
2939 /// containing a crate::lightning::chain::keysinterface::SpendableOutputDescriptor on success and a crate::lightning::ln::msgs::DecodeError on failure.
2940 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2941 pub struct CResult_SpendableOutputDescriptorDecodeErrorZ {
2942         /// The contents of this CResult_SpendableOutputDescriptorDecodeErrorZ, accessible via either
2943         /// `err` or `result` depending on the state of `result_ok`.
2944         pub contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr,
2945         /// Whether this CResult_SpendableOutputDescriptorDecodeErrorZ represents a success state.
2946         pub result_ok: bool,
2947 }
2948 #[no_mangle]
2949 /// Creates a new CResult_SpendableOutputDescriptorDecodeErrorZ in the success state.
2950 pub extern "C" fn CResult_SpendableOutputDescriptorDecodeErrorZ_ok(o: crate::lightning::chain::keysinterface::SpendableOutputDescriptor) -> CResult_SpendableOutputDescriptorDecodeErrorZ {
2951         CResult_SpendableOutputDescriptorDecodeErrorZ {
2952                 contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr {
2953                         result: Box::into_raw(Box::new(o)),
2954                 },
2955                 result_ok: true,
2956         }
2957 }
2958 #[no_mangle]
2959 /// Creates a new CResult_SpendableOutputDescriptorDecodeErrorZ in the error state.
2960 pub extern "C" fn CResult_SpendableOutputDescriptorDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_SpendableOutputDescriptorDecodeErrorZ {
2961         CResult_SpendableOutputDescriptorDecodeErrorZ {
2962                 contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr {
2963                         err: Box::into_raw(Box::new(e)),
2964                 },
2965                 result_ok: false,
2966         }
2967 }
2968 #[no_mangle]
2969 /// Frees any resources used by the CResult_SpendableOutputDescriptorDecodeErrorZ.
2970 pub extern "C" fn CResult_SpendableOutputDescriptorDecodeErrorZ_free(_res: CResult_SpendableOutputDescriptorDecodeErrorZ) { }
2971 impl Drop for CResult_SpendableOutputDescriptorDecodeErrorZ {
2972         fn drop(&mut self) {
2973                 if self.result_ok {
2974                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
2975                                 let _ = unsafe { Box::from_raw(self.contents.result) };
2976                         }
2977                 } else {
2978                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
2979                                 let _ = unsafe { Box::from_raw(self.contents.err) };
2980                         }
2981                 }
2982         }
2983 }
2984 impl From<crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::SpendableOutputDescriptor, crate::lightning::ln::msgs::DecodeError>> for CResult_SpendableOutputDescriptorDecodeErrorZ {
2985         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::SpendableOutputDescriptor, crate::lightning::ln::msgs::DecodeError>) -> Self {
2986                 let contents = if o.result_ok {
2987                         let result = unsafe { o.contents.result };
2988                         unsafe { o.contents.result = std::ptr::null_mut() };
2989                         CResult_SpendableOutputDescriptorDecodeErrorZPtr { result }
2990                 } else {
2991                         let err = unsafe { o.contents.err };
2992                         unsafe { o.contents.err = std::ptr::null_mut(); }
2993                         CResult_SpendableOutputDescriptorDecodeErrorZPtr { err }
2994                 };
2995                 Self {
2996                         contents,
2997                         result_ok: o.result_ok,
2998                 }
2999         }
3000 }
3001 impl Clone for CResult_SpendableOutputDescriptorDecodeErrorZ {
3002         fn clone(&self) -> Self {
3003                 if self.result_ok {
3004                         Self { result_ok: true, contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr {
3005                                 result: Box::into_raw(Box::new(<crate::lightning::chain::keysinterface::SpendableOutputDescriptor>::clone(unsafe { &*self.contents.result })))
3006                         } }
3007                 } else {
3008                         Self { result_ok: false, contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr {
3009                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
3010                         } }
3011                 }
3012         }
3013 }
3014 #[no_mangle]
3015 /// Creates a new CResult_SpendableOutputDescriptorDecodeErrorZ which has the same data as `orig`
3016 /// but with all dynamically-allocated buffers duplicated in new buffers.
3017 pub extern "C" fn CResult_SpendableOutputDescriptorDecodeErrorZ_clone(orig: &CResult_SpendableOutputDescriptorDecodeErrorZ) -> CResult_SpendableOutputDescriptorDecodeErrorZ { orig.clone() }
3018 #[repr(C)]
3019 /// A tuple of 2 elements. See the individual fields for the types contained.
3020 pub struct C2Tuple_SignatureCVec_SignatureZZ {
3021         /// The element at position 0
3022         pub a: crate::c_types::Signature,
3023         /// The element at position 1
3024         pub b: crate::c_types::derived::CVec_SignatureZ,
3025 }
3026 impl From<(crate::c_types::Signature, crate::c_types::derived::CVec_SignatureZ)> for C2Tuple_SignatureCVec_SignatureZZ {
3027         fn from (tup: (crate::c_types::Signature, crate::c_types::derived::CVec_SignatureZ)) -> Self {
3028                 Self {
3029                         a: tup.0,
3030                         b: tup.1,
3031                 }
3032         }
3033 }
3034 impl C2Tuple_SignatureCVec_SignatureZZ {
3035         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::Signature, crate::c_types::derived::CVec_SignatureZ) {
3036                 (self.a, self.b)
3037         }
3038 }
3039 impl Clone for C2Tuple_SignatureCVec_SignatureZZ {
3040         fn clone(&self) -> Self {
3041                 Self {
3042                         a: self.a.clone(),
3043                         b: self.b.clone(),
3044                 }
3045         }
3046 }
3047 #[no_mangle]
3048 /// Creates a new tuple which has the same data as `orig`
3049 /// but with all dynamically-allocated buffers duplicated in new buffers.
3050 pub extern "C" fn C2Tuple_SignatureCVec_SignatureZZ_clone(orig: &C2Tuple_SignatureCVec_SignatureZZ) -> C2Tuple_SignatureCVec_SignatureZZ { orig.clone() }
3051 /// Creates a new C2Tuple_SignatureCVec_SignatureZZ from the contained elements.
3052 #[no_mangle]
3053 pub extern "C" fn C2Tuple_SignatureCVec_SignatureZZ_new(a: crate::c_types::Signature, b: crate::c_types::derived::CVec_SignatureZ) -> C2Tuple_SignatureCVec_SignatureZZ {
3054         C2Tuple_SignatureCVec_SignatureZZ { a, b, }
3055 }
3056
3057 #[no_mangle]
3058 /// Frees any resources used by the C2Tuple_SignatureCVec_SignatureZZ.
3059 pub extern "C" fn C2Tuple_SignatureCVec_SignatureZZ_free(_res: C2Tuple_SignatureCVec_SignatureZZ) { }
3060 #[repr(C)]
3061 /// The contents of CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ
3062 pub union CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
3063         /// A pointer to the contents in the success state.
3064         /// Reading from this pointer when `result_ok` is not set is undefined.
3065         pub result: *mut crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ,
3066         /// Note that this value is always NULL, as there are no contents in the Err variant
3067         pub err: *mut std::ffi::c_void,
3068 }
3069 #[repr(C)]
3070 /// A CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ represents the result of a fallible operation,
3071 /// containing a crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ on success and a () on failure.
3072 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3073 pub struct CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
3074         /// The contents of this CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ, accessible via either
3075         /// `err` or `result` depending on the state of `result_ok`.
3076         pub contents: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr,
3077         /// Whether this CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ represents a success state.
3078         pub result_ok: bool,
3079 }
3080 #[no_mangle]
3081 /// Creates a new CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ in the success state.
3082 pub extern "C" fn CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_ok(o: crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ) -> CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
3083         CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
3084                 contents: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
3085                         result: Box::into_raw(Box::new(o)),
3086                 },
3087                 result_ok: true,
3088         }
3089 }
3090 #[no_mangle]
3091 /// Creates a new CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ in the error state.
3092 pub extern "C" fn CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_err() -> CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
3093         CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
3094                 contents: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
3095                         err: std::ptr::null_mut(),
3096                 },
3097                 result_ok: false,
3098         }
3099 }
3100 #[no_mangle]
3101 /// Frees any resources used by the CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ.
3102 pub extern "C" fn CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_free(_res: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ) { }
3103 impl Drop for CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
3104         fn drop(&mut self) {
3105                 if self.result_ok {
3106                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
3107                                 let _ = unsafe { Box::from_raw(self.contents.result) };
3108                         }
3109                 } else {
3110                 }
3111         }
3112 }
3113 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ, ()>> for CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
3114         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ, ()>) -> Self {
3115                 let contents = if o.result_ok {
3116                         let result = unsafe { o.contents.result };
3117                         unsafe { o.contents.result = std::ptr::null_mut() };
3118                         CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr { result }
3119                 } else {
3120                         let _ = unsafe { Box::from_raw(o.contents.err) };
3121                         o.contents.err = std::ptr::null_mut();
3122                         CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr { err: std::ptr::null_mut() }
3123                 };
3124                 Self {
3125                         contents,
3126                         result_ok: o.result_ok,
3127                 }
3128         }
3129 }
3130 impl Clone for CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
3131         fn clone(&self) -> Self {
3132                 if self.result_ok {
3133                         Self { result_ok: true, contents: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
3134                                 result: Box::into_raw(Box::new(<crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ>::clone(unsafe { &*self.contents.result })))
3135                         } }
3136                 } else {
3137                         Self { result_ok: false, contents: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
3138                                 err: std::ptr::null_mut()
3139                         } }
3140                 }
3141         }
3142 }
3143 #[no_mangle]
3144 /// Creates a new CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ which has the same data as `orig`
3145 /// but with all dynamically-allocated buffers duplicated in new buffers.
3146 pub extern "C" fn CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone(orig: &CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ) -> CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ { orig.clone() }
3147 #[repr(C)]
3148 /// The contents of CResult_SignatureNoneZ
3149 pub union CResult_SignatureNoneZPtr {
3150         /// A pointer to the contents in the success state.
3151         /// Reading from this pointer when `result_ok` is not set is undefined.
3152         pub result: *mut crate::c_types::Signature,
3153         /// Note that this value is always NULL, as there are no contents in the Err variant
3154         pub err: *mut std::ffi::c_void,
3155 }
3156 #[repr(C)]
3157 /// A CResult_SignatureNoneZ represents the result of a fallible operation,
3158 /// containing a crate::c_types::Signature on success and a () on failure.
3159 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3160 pub struct CResult_SignatureNoneZ {
3161         /// The contents of this CResult_SignatureNoneZ, accessible via either
3162         /// `err` or `result` depending on the state of `result_ok`.
3163         pub contents: CResult_SignatureNoneZPtr,
3164         /// Whether this CResult_SignatureNoneZ represents a success state.
3165         pub result_ok: bool,
3166 }
3167 #[no_mangle]
3168 /// Creates a new CResult_SignatureNoneZ in the success state.
3169 pub extern "C" fn CResult_SignatureNoneZ_ok(o: crate::c_types::Signature) -> CResult_SignatureNoneZ {
3170         CResult_SignatureNoneZ {
3171                 contents: CResult_SignatureNoneZPtr {
3172                         result: Box::into_raw(Box::new(o)),
3173                 },
3174                 result_ok: true,
3175         }
3176 }
3177 #[no_mangle]
3178 /// Creates a new CResult_SignatureNoneZ in the error state.
3179 pub extern "C" fn CResult_SignatureNoneZ_err() -> CResult_SignatureNoneZ {
3180         CResult_SignatureNoneZ {
3181                 contents: CResult_SignatureNoneZPtr {
3182                         err: std::ptr::null_mut(),
3183                 },
3184                 result_ok: false,
3185         }
3186 }
3187 #[no_mangle]
3188 /// Frees any resources used by the CResult_SignatureNoneZ.
3189 pub extern "C" fn CResult_SignatureNoneZ_free(_res: CResult_SignatureNoneZ) { }
3190 impl Drop for CResult_SignatureNoneZ {
3191         fn drop(&mut self) {
3192                 if self.result_ok {
3193                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
3194                                 let _ = unsafe { Box::from_raw(self.contents.result) };
3195                         }
3196                 } else {
3197                 }
3198         }
3199 }
3200 impl From<crate::c_types::CResultTempl<crate::c_types::Signature, ()>> for CResult_SignatureNoneZ {
3201         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::Signature, ()>) -> Self {
3202                 let contents = if o.result_ok {
3203                         let result = unsafe { o.contents.result };
3204                         unsafe { o.contents.result = std::ptr::null_mut() };
3205                         CResult_SignatureNoneZPtr { result }
3206                 } else {
3207                         let _ = unsafe { Box::from_raw(o.contents.err) };
3208                         o.contents.err = std::ptr::null_mut();
3209                         CResult_SignatureNoneZPtr { err: std::ptr::null_mut() }
3210                 };
3211                 Self {
3212                         contents,
3213                         result_ok: o.result_ok,
3214                 }
3215         }
3216 }
3217 impl Clone for CResult_SignatureNoneZ {
3218         fn clone(&self) -> Self {
3219                 if self.result_ok {
3220                         Self { result_ok: true, contents: CResult_SignatureNoneZPtr {
3221                                 result: Box::into_raw(Box::new(<crate::c_types::Signature>::clone(unsafe { &*self.contents.result })))
3222                         } }
3223                 } else {
3224                         Self { result_ok: false, contents: CResult_SignatureNoneZPtr {
3225                                 err: std::ptr::null_mut()
3226                         } }
3227                 }
3228         }
3229 }
3230 #[no_mangle]
3231 /// Creates a new CResult_SignatureNoneZ which has the same data as `orig`
3232 /// but with all dynamically-allocated buffers duplicated in new buffers.
3233 pub extern "C" fn CResult_SignatureNoneZ_clone(orig: &CResult_SignatureNoneZ) -> CResult_SignatureNoneZ { orig.clone() }
3234 #[repr(C)]
3235 /// The contents of CResult_SignDecodeErrorZ
3236 pub union CResult_SignDecodeErrorZPtr {
3237         /// A pointer to the contents in the success state.
3238         /// Reading from this pointer when `result_ok` is not set is undefined.
3239         pub result: *mut crate::lightning::chain::keysinterface::Sign,
3240         /// A pointer to the contents in the error state.
3241         /// Reading from this pointer when `result_ok` is set is undefined.
3242         pub err: *mut crate::lightning::ln::msgs::DecodeError,
3243 }
3244 #[repr(C)]
3245 /// A CResult_SignDecodeErrorZ represents the result of a fallible operation,
3246 /// containing a crate::lightning::chain::keysinterface::Sign on success and a crate::lightning::ln::msgs::DecodeError on failure.
3247 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3248 pub struct CResult_SignDecodeErrorZ {
3249         /// The contents of this CResult_SignDecodeErrorZ, accessible via either
3250         /// `err` or `result` depending on the state of `result_ok`.
3251         pub contents: CResult_SignDecodeErrorZPtr,
3252         /// Whether this CResult_SignDecodeErrorZ represents a success state.
3253         pub result_ok: bool,
3254 }
3255 #[no_mangle]
3256 /// Creates a new CResult_SignDecodeErrorZ in the success state.
3257 pub extern "C" fn CResult_SignDecodeErrorZ_ok(o: crate::lightning::chain::keysinterface::Sign) -> CResult_SignDecodeErrorZ {
3258         CResult_SignDecodeErrorZ {
3259                 contents: CResult_SignDecodeErrorZPtr {
3260                         result: Box::into_raw(Box::new(o)),
3261                 },
3262                 result_ok: true,
3263         }
3264 }
3265 #[no_mangle]
3266 /// Creates a new CResult_SignDecodeErrorZ in the error state.
3267 pub extern "C" fn CResult_SignDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_SignDecodeErrorZ {
3268         CResult_SignDecodeErrorZ {
3269                 contents: CResult_SignDecodeErrorZPtr {
3270                         err: Box::into_raw(Box::new(e)),
3271                 },
3272                 result_ok: false,
3273         }
3274 }
3275 #[no_mangle]
3276 /// Frees any resources used by the CResult_SignDecodeErrorZ.
3277 pub extern "C" fn CResult_SignDecodeErrorZ_free(_res: CResult_SignDecodeErrorZ) { }
3278 impl Drop for CResult_SignDecodeErrorZ {
3279         fn drop(&mut self) {
3280                 if self.result_ok {
3281                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
3282                                 let _ = unsafe { Box::from_raw(self.contents.result) };
3283                         }
3284                 } else {
3285                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
3286                                 let _ = unsafe { Box::from_raw(self.contents.err) };
3287                         }
3288                 }
3289         }
3290 }
3291 impl From<crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::Sign, crate::lightning::ln::msgs::DecodeError>> for CResult_SignDecodeErrorZ {
3292         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::Sign, crate::lightning::ln::msgs::DecodeError>) -> Self {
3293                 let contents = if o.result_ok {
3294                         let result = unsafe { o.contents.result };
3295                         unsafe { o.contents.result = std::ptr::null_mut() };
3296                         CResult_SignDecodeErrorZPtr { result }
3297                 } else {
3298                         let err = unsafe { o.contents.err };
3299                         unsafe { o.contents.err = std::ptr::null_mut(); }
3300                         CResult_SignDecodeErrorZPtr { err }
3301                 };
3302                 Self {
3303                         contents,
3304                         result_ok: o.result_ok,
3305                 }
3306         }
3307 }
3308 impl Clone for CResult_SignDecodeErrorZ {
3309         fn clone(&self) -> Self {
3310                 if self.result_ok {
3311                         Self { result_ok: true, contents: CResult_SignDecodeErrorZPtr {
3312                                 result: Box::into_raw(Box::new(<crate::lightning::chain::keysinterface::Sign>::clone(unsafe { &*self.contents.result })))
3313                         } }
3314                 } else {
3315                         Self { result_ok: false, contents: CResult_SignDecodeErrorZPtr {
3316                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
3317                         } }
3318                 }
3319         }
3320 }
3321 #[no_mangle]
3322 /// Creates a new CResult_SignDecodeErrorZ which has the same data as `orig`
3323 /// but with all dynamically-allocated buffers duplicated in new buffers.
3324 pub extern "C" fn CResult_SignDecodeErrorZ_clone(orig: &CResult_SignDecodeErrorZ) -> CResult_SignDecodeErrorZ { orig.clone() }
3325 #[repr(C)]
3326 /// A dynamically-allocated array of u8s of arbitrary size.
3327 /// This corresponds to std::vector in C++
3328 pub struct CVec_u8Z {
3329         /// The elements in the array.
3330         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3331         pub data: *mut u8,
3332         /// The number of elements pointed to by `data`.
3333         pub datalen: usize
3334 }
3335 impl CVec_u8Z {
3336         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<u8> {
3337                 if self.datalen == 0 { return Vec::new(); }
3338                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
3339                 self.data = std::ptr::null_mut();
3340                 self.datalen = 0;
3341                 ret
3342         }
3343         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[u8] {
3344                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
3345         }
3346 }
3347 impl From<Vec<u8>> for CVec_u8Z {
3348         fn from(v: Vec<u8>) -> Self {
3349                 let datalen = v.len();
3350                 let data = Box::into_raw(v.into_boxed_slice());
3351                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
3352         }
3353 }
3354 #[no_mangle]
3355 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
3356 pub extern "C" fn CVec_u8Z_free(_res: CVec_u8Z) { }
3357 impl Drop for CVec_u8Z {
3358         fn drop(&mut self) {
3359                 if self.datalen == 0 { return; }
3360                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
3361         }
3362 }
3363 impl Clone for CVec_u8Z {
3364         fn clone(&self) -> Self {
3365                 let mut res = Vec::new();
3366                 if self.datalen == 0 { return Self::from(res); }
3367                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
3368                 Self::from(res)
3369         }
3370 }
3371 #[repr(C)]
3372 /// The contents of CResult_RecoverableSignatureNoneZ
3373 pub union CResult_RecoverableSignatureNoneZPtr {
3374         /// A pointer to the contents in the success state.
3375         /// Reading from this pointer when `result_ok` is not set is undefined.
3376         pub result: *mut crate::c_types::RecoverableSignature,
3377         /// Note that this value is always NULL, as there are no contents in the Err variant
3378         pub err: *mut std::ffi::c_void,
3379 }
3380 #[repr(C)]
3381 /// A CResult_RecoverableSignatureNoneZ represents the result of a fallible operation,
3382 /// containing a crate::c_types::RecoverableSignature on success and a () on failure.
3383 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3384 pub struct CResult_RecoverableSignatureNoneZ {
3385         /// The contents of this CResult_RecoverableSignatureNoneZ, accessible via either
3386         /// `err` or `result` depending on the state of `result_ok`.
3387         pub contents: CResult_RecoverableSignatureNoneZPtr,
3388         /// Whether this CResult_RecoverableSignatureNoneZ represents a success state.
3389         pub result_ok: bool,
3390 }
3391 #[no_mangle]
3392 /// Creates a new CResult_RecoverableSignatureNoneZ in the success state.
3393 pub extern "C" fn CResult_RecoverableSignatureNoneZ_ok(o: crate::c_types::RecoverableSignature) -> CResult_RecoverableSignatureNoneZ {
3394         CResult_RecoverableSignatureNoneZ {
3395                 contents: CResult_RecoverableSignatureNoneZPtr {
3396                         result: Box::into_raw(Box::new(o)),
3397                 },
3398                 result_ok: true,
3399         }
3400 }
3401 #[no_mangle]
3402 /// Creates a new CResult_RecoverableSignatureNoneZ in the error state.
3403 pub extern "C" fn CResult_RecoverableSignatureNoneZ_err() -> CResult_RecoverableSignatureNoneZ {
3404         CResult_RecoverableSignatureNoneZ {
3405                 contents: CResult_RecoverableSignatureNoneZPtr {
3406                         err: std::ptr::null_mut(),
3407                 },
3408                 result_ok: false,
3409         }
3410 }
3411 #[no_mangle]
3412 /// Frees any resources used by the CResult_RecoverableSignatureNoneZ.
3413 pub extern "C" fn CResult_RecoverableSignatureNoneZ_free(_res: CResult_RecoverableSignatureNoneZ) { }
3414 impl Drop for CResult_RecoverableSignatureNoneZ {
3415         fn drop(&mut self) {
3416                 if self.result_ok {
3417                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
3418                                 let _ = unsafe { Box::from_raw(self.contents.result) };
3419                         }
3420                 } else {
3421                 }
3422         }
3423 }
3424 impl From<crate::c_types::CResultTempl<crate::c_types::RecoverableSignature, ()>> for CResult_RecoverableSignatureNoneZ {
3425         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::RecoverableSignature, ()>) -> Self {
3426                 let contents = if o.result_ok {
3427                         let result = unsafe { o.contents.result };
3428                         unsafe { o.contents.result = std::ptr::null_mut() };
3429                         CResult_RecoverableSignatureNoneZPtr { result }
3430                 } else {
3431                         let _ = unsafe { Box::from_raw(o.contents.err) };
3432                         o.contents.err = std::ptr::null_mut();
3433                         CResult_RecoverableSignatureNoneZPtr { err: std::ptr::null_mut() }
3434                 };
3435                 Self {
3436                         contents,
3437                         result_ok: o.result_ok,
3438                 }
3439         }
3440 }
3441 impl Clone for CResult_RecoverableSignatureNoneZ {
3442         fn clone(&self) -> Self {
3443                 if self.result_ok {
3444                         Self { result_ok: true, contents: CResult_RecoverableSignatureNoneZPtr {
3445                                 result: Box::into_raw(Box::new(<crate::c_types::RecoverableSignature>::clone(unsafe { &*self.contents.result })))
3446                         } }
3447                 } else {
3448                         Self { result_ok: false, contents: CResult_RecoverableSignatureNoneZPtr {
3449                                 err: std::ptr::null_mut()
3450                         } }
3451                 }
3452         }
3453 }
3454 #[no_mangle]
3455 /// Creates a new CResult_RecoverableSignatureNoneZ which has the same data as `orig`
3456 /// but with all dynamically-allocated buffers duplicated in new buffers.
3457 pub extern "C" fn CResult_RecoverableSignatureNoneZ_clone(orig: &CResult_RecoverableSignatureNoneZ) -> CResult_RecoverableSignatureNoneZ { orig.clone() }
3458 #[repr(C)]
3459 /// A dynamically-allocated array of crate::c_types::derived::CVec_u8Zs of arbitrary size.
3460 /// This corresponds to std::vector in C++
3461 pub struct CVec_CVec_u8ZZ {
3462         /// The elements in the array.
3463         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3464         pub data: *mut crate::c_types::derived::CVec_u8Z,
3465         /// The number of elements pointed to by `data`.
3466         pub datalen: usize
3467 }
3468 impl CVec_CVec_u8ZZ {
3469         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::CVec_u8Z> {
3470                 if self.datalen == 0 { return Vec::new(); }
3471                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
3472                 self.data = std::ptr::null_mut();
3473                 self.datalen = 0;
3474                 ret
3475         }
3476         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::CVec_u8Z] {
3477                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
3478         }
3479 }
3480 impl From<Vec<crate::c_types::derived::CVec_u8Z>> for CVec_CVec_u8ZZ {
3481         fn from(v: Vec<crate::c_types::derived::CVec_u8Z>) -> Self {
3482                 let datalen = v.len();
3483                 let data = Box::into_raw(v.into_boxed_slice());
3484                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
3485         }
3486 }
3487 #[no_mangle]
3488 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
3489 pub extern "C" fn CVec_CVec_u8ZZ_free(_res: CVec_CVec_u8ZZ) { }
3490 impl Drop for CVec_CVec_u8ZZ {
3491         fn drop(&mut self) {
3492                 if self.datalen == 0 { return; }
3493                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
3494         }
3495 }
3496 impl Clone for CVec_CVec_u8ZZ {
3497         fn clone(&self) -> Self {
3498                 let mut res = Vec::new();
3499                 if self.datalen == 0 { return Self::from(res); }
3500                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
3501                 Self::from(res)
3502         }
3503 }
3504 #[repr(C)]
3505 /// The contents of CResult_CVec_CVec_u8ZZNoneZ
3506 pub union CResult_CVec_CVec_u8ZZNoneZPtr {
3507         /// A pointer to the contents in the success state.
3508         /// Reading from this pointer when `result_ok` is not set is undefined.
3509         pub result: *mut crate::c_types::derived::CVec_CVec_u8ZZ,
3510         /// Note that this value is always NULL, as there are no contents in the Err variant
3511         pub err: *mut std::ffi::c_void,
3512 }
3513 #[repr(C)]
3514 /// A CResult_CVec_CVec_u8ZZNoneZ represents the result of a fallible operation,
3515 /// containing a crate::c_types::derived::CVec_CVec_u8ZZ on success and a () on failure.
3516 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3517 pub struct CResult_CVec_CVec_u8ZZNoneZ {
3518         /// The contents of this CResult_CVec_CVec_u8ZZNoneZ, accessible via either
3519         /// `err` or `result` depending on the state of `result_ok`.
3520         pub contents: CResult_CVec_CVec_u8ZZNoneZPtr,
3521         /// Whether this CResult_CVec_CVec_u8ZZNoneZ represents a success state.
3522         pub result_ok: bool,
3523 }
3524 #[no_mangle]
3525 /// Creates a new CResult_CVec_CVec_u8ZZNoneZ in the success state.
3526 pub extern "C" fn CResult_CVec_CVec_u8ZZNoneZ_ok(o: crate::c_types::derived::CVec_CVec_u8ZZ) -> CResult_CVec_CVec_u8ZZNoneZ {
3527         CResult_CVec_CVec_u8ZZNoneZ {
3528                 contents: CResult_CVec_CVec_u8ZZNoneZPtr {
3529                         result: Box::into_raw(Box::new(o)),
3530                 },
3531                 result_ok: true,
3532         }
3533 }
3534 #[no_mangle]
3535 /// Creates a new CResult_CVec_CVec_u8ZZNoneZ in the error state.
3536 pub extern "C" fn CResult_CVec_CVec_u8ZZNoneZ_err() -> CResult_CVec_CVec_u8ZZNoneZ {
3537         CResult_CVec_CVec_u8ZZNoneZ {
3538                 contents: CResult_CVec_CVec_u8ZZNoneZPtr {
3539                         err: std::ptr::null_mut(),
3540                 },
3541                 result_ok: false,
3542         }
3543 }
3544 #[no_mangle]
3545 /// Frees any resources used by the CResult_CVec_CVec_u8ZZNoneZ.
3546 pub extern "C" fn CResult_CVec_CVec_u8ZZNoneZ_free(_res: CResult_CVec_CVec_u8ZZNoneZ) { }
3547 impl Drop for CResult_CVec_CVec_u8ZZNoneZ {
3548         fn drop(&mut self) {
3549                 if self.result_ok {
3550                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
3551                                 let _ = unsafe { Box::from_raw(self.contents.result) };
3552                         }
3553                 } else {
3554                 }
3555         }
3556 }
3557 impl From<crate::c_types::CResultTempl<crate::c_types::derived::CVec_CVec_u8ZZ, ()>> for CResult_CVec_CVec_u8ZZNoneZ {
3558         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CVec_CVec_u8ZZ, ()>) -> Self {
3559                 let contents = if o.result_ok {
3560                         let result = unsafe { o.contents.result };
3561                         unsafe { o.contents.result = std::ptr::null_mut() };
3562                         CResult_CVec_CVec_u8ZZNoneZPtr { result }
3563                 } else {
3564                         let _ = unsafe { Box::from_raw(o.contents.err) };
3565                         o.contents.err = std::ptr::null_mut();
3566                         CResult_CVec_CVec_u8ZZNoneZPtr { err: std::ptr::null_mut() }
3567                 };
3568                 Self {
3569                         contents,
3570                         result_ok: o.result_ok,
3571                 }
3572         }
3573 }
3574 impl Clone for CResult_CVec_CVec_u8ZZNoneZ {
3575         fn clone(&self) -> Self {
3576                 if self.result_ok {
3577                         Self { result_ok: true, contents: CResult_CVec_CVec_u8ZZNoneZPtr {
3578                                 result: Box::into_raw(Box::new(<crate::c_types::derived::CVec_CVec_u8ZZ>::clone(unsafe { &*self.contents.result })))
3579                         } }
3580                 } else {
3581                         Self { result_ok: false, contents: CResult_CVec_CVec_u8ZZNoneZPtr {
3582                                 err: std::ptr::null_mut()
3583                         } }
3584                 }
3585         }
3586 }
3587 #[no_mangle]
3588 /// Creates a new CResult_CVec_CVec_u8ZZNoneZ which has the same data as `orig`
3589 /// but with all dynamically-allocated buffers duplicated in new buffers.
3590 pub extern "C" fn CResult_CVec_CVec_u8ZZNoneZ_clone(orig: &CResult_CVec_CVec_u8ZZNoneZ) -> CResult_CVec_CVec_u8ZZNoneZ { orig.clone() }
3591 #[repr(C)]
3592 /// The contents of CResult_InMemorySignerDecodeErrorZ
3593 pub union CResult_InMemorySignerDecodeErrorZPtr {
3594         /// A pointer to the contents in the success state.
3595         /// Reading from this pointer when `result_ok` is not set is undefined.
3596         pub result: *mut crate::lightning::chain::keysinterface::InMemorySigner,
3597         /// A pointer to the contents in the error state.
3598         /// Reading from this pointer when `result_ok` is set is undefined.
3599         pub err: *mut crate::lightning::ln::msgs::DecodeError,
3600 }
3601 #[repr(C)]
3602 /// A CResult_InMemorySignerDecodeErrorZ represents the result of a fallible operation,
3603 /// containing a crate::lightning::chain::keysinterface::InMemorySigner on success and a crate::lightning::ln::msgs::DecodeError on failure.
3604 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3605 pub struct CResult_InMemorySignerDecodeErrorZ {
3606         /// The contents of this CResult_InMemorySignerDecodeErrorZ, accessible via either
3607         /// `err` or `result` depending on the state of `result_ok`.
3608         pub contents: CResult_InMemorySignerDecodeErrorZPtr,
3609         /// Whether this CResult_InMemorySignerDecodeErrorZ represents a success state.
3610         pub result_ok: bool,
3611 }
3612 #[no_mangle]
3613 /// Creates a new CResult_InMemorySignerDecodeErrorZ in the success state.
3614 pub extern "C" fn CResult_InMemorySignerDecodeErrorZ_ok(o: crate::lightning::chain::keysinterface::InMemorySigner) -> CResult_InMemorySignerDecodeErrorZ {
3615         CResult_InMemorySignerDecodeErrorZ {
3616                 contents: CResult_InMemorySignerDecodeErrorZPtr {
3617                         result: Box::into_raw(Box::new(o)),
3618                 },
3619                 result_ok: true,
3620         }
3621 }
3622 #[no_mangle]
3623 /// Creates a new CResult_InMemorySignerDecodeErrorZ in the error state.
3624 pub extern "C" fn CResult_InMemorySignerDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_InMemorySignerDecodeErrorZ {
3625         CResult_InMemorySignerDecodeErrorZ {
3626                 contents: CResult_InMemorySignerDecodeErrorZPtr {
3627                         err: Box::into_raw(Box::new(e)),
3628                 },
3629                 result_ok: false,
3630         }
3631 }
3632 #[no_mangle]
3633 /// Frees any resources used by the CResult_InMemorySignerDecodeErrorZ.
3634 pub extern "C" fn CResult_InMemorySignerDecodeErrorZ_free(_res: CResult_InMemorySignerDecodeErrorZ) { }
3635 impl Drop for CResult_InMemorySignerDecodeErrorZ {
3636         fn drop(&mut self) {
3637                 if self.result_ok {
3638                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
3639                                 let _ = unsafe { Box::from_raw(self.contents.result) };
3640                         }
3641                 } else {
3642                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
3643                                 let _ = unsafe { Box::from_raw(self.contents.err) };
3644                         }
3645                 }
3646         }
3647 }
3648 impl From<crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::InMemorySigner, crate::lightning::ln::msgs::DecodeError>> for CResult_InMemorySignerDecodeErrorZ {
3649         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::InMemorySigner, crate::lightning::ln::msgs::DecodeError>) -> Self {
3650                 let contents = if o.result_ok {
3651                         let result = unsafe { o.contents.result };
3652                         unsafe { o.contents.result = std::ptr::null_mut() };
3653                         CResult_InMemorySignerDecodeErrorZPtr { result }
3654                 } else {
3655                         let err = unsafe { o.contents.err };
3656                         unsafe { o.contents.err = std::ptr::null_mut(); }
3657                         CResult_InMemorySignerDecodeErrorZPtr { err }
3658                 };
3659                 Self {
3660                         contents,
3661                         result_ok: o.result_ok,
3662                 }
3663         }
3664 }
3665 impl Clone for CResult_InMemorySignerDecodeErrorZ {
3666         fn clone(&self) -> Self {
3667                 if self.result_ok {
3668                         Self { result_ok: true, contents: CResult_InMemorySignerDecodeErrorZPtr {
3669                                 result: Box::into_raw(Box::new(<crate::lightning::chain::keysinterface::InMemorySigner>::clone(unsafe { &*self.contents.result })))
3670                         } }
3671                 } else {
3672                         Self { result_ok: false, contents: CResult_InMemorySignerDecodeErrorZPtr {
3673                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
3674                         } }
3675                 }
3676         }
3677 }
3678 #[no_mangle]
3679 /// Creates a new CResult_InMemorySignerDecodeErrorZ which has the same data as `orig`
3680 /// but with all dynamically-allocated buffers duplicated in new buffers.
3681 pub extern "C" fn CResult_InMemorySignerDecodeErrorZ_clone(orig: &CResult_InMemorySignerDecodeErrorZ) -> CResult_InMemorySignerDecodeErrorZ { orig.clone() }
3682 #[repr(C)]
3683 /// A dynamically-allocated array of crate::c_types::TxOuts of arbitrary size.
3684 /// This corresponds to std::vector in C++
3685 pub struct CVec_TxOutZ {
3686         /// The elements in the array.
3687         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3688         pub data: *mut crate::c_types::TxOut,
3689         /// The number of elements pointed to by `data`.
3690         pub datalen: usize
3691 }
3692 impl CVec_TxOutZ {
3693         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::TxOut> {
3694                 if self.datalen == 0 { return Vec::new(); }
3695                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
3696                 self.data = std::ptr::null_mut();
3697                 self.datalen = 0;
3698                 ret
3699         }
3700         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::TxOut] {
3701                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
3702         }
3703 }
3704 impl From<Vec<crate::c_types::TxOut>> for CVec_TxOutZ {
3705         fn from(v: Vec<crate::c_types::TxOut>) -> Self {
3706                 let datalen = v.len();
3707                 let data = Box::into_raw(v.into_boxed_slice());
3708                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
3709         }
3710 }
3711 #[no_mangle]
3712 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
3713 pub extern "C" fn CVec_TxOutZ_free(_res: CVec_TxOutZ) { }
3714 impl Drop for CVec_TxOutZ {
3715         fn drop(&mut self) {
3716                 if self.datalen == 0 { return; }
3717                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
3718         }
3719 }
3720 impl Clone for CVec_TxOutZ {
3721         fn clone(&self) -> Self {
3722                 let mut res = Vec::new();
3723                 if self.datalen == 0 { return Self::from(res); }
3724                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
3725                 Self::from(res)
3726         }
3727 }
3728 #[repr(C)]
3729 /// The contents of CResult_TransactionNoneZ
3730 pub union CResult_TransactionNoneZPtr {
3731         /// A pointer to the contents in the success state.
3732         /// Reading from this pointer when `result_ok` is not set is undefined.
3733         pub result: *mut crate::c_types::Transaction,
3734         /// Note that this value is always NULL, as there are no contents in the Err variant
3735         pub err: *mut std::ffi::c_void,
3736 }
3737 #[repr(C)]
3738 /// A CResult_TransactionNoneZ represents the result of a fallible operation,
3739 /// containing a crate::c_types::Transaction on success and a () on failure.
3740 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3741 pub struct CResult_TransactionNoneZ {
3742         /// The contents of this CResult_TransactionNoneZ, accessible via either
3743         /// `err` or `result` depending on the state of `result_ok`.
3744         pub contents: CResult_TransactionNoneZPtr,
3745         /// Whether this CResult_TransactionNoneZ represents a success state.
3746         pub result_ok: bool,
3747 }
3748 #[no_mangle]
3749 /// Creates a new CResult_TransactionNoneZ in the success state.
3750 pub extern "C" fn CResult_TransactionNoneZ_ok(o: crate::c_types::Transaction) -> CResult_TransactionNoneZ {
3751         CResult_TransactionNoneZ {
3752                 contents: CResult_TransactionNoneZPtr {
3753                         result: Box::into_raw(Box::new(o)),
3754                 },
3755                 result_ok: true,
3756         }
3757 }
3758 #[no_mangle]
3759 /// Creates a new CResult_TransactionNoneZ in the error state.
3760 pub extern "C" fn CResult_TransactionNoneZ_err() -> CResult_TransactionNoneZ {
3761         CResult_TransactionNoneZ {
3762                 contents: CResult_TransactionNoneZPtr {
3763                         err: std::ptr::null_mut(),
3764                 },
3765                 result_ok: false,
3766         }
3767 }
3768 #[no_mangle]
3769 /// Frees any resources used by the CResult_TransactionNoneZ.
3770 pub extern "C" fn CResult_TransactionNoneZ_free(_res: CResult_TransactionNoneZ) { }
3771 impl Drop for CResult_TransactionNoneZ {
3772         fn drop(&mut self) {
3773                 if self.result_ok {
3774                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
3775                                 let _ = unsafe { Box::from_raw(self.contents.result) };
3776                         }
3777                 } else {
3778                 }
3779         }
3780 }
3781 impl From<crate::c_types::CResultTempl<crate::c_types::Transaction, ()>> for CResult_TransactionNoneZ {
3782         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::Transaction, ()>) -> Self {
3783                 let contents = if o.result_ok {
3784                         let result = unsafe { o.contents.result };
3785                         unsafe { o.contents.result = std::ptr::null_mut() };
3786                         CResult_TransactionNoneZPtr { result }
3787                 } else {
3788                         let _ = unsafe { Box::from_raw(o.contents.err) };
3789                         o.contents.err = std::ptr::null_mut();
3790                         CResult_TransactionNoneZPtr { err: std::ptr::null_mut() }
3791                 };
3792                 Self {
3793                         contents,
3794                         result_ok: o.result_ok,
3795                 }
3796         }
3797 }
3798 impl Clone for CResult_TransactionNoneZ {
3799         fn clone(&self) -> Self {
3800                 if self.result_ok {
3801                         Self { result_ok: true, contents: CResult_TransactionNoneZPtr {
3802                                 result: Box::into_raw(Box::new(<crate::c_types::Transaction>::clone(unsafe { &*self.contents.result })))
3803                         } }
3804                 } else {
3805                         Self { result_ok: false, contents: CResult_TransactionNoneZPtr {
3806                                 err: std::ptr::null_mut()
3807                         } }
3808                 }
3809         }
3810 }
3811 #[no_mangle]
3812 /// Creates a new CResult_TransactionNoneZ which has the same data as `orig`
3813 /// but with all dynamically-allocated buffers duplicated in new buffers.
3814 pub extern "C" fn CResult_TransactionNoneZ_clone(orig: &CResult_TransactionNoneZ) -> CResult_TransactionNoneZ { orig.clone() }
3815 #[repr(C)]
3816 /// A tuple of 2 elements. See the individual fields for the types contained.
3817 pub struct C2Tuple_BlockHashChannelMonitorZ {
3818         /// The element at position 0
3819         pub a: crate::c_types::ThirtyTwoBytes,
3820         /// The element at position 1
3821         pub b: crate::lightning::chain::channelmonitor::ChannelMonitor,
3822 }
3823 impl From<(crate::c_types::ThirtyTwoBytes, crate::lightning::chain::channelmonitor::ChannelMonitor)> for C2Tuple_BlockHashChannelMonitorZ {
3824         fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::lightning::chain::channelmonitor::ChannelMonitor)) -> Self {
3825                 Self {
3826                         a: tup.0,
3827                         b: tup.1,
3828                 }
3829         }
3830 }
3831 impl C2Tuple_BlockHashChannelMonitorZ {
3832         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::lightning::chain::channelmonitor::ChannelMonitor) {
3833                 (self.a, self.b)
3834         }
3835 }
3836 /// Creates a new C2Tuple_BlockHashChannelMonitorZ from the contained elements.
3837 #[no_mangle]
3838 pub extern "C" fn C2Tuple_BlockHashChannelMonitorZ_new(a: crate::c_types::ThirtyTwoBytes, b: crate::lightning::chain::channelmonitor::ChannelMonitor) -> C2Tuple_BlockHashChannelMonitorZ {
3839         C2Tuple_BlockHashChannelMonitorZ { a, b, }
3840 }
3841
3842 #[no_mangle]
3843 /// Frees any resources used by the C2Tuple_BlockHashChannelMonitorZ.
3844 pub extern "C" fn C2Tuple_BlockHashChannelMonitorZ_free(_res: C2Tuple_BlockHashChannelMonitorZ) { }
3845 #[repr(C)]
3846 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZs of arbitrary size.
3847 /// This corresponds to std::vector in C++
3848 pub struct CVec_C2Tuple_BlockHashChannelMonitorZZ {
3849         /// The elements in the array.
3850         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3851         pub data: *mut crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ,
3852         /// The number of elements pointed to by `data`.
3853         pub datalen: usize
3854 }
3855 impl CVec_C2Tuple_BlockHashChannelMonitorZZ {
3856         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ> {
3857                 if self.datalen == 0 { return Vec::new(); }
3858                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
3859                 self.data = std::ptr::null_mut();
3860                 self.datalen = 0;
3861                 ret
3862         }
3863         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ] {
3864                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
3865         }
3866 }
3867 impl From<Vec<crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ>> for CVec_C2Tuple_BlockHashChannelMonitorZZ {
3868         fn from(v: Vec<crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ>) -> Self {
3869                 let datalen = v.len();
3870                 let data = Box::into_raw(v.into_boxed_slice());
3871                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
3872         }
3873 }
3874 #[no_mangle]
3875 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
3876 pub extern "C" fn CVec_C2Tuple_BlockHashChannelMonitorZZ_free(_res: CVec_C2Tuple_BlockHashChannelMonitorZZ) { }
3877 impl Drop for CVec_C2Tuple_BlockHashChannelMonitorZZ {
3878         fn drop(&mut self) {
3879                 if self.datalen == 0 { return; }
3880                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
3881         }
3882 }
3883 #[repr(C)]
3884 /// The contents of CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ
3885 pub union CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr {
3886         /// A pointer to the contents in the success state.
3887         /// Reading from this pointer when `result_ok` is not set is undefined.
3888         pub result: *mut crate::c_types::derived::CVec_C2Tuple_BlockHashChannelMonitorZZ,
3889         /// A pointer to the contents in the error state.
3890         /// Reading from this pointer when `result_ok` is set is undefined.
3891         pub err: *mut crate::c_types::IOError,
3892 }
3893 #[repr(C)]
3894 /// A CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ represents the result of a fallible operation,
3895 /// containing a crate::c_types::derived::CVec_C2Tuple_BlockHashChannelMonitorZZ on success and a crate::c_types::IOError on failure.
3896 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3897 pub struct CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
3898         /// The contents of this CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ, accessible via either
3899         /// `err` or `result` depending on the state of `result_ok`.
3900         pub contents: CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr,
3901         /// Whether this CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ represents a success state.
3902         pub result_ok: bool,
3903 }
3904 #[no_mangle]
3905 /// Creates a new CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ in the success state.
3906 pub extern "C" fn CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_ok(o: crate::c_types::derived::CVec_C2Tuple_BlockHashChannelMonitorZZ) -> CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
3907         CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
3908                 contents: CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr {
3909                         result: Box::into_raw(Box::new(o)),
3910                 },
3911                 result_ok: true,
3912         }
3913 }
3914 #[no_mangle]
3915 /// Creates a new CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ in the error state.
3916 pub extern "C" fn CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_err(e: crate::c_types::IOError) -> CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
3917         CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
3918                 contents: CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr {
3919                         err: Box::into_raw(Box::new(e)),
3920                 },
3921                 result_ok: false,
3922         }
3923 }
3924 #[no_mangle]
3925 /// Frees any resources used by the CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ.
3926 pub extern "C" fn CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_free(_res: CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ) { }
3927 impl Drop for CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
3928         fn drop(&mut self) {
3929                 if self.result_ok {
3930                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
3931                                 let _ = unsafe { Box::from_raw(self.contents.result) };
3932                         }
3933                 } else {
3934                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
3935                                 let _ = unsafe { Box::from_raw(self.contents.err) };
3936                         }
3937                 }
3938         }
3939 }
3940 impl From<crate::c_types::CResultTempl<crate::c_types::derived::CVec_C2Tuple_BlockHashChannelMonitorZZ, crate::c_types::IOError>> for CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
3941         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CVec_C2Tuple_BlockHashChannelMonitorZZ, crate::c_types::IOError>) -> Self {
3942                 let contents = if o.result_ok {
3943                         let result = unsafe { o.contents.result };
3944                         unsafe { o.contents.result = std::ptr::null_mut() };
3945                         CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr { result }
3946                 } else {
3947                         let err = unsafe { o.contents.err };
3948                         unsafe { o.contents.err = std::ptr::null_mut(); }
3949                         CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr { err }
3950                 };
3951                 Self {
3952                         contents,
3953                         result_ok: o.result_ok,
3954                 }
3955         }
3956 }
3957 #[repr(C)]
3958 #[derive(Clone)]
3959 /// An enum which can either contain a u16 or not
3960 pub enum COption_u16Z {
3961         /// When we're in this state, this COption_u16Z contains a u16
3962         Some(u16),
3963         /// When we're in this state, this COption_u16Z contains nothing
3964         None
3965 }
3966 impl COption_u16Z {
3967         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
3968                 if let Self::Some(_) = self { true } else { false }
3969         }
3970         #[allow(unused)] pub(crate) fn take(mut self) -> u16 {
3971                 if let Self::Some(v) = self { v } else { unreachable!() }
3972         }
3973 }
3974 #[no_mangle]
3975 /// Constructs a new COption_u16Z containing a u16
3976 pub extern "C" fn COption_u16Z_some(o: u16) -> COption_u16Z {
3977         COption_u16Z::Some(o)
3978 }
3979 #[no_mangle]
3980 /// Constructs a new COption_u16Z containing nothing
3981 pub extern "C" fn COption_u16Z_none() -> COption_u16Z {
3982         COption_u16Z::None
3983 }
3984 #[no_mangle]
3985 /// Frees any resources associated with the u16, if we are in the Some state
3986 pub extern "C" fn COption_u16Z_free(_res: COption_u16Z) { }
3987 #[no_mangle]
3988 /// Creates a new COption_u16Z which has the same data as `orig`
3989 /// but with all dynamically-allocated buffers duplicated in new buffers.
3990 pub extern "C" fn COption_u16Z_clone(orig: &COption_u16Z) -> COption_u16Z { orig.clone() }
3991 #[repr(C)]
3992 /// The contents of CResult_NoneAPIErrorZ
3993 pub union CResult_NoneAPIErrorZPtr {
3994         /// Note that this value is always NULL, as there are no contents in the OK variant
3995         pub result: *mut std::ffi::c_void,
3996         /// A pointer to the contents in the error state.
3997         /// Reading from this pointer when `result_ok` is set is undefined.
3998         pub err: *mut crate::lightning::util::errors::APIError,
3999 }
4000 #[repr(C)]
4001 /// A CResult_NoneAPIErrorZ represents the result of a fallible operation,
4002 /// containing a () on success and a crate::lightning::util::errors::APIError on failure.
4003 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4004 pub struct CResult_NoneAPIErrorZ {
4005         /// The contents of this CResult_NoneAPIErrorZ, accessible via either
4006         /// `err` or `result` depending on the state of `result_ok`.
4007         pub contents: CResult_NoneAPIErrorZPtr,
4008         /// Whether this CResult_NoneAPIErrorZ represents a success state.
4009         pub result_ok: bool,
4010 }
4011 #[no_mangle]
4012 /// Creates a new CResult_NoneAPIErrorZ in the success state.
4013 pub extern "C" fn CResult_NoneAPIErrorZ_ok() -> CResult_NoneAPIErrorZ {
4014         CResult_NoneAPIErrorZ {
4015                 contents: CResult_NoneAPIErrorZPtr {
4016                         result: std::ptr::null_mut(),
4017                 },
4018                 result_ok: true,
4019         }
4020 }
4021 #[no_mangle]
4022 /// Creates a new CResult_NoneAPIErrorZ in the error state.
4023 pub extern "C" fn CResult_NoneAPIErrorZ_err(e: crate::lightning::util::errors::APIError) -> CResult_NoneAPIErrorZ {
4024         CResult_NoneAPIErrorZ {
4025                 contents: CResult_NoneAPIErrorZPtr {
4026                         err: Box::into_raw(Box::new(e)),
4027                 },
4028                 result_ok: false,
4029         }
4030 }
4031 #[no_mangle]
4032 /// Frees any resources used by the CResult_NoneAPIErrorZ.
4033 pub extern "C" fn CResult_NoneAPIErrorZ_free(_res: CResult_NoneAPIErrorZ) { }
4034 impl Drop for CResult_NoneAPIErrorZ {
4035         fn drop(&mut self) {
4036                 if self.result_ok {
4037                 } else {
4038                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
4039                                 let _ = unsafe { Box::from_raw(self.contents.err) };
4040                         }
4041                 }
4042         }
4043 }
4044 impl From<crate::c_types::CResultTempl<(), crate::lightning::util::errors::APIError>> for CResult_NoneAPIErrorZ {
4045         fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::util::errors::APIError>) -> Self {
4046                 let contents = if o.result_ok {
4047                         let _ = unsafe { Box::from_raw(o.contents.result) };
4048                         o.contents.result = std::ptr::null_mut();
4049                         CResult_NoneAPIErrorZPtr { result: std::ptr::null_mut() }
4050                 } else {
4051                         let err = unsafe { o.contents.err };
4052                         unsafe { o.contents.err = std::ptr::null_mut(); }
4053                         CResult_NoneAPIErrorZPtr { err }
4054                 };
4055                 Self {
4056                         contents,
4057                         result_ok: o.result_ok,
4058                 }
4059         }
4060 }
4061 impl Clone for CResult_NoneAPIErrorZ {
4062         fn clone(&self) -> Self {
4063                 if self.result_ok {
4064                         Self { result_ok: true, contents: CResult_NoneAPIErrorZPtr {
4065                                 result: std::ptr::null_mut()
4066                         } }
4067                 } else {
4068                         Self { result_ok: false, contents: CResult_NoneAPIErrorZPtr {
4069                                 err: Box::into_raw(Box::new(<crate::lightning::util::errors::APIError>::clone(unsafe { &*self.contents.err })))
4070                         } }
4071                 }
4072         }
4073 }
4074 #[no_mangle]
4075 /// Creates a new CResult_NoneAPIErrorZ which has the same data as `orig`
4076 /// but with all dynamically-allocated buffers duplicated in new buffers.
4077 pub extern "C" fn CResult_NoneAPIErrorZ_clone(orig: &CResult_NoneAPIErrorZ) -> CResult_NoneAPIErrorZ { orig.clone() }
4078 #[repr(C)]
4079 /// A dynamically-allocated array of crate::c_types::derived::CResult_NoneAPIErrorZs of arbitrary size.
4080 /// This corresponds to std::vector in C++
4081 pub struct CVec_CResult_NoneAPIErrorZZ {
4082         /// The elements in the array.
4083         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4084         pub data: *mut crate::c_types::derived::CResult_NoneAPIErrorZ,
4085         /// The number of elements pointed to by `data`.
4086         pub datalen: usize
4087 }
4088 impl CVec_CResult_NoneAPIErrorZZ {
4089         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::CResult_NoneAPIErrorZ> {
4090                 if self.datalen == 0 { return Vec::new(); }
4091                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
4092                 self.data = std::ptr::null_mut();
4093                 self.datalen = 0;
4094                 ret
4095         }
4096         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::CResult_NoneAPIErrorZ] {
4097                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
4098         }
4099 }
4100 impl From<Vec<crate::c_types::derived::CResult_NoneAPIErrorZ>> for CVec_CResult_NoneAPIErrorZZ {
4101         fn from(v: Vec<crate::c_types::derived::CResult_NoneAPIErrorZ>) -> Self {
4102                 let datalen = v.len();
4103                 let data = Box::into_raw(v.into_boxed_slice());
4104                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
4105         }
4106 }
4107 #[no_mangle]
4108 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
4109 pub extern "C" fn CVec_CResult_NoneAPIErrorZZ_free(_res: CVec_CResult_NoneAPIErrorZZ) { }
4110 impl Drop for CVec_CResult_NoneAPIErrorZZ {
4111         fn drop(&mut self) {
4112                 if self.datalen == 0 { return; }
4113                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
4114         }
4115 }
4116 impl Clone for CVec_CResult_NoneAPIErrorZZ {
4117         fn clone(&self) -> Self {
4118                 let mut res = Vec::new();
4119                 if self.datalen == 0 { return Self::from(res); }
4120                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
4121                 Self::from(res)
4122         }
4123 }
4124 #[repr(C)]
4125 /// A dynamically-allocated array of crate::lightning::util::errors::APIErrors of arbitrary size.
4126 /// This corresponds to std::vector in C++
4127 pub struct CVec_APIErrorZ {
4128         /// The elements in the array.
4129         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4130         pub data: *mut crate::lightning::util::errors::APIError,
4131         /// The number of elements pointed to by `data`.
4132         pub datalen: usize
4133 }
4134 impl CVec_APIErrorZ {
4135         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::util::errors::APIError> {
4136                 if self.datalen == 0 { return Vec::new(); }
4137                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
4138                 self.data = std::ptr::null_mut();
4139                 self.datalen = 0;
4140                 ret
4141         }
4142         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::util::errors::APIError] {
4143                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
4144         }
4145 }
4146 impl From<Vec<crate::lightning::util::errors::APIError>> for CVec_APIErrorZ {
4147         fn from(v: Vec<crate::lightning::util::errors::APIError>) -> Self {
4148                 let datalen = v.len();
4149                 let data = Box::into_raw(v.into_boxed_slice());
4150                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
4151         }
4152 }
4153 #[no_mangle]
4154 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
4155 pub extern "C" fn CVec_APIErrorZ_free(_res: CVec_APIErrorZ) { }
4156 impl Drop for CVec_APIErrorZ {
4157         fn drop(&mut self) {
4158                 if self.datalen == 0 { return; }
4159                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
4160         }
4161 }
4162 impl Clone for CVec_APIErrorZ {
4163         fn clone(&self) -> Self {
4164                 let mut res = Vec::new();
4165                 if self.datalen == 0 { return Self::from(res); }
4166                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
4167                 Self::from(res)
4168         }
4169 }
4170 #[repr(C)]
4171 /// The contents of CResult_NonePaymentSendFailureZ
4172 pub union CResult_NonePaymentSendFailureZPtr {
4173         /// Note that this value is always NULL, as there are no contents in the OK variant
4174         pub result: *mut std::ffi::c_void,
4175         /// A pointer to the contents in the error state.
4176         /// Reading from this pointer when `result_ok` is set is undefined.
4177         pub err: *mut crate::lightning::ln::channelmanager::PaymentSendFailure,
4178 }
4179 #[repr(C)]
4180 /// A CResult_NonePaymentSendFailureZ represents the result of a fallible operation,
4181 /// containing a () on success and a crate::lightning::ln::channelmanager::PaymentSendFailure on failure.
4182 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4183 pub struct CResult_NonePaymentSendFailureZ {
4184         /// The contents of this CResult_NonePaymentSendFailureZ, accessible via either
4185         /// `err` or `result` depending on the state of `result_ok`.
4186         pub contents: CResult_NonePaymentSendFailureZPtr,
4187         /// Whether this CResult_NonePaymentSendFailureZ represents a success state.
4188         pub result_ok: bool,
4189 }
4190 #[no_mangle]
4191 /// Creates a new CResult_NonePaymentSendFailureZ in the success state.
4192 pub extern "C" fn CResult_NonePaymentSendFailureZ_ok() -> CResult_NonePaymentSendFailureZ {
4193         CResult_NonePaymentSendFailureZ {
4194                 contents: CResult_NonePaymentSendFailureZPtr {
4195                         result: std::ptr::null_mut(),
4196                 },
4197                 result_ok: true,
4198         }
4199 }
4200 #[no_mangle]
4201 /// Creates a new CResult_NonePaymentSendFailureZ in the error state.
4202 pub extern "C" fn CResult_NonePaymentSendFailureZ_err(e: crate::lightning::ln::channelmanager::PaymentSendFailure) -> CResult_NonePaymentSendFailureZ {
4203         CResult_NonePaymentSendFailureZ {
4204                 contents: CResult_NonePaymentSendFailureZPtr {
4205                         err: Box::into_raw(Box::new(e)),
4206                 },
4207                 result_ok: false,
4208         }
4209 }
4210 #[no_mangle]
4211 /// Frees any resources used by the CResult_NonePaymentSendFailureZ.
4212 pub extern "C" fn CResult_NonePaymentSendFailureZ_free(_res: CResult_NonePaymentSendFailureZ) { }
4213 impl Drop for CResult_NonePaymentSendFailureZ {
4214         fn drop(&mut self) {
4215                 if self.result_ok {
4216                 } else {
4217                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
4218                                 let _ = unsafe { Box::from_raw(self.contents.err) };
4219                         }
4220                 }
4221         }
4222 }
4223 impl From<crate::c_types::CResultTempl<(), crate::lightning::ln::channelmanager::PaymentSendFailure>> for CResult_NonePaymentSendFailureZ {
4224         fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::ln::channelmanager::PaymentSendFailure>) -> Self {
4225                 let contents = if o.result_ok {
4226                         let _ = unsafe { Box::from_raw(o.contents.result) };
4227                         o.contents.result = std::ptr::null_mut();
4228                         CResult_NonePaymentSendFailureZPtr { result: std::ptr::null_mut() }
4229                 } else {
4230                         let err = unsafe { o.contents.err };
4231                         unsafe { o.contents.err = std::ptr::null_mut(); }
4232                         CResult_NonePaymentSendFailureZPtr { err }
4233                 };
4234                 Self {
4235                         contents,
4236                         result_ok: o.result_ok,
4237                 }
4238         }
4239 }
4240 impl Clone for CResult_NonePaymentSendFailureZ {
4241         fn clone(&self) -> Self {
4242                 if self.result_ok {
4243                         Self { result_ok: true, contents: CResult_NonePaymentSendFailureZPtr {
4244                                 result: std::ptr::null_mut()
4245                         } }
4246                 } else {
4247                         Self { result_ok: false, contents: CResult_NonePaymentSendFailureZPtr {
4248                                 err: Box::into_raw(Box::new(<crate::lightning::ln::channelmanager::PaymentSendFailure>::clone(unsafe { &*self.contents.err })))
4249                         } }
4250                 }
4251         }
4252 }
4253 #[no_mangle]
4254 /// Creates a new CResult_NonePaymentSendFailureZ which has the same data as `orig`
4255 /// but with all dynamically-allocated buffers duplicated in new buffers.
4256 pub extern "C" fn CResult_NonePaymentSendFailureZ_clone(orig: &CResult_NonePaymentSendFailureZ) -> CResult_NonePaymentSendFailureZ { orig.clone() }
4257 #[repr(C)]
4258 /// The contents of CResult_PaymentHashPaymentSendFailureZ
4259 pub union CResult_PaymentHashPaymentSendFailureZPtr {
4260         /// A pointer to the contents in the success state.
4261         /// Reading from this pointer when `result_ok` is not set is undefined.
4262         pub result: *mut crate::c_types::ThirtyTwoBytes,
4263         /// A pointer to the contents in the error state.
4264         /// Reading from this pointer when `result_ok` is set is undefined.
4265         pub err: *mut crate::lightning::ln::channelmanager::PaymentSendFailure,
4266 }
4267 #[repr(C)]
4268 /// A CResult_PaymentHashPaymentSendFailureZ represents the result of a fallible operation,
4269 /// containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning::ln::channelmanager::PaymentSendFailure on failure.
4270 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4271 pub struct CResult_PaymentHashPaymentSendFailureZ {
4272         /// The contents of this CResult_PaymentHashPaymentSendFailureZ, accessible via either
4273         /// `err` or `result` depending on the state of `result_ok`.
4274         pub contents: CResult_PaymentHashPaymentSendFailureZPtr,
4275         /// Whether this CResult_PaymentHashPaymentSendFailureZ represents a success state.
4276         pub result_ok: bool,
4277 }
4278 #[no_mangle]
4279 /// Creates a new CResult_PaymentHashPaymentSendFailureZ in the success state.
4280 pub extern "C" fn CResult_PaymentHashPaymentSendFailureZ_ok(o: crate::c_types::ThirtyTwoBytes) -> CResult_PaymentHashPaymentSendFailureZ {
4281         CResult_PaymentHashPaymentSendFailureZ {
4282                 contents: CResult_PaymentHashPaymentSendFailureZPtr {
4283                         result: Box::into_raw(Box::new(o)),
4284                 },
4285                 result_ok: true,
4286         }
4287 }
4288 #[no_mangle]
4289 /// Creates a new CResult_PaymentHashPaymentSendFailureZ in the error state.
4290 pub extern "C" fn CResult_PaymentHashPaymentSendFailureZ_err(e: crate::lightning::ln::channelmanager::PaymentSendFailure) -> CResult_PaymentHashPaymentSendFailureZ {
4291         CResult_PaymentHashPaymentSendFailureZ {
4292                 contents: CResult_PaymentHashPaymentSendFailureZPtr {
4293                         err: Box::into_raw(Box::new(e)),
4294                 },
4295                 result_ok: false,
4296         }
4297 }
4298 #[no_mangle]
4299 /// Frees any resources used by the CResult_PaymentHashPaymentSendFailureZ.
4300 pub extern "C" fn CResult_PaymentHashPaymentSendFailureZ_free(_res: CResult_PaymentHashPaymentSendFailureZ) { }
4301 impl Drop for CResult_PaymentHashPaymentSendFailureZ {
4302         fn drop(&mut self) {
4303                 if self.result_ok {
4304                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
4305                                 let _ = unsafe { Box::from_raw(self.contents.result) };
4306                         }
4307                 } else {
4308                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
4309                                 let _ = unsafe { Box::from_raw(self.contents.err) };
4310                         }
4311                 }
4312         }
4313 }
4314 impl From<crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::ln::channelmanager::PaymentSendFailure>> for CResult_PaymentHashPaymentSendFailureZ {
4315         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::ln::channelmanager::PaymentSendFailure>) -> Self {
4316                 let contents = if o.result_ok {
4317                         let result = unsafe { o.contents.result };
4318                         unsafe { o.contents.result = std::ptr::null_mut() };
4319                         CResult_PaymentHashPaymentSendFailureZPtr { result }
4320                 } else {
4321                         let err = unsafe { o.contents.err };
4322                         unsafe { o.contents.err = std::ptr::null_mut(); }
4323                         CResult_PaymentHashPaymentSendFailureZPtr { err }
4324                 };
4325                 Self {
4326                         contents,
4327                         result_ok: o.result_ok,
4328                 }
4329         }
4330 }
4331 impl Clone for CResult_PaymentHashPaymentSendFailureZ {
4332         fn clone(&self) -> Self {
4333                 if self.result_ok {
4334                         Self { result_ok: true, contents: CResult_PaymentHashPaymentSendFailureZPtr {
4335                                 result: Box::into_raw(Box::new(<crate::c_types::ThirtyTwoBytes>::clone(unsafe { &*self.contents.result })))
4336                         } }
4337                 } else {
4338                         Self { result_ok: false, contents: CResult_PaymentHashPaymentSendFailureZPtr {
4339                                 err: Box::into_raw(Box::new(<crate::lightning::ln::channelmanager::PaymentSendFailure>::clone(unsafe { &*self.contents.err })))
4340                         } }
4341                 }
4342         }
4343 }
4344 #[no_mangle]
4345 /// Creates a new CResult_PaymentHashPaymentSendFailureZ which has the same data as `orig`
4346 /// but with all dynamically-allocated buffers duplicated in new buffers.
4347 pub extern "C" fn CResult_PaymentHashPaymentSendFailureZ_clone(orig: &CResult_PaymentHashPaymentSendFailureZ) -> CResult_PaymentHashPaymentSendFailureZ { orig.clone() }
4348 #[repr(C)]
4349 /// A dynamically-allocated array of crate::lightning::ln::msgs::NetAddresss of arbitrary size.
4350 /// This corresponds to std::vector in C++
4351 pub struct CVec_NetAddressZ {
4352         /// The elements in the array.
4353         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4354         pub data: *mut crate::lightning::ln::msgs::NetAddress,
4355         /// The number of elements pointed to by `data`.
4356         pub datalen: usize
4357 }
4358 impl CVec_NetAddressZ {
4359         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::NetAddress> {
4360                 if self.datalen == 0 { return Vec::new(); }
4361                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
4362                 self.data = std::ptr::null_mut();
4363                 self.datalen = 0;
4364                 ret
4365         }
4366         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::NetAddress] {
4367                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
4368         }
4369 }
4370 impl From<Vec<crate::lightning::ln::msgs::NetAddress>> for CVec_NetAddressZ {
4371         fn from(v: Vec<crate::lightning::ln::msgs::NetAddress>) -> Self {
4372                 let datalen = v.len();
4373                 let data = Box::into_raw(v.into_boxed_slice());
4374                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
4375         }
4376 }
4377 #[no_mangle]
4378 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
4379 pub extern "C" fn CVec_NetAddressZ_free(_res: CVec_NetAddressZ) { }
4380 impl Drop for CVec_NetAddressZ {
4381         fn drop(&mut self) {
4382                 if self.datalen == 0 { return; }
4383                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
4384         }
4385 }
4386 impl Clone for CVec_NetAddressZ {
4387         fn clone(&self) -> Self {
4388                 let mut res = Vec::new();
4389                 if self.datalen == 0 { return Self::from(res); }
4390                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
4391                 Self::from(res)
4392         }
4393 }
4394 #[repr(C)]
4395 /// A tuple of 2 elements. See the individual fields for the types contained.
4396 pub struct C2Tuple_PaymentHashPaymentSecretZ {
4397         /// The element at position 0
4398         pub a: crate::c_types::ThirtyTwoBytes,
4399         /// The element at position 1
4400         pub b: crate::c_types::ThirtyTwoBytes,
4401 }
4402 impl From<(crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes)> for C2Tuple_PaymentHashPaymentSecretZ {
4403         fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes)) -> Self {
4404                 Self {
4405                         a: tup.0,
4406                         b: tup.1,
4407                 }
4408         }
4409 }
4410 impl C2Tuple_PaymentHashPaymentSecretZ {
4411         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes) {
4412                 (self.a, self.b)
4413         }
4414 }
4415 impl Clone for C2Tuple_PaymentHashPaymentSecretZ {
4416         fn clone(&self) -> Self {
4417                 Self {
4418                         a: self.a.clone(),
4419                         b: self.b.clone(),
4420                 }
4421         }
4422 }
4423 #[no_mangle]
4424 /// Creates a new tuple which has the same data as `orig`
4425 /// but with all dynamically-allocated buffers duplicated in new buffers.
4426 pub extern "C" fn C2Tuple_PaymentHashPaymentSecretZ_clone(orig: &C2Tuple_PaymentHashPaymentSecretZ) -> C2Tuple_PaymentHashPaymentSecretZ { orig.clone() }
4427 /// Creates a new C2Tuple_PaymentHashPaymentSecretZ from the contained elements.
4428 #[no_mangle]
4429 pub extern "C" fn C2Tuple_PaymentHashPaymentSecretZ_new(a: crate::c_types::ThirtyTwoBytes, b: crate::c_types::ThirtyTwoBytes) -> C2Tuple_PaymentHashPaymentSecretZ {
4430         C2Tuple_PaymentHashPaymentSecretZ { a, b, }
4431 }
4432
4433 #[no_mangle]
4434 /// Frees any resources used by the C2Tuple_PaymentHashPaymentSecretZ.
4435 pub extern "C" fn C2Tuple_PaymentHashPaymentSecretZ_free(_res: C2Tuple_PaymentHashPaymentSecretZ) { }
4436 #[repr(C)]
4437 /// The contents of CResult_PaymentSecretAPIErrorZ
4438 pub union CResult_PaymentSecretAPIErrorZPtr {
4439         /// A pointer to the contents in the success state.
4440         /// Reading from this pointer when `result_ok` is not set is undefined.
4441         pub result: *mut crate::c_types::ThirtyTwoBytes,
4442         /// A pointer to the contents in the error state.
4443         /// Reading from this pointer when `result_ok` is set is undefined.
4444         pub err: *mut crate::lightning::util::errors::APIError,
4445 }
4446 #[repr(C)]
4447 /// A CResult_PaymentSecretAPIErrorZ represents the result of a fallible operation,
4448 /// containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning::util::errors::APIError on failure.
4449 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4450 pub struct CResult_PaymentSecretAPIErrorZ {
4451         /// The contents of this CResult_PaymentSecretAPIErrorZ, accessible via either
4452         /// `err` or `result` depending on the state of `result_ok`.
4453         pub contents: CResult_PaymentSecretAPIErrorZPtr,
4454         /// Whether this CResult_PaymentSecretAPIErrorZ represents a success state.
4455         pub result_ok: bool,
4456 }
4457 #[no_mangle]
4458 /// Creates a new CResult_PaymentSecretAPIErrorZ in the success state.
4459 pub extern "C" fn CResult_PaymentSecretAPIErrorZ_ok(o: crate::c_types::ThirtyTwoBytes) -> CResult_PaymentSecretAPIErrorZ {
4460         CResult_PaymentSecretAPIErrorZ {
4461                 contents: CResult_PaymentSecretAPIErrorZPtr {
4462                         result: Box::into_raw(Box::new(o)),
4463                 },
4464                 result_ok: true,
4465         }
4466 }
4467 #[no_mangle]
4468 /// Creates a new CResult_PaymentSecretAPIErrorZ in the error state.
4469 pub extern "C" fn CResult_PaymentSecretAPIErrorZ_err(e: crate::lightning::util::errors::APIError) -> CResult_PaymentSecretAPIErrorZ {
4470         CResult_PaymentSecretAPIErrorZ {
4471                 contents: CResult_PaymentSecretAPIErrorZPtr {
4472                         err: Box::into_raw(Box::new(e)),
4473                 },
4474                 result_ok: false,
4475         }
4476 }
4477 #[no_mangle]
4478 /// Frees any resources used by the CResult_PaymentSecretAPIErrorZ.
4479 pub extern "C" fn CResult_PaymentSecretAPIErrorZ_free(_res: CResult_PaymentSecretAPIErrorZ) { }
4480 impl Drop for CResult_PaymentSecretAPIErrorZ {
4481         fn drop(&mut self) {
4482                 if self.result_ok {
4483                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
4484                                 let _ = unsafe { Box::from_raw(self.contents.result) };
4485                         }
4486                 } else {
4487                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
4488                                 let _ = unsafe { Box::from_raw(self.contents.err) };
4489                         }
4490                 }
4491         }
4492 }
4493 impl From<crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::util::errors::APIError>> for CResult_PaymentSecretAPIErrorZ {
4494         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::util::errors::APIError>) -> Self {
4495                 let contents = if o.result_ok {
4496                         let result = unsafe { o.contents.result };
4497                         unsafe { o.contents.result = std::ptr::null_mut() };
4498                         CResult_PaymentSecretAPIErrorZPtr { result }
4499                 } else {
4500                         let err = unsafe { o.contents.err };
4501                         unsafe { o.contents.err = std::ptr::null_mut(); }
4502                         CResult_PaymentSecretAPIErrorZPtr { err }
4503                 };
4504                 Self {
4505                         contents,
4506                         result_ok: o.result_ok,
4507                 }
4508         }
4509 }
4510 impl Clone for CResult_PaymentSecretAPIErrorZ {
4511         fn clone(&self) -> Self {
4512                 if self.result_ok {
4513                         Self { result_ok: true, contents: CResult_PaymentSecretAPIErrorZPtr {
4514                                 result: Box::into_raw(Box::new(<crate::c_types::ThirtyTwoBytes>::clone(unsafe { &*self.contents.result })))
4515                         } }
4516                 } else {
4517                         Self { result_ok: false, contents: CResult_PaymentSecretAPIErrorZPtr {
4518                                 err: Box::into_raw(Box::new(<crate::lightning::util::errors::APIError>::clone(unsafe { &*self.contents.err })))
4519                         } }
4520                 }
4521         }
4522 }
4523 #[no_mangle]
4524 /// Creates a new CResult_PaymentSecretAPIErrorZ which has the same data as `orig`
4525 /// but with all dynamically-allocated buffers duplicated in new buffers.
4526 pub extern "C" fn CResult_PaymentSecretAPIErrorZ_clone(orig: &CResult_PaymentSecretAPIErrorZ) -> CResult_PaymentSecretAPIErrorZ { orig.clone() }
4527 #[repr(C)]
4528 /// A dynamically-allocated array of crate::lightning::chain::channelmonitor::ChannelMonitors of arbitrary size.
4529 /// This corresponds to std::vector in C++
4530 pub struct CVec_ChannelMonitorZ {
4531         /// The elements in the array.
4532         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4533         pub data: *mut crate::lightning::chain::channelmonitor::ChannelMonitor,
4534         /// The number of elements pointed to by `data`.
4535         pub datalen: usize
4536 }
4537 impl CVec_ChannelMonitorZ {
4538         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::chain::channelmonitor::ChannelMonitor> {
4539                 if self.datalen == 0 { return Vec::new(); }
4540                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
4541                 self.data = std::ptr::null_mut();
4542                 self.datalen = 0;
4543                 ret
4544         }
4545         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::chain::channelmonitor::ChannelMonitor] {
4546                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
4547         }
4548 }
4549 impl From<Vec<crate::lightning::chain::channelmonitor::ChannelMonitor>> for CVec_ChannelMonitorZ {
4550         fn from(v: Vec<crate::lightning::chain::channelmonitor::ChannelMonitor>) -> Self {
4551                 let datalen = v.len();
4552                 let data = Box::into_raw(v.into_boxed_slice());
4553                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
4554         }
4555 }
4556 #[no_mangle]
4557 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
4558 pub extern "C" fn CVec_ChannelMonitorZ_free(_res: CVec_ChannelMonitorZ) { }
4559 impl Drop for CVec_ChannelMonitorZ {
4560         fn drop(&mut self) {
4561                 if self.datalen == 0 { return; }
4562                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
4563         }
4564 }
4565 #[repr(C)]
4566 /// A tuple of 2 elements. See the individual fields for the types contained.
4567 pub struct C2Tuple_BlockHashChannelManagerZ {
4568         /// The element at position 0
4569         pub a: crate::c_types::ThirtyTwoBytes,
4570         /// The element at position 1
4571         pub b: crate::lightning::ln::channelmanager::ChannelManager,
4572 }
4573 impl From<(crate::c_types::ThirtyTwoBytes, crate::lightning::ln::channelmanager::ChannelManager)> for C2Tuple_BlockHashChannelManagerZ {
4574         fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::lightning::ln::channelmanager::ChannelManager)) -> Self {
4575                 Self {
4576                         a: tup.0,
4577                         b: tup.1,
4578                 }
4579         }
4580 }
4581 impl C2Tuple_BlockHashChannelManagerZ {
4582         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::lightning::ln::channelmanager::ChannelManager) {
4583                 (self.a, self.b)
4584         }
4585 }
4586 /// Creates a new C2Tuple_BlockHashChannelManagerZ from the contained elements.
4587 #[no_mangle]
4588 pub extern "C" fn C2Tuple_BlockHashChannelManagerZ_new(a: crate::c_types::ThirtyTwoBytes, b: crate::lightning::ln::channelmanager::ChannelManager) -> C2Tuple_BlockHashChannelManagerZ {
4589         C2Tuple_BlockHashChannelManagerZ { a, b, }
4590 }
4591
4592 #[no_mangle]
4593 /// Frees any resources used by the C2Tuple_BlockHashChannelManagerZ.
4594 pub extern "C" fn C2Tuple_BlockHashChannelManagerZ_free(_res: C2Tuple_BlockHashChannelManagerZ) { }
4595 #[repr(C)]
4596 /// The contents of CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ
4597 pub union CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr {
4598         /// A pointer to the contents in the success state.
4599         /// Reading from this pointer when `result_ok` is not set is undefined.
4600         pub result: *mut crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ,
4601         /// A pointer to the contents in the error state.
4602         /// Reading from this pointer when `result_ok` is set is undefined.
4603         pub err: *mut crate::lightning::ln::msgs::DecodeError,
4604 }
4605 #[repr(C)]
4606 /// A CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ represents the result of a fallible operation,
4607 /// containing a crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
4608 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4609 pub struct CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
4610         /// The contents of this CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ, accessible via either
4611         /// `err` or `result` depending on the state of `result_ok`.
4612         pub contents: CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr,
4613         /// Whether this CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ represents a success state.
4614         pub result_ok: bool,
4615 }
4616 #[no_mangle]
4617 /// Creates a new CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ in the success state.
4618 pub extern "C" fn CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_ok(o: crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ) -> CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
4619         CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
4620                 contents: CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr {
4621                         result: Box::into_raw(Box::new(o)),
4622                 },
4623                 result_ok: true,
4624         }
4625 }
4626 #[no_mangle]
4627 /// Creates a new CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ in the error state.
4628 pub extern "C" fn CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
4629         CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
4630                 contents: CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr {
4631                         err: Box::into_raw(Box::new(e)),
4632                 },
4633                 result_ok: false,
4634         }
4635 }
4636 #[no_mangle]
4637 /// Frees any resources used by the CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ.
4638 pub extern "C" fn CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_free(_res: CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ) { }
4639 impl Drop for CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
4640         fn drop(&mut self) {
4641                 if self.result_ok {
4642                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
4643                                 let _ = unsafe { Box::from_raw(self.contents.result) };
4644                         }
4645                 } else {
4646                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
4647                                 let _ = unsafe { Box::from_raw(self.contents.err) };
4648                         }
4649                 }
4650         }
4651 }
4652 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ, crate::lightning::ln::msgs::DecodeError>> for CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
4653         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
4654                 let contents = if o.result_ok {
4655                         let result = unsafe { o.contents.result };
4656                         unsafe { o.contents.result = std::ptr::null_mut() };
4657                         CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr { result }
4658                 } else {
4659                         let err = unsafe { o.contents.err };
4660                         unsafe { o.contents.err = std::ptr::null_mut(); }
4661                         CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr { err }
4662                 };
4663                 Self {
4664                         contents,
4665                         result_ok: o.result_ok,
4666                 }
4667         }
4668 }
4669 #[repr(C)]
4670 /// The contents of CResult_ChannelConfigDecodeErrorZ
4671 pub union CResult_ChannelConfigDecodeErrorZPtr {
4672         /// A pointer to the contents in the success state.
4673         /// Reading from this pointer when `result_ok` is not set is undefined.
4674         pub result: *mut crate::lightning::util::config::ChannelConfig,
4675         /// A pointer to the contents in the error state.
4676         /// Reading from this pointer when `result_ok` is set is undefined.
4677         pub err: *mut crate::lightning::ln::msgs::DecodeError,
4678 }
4679 #[repr(C)]
4680 /// A CResult_ChannelConfigDecodeErrorZ represents the result of a fallible operation,
4681 /// containing a crate::lightning::util::config::ChannelConfig on success and a crate::lightning::ln::msgs::DecodeError on failure.
4682 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4683 pub struct CResult_ChannelConfigDecodeErrorZ {
4684         /// The contents of this CResult_ChannelConfigDecodeErrorZ, accessible via either
4685         /// `err` or `result` depending on the state of `result_ok`.
4686         pub contents: CResult_ChannelConfigDecodeErrorZPtr,
4687         /// Whether this CResult_ChannelConfigDecodeErrorZ represents a success state.
4688         pub result_ok: bool,
4689 }
4690 #[no_mangle]
4691 /// Creates a new CResult_ChannelConfigDecodeErrorZ in the success state.
4692 pub extern "C" fn CResult_ChannelConfigDecodeErrorZ_ok(o: crate::lightning::util::config::ChannelConfig) -> CResult_ChannelConfigDecodeErrorZ {
4693         CResult_ChannelConfigDecodeErrorZ {
4694                 contents: CResult_ChannelConfigDecodeErrorZPtr {
4695                         result: Box::into_raw(Box::new(o)),
4696                 },
4697                 result_ok: true,
4698         }
4699 }
4700 #[no_mangle]
4701 /// Creates a new CResult_ChannelConfigDecodeErrorZ in the error state.
4702 pub extern "C" fn CResult_ChannelConfigDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelConfigDecodeErrorZ {
4703         CResult_ChannelConfigDecodeErrorZ {
4704                 contents: CResult_ChannelConfigDecodeErrorZPtr {
4705                         err: Box::into_raw(Box::new(e)),
4706                 },
4707                 result_ok: false,
4708         }
4709 }
4710 #[no_mangle]
4711 /// Frees any resources used by the CResult_ChannelConfigDecodeErrorZ.
4712 pub extern "C" fn CResult_ChannelConfigDecodeErrorZ_free(_res: CResult_ChannelConfigDecodeErrorZ) { }
4713 impl Drop for CResult_ChannelConfigDecodeErrorZ {
4714         fn drop(&mut self) {
4715                 if self.result_ok {
4716                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
4717                                 let _ = unsafe { Box::from_raw(self.contents.result) };
4718                         }
4719                 } else {
4720                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
4721                                 let _ = unsafe { Box::from_raw(self.contents.err) };
4722                         }
4723                 }
4724         }
4725 }
4726 impl From<crate::c_types::CResultTempl<crate::lightning::util::config::ChannelConfig, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelConfigDecodeErrorZ {
4727         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::util::config::ChannelConfig, crate::lightning::ln::msgs::DecodeError>) -> Self {
4728                 let contents = if o.result_ok {
4729                         let result = unsafe { o.contents.result };
4730                         unsafe { o.contents.result = std::ptr::null_mut() };
4731                         CResult_ChannelConfigDecodeErrorZPtr { result }
4732                 } else {
4733                         let err = unsafe { o.contents.err };
4734                         unsafe { o.contents.err = std::ptr::null_mut(); }
4735                         CResult_ChannelConfigDecodeErrorZPtr { err }
4736                 };
4737                 Self {
4738                         contents,
4739                         result_ok: o.result_ok,
4740                 }
4741         }
4742 }
4743 impl Clone for CResult_ChannelConfigDecodeErrorZ {
4744         fn clone(&self) -> Self {
4745                 if self.result_ok {
4746                         Self { result_ok: true, contents: CResult_ChannelConfigDecodeErrorZPtr {
4747                                 result: Box::into_raw(Box::new(<crate::lightning::util::config::ChannelConfig>::clone(unsafe { &*self.contents.result })))
4748                         } }
4749                 } else {
4750                         Self { result_ok: false, contents: CResult_ChannelConfigDecodeErrorZPtr {
4751                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
4752                         } }
4753                 }
4754         }
4755 }
4756 #[no_mangle]
4757 /// Creates a new CResult_ChannelConfigDecodeErrorZ which has the same data as `orig`
4758 /// but with all dynamically-allocated buffers duplicated in new buffers.
4759 pub extern "C" fn CResult_ChannelConfigDecodeErrorZ_clone(orig: &CResult_ChannelConfigDecodeErrorZ) -> CResult_ChannelConfigDecodeErrorZ { orig.clone() }
4760 #[repr(C)]
4761 /// The contents of CResult_OutPointDecodeErrorZ
4762 pub union CResult_OutPointDecodeErrorZPtr {
4763         /// A pointer to the contents in the success state.
4764         /// Reading from this pointer when `result_ok` is not set is undefined.
4765         pub result: *mut crate::lightning::chain::transaction::OutPoint,
4766         /// A pointer to the contents in the error state.
4767         /// Reading from this pointer when `result_ok` is set is undefined.
4768         pub err: *mut crate::lightning::ln::msgs::DecodeError,
4769 }
4770 #[repr(C)]
4771 /// A CResult_OutPointDecodeErrorZ represents the result of a fallible operation,
4772 /// containing a crate::lightning::chain::transaction::OutPoint on success and a crate::lightning::ln::msgs::DecodeError on failure.
4773 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4774 pub struct CResult_OutPointDecodeErrorZ {
4775         /// The contents of this CResult_OutPointDecodeErrorZ, accessible via either
4776         /// `err` or `result` depending on the state of `result_ok`.
4777         pub contents: CResult_OutPointDecodeErrorZPtr,
4778         /// Whether this CResult_OutPointDecodeErrorZ represents a success state.
4779         pub result_ok: bool,
4780 }
4781 #[no_mangle]
4782 /// Creates a new CResult_OutPointDecodeErrorZ in the success state.
4783 pub extern "C" fn CResult_OutPointDecodeErrorZ_ok(o: crate::lightning::chain::transaction::OutPoint) -> CResult_OutPointDecodeErrorZ {
4784         CResult_OutPointDecodeErrorZ {
4785                 contents: CResult_OutPointDecodeErrorZPtr {
4786                         result: Box::into_raw(Box::new(o)),
4787                 },
4788                 result_ok: true,
4789         }
4790 }
4791 #[no_mangle]
4792 /// Creates a new CResult_OutPointDecodeErrorZ in the error state.
4793 pub extern "C" fn CResult_OutPointDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_OutPointDecodeErrorZ {
4794         CResult_OutPointDecodeErrorZ {
4795                 contents: CResult_OutPointDecodeErrorZPtr {
4796                         err: Box::into_raw(Box::new(e)),
4797                 },
4798                 result_ok: false,
4799         }
4800 }
4801 #[no_mangle]
4802 /// Frees any resources used by the CResult_OutPointDecodeErrorZ.
4803 pub extern "C" fn CResult_OutPointDecodeErrorZ_free(_res: CResult_OutPointDecodeErrorZ) { }
4804 impl Drop for CResult_OutPointDecodeErrorZ {
4805         fn drop(&mut self) {
4806                 if self.result_ok {
4807                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
4808                                 let _ = unsafe { Box::from_raw(self.contents.result) };
4809                         }
4810                 } else {
4811                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
4812                                 let _ = unsafe { Box::from_raw(self.contents.err) };
4813                         }
4814                 }
4815         }
4816 }
4817 impl From<crate::c_types::CResultTempl<crate::lightning::chain::transaction::OutPoint, crate::lightning::ln::msgs::DecodeError>> for CResult_OutPointDecodeErrorZ {
4818         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::transaction::OutPoint, crate::lightning::ln::msgs::DecodeError>) -> Self {
4819                 let contents = if o.result_ok {
4820                         let result = unsafe { o.contents.result };
4821                         unsafe { o.contents.result = std::ptr::null_mut() };
4822                         CResult_OutPointDecodeErrorZPtr { result }
4823                 } else {
4824                         let err = unsafe { o.contents.err };
4825                         unsafe { o.contents.err = std::ptr::null_mut(); }
4826                         CResult_OutPointDecodeErrorZPtr { err }
4827                 };
4828                 Self {
4829                         contents,
4830                         result_ok: o.result_ok,
4831                 }
4832         }
4833 }
4834 impl Clone for CResult_OutPointDecodeErrorZ {
4835         fn clone(&self) -> Self {
4836                 if self.result_ok {
4837                         Self { result_ok: true, contents: CResult_OutPointDecodeErrorZPtr {
4838                                 result: Box::into_raw(Box::new(<crate::lightning::chain::transaction::OutPoint>::clone(unsafe { &*self.contents.result })))
4839                         } }
4840                 } else {
4841                         Self { result_ok: false, contents: CResult_OutPointDecodeErrorZPtr {
4842                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
4843                         } }
4844                 }
4845         }
4846 }
4847 #[no_mangle]
4848 /// Creates a new CResult_OutPointDecodeErrorZ which has the same data as `orig`
4849 /// but with all dynamically-allocated buffers duplicated in new buffers.
4850 pub extern "C" fn CResult_OutPointDecodeErrorZ_clone(orig: &CResult_OutPointDecodeErrorZ) -> CResult_OutPointDecodeErrorZ { orig.clone() }
4851 #[repr(C)]
4852 /// The contents of CResult_SiPrefixNoneZ
4853 pub union CResult_SiPrefixNoneZPtr {
4854         /// A pointer to the contents in the success state.
4855         /// Reading from this pointer when `result_ok` is not set is undefined.
4856         pub result: *mut crate::lightning_invoice::SiPrefix,
4857         /// Note that this value is always NULL, as there are no contents in the Err variant
4858         pub err: *mut std::ffi::c_void,
4859 }
4860 #[repr(C)]
4861 /// A CResult_SiPrefixNoneZ represents the result of a fallible operation,
4862 /// containing a crate::lightning_invoice::SiPrefix on success and a () on failure.
4863 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4864 pub struct CResult_SiPrefixNoneZ {
4865         /// The contents of this CResult_SiPrefixNoneZ, accessible via either
4866         /// `err` or `result` depending on the state of `result_ok`.
4867         pub contents: CResult_SiPrefixNoneZPtr,
4868         /// Whether this CResult_SiPrefixNoneZ represents a success state.
4869         pub result_ok: bool,
4870 }
4871 #[no_mangle]
4872 /// Creates a new CResult_SiPrefixNoneZ in the success state.
4873 pub extern "C" fn CResult_SiPrefixNoneZ_ok(o: crate::lightning_invoice::SiPrefix) -> CResult_SiPrefixNoneZ {
4874         CResult_SiPrefixNoneZ {
4875                 contents: CResult_SiPrefixNoneZPtr {
4876                         result: Box::into_raw(Box::new(o)),
4877                 },
4878                 result_ok: true,
4879         }
4880 }
4881 #[no_mangle]
4882 /// Creates a new CResult_SiPrefixNoneZ in the error state.
4883 pub extern "C" fn CResult_SiPrefixNoneZ_err() -> CResult_SiPrefixNoneZ {
4884         CResult_SiPrefixNoneZ {
4885                 contents: CResult_SiPrefixNoneZPtr {
4886                         err: std::ptr::null_mut(),
4887                 },
4888                 result_ok: false,
4889         }
4890 }
4891 #[no_mangle]
4892 /// Frees any resources used by the CResult_SiPrefixNoneZ.
4893 pub extern "C" fn CResult_SiPrefixNoneZ_free(_res: CResult_SiPrefixNoneZ) { }
4894 impl Drop for CResult_SiPrefixNoneZ {
4895         fn drop(&mut self) {
4896                 if self.result_ok {
4897                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
4898                                 let _ = unsafe { Box::from_raw(self.contents.result) };
4899                         }
4900                 } else {
4901                 }
4902         }
4903 }
4904 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::SiPrefix, ()>> for CResult_SiPrefixNoneZ {
4905         fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::SiPrefix, ()>) -> Self {
4906                 let contents = if o.result_ok {
4907                         let result = unsafe { o.contents.result };
4908                         unsafe { o.contents.result = std::ptr::null_mut() };
4909                         CResult_SiPrefixNoneZPtr { result }
4910                 } else {
4911                         let _ = unsafe { Box::from_raw(o.contents.err) };
4912                         o.contents.err = std::ptr::null_mut();
4913                         CResult_SiPrefixNoneZPtr { err: std::ptr::null_mut() }
4914                 };
4915                 Self {
4916                         contents,
4917                         result_ok: o.result_ok,
4918                 }
4919         }
4920 }
4921 impl Clone for CResult_SiPrefixNoneZ {
4922         fn clone(&self) -> Self {
4923                 if self.result_ok {
4924                         Self { result_ok: true, contents: CResult_SiPrefixNoneZPtr {
4925                                 result: Box::into_raw(Box::new(<crate::lightning_invoice::SiPrefix>::clone(unsafe { &*self.contents.result })))
4926                         } }
4927                 } else {
4928                         Self { result_ok: false, contents: CResult_SiPrefixNoneZPtr {
4929                                 err: std::ptr::null_mut()
4930                         } }
4931                 }
4932         }
4933 }
4934 #[no_mangle]
4935 /// Creates a new CResult_SiPrefixNoneZ which has the same data as `orig`
4936 /// but with all dynamically-allocated buffers duplicated in new buffers.
4937 pub extern "C" fn CResult_SiPrefixNoneZ_clone(orig: &CResult_SiPrefixNoneZ) -> CResult_SiPrefixNoneZ { orig.clone() }
4938 #[repr(C)]
4939 /// The contents of CResult_InvoiceNoneZ
4940 pub union CResult_InvoiceNoneZPtr {
4941         /// A pointer to the contents in the success state.
4942         /// Reading from this pointer when `result_ok` is not set is undefined.
4943         pub result: *mut crate::lightning_invoice::Invoice,
4944         /// Note that this value is always NULL, as there are no contents in the Err variant
4945         pub err: *mut std::ffi::c_void,
4946 }
4947 #[repr(C)]
4948 /// A CResult_InvoiceNoneZ represents the result of a fallible operation,
4949 /// containing a crate::lightning_invoice::Invoice on success and a () on failure.
4950 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4951 pub struct CResult_InvoiceNoneZ {
4952         /// The contents of this CResult_InvoiceNoneZ, accessible via either
4953         /// `err` or `result` depending on the state of `result_ok`.
4954         pub contents: CResult_InvoiceNoneZPtr,
4955         /// Whether this CResult_InvoiceNoneZ represents a success state.
4956         pub result_ok: bool,
4957 }
4958 #[no_mangle]
4959 /// Creates a new CResult_InvoiceNoneZ in the success state.
4960 pub extern "C" fn CResult_InvoiceNoneZ_ok(o: crate::lightning_invoice::Invoice) -> CResult_InvoiceNoneZ {
4961         CResult_InvoiceNoneZ {
4962                 contents: CResult_InvoiceNoneZPtr {
4963                         result: Box::into_raw(Box::new(o)),
4964                 },
4965                 result_ok: true,
4966         }
4967 }
4968 #[no_mangle]
4969 /// Creates a new CResult_InvoiceNoneZ in the error state.
4970 pub extern "C" fn CResult_InvoiceNoneZ_err() -> CResult_InvoiceNoneZ {
4971         CResult_InvoiceNoneZ {
4972                 contents: CResult_InvoiceNoneZPtr {
4973                         err: std::ptr::null_mut(),
4974                 },
4975                 result_ok: false,
4976         }
4977 }
4978 #[no_mangle]
4979 /// Frees any resources used by the CResult_InvoiceNoneZ.
4980 pub extern "C" fn CResult_InvoiceNoneZ_free(_res: CResult_InvoiceNoneZ) { }
4981 impl Drop for CResult_InvoiceNoneZ {
4982         fn drop(&mut self) {
4983                 if self.result_ok {
4984                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
4985                                 let _ = unsafe { Box::from_raw(self.contents.result) };
4986                         }
4987                 } else {
4988                 }
4989         }
4990 }
4991 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::Invoice, ()>> for CResult_InvoiceNoneZ {
4992         fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::Invoice, ()>) -> Self {
4993                 let contents = if o.result_ok {
4994                         let result = unsafe { o.contents.result };
4995                         unsafe { o.contents.result = std::ptr::null_mut() };
4996                         CResult_InvoiceNoneZPtr { result }
4997                 } else {
4998                         let _ = unsafe { Box::from_raw(o.contents.err) };
4999                         o.contents.err = std::ptr::null_mut();
5000                         CResult_InvoiceNoneZPtr { err: std::ptr::null_mut() }
5001                 };
5002                 Self {
5003                         contents,
5004                         result_ok: o.result_ok,
5005                 }
5006         }
5007 }
5008 impl Clone for CResult_InvoiceNoneZ {
5009         fn clone(&self) -> Self {
5010                 if self.result_ok {
5011                         Self { result_ok: true, contents: CResult_InvoiceNoneZPtr {
5012                                 result: Box::into_raw(Box::new(<crate::lightning_invoice::Invoice>::clone(unsafe { &*self.contents.result })))
5013                         } }
5014                 } else {
5015                         Self { result_ok: false, contents: CResult_InvoiceNoneZPtr {
5016                                 err: std::ptr::null_mut()
5017                         } }
5018                 }
5019         }
5020 }
5021 #[no_mangle]
5022 /// Creates a new CResult_InvoiceNoneZ which has the same data as `orig`
5023 /// but with all dynamically-allocated buffers duplicated in new buffers.
5024 pub extern "C" fn CResult_InvoiceNoneZ_clone(orig: &CResult_InvoiceNoneZ) -> CResult_InvoiceNoneZ { orig.clone() }
5025 #[repr(C)]
5026 /// The contents of CResult_SignedRawInvoiceNoneZ
5027 pub union CResult_SignedRawInvoiceNoneZPtr {
5028         /// A pointer to the contents in the success state.
5029         /// Reading from this pointer when `result_ok` is not set is undefined.
5030         pub result: *mut crate::lightning_invoice::SignedRawInvoice,
5031         /// Note that this value is always NULL, as there are no contents in the Err variant
5032         pub err: *mut std::ffi::c_void,
5033 }
5034 #[repr(C)]
5035 /// A CResult_SignedRawInvoiceNoneZ represents the result of a fallible operation,
5036 /// containing a crate::lightning_invoice::SignedRawInvoice on success and a () on failure.
5037 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5038 pub struct CResult_SignedRawInvoiceNoneZ {
5039         /// The contents of this CResult_SignedRawInvoiceNoneZ, accessible via either
5040         /// `err` or `result` depending on the state of `result_ok`.
5041         pub contents: CResult_SignedRawInvoiceNoneZPtr,
5042         /// Whether this CResult_SignedRawInvoiceNoneZ represents a success state.
5043         pub result_ok: bool,
5044 }
5045 #[no_mangle]
5046 /// Creates a new CResult_SignedRawInvoiceNoneZ in the success state.
5047 pub extern "C" fn CResult_SignedRawInvoiceNoneZ_ok(o: crate::lightning_invoice::SignedRawInvoice) -> CResult_SignedRawInvoiceNoneZ {
5048         CResult_SignedRawInvoiceNoneZ {
5049                 contents: CResult_SignedRawInvoiceNoneZPtr {
5050                         result: Box::into_raw(Box::new(o)),
5051                 },
5052                 result_ok: true,
5053         }
5054 }
5055 #[no_mangle]
5056 /// Creates a new CResult_SignedRawInvoiceNoneZ in the error state.
5057 pub extern "C" fn CResult_SignedRawInvoiceNoneZ_err() -> CResult_SignedRawInvoiceNoneZ {
5058         CResult_SignedRawInvoiceNoneZ {
5059                 contents: CResult_SignedRawInvoiceNoneZPtr {
5060                         err: std::ptr::null_mut(),
5061                 },
5062                 result_ok: false,
5063         }
5064 }
5065 #[no_mangle]
5066 /// Frees any resources used by the CResult_SignedRawInvoiceNoneZ.
5067 pub extern "C" fn CResult_SignedRawInvoiceNoneZ_free(_res: CResult_SignedRawInvoiceNoneZ) { }
5068 impl Drop for CResult_SignedRawInvoiceNoneZ {
5069         fn drop(&mut self) {
5070                 if self.result_ok {
5071                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
5072                                 let _ = unsafe { Box::from_raw(self.contents.result) };
5073                         }
5074                 } else {
5075                 }
5076         }
5077 }
5078 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::SignedRawInvoice, ()>> for CResult_SignedRawInvoiceNoneZ {
5079         fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::SignedRawInvoice, ()>) -> Self {
5080                 let contents = if o.result_ok {
5081                         let result = unsafe { o.contents.result };
5082                         unsafe { o.contents.result = std::ptr::null_mut() };
5083                         CResult_SignedRawInvoiceNoneZPtr { result }
5084                 } else {
5085                         let _ = unsafe { Box::from_raw(o.contents.err) };
5086                         o.contents.err = std::ptr::null_mut();
5087                         CResult_SignedRawInvoiceNoneZPtr { err: std::ptr::null_mut() }
5088                 };
5089                 Self {
5090                         contents,
5091                         result_ok: o.result_ok,
5092                 }
5093         }
5094 }
5095 impl Clone for CResult_SignedRawInvoiceNoneZ {
5096         fn clone(&self) -> Self {
5097                 if self.result_ok {
5098                         Self { result_ok: true, contents: CResult_SignedRawInvoiceNoneZPtr {
5099                                 result: Box::into_raw(Box::new(<crate::lightning_invoice::SignedRawInvoice>::clone(unsafe { &*self.contents.result })))
5100                         } }
5101                 } else {
5102                         Self { result_ok: false, contents: CResult_SignedRawInvoiceNoneZPtr {
5103                                 err: std::ptr::null_mut()
5104                         } }
5105                 }
5106         }
5107 }
5108 #[no_mangle]
5109 /// Creates a new CResult_SignedRawInvoiceNoneZ which has the same data as `orig`
5110 /// but with all dynamically-allocated buffers duplicated in new buffers.
5111 pub extern "C" fn CResult_SignedRawInvoiceNoneZ_clone(orig: &CResult_SignedRawInvoiceNoneZ) -> CResult_SignedRawInvoiceNoneZ { orig.clone() }
5112 #[repr(C)]
5113 /// A tuple of 3 elements. See the individual fields for the types contained.
5114 pub struct C3Tuple_RawInvoice_u832InvoiceSignatureZ {
5115         /// The element at position 0
5116         pub a: crate::lightning_invoice::RawInvoice,
5117         /// The element at position 1
5118         pub b: crate::c_types::ThirtyTwoBytes,
5119         /// The element at position 2
5120         pub c: crate::lightning_invoice::InvoiceSignature,
5121 }
5122 impl From<(crate::lightning_invoice::RawInvoice, crate::c_types::ThirtyTwoBytes, crate::lightning_invoice::InvoiceSignature)> for C3Tuple_RawInvoice_u832InvoiceSignatureZ {
5123         fn from (tup: (crate::lightning_invoice::RawInvoice, crate::c_types::ThirtyTwoBytes, crate::lightning_invoice::InvoiceSignature)) -> Self {
5124                 Self {
5125                         a: tup.0,
5126                         b: tup.1,
5127                         c: tup.2,
5128                 }
5129         }
5130 }
5131 impl C3Tuple_RawInvoice_u832InvoiceSignatureZ {
5132         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::lightning_invoice::RawInvoice, crate::c_types::ThirtyTwoBytes, crate::lightning_invoice::InvoiceSignature) {
5133                 (self.a, self.b, self.c)
5134         }
5135 }
5136 impl Clone for C3Tuple_RawInvoice_u832InvoiceSignatureZ {
5137         fn clone(&self) -> Self {
5138                 Self {
5139                         a: self.a.clone(),
5140                         b: self.b.clone(),
5141                         c: self.c.clone(),
5142                 }
5143         }
5144 }
5145 #[no_mangle]
5146 /// Creates a new tuple which has the same data as `orig`
5147 /// but with all dynamically-allocated buffers duplicated in new buffers.
5148 pub extern "C" fn C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone(orig: &C3Tuple_RawInvoice_u832InvoiceSignatureZ) -> C3Tuple_RawInvoice_u832InvoiceSignatureZ { orig.clone() }
5149 /// Creates a new C3Tuple_RawInvoice_u832InvoiceSignatureZ from the contained elements.
5150 #[no_mangle]
5151 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 {
5152         C3Tuple_RawInvoice_u832InvoiceSignatureZ { a, b, c, }
5153 }
5154
5155 #[no_mangle]
5156 /// Frees any resources used by the C3Tuple_RawInvoice_u832InvoiceSignatureZ.
5157 pub extern "C" fn C3Tuple_RawInvoice_u832InvoiceSignatureZ_free(_res: C3Tuple_RawInvoice_u832InvoiceSignatureZ) { }
5158 #[repr(C)]
5159 /// The contents of CResult_PayeePubKeyErrorZ
5160 pub union CResult_PayeePubKeyErrorZPtr {
5161         /// A pointer to the contents in the success state.
5162         /// Reading from this pointer when `result_ok` is not set is undefined.
5163         pub result: *mut crate::lightning_invoice::PayeePubKey,
5164         /// A pointer to the contents in the error state.
5165         /// Reading from this pointer when `result_ok` is set is undefined.
5166         pub err: *mut crate::c_types::Secp256k1Error,
5167 }
5168 #[repr(C)]
5169 /// A CResult_PayeePubKeyErrorZ represents the result of a fallible operation,
5170 /// containing a crate::lightning_invoice::PayeePubKey on success and a crate::c_types::Secp256k1Error on failure.
5171 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5172 pub struct CResult_PayeePubKeyErrorZ {
5173         /// The contents of this CResult_PayeePubKeyErrorZ, accessible via either
5174         /// `err` or `result` depending on the state of `result_ok`.
5175         pub contents: CResult_PayeePubKeyErrorZPtr,
5176         /// Whether this CResult_PayeePubKeyErrorZ represents a success state.
5177         pub result_ok: bool,
5178 }
5179 #[no_mangle]
5180 /// Creates a new CResult_PayeePubKeyErrorZ in the success state.
5181 pub extern "C" fn CResult_PayeePubKeyErrorZ_ok(o: crate::lightning_invoice::PayeePubKey) -> CResult_PayeePubKeyErrorZ {
5182         CResult_PayeePubKeyErrorZ {
5183                 contents: CResult_PayeePubKeyErrorZPtr {
5184                         result: Box::into_raw(Box::new(o)),
5185                 },
5186                 result_ok: true,
5187         }
5188 }
5189 #[no_mangle]
5190 /// Creates a new CResult_PayeePubKeyErrorZ in the error state.
5191 pub extern "C" fn CResult_PayeePubKeyErrorZ_err(e: crate::c_types::Secp256k1Error) -> CResult_PayeePubKeyErrorZ {
5192         CResult_PayeePubKeyErrorZ {
5193                 contents: CResult_PayeePubKeyErrorZPtr {
5194                         err: Box::into_raw(Box::new(e)),
5195                 },
5196                 result_ok: false,
5197         }
5198 }
5199 #[no_mangle]
5200 /// Frees any resources used by the CResult_PayeePubKeyErrorZ.
5201 pub extern "C" fn CResult_PayeePubKeyErrorZ_free(_res: CResult_PayeePubKeyErrorZ) { }
5202 impl Drop for CResult_PayeePubKeyErrorZ {
5203         fn drop(&mut self) {
5204                 if self.result_ok {
5205                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
5206                                 let _ = unsafe { Box::from_raw(self.contents.result) };
5207                         }
5208                 } else {
5209                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
5210                                 let _ = unsafe { Box::from_raw(self.contents.err) };
5211                         }
5212                 }
5213         }
5214 }
5215 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::PayeePubKey, crate::c_types::Secp256k1Error>> for CResult_PayeePubKeyErrorZ {
5216         fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::PayeePubKey, crate::c_types::Secp256k1Error>) -> Self {
5217                 let contents = if o.result_ok {
5218                         let result = unsafe { o.contents.result };
5219                         unsafe { o.contents.result = std::ptr::null_mut() };
5220                         CResult_PayeePubKeyErrorZPtr { result }
5221                 } else {
5222                         let err = unsafe { o.contents.err };
5223                         unsafe { o.contents.err = std::ptr::null_mut(); }
5224                         CResult_PayeePubKeyErrorZPtr { err }
5225                 };
5226                 Self {
5227                         contents,
5228                         result_ok: o.result_ok,
5229                 }
5230         }
5231 }
5232 impl Clone for CResult_PayeePubKeyErrorZ {
5233         fn clone(&self) -> Self {
5234                 if self.result_ok {
5235                         Self { result_ok: true, contents: CResult_PayeePubKeyErrorZPtr {
5236                                 result: Box::into_raw(Box::new(<crate::lightning_invoice::PayeePubKey>::clone(unsafe { &*self.contents.result })))
5237                         } }
5238                 } else {
5239                         Self { result_ok: false, contents: CResult_PayeePubKeyErrorZPtr {
5240                                 err: Box::into_raw(Box::new(<crate::c_types::Secp256k1Error>::clone(unsafe { &*self.contents.err })))
5241                         } }
5242                 }
5243         }
5244 }
5245 #[no_mangle]
5246 /// Creates a new CResult_PayeePubKeyErrorZ which has the same data as `orig`
5247 /// but with all dynamically-allocated buffers duplicated in new buffers.
5248 pub extern "C" fn CResult_PayeePubKeyErrorZ_clone(orig: &CResult_PayeePubKeyErrorZ) -> CResult_PayeePubKeyErrorZ { orig.clone() }
5249 #[repr(C)]
5250 /// A dynamically-allocated array of crate::lightning_invoice::PrivateRoutes of arbitrary size.
5251 /// This corresponds to std::vector in C++
5252 pub struct CVec_PrivateRouteZ {
5253         /// The elements in the array.
5254         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
5255         pub data: *mut crate::lightning_invoice::PrivateRoute,
5256         /// The number of elements pointed to by `data`.
5257         pub datalen: usize
5258 }
5259 impl CVec_PrivateRouteZ {
5260         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning_invoice::PrivateRoute> {
5261                 if self.datalen == 0 { return Vec::new(); }
5262                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
5263                 self.data = std::ptr::null_mut();
5264                 self.datalen = 0;
5265                 ret
5266         }
5267         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning_invoice::PrivateRoute] {
5268                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
5269         }
5270 }
5271 impl From<Vec<crate::lightning_invoice::PrivateRoute>> for CVec_PrivateRouteZ {
5272         fn from(v: Vec<crate::lightning_invoice::PrivateRoute>) -> Self {
5273                 let datalen = v.len();
5274                 let data = Box::into_raw(v.into_boxed_slice());
5275                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
5276         }
5277 }
5278 #[no_mangle]
5279 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
5280 pub extern "C" fn CVec_PrivateRouteZ_free(_res: CVec_PrivateRouteZ) { }
5281 impl Drop for CVec_PrivateRouteZ {
5282         fn drop(&mut self) {
5283                 if self.datalen == 0 { return; }
5284                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
5285         }
5286 }
5287 impl Clone for CVec_PrivateRouteZ {
5288         fn clone(&self) -> Self {
5289                 let mut res = Vec::new();
5290                 if self.datalen == 0 { return Self::from(res); }
5291                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
5292                 Self::from(res)
5293         }
5294 }
5295 #[repr(C)]
5296 /// The contents of CResult_PositiveTimestampCreationErrorZ
5297 pub union CResult_PositiveTimestampCreationErrorZPtr {
5298         /// A pointer to the contents in the success state.
5299         /// Reading from this pointer when `result_ok` is not set is undefined.
5300         pub result: *mut crate::lightning_invoice::PositiveTimestamp,
5301         /// A pointer to the contents in the error state.
5302         /// Reading from this pointer when `result_ok` is set is undefined.
5303         pub err: *mut crate::lightning_invoice::CreationError,
5304 }
5305 #[repr(C)]
5306 /// A CResult_PositiveTimestampCreationErrorZ represents the result of a fallible operation,
5307 /// containing a crate::lightning_invoice::PositiveTimestamp on success and a crate::lightning_invoice::CreationError on failure.
5308 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5309 pub struct CResult_PositiveTimestampCreationErrorZ {
5310         /// The contents of this CResult_PositiveTimestampCreationErrorZ, accessible via either
5311         /// `err` or `result` depending on the state of `result_ok`.
5312         pub contents: CResult_PositiveTimestampCreationErrorZPtr,
5313         /// Whether this CResult_PositiveTimestampCreationErrorZ represents a success state.
5314         pub result_ok: bool,
5315 }
5316 #[no_mangle]
5317 /// Creates a new CResult_PositiveTimestampCreationErrorZ in the success state.
5318 pub extern "C" fn CResult_PositiveTimestampCreationErrorZ_ok(o: crate::lightning_invoice::PositiveTimestamp) -> CResult_PositiveTimestampCreationErrorZ {
5319         CResult_PositiveTimestampCreationErrorZ {
5320                 contents: CResult_PositiveTimestampCreationErrorZPtr {
5321                         result: Box::into_raw(Box::new(o)),
5322                 },
5323                 result_ok: true,
5324         }
5325 }
5326 #[no_mangle]
5327 /// Creates a new CResult_PositiveTimestampCreationErrorZ in the error state.
5328 pub extern "C" fn CResult_PositiveTimestampCreationErrorZ_err(e: crate::lightning_invoice::CreationError) -> CResult_PositiveTimestampCreationErrorZ {
5329         CResult_PositiveTimestampCreationErrorZ {
5330                 contents: CResult_PositiveTimestampCreationErrorZPtr {
5331                         err: Box::into_raw(Box::new(e)),
5332                 },
5333                 result_ok: false,
5334         }
5335 }
5336 #[no_mangle]
5337 /// Frees any resources used by the CResult_PositiveTimestampCreationErrorZ.
5338 pub extern "C" fn CResult_PositiveTimestampCreationErrorZ_free(_res: CResult_PositiveTimestampCreationErrorZ) { }
5339 impl Drop for CResult_PositiveTimestampCreationErrorZ {
5340         fn drop(&mut self) {
5341                 if self.result_ok {
5342                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
5343                                 let _ = unsafe { Box::from_raw(self.contents.result) };
5344                         }
5345                 } else {
5346                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
5347                                 let _ = unsafe { Box::from_raw(self.contents.err) };
5348                         }
5349                 }
5350         }
5351 }
5352 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::PositiveTimestamp, crate::lightning_invoice::CreationError>> for CResult_PositiveTimestampCreationErrorZ {
5353         fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::PositiveTimestamp, crate::lightning_invoice::CreationError>) -> Self {
5354                 let contents = if o.result_ok {
5355                         let result = unsafe { o.contents.result };
5356                         unsafe { o.contents.result = std::ptr::null_mut() };
5357                         CResult_PositiveTimestampCreationErrorZPtr { result }
5358                 } else {
5359                         let err = unsafe { o.contents.err };
5360                         unsafe { o.contents.err = std::ptr::null_mut(); }
5361                         CResult_PositiveTimestampCreationErrorZPtr { err }
5362                 };
5363                 Self {
5364                         contents,
5365                         result_ok: o.result_ok,
5366                 }
5367         }
5368 }
5369 impl Clone for CResult_PositiveTimestampCreationErrorZ {
5370         fn clone(&self) -> Self {
5371                 if self.result_ok {
5372                         Self { result_ok: true, contents: CResult_PositiveTimestampCreationErrorZPtr {
5373                                 result: Box::into_raw(Box::new(<crate::lightning_invoice::PositiveTimestamp>::clone(unsafe { &*self.contents.result })))
5374                         } }
5375                 } else {
5376                         Self { result_ok: false, contents: CResult_PositiveTimestampCreationErrorZPtr {
5377                                 err: Box::into_raw(Box::new(<crate::lightning_invoice::CreationError>::clone(unsafe { &*self.contents.err })))
5378                         } }
5379                 }
5380         }
5381 }
5382 #[no_mangle]
5383 /// Creates a new CResult_PositiveTimestampCreationErrorZ which has the same data as `orig`
5384 /// but with all dynamically-allocated buffers duplicated in new buffers.
5385 pub extern "C" fn CResult_PositiveTimestampCreationErrorZ_clone(orig: &CResult_PositiveTimestampCreationErrorZ) -> CResult_PositiveTimestampCreationErrorZ { orig.clone() }
5386 #[repr(C)]
5387 /// The contents of CResult_NoneSemanticErrorZ
5388 pub union CResult_NoneSemanticErrorZPtr {
5389         /// Note that this value is always NULL, as there are no contents in the OK variant
5390         pub result: *mut std::ffi::c_void,
5391         /// A pointer to the contents in the error state.
5392         /// Reading from this pointer when `result_ok` is set is undefined.
5393         pub err: *mut crate::lightning_invoice::SemanticError,
5394 }
5395 #[repr(C)]
5396 /// A CResult_NoneSemanticErrorZ represents the result of a fallible operation,
5397 /// containing a () on success and a crate::lightning_invoice::SemanticError on failure.
5398 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5399 pub struct CResult_NoneSemanticErrorZ {
5400         /// The contents of this CResult_NoneSemanticErrorZ, accessible via either
5401         /// `err` or `result` depending on the state of `result_ok`.
5402         pub contents: CResult_NoneSemanticErrorZPtr,
5403         /// Whether this CResult_NoneSemanticErrorZ represents a success state.
5404         pub result_ok: bool,
5405 }
5406 #[no_mangle]
5407 /// Creates a new CResult_NoneSemanticErrorZ in the success state.
5408 pub extern "C" fn CResult_NoneSemanticErrorZ_ok() -> CResult_NoneSemanticErrorZ {
5409         CResult_NoneSemanticErrorZ {
5410                 contents: CResult_NoneSemanticErrorZPtr {
5411                         result: std::ptr::null_mut(),
5412                 },
5413                 result_ok: true,
5414         }
5415 }
5416 #[no_mangle]
5417 /// Creates a new CResult_NoneSemanticErrorZ in the error state.
5418 pub extern "C" fn CResult_NoneSemanticErrorZ_err(e: crate::lightning_invoice::SemanticError) -> CResult_NoneSemanticErrorZ {
5419         CResult_NoneSemanticErrorZ {
5420                 contents: CResult_NoneSemanticErrorZPtr {
5421                         err: Box::into_raw(Box::new(e)),
5422                 },
5423                 result_ok: false,
5424         }
5425 }
5426 #[no_mangle]
5427 /// Frees any resources used by the CResult_NoneSemanticErrorZ.
5428 pub extern "C" fn CResult_NoneSemanticErrorZ_free(_res: CResult_NoneSemanticErrorZ) { }
5429 impl Drop for CResult_NoneSemanticErrorZ {
5430         fn drop(&mut self) {
5431                 if self.result_ok {
5432                 } else {
5433                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
5434                                 let _ = unsafe { Box::from_raw(self.contents.err) };
5435                         }
5436                 }
5437         }
5438 }
5439 impl From<crate::c_types::CResultTempl<(), crate::lightning_invoice::SemanticError>> for CResult_NoneSemanticErrorZ {
5440         fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning_invoice::SemanticError>) -> Self {
5441                 let contents = if o.result_ok {
5442                         let _ = unsafe { Box::from_raw(o.contents.result) };
5443                         o.contents.result = std::ptr::null_mut();
5444                         CResult_NoneSemanticErrorZPtr { result: std::ptr::null_mut() }
5445                 } else {
5446                         let err = unsafe { o.contents.err };
5447                         unsafe { o.contents.err = std::ptr::null_mut(); }
5448                         CResult_NoneSemanticErrorZPtr { err }
5449                 };
5450                 Self {
5451                         contents,
5452                         result_ok: o.result_ok,
5453                 }
5454         }
5455 }
5456 impl Clone for CResult_NoneSemanticErrorZ {
5457         fn clone(&self) -> Self {
5458                 if self.result_ok {
5459                         Self { result_ok: true, contents: CResult_NoneSemanticErrorZPtr {
5460                                 result: std::ptr::null_mut()
5461                         } }
5462                 } else {
5463                         Self { result_ok: false, contents: CResult_NoneSemanticErrorZPtr {
5464                                 err: Box::into_raw(Box::new(<crate::lightning_invoice::SemanticError>::clone(unsafe { &*self.contents.err })))
5465                         } }
5466                 }
5467         }
5468 }
5469 #[no_mangle]
5470 /// Creates a new CResult_NoneSemanticErrorZ which has the same data as `orig`
5471 /// but with all dynamically-allocated buffers duplicated in new buffers.
5472 pub extern "C" fn CResult_NoneSemanticErrorZ_clone(orig: &CResult_NoneSemanticErrorZ) -> CResult_NoneSemanticErrorZ { orig.clone() }
5473 #[repr(C)]
5474 /// The contents of CResult_InvoiceSemanticErrorZ
5475 pub union CResult_InvoiceSemanticErrorZPtr {
5476         /// A pointer to the contents in the success state.
5477         /// Reading from this pointer when `result_ok` is not set is undefined.
5478         pub result: *mut crate::lightning_invoice::Invoice,
5479         /// A pointer to the contents in the error state.
5480         /// Reading from this pointer when `result_ok` is set is undefined.
5481         pub err: *mut crate::lightning_invoice::SemanticError,
5482 }
5483 #[repr(C)]
5484 /// A CResult_InvoiceSemanticErrorZ represents the result of a fallible operation,
5485 /// containing a crate::lightning_invoice::Invoice on success and a crate::lightning_invoice::SemanticError on failure.
5486 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5487 pub struct CResult_InvoiceSemanticErrorZ {
5488         /// The contents of this CResult_InvoiceSemanticErrorZ, accessible via either
5489         /// `err` or `result` depending on the state of `result_ok`.
5490         pub contents: CResult_InvoiceSemanticErrorZPtr,
5491         /// Whether this CResult_InvoiceSemanticErrorZ represents a success state.
5492         pub result_ok: bool,
5493 }
5494 #[no_mangle]
5495 /// Creates a new CResult_InvoiceSemanticErrorZ in the success state.
5496 pub extern "C" fn CResult_InvoiceSemanticErrorZ_ok(o: crate::lightning_invoice::Invoice) -> CResult_InvoiceSemanticErrorZ {
5497         CResult_InvoiceSemanticErrorZ {
5498                 contents: CResult_InvoiceSemanticErrorZPtr {
5499                         result: Box::into_raw(Box::new(o)),
5500                 },
5501                 result_ok: true,
5502         }
5503 }
5504 #[no_mangle]
5505 /// Creates a new CResult_InvoiceSemanticErrorZ in the error state.
5506 pub extern "C" fn CResult_InvoiceSemanticErrorZ_err(e: crate::lightning_invoice::SemanticError) -> CResult_InvoiceSemanticErrorZ {
5507         CResult_InvoiceSemanticErrorZ {
5508                 contents: CResult_InvoiceSemanticErrorZPtr {
5509                         err: Box::into_raw(Box::new(e)),
5510                 },
5511                 result_ok: false,
5512         }
5513 }
5514 #[no_mangle]
5515 /// Frees any resources used by the CResult_InvoiceSemanticErrorZ.
5516 pub extern "C" fn CResult_InvoiceSemanticErrorZ_free(_res: CResult_InvoiceSemanticErrorZ) { }
5517 impl Drop for CResult_InvoiceSemanticErrorZ {
5518         fn drop(&mut self) {
5519                 if self.result_ok {
5520                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
5521                                 let _ = unsafe { Box::from_raw(self.contents.result) };
5522                         }
5523                 } else {
5524                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
5525                                 let _ = unsafe { Box::from_raw(self.contents.err) };
5526                         }
5527                 }
5528         }
5529 }
5530 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::Invoice, crate::lightning_invoice::SemanticError>> for CResult_InvoiceSemanticErrorZ {
5531         fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::Invoice, crate::lightning_invoice::SemanticError>) -> Self {
5532                 let contents = if o.result_ok {
5533                         let result = unsafe { o.contents.result };
5534                         unsafe { o.contents.result = std::ptr::null_mut() };
5535                         CResult_InvoiceSemanticErrorZPtr { result }
5536                 } else {
5537                         let err = unsafe { o.contents.err };
5538                         unsafe { o.contents.err = std::ptr::null_mut(); }
5539                         CResult_InvoiceSemanticErrorZPtr { err }
5540                 };
5541                 Self {
5542                         contents,
5543                         result_ok: o.result_ok,
5544                 }
5545         }
5546 }
5547 impl Clone for CResult_InvoiceSemanticErrorZ {
5548         fn clone(&self) -> Self {
5549                 if self.result_ok {
5550                         Self { result_ok: true, contents: CResult_InvoiceSemanticErrorZPtr {
5551                                 result: Box::into_raw(Box::new(<crate::lightning_invoice::Invoice>::clone(unsafe { &*self.contents.result })))
5552                         } }
5553                 } else {
5554                         Self { result_ok: false, contents: CResult_InvoiceSemanticErrorZPtr {
5555                                 err: Box::into_raw(Box::new(<crate::lightning_invoice::SemanticError>::clone(unsafe { &*self.contents.err })))
5556                         } }
5557                 }
5558         }
5559 }
5560 #[no_mangle]
5561 /// Creates a new CResult_InvoiceSemanticErrorZ which has the same data as `orig`
5562 /// but with all dynamically-allocated buffers duplicated in new buffers.
5563 pub extern "C" fn CResult_InvoiceSemanticErrorZ_clone(orig: &CResult_InvoiceSemanticErrorZ) -> CResult_InvoiceSemanticErrorZ { orig.clone() }
5564 #[repr(C)]
5565 /// The contents of CResult_DescriptionCreationErrorZ
5566 pub union CResult_DescriptionCreationErrorZPtr {
5567         /// A pointer to the contents in the success state.
5568         /// Reading from this pointer when `result_ok` is not set is undefined.
5569         pub result: *mut crate::lightning_invoice::Description,
5570         /// A pointer to the contents in the error state.
5571         /// Reading from this pointer when `result_ok` is set is undefined.
5572         pub err: *mut crate::lightning_invoice::CreationError,
5573 }
5574 #[repr(C)]
5575 /// A CResult_DescriptionCreationErrorZ represents the result of a fallible operation,
5576 /// containing a crate::lightning_invoice::Description on success and a crate::lightning_invoice::CreationError on failure.
5577 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5578 pub struct CResult_DescriptionCreationErrorZ {
5579         /// The contents of this CResult_DescriptionCreationErrorZ, accessible via either
5580         /// `err` or `result` depending on the state of `result_ok`.
5581         pub contents: CResult_DescriptionCreationErrorZPtr,
5582         /// Whether this CResult_DescriptionCreationErrorZ represents a success state.
5583         pub result_ok: bool,
5584 }
5585 #[no_mangle]
5586 /// Creates a new CResult_DescriptionCreationErrorZ in the success state.
5587 pub extern "C" fn CResult_DescriptionCreationErrorZ_ok(o: crate::lightning_invoice::Description) -> CResult_DescriptionCreationErrorZ {
5588         CResult_DescriptionCreationErrorZ {
5589                 contents: CResult_DescriptionCreationErrorZPtr {
5590                         result: Box::into_raw(Box::new(o)),
5591                 },
5592                 result_ok: true,
5593         }
5594 }
5595 #[no_mangle]
5596 /// Creates a new CResult_DescriptionCreationErrorZ in the error state.
5597 pub extern "C" fn CResult_DescriptionCreationErrorZ_err(e: crate::lightning_invoice::CreationError) -> CResult_DescriptionCreationErrorZ {
5598         CResult_DescriptionCreationErrorZ {
5599                 contents: CResult_DescriptionCreationErrorZPtr {
5600                         err: Box::into_raw(Box::new(e)),
5601                 },
5602                 result_ok: false,
5603         }
5604 }
5605 #[no_mangle]
5606 /// Frees any resources used by the CResult_DescriptionCreationErrorZ.
5607 pub extern "C" fn CResult_DescriptionCreationErrorZ_free(_res: CResult_DescriptionCreationErrorZ) { }
5608 impl Drop for CResult_DescriptionCreationErrorZ {
5609         fn drop(&mut self) {
5610                 if self.result_ok {
5611                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
5612                                 let _ = unsafe { Box::from_raw(self.contents.result) };
5613                         }
5614                 } else {
5615                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
5616                                 let _ = unsafe { Box::from_raw(self.contents.err) };
5617                         }
5618                 }
5619         }
5620 }
5621 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::Description, crate::lightning_invoice::CreationError>> for CResult_DescriptionCreationErrorZ {
5622         fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::Description, crate::lightning_invoice::CreationError>) -> Self {
5623                 let contents = if o.result_ok {
5624                         let result = unsafe { o.contents.result };
5625                         unsafe { o.contents.result = std::ptr::null_mut() };
5626                         CResult_DescriptionCreationErrorZPtr { result }
5627                 } else {
5628                         let err = unsafe { o.contents.err };
5629                         unsafe { o.contents.err = std::ptr::null_mut(); }
5630                         CResult_DescriptionCreationErrorZPtr { err }
5631                 };
5632                 Self {
5633                         contents,
5634                         result_ok: o.result_ok,
5635                 }
5636         }
5637 }
5638 impl Clone for CResult_DescriptionCreationErrorZ {
5639         fn clone(&self) -> Self {
5640                 if self.result_ok {
5641                         Self { result_ok: true, contents: CResult_DescriptionCreationErrorZPtr {
5642                                 result: Box::into_raw(Box::new(<crate::lightning_invoice::Description>::clone(unsafe { &*self.contents.result })))
5643                         } }
5644                 } else {
5645                         Self { result_ok: false, contents: CResult_DescriptionCreationErrorZPtr {
5646                                 err: Box::into_raw(Box::new(<crate::lightning_invoice::CreationError>::clone(unsafe { &*self.contents.err })))
5647                         } }
5648                 }
5649         }
5650 }
5651 #[no_mangle]
5652 /// Creates a new CResult_DescriptionCreationErrorZ which has the same data as `orig`
5653 /// but with all dynamically-allocated buffers duplicated in new buffers.
5654 pub extern "C" fn CResult_DescriptionCreationErrorZ_clone(orig: &CResult_DescriptionCreationErrorZ) -> CResult_DescriptionCreationErrorZ { orig.clone() }
5655 #[repr(C)]
5656 /// The contents of CResult_ExpiryTimeCreationErrorZ
5657 pub union CResult_ExpiryTimeCreationErrorZPtr {
5658         /// A pointer to the contents in the success state.
5659         /// Reading from this pointer when `result_ok` is not set is undefined.
5660         pub result: *mut crate::lightning_invoice::ExpiryTime,
5661         /// A pointer to the contents in the error state.
5662         /// Reading from this pointer when `result_ok` is set is undefined.
5663         pub err: *mut crate::lightning_invoice::CreationError,
5664 }
5665 #[repr(C)]
5666 /// A CResult_ExpiryTimeCreationErrorZ represents the result of a fallible operation,
5667 /// containing a crate::lightning_invoice::ExpiryTime on success and a crate::lightning_invoice::CreationError on failure.
5668 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5669 pub struct CResult_ExpiryTimeCreationErrorZ {
5670         /// The contents of this CResult_ExpiryTimeCreationErrorZ, accessible via either
5671         /// `err` or `result` depending on the state of `result_ok`.
5672         pub contents: CResult_ExpiryTimeCreationErrorZPtr,
5673         /// Whether this CResult_ExpiryTimeCreationErrorZ represents a success state.
5674         pub result_ok: bool,
5675 }
5676 #[no_mangle]
5677 /// Creates a new CResult_ExpiryTimeCreationErrorZ in the success state.
5678 pub extern "C" fn CResult_ExpiryTimeCreationErrorZ_ok(o: crate::lightning_invoice::ExpiryTime) -> CResult_ExpiryTimeCreationErrorZ {
5679         CResult_ExpiryTimeCreationErrorZ {
5680                 contents: CResult_ExpiryTimeCreationErrorZPtr {
5681                         result: Box::into_raw(Box::new(o)),
5682                 },
5683                 result_ok: true,
5684         }
5685 }
5686 #[no_mangle]
5687 /// Creates a new CResult_ExpiryTimeCreationErrorZ in the error state.
5688 pub extern "C" fn CResult_ExpiryTimeCreationErrorZ_err(e: crate::lightning_invoice::CreationError) -> CResult_ExpiryTimeCreationErrorZ {
5689         CResult_ExpiryTimeCreationErrorZ {
5690                 contents: CResult_ExpiryTimeCreationErrorZPtr {
5691                         err: Box::into_raw(Box::new(e)),
5692                 },
5693                 result_ok: false,
5694         }
5695 }
5696 #[no_mangle]
5697 /// Frees any resources used by the CResult_ExpiryTimeCreationErrorZ.
5698 pub extern "C" fn CResult_ExpiryTimeCreationErrorZ_free(_res: CResult_ExpiryTimeCreationErrorZ) { }
5699 impl Drop for CResult_ExpiryTimeCreationErrorZ {
5700         fn drop(&mut self) {
5701                 if self.result_ok {
5702                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
5703                                 let _ = unsafe { Box::from_raw(self.contents.result) };
5704                         }
5705                 } else {
5706                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
5707                                 let _ = unsafe { Box::from_raw(self.contents.err) };
5708                         }
5709                 }
5710         }
5711 }
5712 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::ExpiryTime, crate::lightning_invoice::CreationError>> for CResult_ExpiryTimeCreationErrorZ {
5713         fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::ExpiryTime, crate::lightning_invoice::CreationError>) -> Self {
5714                 let contents = if o.result_ok {
5715                         let result = unsafe { o.contents.result };
5716                         unsafe { o.contents.result = std::ptr::null_mut() };
5717                         CResult_ExpiryTimeCreationErrorZPtr { result }
5718                 } else {
5719                         let err = unsafe { o.contents.err };
5720                         unsafe { o.contents.err = std::ptr::null_mut(); }
5721                         CResult_ExpiryTimeCreationErrorZPtr { err }
5722                 };
5723                 Self {
5724                         contents,
5725                         result_ok: o.result_ok,
5726                 }
5727         }
5728 }
5729 impl Clone for CResult_ExpiryTimeCreationErrorZ {
5730         fn clone(&self) -> Self {
5731                 if self.result_ok {
5732                         Self { result_ok: true, contents: CResult_ExpiryTimeCreationErrorZPtr {
5733                                 result: Box::into_raw(Box::new(<crate::lightning_invoice::ExpiryTime>::clone(unsafe { &*self.contents.result })))
5734                         } }
5735                 } else {
5736                         Self { result_ok: false, contents: CResult_ExpiryTimeCreationErrorZPtr {
5737                                 err: Box::into_raw(Box::new(<crate::lightning_invoice::CreationError>::clone(unsafe { &*self.contents.err })))
5738                         } }
5739                 }
5740         }
5741 }
5742 #[no_mangle]
5743 /// Creates a new CResult_ExpiryTimeCreationErrorZ which has the same data as `orig`
5744 /// but with all dynamically-allocated buffers duplicated in new buffers.
5745 pub extern "C" fn CResult_ExpiryTimeCreationErrorZ_clone(orig: &CResult_ExpiryTimeCreationErrorZ) -> CResult_ExpiryTimeCreationErrorZ { orig.clone() }
5746 #[repr(C)]
5747 /// The contents of CResult_PrivateRouteCreationErrorZ
5748 pub union CResult_PrivateRouteCreationErrorZPtr {
5749         /// A pointer to the contents in the success state.
5750         /// Reading from this pointer when `result_ok` is not set is undefined.
5751         pub result: *mut crate::lightning_invoice::PrivateRoute,
5752         /// A pointer to the contents in the error state.
5753         /// Reading from this pointer when `result_ok` is set is undefined.
5754         pub err: *mut crate::lightning_invoice::CreationError,
5755 }
5756 #[repr(C)]
5757 /// A CResult_PrivateRouteCreationErrorZ represents the result of a fallible operation,
5758 /// containing a crate::lightning_invoice::PrivateRoute on success and a crate::lightning_invoice::CreationError on failure.
5759 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5760 pub struct CResult_PrivateRouteCreationErrorZ {
5761         /// The contents of this CResult_PrivateRouteCreationErrorZ, accessible via either
5762         /// `err` or `result` depending on the state of `result_ok`.
5763         pub contents: CResult_PrivateRouteCreationErrorZPtr,
5764         /// Whether this CResult_PrivateRouteCreationErrorZ represents a success state.
5765         pub result_ok: bool,
5766 }
5767 #[no_mangle]
5768 /// Creates a new CResult_PrivateRouteCreationErrorZ in the success state.
5769 pub extern "C" fn CResult_PrivateRouteCreationErrorZ_ok(o: crate::lightning_invoice::PrivateRoute) -> CResult_PrivateRouteCreationErrorZ {
5770         CResult_PrivateRouteCreationErrorZ {
5771                 contents: CResult_PrivateRouteCreationErrorZPtr {
5772                         result: Box::into_raw(Box::new(o)),
5773                 },
5774                 result_ok: true,
5775         }
5776 }
5777 #[no_mangle]
5778 /// Creates a new CResult_PrivateRouteCreationErrorZ in the error state.
5779 pub extern "C" fn CResult_PrivateRouteCreationErrorZ_err(e: crate::lightning_invoice::CreationError) -> CResult_PrivateRouteCreationErrorZ {
5780         CResult_PrivateRouteCreationErrorZ {
5781                 contents: CResult_PrivateRouteCreationErrorZPtr {
5782                         err: Box::into_raw(Box::new(e)),
5783                 },
5784                 result_ok: false,
5785         }
5786 }
5787 #[no_mangle]
5788 /// Frees any resources used by the CResult_PrivateRouteCreationErrorZ.
5789 pub extern "C" fn CResult_PrivateRouteCreationErrorZ_free(_res: CResult_PrivateRouteCreationErrorZ) { }
5790 impl Drop for CResult_PrivateRouteCreationErrorZ {
5791         fn drop(&mut self) {
5792                 if self.result_ok {
5793                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
5794                                 let _ = unsafe { Box::from_raw(self.contents.result) };
5795                         }
5796                 } else {
5797                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
5798                                 let _ = unsafe { Box::from_raw(self.contents.err) };
5799                         }
5800                 }
5801         }
5802 }
5803 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::PrivateRoute, crate::lightning_invoice::CreationError>> for CResult_PrivateRouteCreationErrorZ {
5804         fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::PrivateRoute, crate::lightning_invoice::CreationError>) -> Self {
5805                 let contents = if o.result_ok {
5806                         let result = unsafe { o.contents.result };
5807                         unsafe { o.contents.result = std::ptr::null_mut() };
5808                         CResult_PrivateRouteCreationErrorZPtr { result }
5809                 } else {
5810                         let err = unsafe { o.contents.err };
5811                         unsafe { o.contents.err = std::ptr::null_mut(); }
5812                         CResult_PrivateRouteCreationErrorZPtr { err }
5813                 };
5814                 Self {
5815                         contents,
5816                         result_ok: o.result_ok,
5817                 }
5818         }
5819 }
5820 impl Clone for CResult_PrivateRouteCreationErrorZ {
5821         fn clone(&self) -> Self {
5822                 if self.result_ok {
5823                         Self { result_ok: true, contents: CResult_PrivateRouteCreationErrorZPtr {
5824                                 result: Box::into_raw(Box::new(<crate::lightning_invoice::PrivateRoute>::clone(unsafe { &*self.contents.result })))
5825                         } }
5826                 } else {
5827                         Self { result_ok: false, contents: CResult_PrivateRouteCreationErrorZPtr {
5828                                 err: Box::into_raw(Box::new(<crate::lightning_invoice::CreationError>::clone(unsafe { &*self.contents.err })))
5829                         } }
5830                 }
5831         }
5832 }
5833 #[no_mangle]
5834 /// Creates a new CResult_PrivateRouteCreationErrorZ which has the same data as `orig`
5835 /// but with all dynamically-allocated buffers duplicated in new buffers.
5836 pub extern "C" fn CResult_PrivateRouteCreationErrorZ_clone(orig: &CResult_PrivateRouteCreationErrorZ) -> CResult_PrivateRouteCreationErrorZ { orig.clone() }
5837 #[repr(C)]
5838 /// The contents of CResult_StringErrorZ
5839 pub union CResult_StringErrorZPtr {
5840         /// A pointer to the contents in the success state.
5841         /// Reading from this pointer when `result_ok` is not set is undefined.
5842         pub result: *mut crate::c_types::Str,
5843         /// A pointer to the contents in the error state.
5844         /// Reading from this pointer when `result_ok` is set is undefined.
5845         pub err: *mut crate::c_types::Secp256k1Error,
5846 }
5847 #[repr(C)]
5848 /// A CResult_StringErrorZ represents the result of a fallible operation,
5849 /// containing a crate::c_types::Str on success and a crate::c_types::Secp256k1Error on failure.
5850 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5851 pub struct CResult_StringErrorZ {
5852         /// The contents of this CResult_StringErrorZ, accessible via either
5853         /// `err` or `result` depending on the state of `result_ok`.
5854         pub contents: CResult_StringErrorZPtr,
5855         /// Whether this CResult_StringErrorZ represents a success state.
5856         pub result_ok: bool,
5857 }
5858 #[no_mangle]
5859 /// Creates a new CResult_StringErrorZ in the success state.
5860 pub extern "C" fn CResult_StringErrorZ_ok(o: crate::c_types::Str) -> CResult_StringErrorZ {
5861         CResult_StringErrorZ {
5862                 contents: CResult_StringErrorZPtr {
5863                         result: Box::into_raw(Box::new(o)),
5864                 },
5865                 result_ok: true,
5866         }
5867 }
5868 #[no_mangle]
5869 /// Creates a new CResult_StringErrorZ in the error state.
5870 pub extern "C" fn CResult_StringErrorZ_err(e: crate::c_types::Secp256k1Error) -> CResult_StringErrorZ {
5871         CResult_StringErrorZ {
5872                 contents: CResult_StringErrorZPtr {
5873                         err: Box::into_raw(Box::new(e)),
5874                 },
5875                 result_ok: false,
5876         }
5877 }
5878 #[no_mangle]
5879 /// Frees any resources used by the CResult_StringErrorZ.
5880 pub extern "C" fn CResult_StringErrorZ_free(_res: CResult_StringErrorZ) { }
5881 impl Drop for CResult_StringErrorZ {
5882         fn drop(&mut self) {
5883                 if self.result_ok {
5884                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
5885                                 let _ = unsafe { Box::from_raw(self.contents.result) };
5886                         }
5887                 } else {
5888                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
5889                                 let _ = unsafe { Box::from_raw(self.contents.err) };
5890                         }
5891                 }
5892         }
5893 }
5894 impl From<crate::c_types::CResultTempl<crate::c_types::Str, crate::c_types::Secp256k1Error>> for CResult_StringErrorZ {
5895         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::Str, crate::c_types::Secp256k1Error>) -> Self {
5896                 let contents = if o.result_ok {
5897                         let result = unsafe { o.contents.result };
5898                         unsafe { o.contents.result = std::ptr::null_mut() };
5899                         CResult_StringErrorZPtr { result }
5900                 } else {
5901                         let err = unsafe { o.contents.err };
5902                         unsafe { o.contents.err = std::ptr::null_mut(); }
5903                         CResult_StringErrorZPtr { err }
5904                 };
5905                 Self {
5906                         contents,
5907                         result_ok: o.result_ok,
5908                 }
5909         }
5910 }
5911 #[repr(C)]
5912 /// The contents of CResult_ChannelMonitorUpdateDecodeErrorZ
5913 pub union CResult_ChannelMonitorUpdateDecodeErrorZPtr {
5914         /// A pointer to the contents in the success state.
5915         /// Reading from this pointer when `result_ok` is not set is undefined.
5916         pub result: *mut crate::lightning::chain::channelmonitor::ChannelMonitorUpdate,
5917         /// A pointer to the contents in the error state.
5918         /// Reading from this pointer when `result_ok` is set is undefined.
5919         pub err: *mut crate::lightning::ln::msgs::DecodeError,
5920 }
5921 #[repr(C)]
5922 /// A CResult_ChannelMonitorUpdateDecodeErrorZ represents the result of a fallible operation,
5923 /// containing a crate::lightning::chain::channelmonitor::ChannelMonitorUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
5924 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5925 pub struct CResult_ChannelMonitorUpdateDecodeErrorZ {
5926         /// The contents of this CResult_ChannelMonitorUpdateDecodeErrorZ, accessible via either
5927         /// `err` or `result` depending on the state of `result_ok`.
5928         pub contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr,
5929         /// Whether this CResult_ChannelMonitorUpdateDecodeErrorZ represents a success state.
5930         pub result_ok: bool,
5931 }
5932 #[no_mangle]
5933 /// Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ in the success state.
5934 pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_ok(o: crate::lightning::chain::channelmonitor::ChannelMonitorUpdate) -> CResult_ChannelMonitorUpdateDecodeErrorZ {
5935         CResult_ChannelMonitorUpdateDecodeErrorZ {
5936                 contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr {
5937                         result: Box::into_raw(Box::new(o)),
5938                 },
5939                 result_ok: true,
5940         }
5941 }
5942 #[no_mangle]
5943 /// Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ in the error state.
5944 pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelMonitorUpdateDecodeErrorZ {
5945         CResult_ChannelMonitorUpdateDecodeErrorZ {
5946                 contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr {
5947                         err: Box::into_raw(Box::new(e)),
5948                 },
5949                 result_ok: false,
5950         }
5951 }
5952 #[no_mangle]
5953 /// Frees any resources used by the CResult_ChannelMonitorUpdateDecodeErrorZ.
5954 pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_free(_res: CResult_ChannelMonitorUpdateDecodeErrorZ) { }
5955 impl Drop for CResult_ChannelMonitorUpdateDecodeErrorZ {
5956         fn drop(&mut self) {
5957                 if self.result_ok {
5958                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
5959                                 let _ = unsafe { Box::from_raw(self.contents.result) };
5960                         }
5961                 } else {
5962                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
5963                                 let _ = unsafe { Box::from_raw(self.contents.err) };
5964                         }
5965                 }
5966         }
5967 }
5968 impl From<crate::c_types::CResultTempl<crate::lightning::chain::channelmonitor::ChannelMonitorUpdate, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelMonitorUpdateDecodeErrorZ {
5969         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::channelmonitor::ChannelMonitorUpdate, crate::lightning::ln::msgs::DecodeError>) -> Self {
5970                 let contents = if o.result_ok {
5971                         let result = unsafe { o.contents.result };
5972                         unsafe { o.contents.result = std::ptr::null_mut() };
5973                         CResult_ChannelMonitorUpdateDecodeErrorZPtr { result }
5974                 } else {
5975                         let err = unsafe { o.contents.err };
5976                         unsafe { o.contents.err = std::ptr::null_mut(); }
5977                         CResult_ChannelMonitorUpdateDecodeErrorZPtr { err }
5978                 };
5979                 Self {
5980                         contents,
5981                         result_ok: o.result_ok,
5982                 }
5983         }
5984 }
5985 impl Clone for CResult_ChannelMonitorUpdateDecodeErrorZ {
5986         fn clone(&self) -> Self {
5987                 if self.result_ok {
5988                         Self { result_ok: true, contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr {
5989                                 result: Box::into_raw(Box::new(<crate::lightning::chain::channelmonitor::ChannelMonitorUpdate>::clone(unsafe { &*self.contents.result })))
5990                         } }
5991                 } else {
5992                         Self { result_ok: false, contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr {
5993                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
5994                         } }
5995                 }
5996         }
5997 }
5998 #[no_mangle]
5999 /// Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ which has the same data as `orig`
6000 /// but with all dynamically-allocated buffers duplicated in new buffers.
6001 pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_clone(orig: &CResult_ChannelMonitorUpdateDecodeErrorZ) -> CResult_ChannelMonitorUpdateDecodeErrorZ { orig.clone() }
6002 #[repr(C)]
6003 /// The contents of CResult_HTLCUpdateDecodeErrorZ
6004 pub union CResult_HTLCUpdateDecodeErrorZPtr {
6005         /// A pointer to the contents in the success state.
6006         /// Reading from this pointer when `result_ok` is not set is undefined.
6007         pub result: *mut crate::lightning::chain::channelmonitor::HTLCUpdate,
6008         /// A pointer to the contents in the error state.
6009         /// Reading from this pointer when `result_ok` is set is undefined.
6010         pub err: *mut crate::lightning::ln::msgs::DecodeError,
6011 }
6012 #[repr(C)]
6013 /// A CResult_HTLCUpdateDecodeErrorZ represents the result of a fallible operation,
6014 /// containing a crate::lightning::chain::channelmonitor::HTLCUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
6015 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6016 pub struct CResult_HTLCUpdateDecodeErrorZ {
6017         /// The contents of this CResult_HTLCUpdateDecodeErrorZ, accessible via either
6018         /// `err` or `result` depending on the state of `result_ok`.
6019         pub contents: CResult_HTLCUpdateDecodeErrorZPtr,
6020         /// Whether this CResult_HTLCUpdateDecodeErrorZ represents a success state.
6021         pub result_ok: bool,
6022 }
6023 #[no_mangle]
6024 /// Creates a new CResult_HTLCUpdateDecodeErrorZ in the success state.
6025 pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_ok(o: crate::lightning::chain::channelmonitor::HTLCUpdate) -> CResult_HTLCUpdateDecodeErrorZ {
6026         CResult_HTLCUpdateDecodeErrorZ {
6027                 contents: CResult_HTLCUpdateDecodeErrorZPtr {
6028                         result: Box::into_raw(Box::new(o)),
6029                 },
6030                 result_ok: true,
6031         }
6032 }
6033 #[no_mangle]
6034 /// Creates a new CResult_HTLCUpdateDecodeErrorZ in the error state.
6035 pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_HTLCUpdateDecodeErrorZ {
6036         CResult_HTLCUpdateDecodeErrorZ {
6037                 contents: CResult_HTLCUpdateDecodeErrorZPtr {
6038                         err: Box::into_raw(Box::new(e)),
6039                 },
6040                 result_ok: false,
6041         }
6042 }
6043 #[no_mangle]
6044 /// Frees any resources used by the CResult_HTLCUpdateDecodeErrorZ.
6045 pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_free(_res: CResult_HTLCUpdateDecodeErrorZ) { }
6046 impl Drop for CResult_HTLCUpdateDecodeErrorZ {
6047         fn drop(&mut self) {
6048                 if self.result_ok {
6049                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
6050                                 let _ = unsafe { Box::from_raw(self.contents.result) };
6051                         }
6052                 } else {
6053                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
6054                                 let _ = unsafe { Box::from_raw(self.contents.err) };
6055                         }
6056                 }
6057         }
6058 }
6059 impl From<crate::c_types::CResultTempl<crate::lightning::chain::channelmonitor::HTLCUpdate, crate::lightning::ln::msgs::DecodeError>> for CResult_HTLCUpdateDecodeErrorZ {
6060         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::channelmonitor::HTLCUpdate, crate::lightning::ln::msgs::DecodeError>) -> Self {
6061                 let contents = if o.result_ok {
6062                         let result = unsafe { o.contents.result };
6063                         unsafe { o.contents.result = std::ptr::null_mut() };
6064                         CResult_HTLCUpdateDecodeErrorZPtr { result }
6065                 } else {
6066                         let err = unsafe { o.contents.err };
6067                         unsafe { o.contents.err = std::ptr::null_mut(); }
6068                         CResult_HTLCUpdateDecodeErrorZPtr { err }
6069                 };
6070                 Self {
6071                         contents,
6072                         result_ok: o.result_ok,
6073                 }
6074         }
6075 }
6076 impl Clone for CResult_HTLCUpdateDecodeErrorZ {
6077         fn clone(&self) -> Self {
6078                 if self.result_ok {
6079                         Self { result_ok: true, contents: CResult_HTLCUpdateDecodeErrorZPtr {
6080                                 result: Box::into_raw(Box::new(<crate::lightning::chain::channelmonitor::HTLCUpdate>::clone(unsafe { &*self.contents.result })))
6081                         } }
6082                 } else {
6083                         Self { result_ok: false, contents: CResult_HTLCUpdateDecodeErrorZPtr {
6084                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
6085                         } }
6086                 }
6087         }
6088 }
6089 #[no_mangle]
6090 /// Creates a new CResult_HTLCUpdateDecodeErrorZ which has the same data as `orig`
6091 /// but with all dynamically-allocated buffers duplicated in new buffers.
6092 pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_clone(orig: &CResult_HTLCUpdateDecodeErrorZ) -> CResult_HTLCUpdateDecodeErrorZ { orig.clone() }
6093 #[repr(C)]
6094 /// The contents of CResult_NoneMonitorUpdateErrorZ
6095 pub union CResult_NoneMonitorUpdateErrorZPtr {
6096         /// Note that this value is always NULL, as there are no contents in the OK variant
6097         pub result: *mut std::ffi::c_void,
6098         /// A pointer to the contents in the error state.
6099         /// Reading from this pointer when `result_ok` is set is undefined.
6100         pub err: *mut crate::lightning::chain::channelmonitor::MonitorUpdateError,
6101 }
6102 #[repr(C)]
6103 /// A CResult_NoneMonitorUpdateErrorZ represents the result of a fallible operation,
6104 /// containing a () on success and a crate::lightning::chain::channelmonitor::MonitorUpdateError on failure.
6105 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6106 pub struct CResult_NoneMonitorUpdateErrorZ {
6107         /// The contents of this CResult_NoneMonitorUpdateErrorZ, accessible via either
6108         /// `err` or `result` depending on the state of `result_ok`.
6109         pub contents: CResult_NoneMonitorUpdateErrorZPtr,
6110         /// Whether this CResult_NoneMonitorUpdateErrorZ represents a success state.
6111         pub result_ok: bool,
6112 }
6113 #[no_mangle]
6114 /// Creates a new CResult_NoneMonitorUpdateErrorZ in the success state.
6115 pub extern "C" fn CResult_NoneMonitorUpdateErrorZ_ok() -> CResult_NoneMonitorUpdateErrorZ {
6116         CResult_NoneMonitorUpdateErrorZ {
6117                 contents: CResult_NoneMonitorUpdateErrorZPtr {
6118                         result: std::ptr::null_mut(),
6119                 },
6120                 result_ok: true,
6121         }
6122 }
6123 #[no_mangle]
6124 /// Creates a new CResult_NoneMonitorUpdateErrorZ in the error state.
6125 pub extern "C" fn CResult_NoneMonitorUpdateErrorZ_err(e: crate::lightning::chain::channelmonitor::MonitorUpdateError) -> CResult_NoneMonitorUpdateErrorZ {
6126         CResult_NoneMonitorUpdateErrorZ {
6127                 contents: CResult_NoneMonitorUpdateErrorZPtr {
6128                         err: Box::into_raw(Box::new(e)),
6129                 },
6130                 result_ok: false,
6131         }
6132 }
6133 #[no_mangle]
6134 /// Frees any resources used by the CResult_NoneMonitorUpdateErrorZ.
6135 pub extern "C" fn CResult_NoneMonitorUpdateErrorZ_free(_res: CResult_NoneMonitorUpdateErrorZ) { }
6136 impl Drop for CResult_NoneMonitorUpdateErrorZ {
6137         fn drop(&mut self) {
6138                 if self.result_ok {
6139                 } else {
6140                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
6141                                 let _ = unsafe { Box::from_raw(self.contents.err) };
6142                         }
6143                 }
6144         }
6145 }
6146 impl From<crate::c_types::CResultTempl<(), crate::lightning::chain::channelmonitor::MonitorUpdateError>> for CResult_NoneMonitorUpdateErrorZ {
6147         fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::chain::channelmonitor::MonitorUpdateError>) -> Self {
6148                 let contents = if o.result_ok {
6149                         let _ = unsafe { Box::from_raw(o.contents.result) };
6150                         o.contents.result = std::ptr::null_mut();
6151                         CResult_NoneMonitorUpdateErrorZPtr { result: std::ptr::null_mut() }
6152                 } else {
6153                         let err = unsafe { o.contents.err };
6154                         unsafe { o.contents.err = std::ptr::null_mut(); }
6155                         CResult_NoneMonitorUpdateErrorZPtr { err }
6156                 };
6157                 Self {
6158                         contents,
6159                         result_ok: o.result_ok,
6160                 }
6161         }
6162 }
6163 impl Clone for CResult_NoneMonitorUpdateErrorZ {
6164         fn clone(&self) -> Self {
6165                 if self.result_ok {
6166                         Self { result_ok: true, contents: CResult_NoneMonitorUpdateErrorZPtr {
6167                                 result: std::ptr::null_mut()
6168                         } }
6169                 } else {
6170                         Self { result_ok: false, contents: CResult_NoneMonitorUpdateErrorZPtr {
6171                                 err: Box::into_raw(Box::new(<crate::lightning::chain::channelmonitor::MonitorUpdateError>::clone(unsafe { &*self.contents.err })))
6172                         } }
6173                 }
6174         }
6175 }
6176 #[no_mangle]
6177 /// Creates a new CResult_NoneMonitorUpdateErrorZ which has the same data as `orig`
6178 /// but with all dynamically-allocated buffers duplicated in new buffers.
6179 pub extern "C" fn CResult_NoneMonitorUpdateErrorZ_clone(orig: &CResult_NoneMonitorUpdateErrorZ) -> CResult_NoneMonitorUpdateErrorZ { orig.clone() }
6180 #[repr(C)]
6181 /// A tuple of 2 elements. See the individual fields for the types contained.
6182 pub struct C2Tuple_OutPointScriptZ {
6183         /// The element at position 0
6184         pub a: crate::lightning::chain::transaction::OutPoint,
6185         /// The element at position 1
6186         pub b: crate::c_types::derived::CVec_u8Z,
6187 }
6188 impl From<(crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_u8Z)> for C2Tuple_OutPointScriptZ {
6189         fn from (tup: (crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_u8Z)) -> Self {
6190                 Self {
6191                         a: tup.0,
6192                         b: tup.1,
6193                 }
6194         }
6195 }
6196 impl C2Tuple_OutPointScriptZ {
6197         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_u8Z) {
6198                 (self.a, self.b)
6199         }
6200 }
6201 impl Clone for C2Tuple_OutPointScriptZ {
6202         fn clone(&self) -> Self {
6203                 Self {
6204                         a: self.a.clone(),
6205                         b: self.b.clone(),
6206                 }
6207         }
6208 }
6209 #[no_mangle]
6210 /// Creates a new tuple which has the same data as `orig`
6211 /// but with all dynamically-allocated buffers duplicated in new buffers.
6212 pub extern "C" fn C2Tuple_OutPointScriptZ_clone(orig: &C2Tuple_OutPointScriptZ) -> C2Tuple_OutPointScriptZ { orig.clone() }
6213 /// Creates a new C2Tuple_OutPointScriptZ from the contained elements.
6214 #[no_mangle]
6215 pub extern "C" fn C2Tuple_OutPointScriptZ_new(a: crate::lightning::chain::transaction::OutPoint, b: crate::c_types::derived::CVec_u8Z) -> C2Tuple_OutPointScriptZ {
6216         C2Tuple_OutPointScriptZ { a, b, }
6217 }
6218
6219 #[no_mangle]
6220 /// Frees any resources used by the C2Tuple_OutPointScriptZ.
6221 pub extern "C" fn C2Tuple_OutPointScriptZ_free(_res: C2Tuple_OutPointScriptZ) { }
6222 #[repr(C)]
6223 /// A tuple of 2 elements. See the individual fields for the types contained.
6224 pub struct C2Tuple_u32ScriptZ {
6225         /// The element at position 0
6226         pub a: u32,
6227         /// The element at position 1
6228         pub b: crate::c_types::derived::CVec_u8Z,
6229 }
6230 impl From<(u32, crate::c_types::derived::CVec_u8Z)> for C2Tuple_u32ScriptZ {
6231         fn from (tup: (u32, crate::c_types::derived::CVec_u8Z)) -> Self {
6232                 Self {
6233                         a: tup.0,
6234                         b: tup.1,
6235                 }
6236         }
6237 }
6238 impl C2Tuple_u32ScriptZ {
6239         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (u32, crate::c_types::derived::CVec_u8Z) {
6240                 (self.a, self.b)
6241         }
6242 }
6243 impl Clone for C2Tuple_u32ScriptZ {
6244         fn clone(&self) -> Self {
6245                 Self {
6246                         a: self.a.clone(),
6247                         b: self.b.clone(),
6248                 }
6249         }
6250 }
6251 #[no_mangle]
6252 /// Creates a new tuple which has the same data as `orig`
6253 /// but with all dynamically-allocated buffers duplicated in new buffers.
6254 pub extern "C" fn C2Tuple_u32ScriptZ_clone(orig: &C2Tuple_u32ScriptZ) -> C2Tuple_u32ScriptZ { orig.clone() }
6255 /// Creates a new C2Tuple_u32ScriptZ from the contained elements.
6256 #[no_mangle]
6257 pub extern "C" fn C2Tuple_u32ScriptZ_new(a: u32, b: crate::c_types::derived::CVec_u8Z) -> C2Tuple_u32ScriptZ {
6258         C2Tuple_u32ScriptZ { a, b, }
6259 }
6260
6261 #[no_mangle]
6262 /// Frees any resources used by the C2Tuple_u32ScriptZ.
6263 pub extern "C" fn C2Tuple_u32ScriptZ_free(_res: C2Tuple_u32ScriptZ) { }
6264 #[repr(C)]
6265 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_u32ScriptZs of arbitrary size.
6266 /// This corresponds to std::vector in C++
6267 pub struct CVec_C2Tuple_u32ScriptZZ {
6268         /// The elements in the array.
6269         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
6270         pub data: *mut crate::c_types::derived::C2Tuple_u32ScriptZ,
6271         /// The number of elements pointed to by `data`.
6272         pub datalen: usize
6273 }
6274 impl CVec_C2Tuple_u32ScriptZZ {
6275         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_u32ScriptZ> {
6276                 if self.datalen == 0 { return Vec::new(); }
6277                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
6278                 self.data = std::ptr::null_mut();
6279                 self.datalen = 0;
6280                 ret
6281         }
6282         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_u32ScriptZ] {
6283                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
6284         }
6285 }
6286 impl From<Vec<crate::c_types::derived::C2Tuple_u32ScriptZ>> for CVec_C2Tuple_u32ScriptZZ {
6287         fn from(v: Vec<crate::c_types::derived::C2Tuple_u32ScriptZ>) -> Self {
6288                 let datalen = v.len();
6289                 let data = Box::into_raw(v.into_boxed_slice());
6290                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
6291         }
6292 }
6293 #[no_mangle]
6294 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
6295 pub extern "C" fn CVec_C2Tuple_u32ScriptZZ_free(_res: CVec_C2Tuple_u32ScriptZZ) { }
6296 impl Drop for CVec_C2Tuple_u32ScriptZZ {
6297         fn drop(&mut self) {
6298                 if self.datalen == 0 { return; }
6299                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
6300         }
6301 }
6302 impl Clone for CVec_C2Tuple_u32ScriptZZ {
6303         fn clone(&self) -> Self {
6304                 let mut res = Vec::new();
6305                 if self.datalen == 0 { return Self::from(res); }
6306                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
6307                 Self::from(res)
6308         }
6309 }
6310 #[repr(C)]
6311 /// A tuple of 2 elements. See the individual fields for the types contained.
6312 pub struct C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ {
6313         /// The element at position 0
6314         pub a: crate::c_types::ThirtyTwoBytes,
6315         /// The element at position 1
6316         pub b: crate::c_types::derived::CVec_C2Tuple_u32ScriptZZ,
6317 }
6318 impl From<(crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32ScriptZZ)> for C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ {
6319         fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32ScriptZZ)) -> Self {
6320                 Self {
6321                         a: tup.0,
6322                         b: tup.1,
6323                 }
6324         }
6325 }
6326 impl C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ {
6327         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32ScriptZZ) {
6328                 (self.a, self.b)
6329         }
6330 }
6331 impl Clone for C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ {
6332         fn clone(&self) -> Self {
6333                 Self {
6334                         a: self.a.clone(),
6335                         b: self.b.clone(),
6336                 }
6337         }
6338 }
6339 #[no_mangle]
6340 /// Creates a new tuple which has the same data as `orig`
6341 /// but with all dynamically-allocated buffers duplicated in new buffers.
6342 pub extern "C" fn C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone(orig: &C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ) -> C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ { orig.clone() }
6343 /// Creates a new C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ from the contained elements.
6344 #[no_mangle]
6345 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 {
6346         C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ { a, b, }
6347 }
6348
6349 #[no_mangle]
6350 /// Frees any resources used by the C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ.
6351 pub extern "C" fn C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_free(_res: C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ) { }
6352 #[repr(C)]
6353 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZs of arbitrary size.
6354 /// This corresponds to std::vector in C++
6355 pub struct CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ {
6356         /// The elements in the array.
6357         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
6358         pub data: *mut crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ,
6359         /// The number of elements pointed to by `data`.
6360         pub datalen: usize
6361 }
6362 impl CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ {
6363         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ> {
6364                 if self.datalen == 0 { return Vec::new(); }
6365                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
6366                 self.data = std::ptr::null_mut();
6367                 self.datalen = 0;
6368                 ret
6369         }
6370         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ] {
6371                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
6372         }
6373 }
6374 impl From<Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ>> for CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ {
6375         fn from(v: Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ>) -> Self {
6376                 let datalen = v.len();
6377                 let data = Box::into_raw(v.into_boxed_slice());
6378                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
6379         }
6380 }
6381 #[no_mangle]
6382 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
6383 pub extern "C" fn CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ_free(_res: CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ) { }
6384 impl Drop for CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ {
6385         fn drop(&mut self) {
6386                 if self.datalen == 0 { return; }
6387                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
6388         }
6389 }
6390 impl Clone for CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ {
6391         fn clone(&self) -> Self {
6392                 let mut res = Vec::new();
6393                 if self.datalen == 0 { return Self::from(res); }
6394                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
6395                 Self::from(res)
6396         }
6397 }
6398 #[repr(C)]
6399 /// A dynamically-allocated array of crate::lightning::util::events::Events of arbitrary size.
6400 /// This corresponds to std::vector in C++
6401 pub struct CVec_EventZ {
6402         /// The elements in the array.
6403         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
6404         pub data: *mut crate::lightning::util::events::Event,
6405         /// The number of elements pointed to by `data`.
6406         pub datalen: usize
6407 }
6408 impl CVec_EventZ {
6409         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::util::events::Event> {
6410                 if self.datalen == 0 { return Vec::new(); }
6411                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
6412                 self.data = std::ptr::null_mut();
6413                 self.datalen = 0;
6414                 ret
6415         }
6416         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::util::events::Event] {
6417                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
6418         }
6419 }
6420 impl From<Vec<crate::lightning::util::events::Event>> for CVec_EventZ {
6421         fn from(v: Vec<crate::lightning::util::events::Event>) -> Self {
6422                 let datalen = v.len();
6423                 let data = Box::into_raw(v.into_boxed_slice());
6424                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
6425         }
6426 }
6427 #[no_mangle]
6428 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
6429 pub extern "C" fn CVec_EventZ_free(_res: CVec_EventZ) { }
6430 impl Drop for CVec_EventZ {
6431         fn drop(&mut self) {
6432                 if self.datalen == 0 { return; }
6433                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
6434         }
6435 }
6436 impl Clone for CVec_EventZ {
6437         fn clone(&self) -> Self {
6438                 let mut res = Vec::new();
6439                 if self.datalen == 0 { return Self::from(res); }
6440                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
6441                 Self::from(res)
6442         }
6443 }
6444 #[repr(C)]
6445 /// A dynamically-allocated array of crate::c_types::Transactions of arbitrary size.
6446 /// This corresponds to std::vector in C++
6447 pub struct CVec_TransactionZ {
6448         /// The elements in the array.
6449         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
6450         pub data: *mut crate::c_types::Transaction,
6451         /// The number of elements pointed to by `data`.
6452         pub datalen: usize
6453 }
6454 impl CVec_TransactionZ {
6455         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::Transaction> {
6456                 if self.datalen == 0 { return Vec::new(); }
6457                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
6458                 self.data = std::ptr::null_mut();
6459                 self.datalen = 0;
6460                 ret
6461         }
6462         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::Transaction] {
6463                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
6464         }
6465 }
6466 impl From<Vec<crate::c_types::Transaction>> for CVec_TransactionZ {
6467         fn from(v: Vec<crate::c_types::Transaction>) -> Self {
6468                 let datalen = v.len();
6469                 let data = Box::into_raw(v.into_boxed_slice());
6470                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
6471         }
6472 }
6473 #[no_mangle]
6474 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
6475 pub extern "C" fn CVec_TransactionZ_free(_res: CVec_TransactionZ) { }
6476 impl Drop for CVec_TransactionZ {
6477         fn drop(&mut self) {
6478                 if self.datalen == 0 { return; }
6479                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
6480         }
6481 }
6482 impl Clone for CVec_TransactionZ {
6483         fn clone(&self) -> Self {
6484                 let mut res = Vec::new();
6485                 if self.datalen == 0 { return Self::from(res); }
6486                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
6487                 Self::from(res)
6488         }
6489 }
6490 #[repr(C)]
6491 /// A tuple of 2 elements. See the individual fields for the types contained.
6492 pub struct C2Tuple_u32TxOutZ {
6493         /// The element at position 0
6494         pub a: u32,
6495         /// The element at position 1
6496         pub b: crate::c_types::TxOut,
6497 }
6498 impl From<(u32, crate::c_types::TxOut)> for C2Tuple_u32TxOutZ {
6499         fn from (tup: (u32, crate::c_types::TxOut)) -> Self {
6500                 Self {
6501                         a: tup.0,
6502                         b: tup.1,
6503                 }
6504         }
6505 }
6506 impl C2Tuple_u32TxOutZ {
6507         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (u32, crate::c_types::TxOut) {
6508                 (self.a, self.b)
6509         }
6510 }
6511 impl Clone for C2Tuple_u32TxOutZ {
6512         fn clone(&self) -> Self {
6513                 Self {
6514                         a: self.a.clone(),
6515                         b: self.b.clone(),
6516                 }
6517         }
6518 }
6519 #[no_mangle]
6520 /// Creates a new tuple which has the same data as `orig`
6521 /// but with all dynamically-allocated buffers duplicated in new buffers.
6522 pub extern "C" fn C2Tuple_u32TxOutZ_clone(orig: &C2Tuple_u32TxOutZ) -> C2Tuple_u32TxOutZ { orig.clone() }
6523 /// Creates a new C2Tuple_u32TxOutZ from the contained elements.
6524 #[no_mangle]
6525 pub extern "C" fn C2Tuple_u32TxOutZ_new(a: u32, b: crate::c_types::TxOut) -> C2Tuple_u32TxOutZ {
6526         C2Tuple_u32TxOutZ { a, b, }
6527 }
6528
6529 #[no_mangle]
6530 /// Frees any resources used by the C2Tuple_u32TxOutZ.
6531 pub extern "C" fn C2Tuple_u32TxOutZ_free(_res: C2Tuple_u32TxOutZ) { }
6532 #[repr(C)]
6533 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_u32TxOutZs of arbitrary size.
6534 /// This corresponds to std::vector in C++
6535 pub struct CVec_C2Tuple_u32TxOutZZ {
6536         /// The elements in the array.
6537         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
6538         pub data: *mut crate::c_types::derived::C2Tuple_u32TxOutZ,
6539         /// The number of elements pointed to by `data`.
6540         pub datalen: usize
6541 }
6542 impl CVec_C2Tuple_u32TxOutZZ {
6543         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_u32TxOutZ> {
6544                 if self.datalen == 0 { return Vec::new(); }
6545                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
6546                 self.data = std::ptr::null_mut();
6547                 self.datalen = 0;
6548                 ret
6549         }
6550         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_u32TxOutZ] {
6551                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
6552         }
6553 }
6554 impl From<Vec<crate::c_types::derived::C2Tuple_u32TxOutZ>> for CVec_C2Tuple_u32TxOutZZ {
6555         fn from(v: Vec<crate::c_types::derived::C2Tuple_u32TxOutZ>) -> Self {
6556                 let datalen = v.len();
6557                 let data = Box::into_raw(v.into_boxed_slice());
6558                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
6559         }
6560 }
6561 #[no_mangle]
6562 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
6563 pub extern "C" fn CVec_C2Tuple_u32TxOutZZ_free(_res: CVec_C2Tuple_u32TxOutZZ) { }
6564 impl Drop for CVec_C2Tuple_u32TxOutZZ {
6565         fn drop(&mut self) {
6566                 if self.datalen == 0 { return; }
6567                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
6568         }
6569 }
6570 impl Clone for CVec_C2Tuple_u32TxOutZZ {
6571         fn clone(&self) -> Self {
6572                 let mut res = Vec::new();
6573                 if self.datalen == 0 { return Self::from(res); }
6574                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
6575                 Self::from(res)
6576         }
6577 }
6578 #[repr(C)]
6579 /// A tuple of 2 elements. See the individual fields for the types contained.
6580 pub struct C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ {
6581         /// The element at position 0
6582         pub a: crate::c_types::ThirtyTwoBytes,
6583         /// The element at position 1
6584         pub b: crate::c_types::derived::CVec_C2Tuple_u32TxOutZZ,
6585 }
6586 impl From<(crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32TxOutZZ)> for C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ {
6587         fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32TxOutZZ)) -> Self {
6588                 Self {
6589                         a: tup.0,
6590                         b: tup.1,
6591                 }
6592         }
6593 }
6594 impl C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ {
6595         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32TxOutZZ) {
6596                 (self.a, self.b)
6597         }
6598 }
6599 impl Clone for C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ {
6600         fn clone(&self) -> Self {
6601                 Self {
6602                         a: self.a.clone(),
6603                         b: self.b.clone(),
6604                 }
6605         }
6606 }
6607 #[no_mangle]
6608 /// Creates a new tuple which has the same data as `orig`
6609 /// but with all dynamically-allocated buffers duplicated in new buffers.
6610 pub extern "C" fn C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone(orig: &C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ) -> C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ { orig.clone() }
6611 /// Creates a new C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ from the contained elements.
6612 #[no_mangle]
6613 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 {
6614         C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ { a, b, }
6615 }
6616
6617 #[no_mangle]
6618 /// Frees any resources used by the C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ.
6619 pub extern "C" fn C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_free(_res: C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ) { }
6620 #[repr(C)]
6621 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZs of arbitrary size.
6622 /// This corresponds to std::vector in C++
6623 pub struct CVec_TransactionOutputsZ {
6624         /// The elements in the array.
6625         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
6626         pub data: *mut crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ,
6627         /// The number of elements pointed to by `data`.
6628         pub datalen: usize
6629 }
6630 impl CVec_TransactionOutputsZ {
6631         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ> {
6632                 if self.datalen == 0 { return Vec::new(); }
6633                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
6634                 self.data = std::ptr::null_mut();
6635                 self.datalen = 0;
6636                 ret
6637         }
6638         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ] {
6639                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
6640         }
6641 }
6642 impl From<Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ>> for CVec_TransactionOutputsZ {
6643         fn from(v: Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ>) -> Self {
6644                 let datalen = v.len();
6645                 let data = Box::into_raw(v.into_boxed_slice());
6646                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
6647         }
6648 }
6649 #[no_mangle]
6650 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
6651 pub extern "C" fn CVec_TransactionOutputsZ_free(_res: CVec_TransactionOutputsZ) { }
6652 impl Drop for CVec_TransactionOutputsZ {
6653         fn drop(&mut self) {
6654                 if self.datalen == 0 { return; }
6655                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
6656         }
6657 }
6658 impl Clone for CVec_TransactionOutputsZ {
6659         fn clone(&self) -> Self {
6660                 let mut res = Vec::new();
6661                 if self.datalen == 0 { return Self::from(res); }
6662                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
6663                 Self::from(res)
6664         }
6665 }
6666 #[repr(C)]
6667 /// The contents of CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ
6668 pub union CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr {
6669         /// A pointer to the contents in the success state.
6670         /// Reading from this pointer when `result_ok` is not set is undefined.
6671         pub result: *mut crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ,
6672         /// A pointer to the contents in the error state.
6673         /// Reading from this pointer when `result_ok` is set is undefined.
6674         pub err: *mut crate::lightning::ln::msgs::DecodeError,
6675 }
6676 #[repr(C)]
6677 /// A CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ represents the result of a fallible operation,
6678 /// containing a crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
6679 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6680 pub struct CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
6681         /// The contents of this CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ, accessible via either
6682         /// `err` or `result` depending on the state of `result_ok`.
6683         pub contents: CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr,
6684         /// Whether this CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ represents a success state.
6685         pub result_ok: bool,
6686 }
6687 #[no_mangle]
6688 /// Creates a new CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ in the success state.
6689 pub extern "C" fn CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_ok(o: crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ) -> CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
6690         CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
6691                 contents: CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr {
6692                         result: Box::into_raw(Box::new(o)),
6693                 },
6694                 result_ok: true,
6695         }
6696 }
6697 #[no_mangle]
6698 /// Creates a new CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ in the error state.
6699 pub extern "C" fn CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
6700         CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
6701                 contents: CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr {
6702                         err: Box::into_raw(Box::new(e)),
6703                 },
6704                 result_ok: false,
6705         }
6706 }
6707 #[no_mangle]
6708 /// Frees any resources used by the CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ.
6709 pub extern "C" fn CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_free(_res: CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ) { }
6710 impl Drop for CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
6711         fn drop(&mut self) {
6712                 if self.result_ok {
6713                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
6714                                 let _ = unsafe { Box::from_raw(self.contents.result) };
6715                         }
6716                 } else {
6717                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
6718                                 let _ = unsafe { Box::from_raw(self.contents.err) };
6719                         }
6720                 }
6721         }
6722 }
6723 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ, crate::lightning::ln::msgs::DecodeError>> for CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
6724         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
6725                 let contents = if o.result_ok {
6726                         let result = unsafe { o.contents.result };
6727                         unsafe { o.contents.result = std::ptr::null_mut() };
6728                         CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr { result }
6729                 } else {
6730                         let err = unsafe { o.contents.err };
6731                         unsafe { o.contents.err = std::ptr::null_mut(); }
6732                         CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr { err }
6733                 };
6734                 Self {
6735                         contents,
6736                         result_ok: o.result_ok,
6737                 }
6738         }
6739 }
6740 #[repr(C)]
6741 /// The contents of CResult_boolLightningErrorZ
6742 pub union CResult_boolLightningErrorZPtr {
6743         /// A pointer to the contents in the success state.
6744         /// Reading from this pointer when `result_ok` is not set is undefined.
6745         pub result: *mut bool,
6746         /// A pointer to the contents in the error state.
6747         /// Reading from this pointer when `result_ok` is set is undefined.
6748         pub err: *mut crate::lightning::ln::msgs::LightningError,
6749 }
6750 #[repr(C)]
6751 /// A CResult_boolLightningErrorZ represents the result of a fallible operation,
6752 /// containing a bool on success and a crate::lightning::ln::msgs::LightningError on failure.
6753 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6754 pub struct CResult_boolLightningErrorZ {
6755         /// The contents of this CResult_boolLightningErrorZ, accessible via either
6756         /// `err` or `result` depending on the state of `result_ok`.
6757         pub contents: CResult_boolLightningErrorZPtr,
6758         /// Whether this CResult_boolLightningErrorZ represents a success state.
6759         pub result_ok: bool,
6760 }
6761 #[no_mangle]
6762 /// Creates a new CResult_boolLightningErrorZ in the success state.
6763 pub extern "C" fn CResult_boolLightningErrorZ_ok(o: bool) -> CResult_boolLightningErrorZ {
6764         CResult_boolLightningErrorZ {
6765                 contents: CResult_boolLightningErrorZPtr {
6766                         result: Box::into_raw(Box::new(o)),
6767                 },
6768                 result_ok: true,
6769         }
6770 }
6771 #[no_mangle]
6772 /// Creates a new CResult_boolLightningErrorZ in the error state.
6773 pub extern "C" fn CResult_boolLightningErrorZ_err(e: crate::lightning::ln::msgs::LightningError) -> CResult_boolLightningErrorZ {
6774         CResult_boolLightningErrorZ {
6775                 contents: CResult_boolLightningErrorZPtr {
6776                         err: Box::into_raw(Box::new(e)),
6777                 },
6778                 result_ok: false,
6779         }
6780 }
6781 #[no_mangle]
6782 /// Frees any resources used by the CResult_boolLightningErrorZ.
6783 pub extern "C" fn CResult_boolLightningErrorZ_free(_res: CResult_boolLightningErrorZ) { }
6784 impl Drop for CResult_boolLightningErrorZ {
6785         fn drop(&mut self) {
6786                 if self.result_ok {
6787                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
6788                                 let _ = unsafe { Box::from_raw(self.contents.result) };
6789                         }
6790                 } else {
6791                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
6792                                 let _ = unsafe { Box::from_raw(self.contents.err) };
6793                         }
6794                 }
6795         }
6796 }
6797 impl From<crate::c_types::CResultTempl<bool, crate::lightning::ln::msgs::LightningError>> for CResult_boolLightningErrorZ {
6798         fn from(mut o: crate::c_types::CResultTempl<bool, crate::lightning::ln::msgs::LightningError>) -> Self {
6799                 let contents = if o.result_ok {
6800                         let result = unsafe { o.contents.result };
6801                         unsafe { o.contents.result = std::ptr::null_mut() };
6802                         CResult_boolLightningErrorZPtr { result }
6803                 } else {
6804                         let err = unsafe { o.contents.err };
6805                         unsafe { o.contents.err = std::ptr::null_mut(); }
6806                         CResult_boolLightningErrorZPtr { err }
6807                 };
6808                 Self {
6809                         contents,
6810                         result_ok: o.result_ok,
6811                 }
6812         }
6813 }
6814 impl Clone for CResult_boolLightningErrorZ {
6815         fn clone(&self) -> Self {
6816                 if self.result_ok {
6817                         Self { result_ok: true, contents: CResult_boolLightningErrorZPtr {
6818                                 result: Box::into_raw(Box::new(<bool>::clone(unsafe { &*self.contents.result })))
6819                         } }
6820                 } else {
6821                         Self { result_ok: false, contents: CResult_boolLightningErrorZPtr {
6822                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::LightningError>::clone(unsafe { &*self.contents.err })))
6823                         } }
6824                 }
6825         }
6826 }
6827 #[no_mangle]
6828 /// Creates a new CResult_boolLightningErrorZ which has the same data as `orig`
6829 /// but with all dynamically-allocated buffers duplicated in new buffers.
6830 pub extern "C" fn CResult_boolLightningErrorZ_clone(orig: &CResult_boolLightningErrorZ) -> CResult_boolLightningErrorZ { orig.clone() }
6831 #[repr(C)]
6832 /// A tuple of 3 elements. See the individual fields for the types contained.
6833 pub struct C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
6834         /// The element at position 0
6835         pub a: crate::lightning::ln::msgs::ChannelAnnouncement,
6836         /// The element at position 1
6837         pub b: crate::lightning::ln::msgs::ChannelUpdate,
6838         /// The element at position 2
6839         pub c: crate::lightning::ln::msgs::ChannelUpdate,
6840 }
6841 impl From<(crate::lightning::ln::msgs::ChannelAnnouncement, crate::lightning::ln::msgs::ChannelUpdate, crate::lightning::ln::msgs::ChannelUpdate)> for C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
6842         fn from (tup: (crate::lightning::ln::msgs::ChannelAnnouncement, crate::lightning::ln::msgs::ChannelUpdate, crate::lightning::ln::msgs::ChannelUpdate)) -> Self {
6843                 Self {
6844                         a: tup.0,
6845                         b: tup.1,
6846                         c: tup.2,
6847                 }
6848         }
6849 }
6850 impl C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
6851         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::lightning::ln::msgs::ChannelAnnouncement, crate::lightning::ln::msgs::ChannelUpdate, crate::lightning::ln::msgs::ChannelUpdate) {
6852                 (self.a, self.b, self.c)
6853         }
6854 }
6855 impl Clone for C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
6856         fn clone(&self) -> Self {
6857                 Self {
6858                         a: self.a.clone(),
6859                         b: self.b.clone(),
6860                         c: self.c.clone(),
6861                 }
6862         }
6863 }
6864 #[no_mangle]
6865 /// Creates a new tuple which has the same data as `orig`
6866 /// but with all dynamically-allocated buffers duplicated in new buffers.
6867 pub extern "C" fn C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(orig: &C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ) -> C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ { orig.clone() }
6868 /// Creates a new C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ from the contained elements.
6869 #[no_mangle]
6870 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 {
6871         C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ { a, b, c, }
6872 }
6873
6874 #[no_mangle]
6875 /// Frees any resources used by the C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ.
6876 pub extern "C" fn C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free(_res: C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ) { }
6877 #[repr(C)]
6878 /// A dynamically-allocated array of crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZs of arbitrary size.
6879 /// This corresponds to std::vector in C++
6880 pub struct CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
6881         /// The elements in the array.
6882         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
6883         pub data: *mut crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ,
6884         /// The number of elements pointed to by `data`.
6885         pub datalen: usize
6886 }
6887 impl CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
6888         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ> {
6889                 if self.datalen == 0 { return Vec::new(); }
6890                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
6891                 self.data = std::ptr::null_mut();
6892                 self.datalen = 0;
6893                 ret
6894         }
6895         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ] {
6896                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
6897         }
6898 }
6899 impl From<Vec<crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ>> for CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
6900         fn from(v: Vec<crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ>) -> Self {
6901                 let datalen = v.len();
6902                 let data = Box::into_raw(v.into_boxed_slice());
6903                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
6904         }
6905 }
6906 #[no_mangle]
6907 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
6908 pub extern "C" fn CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free(_res: CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ) { }
6909 impl Drop for CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
6910         fn drop(&mut self) {
6911                 if self.datalen == 0 { return; }
6912                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
6913         }
6914 }
6915 impl Clone for CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
6916         fn clone(&self) -> Self {
6917                 let mut res = Vec::new();
6918                 if self.datalen == 0 { return Self::from(res); }
6919                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
6920                 Self::from(res)
6921         }
6922 }
6923 #[repr(C)]
6924 /// A dynamically-allocated array of crate::lightning::ln::msgs::NodeAnnouncements of arbitrary size.
6925 /// This corresponds to std::vector in C++
6926 pub struct CVec_NodeAnnouncementZ {
6927         /// The elements in the array.
6928         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
6929         pub data: *mut crate::lightning::ln::msgs::NodeAnnouncement,
6930         /// The number of elements pointed to by `data`.
6931         pub datalen: usize
6932 }
6933 impl CVec_NodeAnnouncementZ {
6934         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::NodeAnnouncement> {
6935                 if self.datalen == 0 { return Vec::new(); }
6936                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
6937                 self.data = std::ptr::null_mut();
6938                 self.datalen = 0;
6939                 ret
6940         }
6941         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::NodeAnnouncement] {
6942                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
6943         }
6944 }
6945 impl From<Vec<crate::lightning::ln::msgs::NodeAnnouncement>> for CVec_NodeAnnouncementZ {
6946         fn from(v: Vec<crate::lightning::ln::msgs::NodeAnnouncement>) -> Self {
6947                 let datalen = v.len();
6948                 let data = Box::into_raw(v.into_boxed_slice());
6949                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
6950         }
6951 }
6952 #[no_mangle]
6953 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
6954 pub extern "C" fn CVec_NodeAnnouncementZ_free(_res: CVec_NodeAnnouncementZ) { }
6955 impl Drop for CVec_NodeAnnouncementZ {
6956         fn drop(&mut self) {
6957                 if self.datalen == 0 { return; }
6958                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
6959         }
6960 }
6961 impl Clone for CVec_NodeAnnouncementZ {
6962         fn clone(&self) -> Self {
6963                 let mut res = Vec::new();
6964                 if self.datalen == 0 { return Self::from(res); }
6965                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
6966                 Self::from(res)
6967         }
6968 }
6969 #[repr(C)]
6970 /// The contents of CResult_NoneLightningErrorZ
6971 pub union CResult_NoneLightningErrorZPtr {
6972         /// Note that this value is always NULL, as there are no contents in the OK variant
6973         pub result: *mut std::ffi::c_void,
6974         /// A pointer to the contents in the error state.
6975         /// Reading from this pointer when `result_ok` is set is undefined.
6976         pub err: *mut crate::lightning::ln::msgs::LightningError,
6977 }
6978 #[repr(C)]
6979 /// A CResult_NoneLightningErrorZ represents the result of a fallible operation,
6980 /// containing a () on success and a crate::lightning::ln::msgs::LightningError on failure.
6981 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6982 pub struct CResult_NoneLightningErrorZ {
6983         /// The contents of this CResult_NoneLightningErrorZ, accessible via either
6984         /// `err` or `result` depending on the state of `result_ok`.
6985         pub contents: CResult_NoneLightningErrorZPtr,
6986         /// Whether this CResult_NoneLightningErrorZ represents a success state.
6987         pub result_ok: bool,
6988 }
6989 #[no_mangle]
6990 /// Creates a new CResult_NoneLightningErrorZ in the success state.
6991 pub extern "C" fn CResult_NoneLightningErrorZ_ok() -> CResult_NoneLightningErrorZ {
6992         CResult_NoneLightningErrorZ {
6993                 contents: CResult_NoneLightningErrorZPtr {
6994                         result: std::ptr::null_mut(),
6995                 },
6996                 result_ok: true,
6997         }
6998 }
6999 #[no_mangle]
7000 /// Creates a new CResult_NoneLightningErrorZ in the error state.
7001 pub extern "C" fn CResult_NoneLightningErrorZ_err(e: crate::lightning::ln::msgs::LightningError) -> CResult_NoneLightningErrorZ {
7002         CResult_NoneLightningErrorZ {
7003                 contents: CResult_NoneLightningErrorZPtr {
7004                         err: Box::into_raw(Box::new(e)),
7005                 },
7006                 result_ok: false,
7007         }
7008 }
7009 #[no_mangle]
7010 /// Frees any resources used by the CResult_NoneLightningErrorZ.
7011 pub extern "C" fn CResult_NoneLightningErrorZ_free(_res: CResult_NoneLightningErrorZ) { }
7012 impl Drop for CResult_NoneLightningErrorZ {
7013         fn drop(&mut self) {
7014                 if self.result_ok {
7015                 } else {
7016                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
7017                                 let _ = unsafe { Box::from_raw(self.contents.err) };
7018                         }
7019                 }
7020         }
7021 }
7022 impl From<crate::c_types::CResultTempl<(), crate::lightning::ln::msgs::LightningError>> for CResult_NoneLightningErrorZ {
7023         fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::ln::msgs::LightningError>) -> Self {
7024                 let contents = if o.result_ok {
7025                         let _ = unsafe { Box::from_raw(o.contents.result) };
7026                         o.contents.result = std::ptr::null_mut();
7027                         CResult_NoneLightningErrorZPtr { result: std::ptr::null_mut() }
7028                 } else {
7029                         let err = unsafe { o.contents.err };
7030                         unsafe { o.contents.err = std::ptr::null_mut(); }
7031                         CResult_NoneLightningErrorZPtr { err }
7032                 };
7033                 Self {
7034                         contents,
7035                         result_ok: o.result_ok,
7036                 }
7037         }
7038 }
7039 impl Clone for CResult_NoneLightningErrorZ {
7040         fn clone(&self) -> Self {
7041                 if self.result_ok {
7042                         Self { result_ok: true, contents: CResult_NoneLightningErrorZPtr {
7043                                 result: std::ptr::null_mut()
7044                         } }
7045                 } else {
7046                         Self { result_ok: false, contents: CResult_NoneLightningErrorZPtr {
7047                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::LightningError>::clone(unsafe { &*self.contents.err })))
7048                         } }
7049                 }
7050         }
7051 }
7052 #[no_mangle]
7053 /// Creates a new CResult_NoneLightningErrorZ which has the same data as `orig`
7054 /// but with all dynamically-allocated buffers duplicated in new buffers.
7055 pub extern "C" fn CResult_NoneLightningErrorZ_clone(orig: &CResult_NoneLightningErrorZ) -> CResult_NoneLightningErrorZ { orig.clone() }
7056 #[repr(C)]
7057 /// A dynamically-allocated array of crate::c_types::PublicKeys of arbitrary size.
7058 /// This corresponds to std::vector in C++
7059 pub struct CVec_PublicKeyZ {
7060         /// The elements in the array.
7061         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
7062         pub data: *mut crate::c_types::PublicKey,
7063         /// The number of elements pointed to by `data`.
7064         pub datalen: usize
7065 }
7066 impl CVec_PublicKeyZ {
7067         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::PublicKey> {
7068                 if self.datalen == 0 { return Vec::new(); }
7069                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
7070                 self.data = std::ptr::null_mut();
7071                 self.datalen = 0;
7072                 ret
7073         }
7074         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::PublicKey] {
7075                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
7076         }
7077 }
7078 impl From<Vec<crate::c_types::PublicKey>> for CVec_PublicKeyZ {
7079         fn from(v: Vec<crate::c_types::PublicKey>) -> Self {
7080                 let datalen = v.len();
7081                 let data = Box::into_raw(v.into_boxed_slice());
7082                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
7083         }
7084 }
7085 #[no_mangle]
7086 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
7087 pub extern "C" fn CVec_PublicKeyZ_free(_res: CVec_PublicKeyZ) { }
7088 impl Drop for CVec_PublicKeyZ {
7089         fn drop(&mut self) {
7090                 if self.datalen == 0 { return; }
7091                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
7092         }
7093 }
7094 impl Clone for CVec_PublicKeyZ {
7095         fn clone(&self) -> Self {
7096                 let mut res = Vec::new();
7097                 if self.datalen == 0 { return Self::from(res); }
7098                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
7099                 Self::from(res)
7100         }
7101 }
7102 #[repr(C)]
7103 /// The contents of CResult_CVec_u8ZPeerHandleErrorZ
7104 pub union CResult_CVec_u8ZPeerHandleErrorZPtr {
7105         /// A pointer to the contents in the success state.
7106         /// Reading from this pointer when `result_ok` is not set is undefined.
7107         pub result: *mut crate::c_types::derived::CVec_u8Z,
7108         /// A pointer to the contents in the error state.
7109         /// Reading from this pointer when `result_ok` is set is undefined.
7110         pub err: *mut crate::lightning::ln::peer_handler::PeerHandleError,
7111 }
7112 #[repr(C)]
7113 /// A CResult_CVec_u8ZPeerHandleErrorZ represents the result of a fallible operation,
7114 /// containing a crate::c_types::derived::CVec_u8Z on success and a crate::lightning::ln::peer_handler::PeerHandleError on failure.
7115 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7116 pub struct CResult_CVec_u8ZPeerHandleErrorZ {
7117         /// The contents of this CResult_CVec_u8ZPeerHandleErrorZ, accessible via either
7118         /// `err` or `result` depending on the state of `result_ok`.
7119         pub contents: CResult_CVec_u8ZPeerHandleErrorZPtr,
7120         /// Whether this CResult_CVec_u8ZPeerHandleErrorZ represents a success state.
7121         pub result_ok: bool,
7122 }
7123 #[no_mangle]
7124 /// Creates a new CResult_CVec_u8ZPeerHandleErrorZ in the success state.
7125 pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_ok(o: crate::c_types::derived::CVec_u8Z) -> CResult_CVec_u8ZPeerHandleErrorZ {
7126         CResult_CVec_u8ZPeerHandleErrorZ {
7127                 contents: CResult_CVec_u8ZPeerHandleErrorZPtr {
7128                         result: Box::into_raw(Box::new(o)),
7129                 },
7130                 result_ok: true,
7131         }
7132 }
7133 #[no_mangle]
7134 /// Creates a new CResult_CVec_u8ZPeerHandleErrorZ in the error state.
7135 pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_err(e: crate::lightning::ln::peer_handler::PeerHandleError) -> CResult_CVec_u8ZPeerHandleErrorZ {
7136         CResult_CVec_u8ZPeerHandleErrorZ {
7137                 contents: CResult_CVec_u8ZPeerHandleErrorZPtr {
7138                         err: Box::into_raw(Box::new(e)),
7139                 },
7140                 result_ok: false,
7141         }
7142 }
7143 #[no_mangle]
7144 /// Frees any resources used by the CResult_CVec_u8ZPeerHandleErrorZ.
7145 pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_free(_res: CResult_CVec_u8ZPeerHandleErrorZ) { }
7146 impl Drop for CResult_CVec_u8ZPeerHandleErrorZ {
7147         fn drop(&mut self) {
7148                 if self.result_ok {
7149                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
7150                                 let _ = unsafe { Box::from_raw(self.contents.result) };
7151                         }
7152                 } else {
7153                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
7154                                 let _ = unsafe { Box::from_raw(self.contents.err) };
7155                         }
7156                 }
7157         }
7158 }
7159 impl From<crate::c_types::CResultTempl<crate::c_types::derived::CVec_u8Z, crate::lightning::ln::peer_handler::PeerHandleError>> for CResult_CVec_u8ZPeerHandleErrorZ {
7160         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CVec_u8Z, crate::lightning::ln::peer_handler::PeerHandleError>) -> Self {
7161                 let contents = if o.result_ok {
7162                         let result = unsafe { o.contents.result };
7163                         unsafe { o.contents.result = std::ptr::null_mut() };
7164                         CResult_CVec_u8ZPeerHandleErrorZPtr { result }
7165                 } else {
7166                         let err = unsafe { o.contents.err };
7167                         unsafe { o.contents.err = std::ptr::null_mut(); }
7168                         CResult_CVec_u8ZPeerHandleErrorZPtr { err }
7169                 };
7170                 Self {
7171                         contents,
7172                         result_ok: o.result_ok,
7173                 }
7174         }
7175 }
7176 impl Clone for CResult_CVec_u8ZPeerHandleErrorZ {
7177         fn clone(&self) -> Self {
7178                 if self.result_ok {
7179                         Self { result_ok: true, contents: CResult_CVec_u8ZPeerHandleErrorZPtr {
7180                                 result: Box::into_raw(Box::new(<crate::c_types::derived::CVec_u8Z>::clone(unsafe { &*self.contents.result })))
7181                         } }
7182                 } else {
7183                         Self { result_ok: false, contents: CResult_CVec_u8ZPeerHandleErrorZPtr {
7184                                 err: Box::into_raw(Box::new(<crate::lightning::ln::peer_handler::PeerHandleError>::clone(unsafe { &*self.contents.err })))
7185                         } }
7186                 }
7187         }
7188 }
7189 #[no_mangle]
7190 /// Creates a new CResult_CVec_u8ZPeerHandleErrorZ which has the same data as `orig`
7191 /// but with all dynamically-allocated buffers duplicated in new buffers.
7192 pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_clone(orig: &CResult_CVec_u8ZPeerHandleErrorZ) -> CResult_CVec_u8ZPeerHandleErrorZ { orig.clone() }
7193 #[repr(C)]
7194 /// The contents of CResult_NonePeerHandleErrorZ
7195 pub union CResult_NonePeerHandleErrorZPtr {
7196         /// Note that this value is always NULL, as there are no contents in the OK variant
7197         pub result: *mut std::ffi::c_void,
7198         /// A pointer to the contents in the error state.
7199         /// Reading from this pointer when `result_ok` is set is undefined.
7200         pub err: *mut crate::lightning::ln::peer_handler::PeerHandleError,
7201 }
7202 #[repr(C)]
7203 /// A CResult_NonePeerHandleErrorZ represents the result of a fallible operation,
7204 /// containing a () on success and a crate::lightning::ln::peer_handler::PeerHandleError on failure.
7205 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7206 pub struct CResult_NonePeerHandleErrorZ {
7207         /// The contents of this CResult_NonePeerHandleErrorZ, accessible via either
7208         /// `err` or `result` depending on the state of `result_ok`.
7209         pub contents: CResult_NonePeerHandleErrorZPtr,
7210         /// Whether this CResult_NonePeerHandleErrorZ represents a success state.
7211         pub result_ok: bool,
7212 }
7213 #[no_mangle]
7214 /// Creates a new CResult_NonePeerHandleErrorZ in the success state.
7215 pub extern "C" fn CResult_NonePeerHandleErrorZ_ok() -> CResult_NonePeerHandleErrorZ {
7216         CResult_NonePeerHandleErrorZ {
7217                 contents: CResult_NonePeerHandleErrorZPtr {
7218                         result: std::ptr::null_mut(),
7219                 },
7220                 result_ok: true,
7221         }
7222 }
7223 #[no_mangle]
7224 /// Creates a new CResult_NonePeerHandleErrorZ in the error state.
7225 pub extern "C" fn CResult_NonePeerHandleErrorZ_err(e: crate::lightning::ln::peer_handler::PeerHandleError) -> CResult_NonePeerHandleErrorZ {
7226         CResult_NonePeerHandleErrorZ {
7227                 contents: CResult_NonePeerHandleErrorZPtr {
7228                         err: Box::into_raw(Box::new(e)),
7229                 },
7230                 result_ok: false,
7231         }
7232 }
7233 #[no_mangle]
7234 /// Frees any resources used by the CResult_NonePeerHandleErrorZ.
7235 pub extern "C" fn CResult_NonePeerHandleErrorZ_free(_res: CResult_NonePeerHandleErrorZ) { }
7236 impl Drop for CResult_NonePeerHandleErrorZ {
7237         fn drop(&mut self) {
7238                 if self.result_ok {
7239                 } else {
7240                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
7241                                 let _ = unsafe { Box::from_raw(self.contents.err) };
7242                         }
7243                 }
7244         }
7245 }
7246 impl From<crate::c_types::CResultTempl<(), crate::lightning::ln::peer_handler::PeerHandleError>> for CResult_NonePeerHandleErrorZ {
7247         fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::ln::peer_handler::PeerHandleError>) -> Self {
7248                 let contents = if o.result_ok {
7249                         let _ = unsafe { Box::from_raw(o.contents.result) };
7250                         o.contents.result = std::ptr::null_mut();
7251                         CResult_NonePeerHandleErrorZPtr { result: std::ptr::null_mut() }
7252                 } else {
7253                         let err = unsafe { o.contents.err };
7254                         unsafe { o.contents.err = std::ptr::null_mut(); }
7255                         CResult_NonePeerHandleErrorZPtr { err }
7256                 };
7257                 Self {
7258                         contents,
7259                         result_ok: o.result_ok,
7260                 }
7261         }
7262 }
7263 impl Clone for CResult_NonePeerHandleErrorZ {
7264         fn clone(&self) -> Self {
7265                 if self.result_ok {
7266                         Self { result_ok: true, contents: CResult_NonePeerHandleErrorZPtr {
7267                                 result: std::ptr::null_mut()
7268                         } }
7269                 } else {
7270                         Self { result_ok: false, contents: CResult_NonePeerHandleErrorZPtr {
7271                                 err: Box::into_raw(Box::new(<crate::lightning::ln::peer_handler::PeerHandleError>::clone(unsafe { &*self.contents.err })))
7272                         } }
7273                 }
7274         }
7275 }
7276 #[no_mangle]
7277 /// Creates a new CResult_NonePeerHandleErrorZ which has the same data as `orig`
7278 /// but with all dynamically-allocated buffers duplicated in new buffers.
7279 pub extern "C" fn CResult_NonePeerHandleErrorZ_clone(orig: &CResult_NonePeerHandleErrorZ) -> CResult_NonePeerHandleErrorZ { orig.clone() }
7280 #[repr(C)]
7281 /// The contents of CResult_boolPeerHandleErrorZ
7282 pub union CResult_boolPeerHandleErrorZPtr {
7283         /// A pointer to the contents in the success state.
7284         /// Reading from this pointer when `result_ok` is not set is undefined.
7285         pub result: *mut bool,
7286         /// A pointer to the contents in the error state.
7287         /// Reading from this pointer when `result_ok` is set is undefined.
7288         pub err: *mut crate::lightning::ln::peer_handler::PeerHandleError,
7289 }
7290 #[repr(C)]
7291 /// A CResult_boolPeerHandleErrorZ represents the result of a fallible operation,
7292 /// containing a bool on success and a crate::lightning::ln::peer_handler::PeerHandleError on failure.
7293 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7294 pub struct CResult_boolPeerHandleErrorZ {
7295         /// The contents of this CResult_boolPeerHandleErrorZ, accessible via either
7296         /// `err` or `result` depending on the state of `result_ok`.
7297         pub contents: CResult_boolPeerHandleErrorZPtr,
7298         /// Whether this CResult_boolPeerHandleErrorZ represents a success state.
7299         pub result_ok: bool,
7300 }
7301 #[no_mangle]
7302 /// Creates a new CResult_boolPeerHandleErrorZ in the success state.
7303 pub extern "C" fn CResult_boolPeerHandleErrorZ_ok(o: bool) -> CResult_boolPeerHandleErrorZ {
7304         CResult_boolPeerHandleErrorZ {
7305                 contents: CResult_boolPeerHandleErrorZPtr {
7306                         result: Box::into_raw(Box::new(o)),
7307                 },
7308                 result_ok: true,
7309         }
7310 }
7311 #[no_mangle]
7312 /// Creates a new CResult_boolPeerHandleErrorZ in the error state.
7313 pub extern "C" fn CResult_boolPeerHandleErrorZ_err(e: crate::lightning::ln::peer_handler::PeerHandleError) -> CResult_boolPeerHandleErrorZ {
7314         CResult_boolPeerHandleErrorZ {
7315                 contents: CResult_boolPeerHandleErrorZPtr {
7316                         err: Box::into_raw(Box::new(e)),
7317                 },
7318                 result_ok: false,
7319         }
7320 }
7321 #[no_mangle]
7322 /// Frees any resources used by the CResult_boolPeerHandleErrorZ.
7323 pub extern "C" fn CResult_boolPeerHandleErrorZ_free(_res: CResult_boolPeerHandleErrorZ) { }
7324 impl Drop for CResult_boolPeerHandleErrorZ {
7325         fn drop(&mut self) {
7326                 if self.result_ok {
7327                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
7328                                 let _ = unsafe { Box::from_raw(self.contents.result) };
7329                         }
7330                 } else {
7331                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
7332                                 let _ = unsafe { Box::from_raw(self.contents.err) };
7333                         }
7334                 }
7335         }
7336 }
7337 impl From<crate::c_types::CResultTempl<bool, crate::lightning::ln::peer_handler::PeerHandleError>> for CResult_boolPeerHandleErrorZ {
7338         fn from(mut o: crate::c_types::CResultTempl<bool, crate::lightning::ln::peer_handler::PeerHandleError>) -> Self {
7339                 let contents = if o.result_ok {
7340                         let result = unsafe { o.contents.result };
7341                         unsafe { o.contents.result = std::ptr::null_mut() };
7342                         CResult_boolPeerHandleErrorZPtr { result }
7343                 } else {
7344                         let err = unsafe { o.contents.err };
7345                         unsafe { o.contents.err = std::ptr::null_mut(); }
7346                         CResult_boolPeerHandleErrorZPtr { err }
7347                 };
7348                 Self {
7349                         contents,
7350                         result_ok: o.result_ok,
7351                 }
7352         }
7353 }
7354 impl Clone for CResult_boolPeerHandleErrorZ {
7355         fn clone(&self) -> Self {
7356                 if self.result_ok {
7357                         Self { result_ok: true, contents: CResult_boolPeerHandleErrorZPtr {
7358                                 result: Box::into_raw(Box::new(<bool>::clone(unsafe { &*self.contents.result })))
7359                         } }
7360                 } else {
7361                         Self { result_ok: false, contents: CResult_boolPeerHandleErrorZPtr {
7362                                 err: Box::into_raw(Box::new(<crate::lightning::ln::peer_handler::PeerHandleError>::clone(unsafe { &*self.contents.err })))
7363                         } }
7364                 }
7365         }
7366 }
7367 #[no_mangle]
7368 /// Creates a new CResult_boolPeerHandleErrorZ which has the same data as `orig`
7369 /// but with all dynamically-allocated buffers duplicated in new buffers.
7370 pub extern "C" fn CResult_boolPeerHandleErrorZ_clone(orig: &CResult_boolPeerHandleErrorZ) -> CResult_boolPeerHandleErrorZ { orig.clone() }
7371 #[repr(C)]
7372 /// The contents of CResult_DirectionalChannelInfoDecodeErrorZ
7373 pub union CResult_DirectionalChannelInfoDecodeErrorZPtr {
7374         /// A pointer to the contents in the success state.
7375         /// Reading from this pointer when `result_ok` is not set is undefined.
7376         pub result: *mut crate::lightning::routing::network_graph::DirectionalChannelInfo,
7377         /// A pointer to the contents in the error state.
7378         /// Reading from this pointer when `result_ok` is set is undefined.
7379         pub err: *mut crate::lightning::ln::msgs::DecodeError,
7380 }
7381 #[repr(C)]
7382 /// A CResult_DirectionalChannelInfoDecodeErrorZ represents the result of a fallible operation,
7383 /// containing a crate::lightning::routing::network_graph::DirectionalChannelInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
7384 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7385 pub struct CResult_DirectionalChannelInfoDecodeErrorZ {
7386         /// The contents of this CResult_DirectionalChannelInfoDecodeErrorZ, accessible via either
7387         /// `err` or `result` depending on the state of `result_ok`.
7388         pub contents: CResult_DirectionalChannelInfoDecodeErrorZPtr,
7389         /// Whether this CResult_DirectionalChannelInfoDecodeErrorZ represents a success state.
7390         pub result_ok: bool,
7391 }
7392 #[no_mangle]
7393 /// Creates a new CResult_DirectionalChannelInfoDecodeErrorZ in the success state.
7394 pub extern "C" fn CResult_DirectionalChannelInfoDecodeErrorZ_ok(o: crate::lightning::routing::network_graph::DirectionalChannelInfo) -> CResult_DirectionalChannelInfoDecodeErrorZ {
7395         CResult_DirectionalChannelInfoDecodeErrorZ {
7396                 contents: CResult_DirectionalChannelInfoDecodeErrorZPtr {
7397                         result: Box::into_raw(Box::new(o)),
7398                 },
7399                 result_ok: true,
7400         }
7401 }
7402 #[no_mangle]
7403 /// Creates a new CResult_DirectionalChannelInfoDecodeErrorZ in the error state.
7404 pub extern "C" fn CResult_DirectionalChannelInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_DirectionalChannelInfoDecodeErrorZ {
7405         CResult_DirectionalChannelInfoDecodeErrorZ {
7406                 contents: CResult_DirectionalChannelInfoDecodeErrorZPtr {
7407                         err: Box::into_raw(Box::new(e)),
7408                 },
7409                 result_ok: false,
7410         }
7411 }
7412 #[no_mangle]
7413 /// Frees any resources used by the CResult_DirectionalChannelInfoDecodeErrorZ.
7414 pub extern "C" fn CResult_DirectionalChannelInfoDecodeErrorZ_free(_res: CResult_DirectionalChannelInfoDecodeErrorZ) { }
7415 impl Drop for CResult_DirectionalChannelInfoDecodeErrorZ {
7416         fn drop(&mut self) {
7417                 if self.result_ok {
7418                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
7419                                 let _ = unsafe { Box::from_raw(self.contents.result) };
7420                         }
7421                 } else {
7422                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
7423                                 let _ = unsafe { Box::from_raw(self.contents.err) };
7424                         }
7425                 }
7426         }
7427 }
7428 impl From<crate::c_types::CResultTempl<crate::lightning::routing::network_graph::DirectionalChannelInfo, crate::lightning::ln::msgs::DecodeError>> for CResult_DirectionalChannelInfoDecodeErrorZ {
7429         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::network_graph::DirectionalChannelInfo, crate::lightning::ln::msgs::DecodeError>) -> Self {
7430                 let contents = if o.result_ok {
7431                         let result = unsafe { o.contents.result };
7432                         unsafe { o.contents.result = std::ptr::null_mut() };
7433                         CResult_DirectionalChannelInfoDecodeErrorZPtr { result }
7434                 } else {
7435                         let err = unsafe { o.contents.err };
7436                         unsafe { o.contents.err = std::ptr::null_mut(); }
7437                         CResult_DirectionalChannelInfoDecodeErrorZPtr { err }
7438                 };
7439                 Self {
7440                         contents,
7441                         result_ok: o.result_ok,
7442                 }
7443         }
7444 }
7445 impl Clone for CResult_DirectionalChannelInfoDecodeErrorZ {
7446         fn clone(&self) -> Self {
7447                 if self.result_ok {
7448                         Self { result_ok: true, contents: CResult_DirectionalChannelInfoDecodeErrorZPtr {
7449                                 result: Box::into_raw(Box::new(<crate::lightning::routing::network_graph::DirectionalChannelInfo>::clone(unsafe { &*self.contents.result })))
7450                         } }
7451                 } else {
7452                         Self { result_ok: false, contents: CResult_DirectionalChannelInfoDecodeErrorZPtr {
7453                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
7454                         } }
7455                 }
7456         }
7457 }
7458 #[no_mangle]
7459 /// Creates a new CResult_DirectionalChannelInfoDecodeErrorZ which has the same data as `orig`
7460 /// but with all dynamically-allocated buffers duplicated in new buffers.
7461 pub extern "C" fn CResult_DirectionalChannelInfoDecodeErrorZ_clone(orig: &CResult_DirectionalChannelInfoDecodeErrorZ) -> CResult_DirectionalChannelInfoDecodeErrorZ { orig.clone() }
7462 #[repr(C)]
7463 /// The contents of CResult_ChannelInfoDecodeErrorZ
7464 pub union CResult_ChannelInfoDecodeErrorZPtr {
7465         /// A pointer to the contents in the success state.
7466         /// Reading from this pointer when `result_ok` is not set is undefined.
7467         pub result: *mut crate::lightning::routing::network_graph::ChannelInfo,
7468         /// A pointer to the contents in the error state.
7469         /// Reading from this pointer when `result_ok` is set is undefined.
7470         pub err: *mut crate::lightning::ln::msgs::DecodeError,
7471 }
7472 #[repr(C)]
7473 /// A CResult_ChannelInfoDecodeErrorZ represents the result of a fallible operation,
7474 /// containing a crate::lightning::routing::network_graph::ChannelInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
7475 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7476 pub struct CResult_ChannelInfoDecodeErrorZ {
7477         /// The contents of this CResult_ChannelInfoDecodeErrorZ, accessible via either
7478         /// `err` or `result` depending on the state of `result_ok`.
7479         pub contents: CResult_ChannelInfoDecodeErrorZPtr,
7480         /// Whether this CResult_ChannelInfoDecodeErrorZ represents a success state.
7481         pub result_ok: bool,
7482 }
7483 #[no_mangle]
7484 /// Creates a new CResult_ChannelInfoDecodeErrorZ in the success state.
7485 pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_ok(o: crate::lightning::routing::network_graph::ChannelInfo) -> CResult_ChannelInfoDecodeErrorZ {
7486         CResult_ChannelInfoDecodeErrorZ {
7487                 contents: CResult_ChannelInfoDecodeErrorZPtr {
7488                         result: Box::into_raw(Box::new(o)),
7489                 },
7490                 result_ok: true,
7491         }
7492 }
7493 #[no_mangle]
7494 /// Creates a new CResult_ChannelInfoDecodeErrorZ in the error state.
7495 pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelInfoDecodeErrorZ {
7496         CResult_ChannelInfoDecodeErrorZ {
7497                 contents: CResult_ChannelInfoDecodeErrorZPtr {
7498                         err: Box::into_raw(Box::new(e)),
7499                 },
7500                 result_ok: false,
7501         }
7502 }
7503 #[no_mangle]
7504 /// Frees any resources used by the CResult_ChannelInfoDecodeErrorZ.
7505 pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_free(_res: CResult_ChannelInfoDecodeErrorZ) { }
7506 impl Drop for CResult_ChannelInfoDecodeErrorZ {
7507         fn drop(&mut self) {
7508                 if self.result_ok {
7509                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
7510                                 let _ = unsafe { Box::from_raw(self.contents.result) };
7511                         }
7512                 } else {
7513                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
7514                                 let _ = unsafe { Box::from_raw(self.contents.err) };
7515                         }
7516                 }
7517         }
7518 }
7519 impl From<crate::c_types::CResultTempl<crate::lightning::routing::network_graph::ChannelInfo, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelInfoDecodeErrorZ {
7520         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::network_graph::ChannelInfo, crate::lightning::ln::msgs::DecodeError>) -> Self {
7521                 let contents = if o.result_ok {
7522                         let result = unsafe { o.contents.result };
7523                         unsafe { o.contents.result = std::ptr::null_mut() };
7524                         CResult_ChannelInfoDecodeErrorZPtr { result }
7525                 } else {
7526                         let err = unsafe { o.contents.err };
7527                         unsafe { o.contents.err = std::ptr::null_mut(); }
7528                         CResult_ChannelInfoDecodeErrorZPtr { err }
7529                 };
7530                 Self {
7531                         contents,
7532                         result_ok: o.result_ok,
7533                 }
7534         }
7535 }
7536 impl Clone for CResult_ChannelInfoDecodeErrorZ {
7537         fn clone(&self) -> Self {
7538                 if self.result_ok {
7539                         Self { result_ok: true, contents: CResult_ChannelInfoDecodeErrorZPtr {
7540                                 result: Box::into_raw(Box::new(<crate::lightning::routing::network_graph::ChannelInfo>::clone(unsafe { &*self.contents.result })))
7541                         } }
7542                 } else {
7543                         Self { result_ok: false, contents: CResult_ChannelInfoDecodeErrorZPtr {
7544                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
7545                         } }
7546                 }
7547         }
7548 }
7549 #[no_mangle]
7550 /// Creates a new CResult_ChannelInfoDecodeErrorZ which has the same data as `orig`
7551 /// but with all dynamically-allocated buffers duplicated in new buffers.
7552 pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_clone(orig: &CResult_ChannelInfoDecodeErrorZ) -> CResult_ChannelInfoDecodeErrorZ { orig.clone() }
7553 #[repr(C)]
7554 /// The contents of CResult_RoutingFeesDecodeErrorZ
7555 pub union CResult_RoutingFeesDecodeErrorZPtr {
7556         /// A pointer to the contents in the success state.
7557         /// Reading from this pointer when `result_ok` is not set is undefined.
7558         pub result: *mut crate::lightning::routing::network_graph::RoutingFees,
7559         /// A pointer to the contents in the error state.
7560         /// Reading from this pointer when `result_ok` is set is undefined.
7561         pub err: *mut crate::lightning::ln::msgs::DecodeError,
7562 }
7563 #[repr(C)]
7564 /// A CResult_RoutingFeesDecodeErrorZ represents the result of a fallible operation,
7565 /// containing a crate::lightning::routing::network_graph::RoutingFees on success and a crate::lightning::ln::msgs::DecodeError on failure.
7566 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7567 pub struct CResult_RoutingFeesDecodeErrorZ {
7568         /// The contents of this CResult_RoutingFeesDecodeErrorZ, accessible via either
7569         /// `err` or `result` depending on the state of `result_ok`.
7570         pub contents: CResult_RoutingFeesDecodeErrorZPtr,
7571         /// Whether this CResult_RoutingFeesDecodeErrorZ represents a success state.
7572         pub result_ok: bool,
7573 }
7574 #[no_mangle]
7575 /// Creates a new CResult_RoutingFeesDecodeErrorZ in the success state.
7576 pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_ok(o: crate::lightning::routing::network_graph::RoutingFees) -> CResult_RoutingFeesDecodeErrorZ {
7577         CResult_RoutingFeesDecodeErrorZ {
7578                 contents: CResult_RoutingFeesDecodeErrorZPtr {
7579                         result: Box::into_raw(Box::new(o)),
7580                 },
7581                 result_ok: true,
7582         }
7583 }
7584 #[no_mangle]
7585 /// Creates a new CResult_RoutingFeesDecodeErrorZ in the error state.
7586 pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RoutingFeesDecodeErrorZ {
7587         CResult_RoutingFeesDecodeErrorZ {
7588                 contents: CResult_RoutingFeesDecodeErrorZPtr {
7589                         err: Box::into_raw(Box::new(e)),
7590                 },
7591                 result_ok: false,
7592         }
7593 }
7594 #[no_mangle]
7595 /// Frees any resources used by the CResult_RoutingFeesDecodeErrorZ.
7596 pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_free(_res: CResult_RoutingFeesDecodeErrorZ) { }
7597 impl Drop for CResult_RoutingFeesDecodeErrorZ {
7598         fn drop(&mut self) {
7599                 if self.result_ok {
7600                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
7601                                 let _ = unsafe { Box::from_raw(self.contents.result) };
7602                         }
7603                 } else {
7604                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
7605                                 let _ = unsafe { Box::from_raw(self.contents.err) };
7606                         }
7607                 }
7608         }
7609 }
7610 impl From<crate::c_types::CResultTempl<crate::lightning::routing::network_graph::RoutingFees, crate::lightning::ln::msgs::DecodeError>> for CResult_RoutingFeesDecodeErrorZ {
7611         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::network_graph::RoutingFees, crate::lightning::ln::msgs::DecodeError>) -> Self {
7612                 let contents = if o.result_ok {
7613                         let result = unsafe { o.contents.result };
7614                         unsafe { o.contents.result = std::ptr::null_mut() };
7615                         CResult_RoutingFeesDecodeErrorZPtr { result }
7616                 } else {
7617                         let err = unsafe { o.contents.err };
7618                         unsafe { o.contents.err = std::ptr::null_mut(); }
7619                         CResult_RoutingFeesDecodeErrorZPtr { err }
7620                 };
7621                 Self {
7622                         contents,
7623                         result_ok: o.result_ok,
7624                 }
7625         }
7626 }
7627 impl Clone for CResult_RoutingFeesDecodeErrorZ {
7628         fn clone(&self) -> Self {
7629                 if self.result_ok {
7630                         Self { result_ok: true, contents: CResult_RoutingFeesDecodeErrorZPtr {
7631                                 result: Box::into_raw(Box::new(<crate::lightning::routing::network_graph::RoutingFees>::clone(unsafe { &*self.contents.result })))
7632                         } }
7633                 } else {
7634                         Self { result_ok: false, contents: CResult_RoutingFeesDecodeErrorZPtr {
7635                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
7636                         } }
7637                 }
7638         }
7639 }
7640 #[no_mangle]
7641 /// Creates a new CResult_RoutingFeesDecodeErrorZ which has the same data as `orig`
7642 /// but with all dynamically-allocated buffers duplicated in new buffers.
7643 pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_clone(orig: &CResult_RoutingFeesDecodeErrorZ) -> CResult_RoutingFeesDecodeErrorZ { orig.clone() }
7644 #[repr(C)]
7645 /// The contents of CResult_NodeAnnouncementInfoDecodeErrorZ
7646 pub union CResult_NodeAnnouncementInfoDecodeErrorZPtr {
7647         /// A pointer to the contents in the success state.
7648         /// Reading from this pointer when `result_ok` is not set is undefined.
7649         pub result: *mut crate::lightning::routing::network_graph::NodeAnnouncementInfo,
7650         /// A pointer to the contents in the error state.
7651         /// Reading from this pointer when `result_ok` is set is undefined.
7652         pub err: *mut crate::lightning::ln::msgs::DecodeError,
7653 }
7654 #[repr(C)]
7655 /// A CResult_NodeAnnouncementInfoDecodeErrorZ represents the result of a fallible operation,
7656 /// containing a crate::lightning::routing::network_graph::NodeAnnouncementInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
7657 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7658 pub struct CResult_NodeAnnouncementInfoDecodeErrorZ {
7659         /// The contents of this CResult_NodeAnnouncementInfoDecodeErrorZ, accessible via either
7660         /// `err` or `result` depending on the state of `result_ok`.
7661         pub contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr,
7662         /// Whether this CResult_NodeAnnouncementInfoDecodeErrorZ represents a success state.
7663         pub result_ok: bool,
7664 }
7665 #[no_mangle]
7666 /// Creates a new CResult_NodeAnnouncementInfoDecodeErrorZ in the success state.
7667 pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_ok(o: crate::lightning::routing::network_graph::NodeAnnouncementInfo) -> CResult_NodeAnnouncementInfoDecodeErrorZ {
7668         CResult_NodeAnnouncementInfoDecodeErrorZ {
7669                 contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr {
7670                         result: Box::into_raw(Box::new(o)),
7671                 },
7672                 result_ok: true,
7673         }
7674 }
7675 #[no_mangle]
7676 /// Creates a new CResult_NodeAnnouncementInfoDecodeErrorZ in the error state.
7677 pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeAnnouncementInfoDecodeErrorZ {
7678         CResult_NodeAnnouncementInfoDecodeErrorZ {
7679                 contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr {
7680                         err: Box::into_raw(Box::new(e)),
7681                 },
7682                 result_ok: false,
7683         }
7684 }
7685 #[no_mangle]
7686 /// Frees any resources used by the CResult_NodeAnnouncementInfoDecodeErrorZ.
7687 pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_free(_res: CResult_NodeAnnouncementInfoDecodeErrorZ) { }
7688 impl Drop for CResult_NodeAnnouncementInfoDecodeErrorZ {
7689         fn drop(&mut self) {
7690                 if self.result_ok {
7691                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
7692                                 let _ = unsafe { Box::from_raw(self.contents.result) };
7693                         }
7694                 } else {
7695                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
7696                                 let _ = unsafe { Box::from_raw(self.contents.err) };
7697                         }
7698                 }
7699         }
7700 }
7701 impl From<crate::c_types::CResultTempl<crate::lightning::routing::network_graph::NodeAnnouncementInfo, crate::lightning::ln::msgs::DecodeError>> for CResult_NodeAnnouncementInfoDecodeErrorZ {
7702         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::network_graph::NodeAnnouncementInfo, crate::lightning::ln::msgs::DecodeError>) -> Self {
7703                 let contents = if o.result_ok {
7704                         let result = unsafe { o.contents.result };
7705                         unsafe { o.contents.result = std::ptr::null_mut() };
7706                         CResult_NodeAnnouncementInfoDecodeErrorZPtr { result }
7707                 } else {
7708                         let err = unsafe { o.contents.err };
7709                         unsafe { o.contents.err = std::ptr::null_mut(); }
7710                         CResult_NodeAnnouncementInfoDecodeErrorZPtr { err }
7711                 };
7712                 Self {
7713                         contents,
7714                         result_ok: o.result_ok,
7715                 }
7716         }
7717 }
7718 impl Clone for CResult_NodeAnnouncementInfoDecodeErrorZ {
7719         fn clone(&self) -> Self {
7720                 if self.result_ok {
7721                         Self { result_ok: true, contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr {
7722                                 result: Box::into_raw(Box::new(<crate::lightning::routing::network_graph::NodeAnnouncementInfo>::clone(unsafe { &*self.contents.result })))
7723                         } }
7724                 } else {
7725                         Self { result_ok: false, contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr {
7726                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
7727                         } }
7728                 }
7729         }
7730 }
7731 #[no_mangle]
7732 /// Creates a new CResult_NodeAnnouncementInfoDecodeErrorZ which has the same data as `orig`
7733 /// but with all dynamically-allocated buffers duplicated in new buffers.
7734 pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_clone(orig: &CResult_NodeAnnouncementInfoDecodeErrorZ) -> CResult_NodeAnnouncementInfoDecodeErrorZ { orig.clone() }
7735 #[repr(C)]
7736 /// A dynamically-allocated array of u64s of arbitrary size.
7737 /// This corresponds to std::vector in C++
7738 pub struct CVec_u64Z {
7739         /// The elements in the array.
7740         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
7741         pub data: *mut u64,
7742         /// The number of elements pointed to by `data`.
7743         pub datalen: usize
7744 }
7745 impl CVec_u64Z {
7746         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<u64> {
7747                 if self.datalen == 0 { return Vec::new(); }
7748                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
7749                 self.data = std::ptr::null_mut();
7750                 self.datalen = 0;
7751                 ret
7752         }
7753         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[u64] {
7754                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
7755         }
7756 }
7757 impl From<Vec<u64>> for CVec_u64Z {
7758         fn from(v: Vec<u64>) -> Self {
7759                 let datalen = v.len();
7760                 let data = Box::into_raw(v.into_boxed_slice());
7761                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
7762         }
7763 }
7764 #[no_mangle]
7765 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
7766 pub extern "C" fn CVec_u64Z_free(_res: CVec_u64Z) { }
7767 impl Drop for CVec_u64Z {
7768         fn drop(&mut self) {
7769                 if self.datalen == 0 { return; }
7770                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
7771         }
7772 }
7773 impl Clone for CVec_u64Z {
7774         fn clone(&self) -> Self {
7775                 let mut res = Vec::new();
7776                 if self.datalen == 0 { return Self::from(res); }
7777                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
7778                 Self::from(res)
7779         }
7780 }
7781 #[repr(C)]
7782 /// The contents of CResult_NodeInfoDecodeErrorZ
7783 pub union CResult_NodeInfoDecodeErrorZPtr {
7784         /// A pointer to the contents in the success state.
7785         /// Reading from this pointer when `result_ok` is not set is undefined.
7786         pub result: *mut crate::lightning::routing::network_graph::NodeInfo,
7787         /// A pointer to the contents in the error state.
7788         /// Reading from this pointer when `result_ok` is set is undefined.
7789         pub err: *mut crate::lightning::ln::msgs::DecodeError,
7790 }
7791 #[repr(C)]
7792 /// A CResult_NodeInfoDecodeErrorZ represents the result of a fallible operation,
7793 /// containing a crate::lightning::routing::network_graph::NodeInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
7794 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7795 pub struct CResult_NodeInfoDecodeErrorZ {
7796         /// The contents of this CResult_NodeInfoDecodeErrorZ, accessible via either
7797         /// `err` or `result` depending on the state of `result_ok`.
7798         pub contents: CResult_NodeInfoDecodeErrorZPtr,
7799         /// Whether this CResult_NodeInfoDecodeErrorZ represents a success state.
7800         pub result_ok: bool,
7801 }
7802 #[no_mangle]
7803 /// Creates a new CResult_NodeInfoDecodeErrorZ in the success state.
7804 pub extern "C" fn CResult_NodeInfoDecodeErrorZ_ok(o: crate::lightning::routing::network_graph::NodeInfo) -> CResult_NodeInfoDecodeErrorZ {
7805         CResult_NodeInfoDecodeErrorZ {
7806                 contents: CResult_NodeInfoDecodeErrorZPtr {
7807                         result: Box::into_raw(Box::new(o)),
7808                 },
7809                 result_ok: true,
7810         }
7811 }
7812 #[no_mangle]
7813 /// Creates a new CResult_NodeInfoDecodeErrorZ in the error state.
7814 pub extern "C" fn CResult_NodeInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeInfoDecodeErrorZ {
7815         CResult_NodeInfoDecodeErrorZ {
7816                 contents: CResult_NodeInfoDecodeErrorZPtr {
7817                         err: Box::into_raw(Box::new(e)),
7818                 },
7819                 result_ok: false,
7820         }
7821 }
7822 #[no_mangle]
7823 /// Frees any resources used by the CResult_NodeInfoDecodeErrorZ.
7824 pub extern "C" fn CResult_NodeInfoDecodeErrorZ_free(_res: CResult_NodeInfoDecodeErrorZ) { }
7825 impl Drop for CResult_NodeInfoDecodeErrorZ {
7826         fn drop(&mut self) {
7827                 if self.result_ok {
7828                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
7829                                 let _ = unsafe { Box::from_raw(self.contents.result) };
7830                         }
7831                 } else {
7832                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
7833                                 let _ = unsafe { Box::from_raw(self.contents.err) };
7834                         }
7835                 }
7836         }
7837 }
7838 impl From<crate::c_types::CResultTempl<crate::lightning::routing::network_graph::NodeInfo, crate::lightning::ln::msgs::DecodeError>> for CResult_NodeInfoDecodeErrorZ {
7839         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::network_graph::NodeInfo, crate::lightning::ln::msgs::DecodeError>) -> Self {
7840                 let contents = if o.result_ok {
7841                         let result = unsafe { o.contents.result };
7842                         unsafe { o.contents.result = std::ptr::null_mut() };
7843                         CResult_NodeInfoDecodeErrorZPtr { result }
7844                 } else {
7845                         let err = unsafe { o.contents.err };
7846                         unsafe { o.contents.err = std::ptr::null_mut(); }
7847                         CResult_NodeInfoDecodeErrorZPtr { err }
7848                 };
7849                 Self {
7850                         contents,
7851                         result_ok: o.result_ok,
7852                 }
7853         }
7854 }
7855 impl Clone for CResult_NodeInfoDecodeErrorZ {
7856         fn clone(&self) -> Self {
7857                 if self.result_ok {
7858                         Self { result_ok: true, contents: CResult_NodeInfoDecodeErrorZPtr {
7859                                 result: Box::into_raw(Box::new(<crate::lightning::routing::network_graph::NodeInfo>::clone(unsafe { &*self.contents.result })))
7860                         } }
7861                 } else {
7862                         Self { result_ok: false, contents: CResult_NodeInfoDecodeErrorZPtr {
7863                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
7864                         } }
7865                 }
7866         }
7867 }
7868 #[no_mangle]
7869 /// Creates a new CResult_NodeInfoDecodeErrorZ which has the same data as `orig`
7870 /// but with all dynamically-allocated buffers duplicated in new buffers.
7871 pub extern "C" fn CResult_NodeInfoDecodeErrorZ_clone(orig: &CResult_NodeInfoDecodeErrorZ) -> CResult_NodeInfoDecodeErrorZ { orig.clone() }
7872 #[repr(C)]
7873 /// The contents of CResult_NetworkGraphDecodeErrorZ
7874 pub union CResult_NetworkGraphDecodeErrorZPtr {
7875         /// A pointer to the contents in the success state.
7876         /// Reading from this pointer when `result_ok` is not set is undefined.
7877         pub result: *mut crate::lightning::routing::network_graph::NetworkGraph,
7878         /// A pointer to the contents in the error state.
7879         /// Reading from this pointer when `result_ok` is set is undefined.
7880         pub err: *mut crate::lightning::ln::msgs::DecodeError,
7881 }
7882 #[repr(C)]
7883 /// A CResult_NetworkGraphDecodeErrorZ represents the result of a fallible operation,
7884 /// containing a crate::lightning::routing::network_graph::NetworkGraph on success and a crate::lightning::ln::msgs::DecodeError on failure.
7885 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7886 pub struct CResult_NetworkGraphDecodeErrorZ {
7887         /// The contents of this CResult_NetworkGraphDecodeErrorZ, accessible via either
7888         /// `err` or `result` depending on the state of `result_ok`.
7889         pub contents: CResult_NetworkGraphDecodeErrorZPtr,
7890         /// Whether this CResult_NetworkGraphDecodeErrorZ represents a success state.
7891         pub result_ok: bool,
7892 }
7893 #[no_mangle]
7894 /// Creates a new CResult_NetworkGraphDecodeErrorZ in the success state.
7895 pub extern "C" fn CResult_NetworkGraphDecodeErrorZ_ok(o: crate::lightning::routing::network_graph::NetworkGraph) -> CResult_NetworkGraphDecodeErrorZ {
7896         CResult_NetworkGraphDecodeErrorZ {
7897                 contents: CResult_NetworkGraphDecodeErrorZPtr {
7898                         result: Box::into_raw(Box::new(o)),
7899                 },
7900                 result_ok: true,
7901         }
7902 }
7903 #[no_mangle]
7904 /// Creates a new CResult_NetworkGraphDecodeErrorZ in the error state.
7905 pub extern "C" fn CResult_NetworkGraphDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NetworkGraphDecodeErrorZ {
7906         CResult_NetworkGraphDecodeErrorZ {
7907                 contents: CResult_NetworkGraphDecodeErrorZPtr {
7908                         err: Box::into_raw(Box::new(e)),
7909                 },
7910                 result_ok: false,
7911         }
7912 }
7913 #[no_mangle]
7914 /// Frees any resources used by the CResult_NetworkGraphDecodeErrorZ.
7915 pub extern "C" fn CResult_NetworkGraphDecodeErrorZ_free(_res: CResult_NetworkGraphDecodeErrorZ) { }
7916 impl Drop for CResult_NetworkGraphDecodeErrorZ {
7917         fn drop(&mut self) {
7918                 if self.result_ok {
7919                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
7920                                 let _ = unsafe { Box::from_raw(self.contents.result) };
7921                         }
7922                 } else {
7923                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
7924                                 let _ = unsafe { Box::from_raw(self.contents.err) };
7925                         }
7926                 }
7927         }
7928 }
7929 impl From<crate::c_types::CResultTempl<crate::lightning::routing::network_graph::NetworkGraph, crate::lightning::ln::msgs::DecodeError>> for CResult_NetworkGraphDecodeErrorZ {
7930         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::network_graph::NetworkGraph, crate::lightning::ln::msgs::DecodeError>) -> Self {
7931                 let contents = if o.result_ok {
7932                         let result = unsafe { o.contents.result };
7933                         unsafe { o.contents.result = std::ptr::null_mut() };
7934                         CResult_NetworkGraphDecodeErrorZPtr { result }
7935                 } else {
7936                         let err = unsafe { o.contents.err };
7937                         unsafe { o.contents.err = std::ptr::null_mut(); }
7938                         CResult_NetworkGraphDecodeErrorZPtr { err }
7939                 };
7940                 Self {
7941                         contents,
7942                         result_ok: o.result_ok,
7943                 }
7944         }
7945 }
7946 impl Clone for CResult_NetworkGraphDecodeErrorZ {
7947         fn clone(&self) -> Self {
7948                 if self.result_ok {
7949                         Self { result_ok: true, contents: CResult_NetworkGraphDecodeErrorZPtr {
7950                                 result: Box::into_raw(Box::new(<crate::lightning::routing::network_graph::NetworkGraph>::clone(unsafe { &*self.contents.result })))
7951                         } }
7952                 } else {
7953                         Self { result_ok: false, contents: CResult_NetworkGraphDecodeErrorZPtr {
7954                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
7955                         } }
7956                 }
7957         }
7958 }
7959 #[no_mangle]
7960 /// Creates a new CResult_NetworkGraphDecodeErrorZ which has the same data as `orig`
7961 /// but with all dynamically-allocated buffers duplicated in new buffers.
7962 pub extern "C" fn CResult_NetworkGraphDecodeErrorZ_clone(orig: &CResult_NetworkGraphDecodeErrorZ) -> CResult_NetworkGraphDecodeErrorZ { orig.clone() }
7963 #[repr(C)]
7964 /// The contents of CResult_NetAddressu8Z
7965 pub union CResult_NetAddressu8ZPtr {
7966         /// A pointer to the contents in the success state.
7967         /// Reading from this pointer when `result_ok` is not set is undefined.
7968         pub result: *mut crate::lightning::ln::msgs::NetAddress,
7969         /// A pointer to the contents in the error state.
7970         /// Reading from this pointer when `result_ok` is set is undefined.
7971         pub err: *mut u8,
7972 }
7973 #[repr(C)]
7974 /// A CResult_NetAddressu8Z represents the result of a fallible operation,
7975 /// containing a crate::lightning::ln::msgs::NetAddress on success and a u8 on failure.
7976 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7977 pub struct CResult_NetAddressu8Z {
7978         /// The contents of this CResult_NetAddressu8Z, accessible via either
7979         /// `err` or `result` depending on the state of `result_ok`.
7980         pub contents: CResult_NetAddressu8ZPtr,
7981         /// Whether this CResult_NetAddressu8Z represents a success state.
7982         pub result_ok: bool,
7983 }
7984 #[no_mangle]
7985 /// Creates a new CResult_NetAddressu8Z in the success state.
7986 pub extern "C" fn CResult_NetAddressu8Z_ok(o: crate::lightning::ln::msgs::NetAddress) -> CResult_NetAddressu8Z {
7987         CResult_NetAddressu8Z {
7988                 contents: CResult_NetAddressu8ZPtr {
7989                         result: Box::into_raw(Box::new(o)),
7990                 },
7991                 result_ok: true,
7992         }
7993 }
7994 #[no_mangle]
7995 /// Creates a new CResult_NetAddressu8Z in the error state.
7996 pub extern "C" fn CResult_NetAddressu8Z_err(e: u8) -> CResult_NetAddressu8Z {
7997         CResult_NetAddressu8Z {
7998                 contents: CResult_NetAddressu8ZPtr {
7999                         err: Box::into_raw(Box::new(e)),
8000                 },
8001                 result_ok: false,
8002         }
8003 }
8004 #[no_mangle]
8005 /// Frees any resources used by the CResult_NetAddressu8Z.
8006 pub extern "C" fn CResult_NetAddressu8Z_free(_res: CResult_NetAddressu8Z) { }
8007 impl Drop for CResult_NetAddressu8Z {
8008         fn drop(&mut self) {
8009                 if self.result_ok {
8010                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
8011                                 let _ = unsafe { Box::from_raw(self.contents.result) };
8012                         }
8013                 } else {
8014                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
8015                                 let _ = unsafe { Box::from_raw(self.contents.err) };
8016                         }
8017                 }
8018         }
8019 }
8020 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::NetAddress, u8>> for CResult_NetAddressu8Z {
8021         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::NetAddress, u8>) -> Self {
8022                 let contents = if o.result_ok {
8023                         let result = unsafe { o.contents.result };
8024                         unsafe { o.contents.result = std::ptr::null_mut() };
8025                         CResult_NetAddressu8ZPtr { result }
8026                 } else {
8027                         let err = unsafe { o.contents.err };
8028                         unsafe { o.contents.err = std::ptr::null_mut(); }
8029                         CResult_NetAddressu8ZPtr { err }
8030                 };
8031                 Self {
8032                         contents,
8033                         result_ok: o.result_ok,
8034                 }
8035         }
8036 }
8037 impl Clone for CResult_NetAddressu8Z {
8038         fn clone(&self) -> Self {
8039                 if self.result_ok {
8040                         Self { result_ok: true, contents: CResult_NetAddressu8ZPtr {
8041                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::NetAddress>::clone(unsafe { &*self.contents.result })))
8042                         } }
8043                 } else {
8044                         Self { result_ok: false, contents: CResult_NetAddressu8ZPtr {
8045                                 err: Box::into_raw(Box::new(<u8>::clone(unsafe { &*self.contents.err })))
8046                         } }
8047                 }
8048         }
8049 }
8050 #[no_mangle]
8051 /// Creates a new CResult_NetAddressu8Z which has the same data as `orig`
8052 /// but with all dynamically-allocated buffers duplicated in new buffers.
8053 pub extern "C" fn CResult_NetAddressu8Z_clone(orig: &CResult_NetAddressu8Z) -> CResult_NetAddressu8Z { orig.clone() }
8054 #[repr(C)]
8055 /// The contents of CResult_CResult_NetAddressu8ZDecodeErrorZ
8056 pub union CResult_CResult_NetAddressu8ZDecodeErrorZPtr {
8057         /// A pointer to the contents in the success state.
8058         /// Reading from this pointer when `result_ok` is not set is undefined.
8059         pub result: *mut crate::c_types::derived::CResult_NetAddressu8Z,
8060         /// A pointer to the contents in the error state.
8061         /// Reading from this pointer when `result_ok` is set is undefined.
8062         pub err: *mut crate::lightning::ln::msgs::DecodeError,
8063 }
8064 #[repr(C)]
8065 /// A CResult_CResult_NetAddressu8ZDecodeErrorZ represents the result of a fallible operation,
8066 /// containing a crate::c_types::derived::CResult_NetAddressu8Z on success and a crate::lightning::ln::msgs::DecodeError on failure.
8067 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8068 pub struct CResult_CResult_NetAddressu8ZDecodeErrorZ {
8069         /// The contents of this CResult_CResult_NetAddressu8ZDecodeErrorZ, accessible via either
8070         /// `err` or `result` depending on the state of `result_ok`.
8071         pub contents: CResult_CResult_NetAddressu8ZDecodeErrorZPtr,
8072         /// Whether this CResult_CResult_NetAddressu8ZDecodeErrorZ represents a success state.
8073         pub result_ok: bool,
8074 }
8075 #[no_mangle]
8076 /// Creates a new CResult_CResult_NetAddressu8ZDecodeErrorZ in the success state.
8077 pub extern "C" fn CResult_CResult_NetAddressu8ZDecodeErrorZ_ok(o: crate::c_types::derived::CResult_NetAddressu8Z) -> CResult_CResult_NetAddressu8ZDecodeErrorZ {
8078         CResult_CResult_NetAddressu8ZDecodeErrorZ {
8079                 contents: CResult_CResult_NetAddressu8ZDecodeErrorZPtr {
8080                         result: Box::into_raw(Box::new(o)),
8081                 },
8082                 result_ok: true,
8083         }
8084 }
8085 #[no_mangle]
8086 /// Creates a new CResult_CResult_NetAddressu8ZDecodeErrorZ in the error state.
8087 pub extern "C" fn CResult_CResult_NetAddressu8ZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_CResult_NetAddressu8ZDecodeErrorZ {
8088         CResult_CResult_NetAddressu8ZDecodeErrorZ {
8089                 contents: CResult_CResult_NetAddressu8ZDecodeErrorZPtr {
8090                         err: Box::into_raw(Box::new(e)),
8091                 },
8092                 result_ok: false,
8093         }
8094 }
8095 #[no_mangle]
8096 /// Frees any resources used by the CResult_CResult_NetAddressu8ZDecodeErrorZ.
8097 pub extern "C" fn CResult_CResult_NetAddressu8ZDecodeErrorZ_free(_res: CResult_CResult_NetAddressu8ZDecodeErrorZ) { }
8098 impl Drop for CResult_CResult_NetAddressu8ZDecodeErrorZ {
8099         fn drop(&mut self) {
8100                 if self.result_ok {
8101                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
8102                                 let _ = unsafe { Box::from_raw(self.contents.result) };
8103                         }
8104                 } else {
8105                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
8106                                 let _ = unsafe { Box::from_raw(self.contents.err) };
8107                         }
8108                 }
8109         }
8110 }
8111 impl From<crate::c_types::CResultTempl<crate::c_types::derived::CResult_NetAddressu8Z, crate::lightning::ln::msgs::DecodeError>> for CResult_CResult_NetAddressu8ZDecodeErrorZ {
8112         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CResult_NetAddressu8Z, crate::lightning::ln::msgs::DecodeError>) -> Self {
8113                 let contents = if o.result_ok {
8114                         let result = unsafe { o.contents.result };
8115                         unsafe { o.contents.result = std::ptr::null_mut() };
8116                         CResult_CResult_NetAddressu8ZDecodeErrorZPtr { result }
8117                 } else {
8118                         let err = unsafe { o.contents.err };
8119                         unsafe { o.contents.err = std::ptr::null_mut(); }
8120                         CResult_CResult_NetAddressu8ZDecodeErrorZPtr { err }
8121                 };
8122                 Self {
8123                         contents,
8124                         result_ok: o.result_ok,
8125                 }
8126         }
8127 }
8128 impl Clone for CResult_CResult_NetAddressu8ZDecodeErrorZ {
8129         fn clone(&self) -> Self {
8130                 if self.result_ok {
8131                         Self { result_ok: true, contents: CResult_CResult_NetAddressu8ZDecodeErrorZPtr {
8132                                 result: Box::into_raw(Box::new(<crate::c_types::derived::CResult_NetAddressu8Z>::clone(unsafe { &*self.contents.result })))
8133                         } }
8134                 } else {
8135                         Self { result_ok: false, contents: CResult_CResult_NetAddressu8ZDecodeErrorZPtr {
8136                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
8137                         } }
8138                 }
8139         }
8140 }
8141 #[no_mangle]
8142 /// Creates a new CResult_CResult_NetAddressu8ZDecodeErrorZ which has the same data as `orig`
8143 /// but with all dynamically-allocated buffers duplicated in new buffers.
8144 pub extern "C" fn CResult_CResult_NetAddressu8ZDecodeErrorZ_clone(orig: &CResult_CResult_NetAddressu8ZDecodeErrorZ) -> CResult_CResult_NetAddressu8ZDecodeErrorZ { orig.clone() }
8145 #[repr(C)]
8146 /// The contents of CResult_NetAddressDecodeErrorZ
8147 pub union CResult_NetAddressDecodeErrorZPtr {
8148         /// A pointer to the contents in the success state.
8149         /// Reading from this pointer when `result_ok` is not set is undefined.
8150         pub result: *mut crate::lightning::ln::msgs::NetAddress,
8151         /// A pointer to the contents in the error state.
8152         /// Reading from this pointer when `result_ok` is set is undefined.
8153         pub err: *mut crate::lightning::ln::msgs::DecodeError,
8154 }
8155 #[repr(C)]
8156 /// A CResult_NetAddressDecodeErrorZ represents the result of a fallible operation,
8157 /// containing a crate::lightning::ln::msgs::NetAddress on success and a crate::lightning::ln::msgs::DecodeError on failure.
8158 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8159 pub struct CResult_NetAddressDecodeErrorZ {
8160         /// The contents of this CResult_NetAddressDecodeErrorZ, accessible via either
8161         /// `err` or `result` depending on the state of `result_ok`.
8162         pub contents: CResult_NetAddressDecodeErrorZPtr,
8163         /// Whether this CResult_NetAddressDecodeErrorZ represents a success state.
8164         pub result_ok: bool,
8165 }
8166 #[no_mangle]
8167 /// Creates a new CResult_NetAddressDecodeErrorZ in the success state.
8168 pub extern "C" fn CResult_NetAddressDecodeErrorZ_ok(o: crate::lightning::ln::msgs::NetAddress) -> CResult_NetAddressDecodeErrorZ {
8169         CResult_NetAddressDecodeErrorZ {
8170                 contents: CResult_NetAddressDecodeErrorZPtr {
8171                         result: Box::into_raw(Box::new(o)),
8172                 },
8173                 result_ok: true,
8174         }
8175 }
8176 #[no_mangle]
8177 /// Creates a new CResult_NetAddressDecodeErrorZ in the error state.
8178 pub extern "C" fn CResult_NetAddressDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NetAddressDecodeErrorZ {
8179         CResult_NetAddressDecodeErrorZ {
8180                 contents: CResult_NetAddressDecodeErrorZPtr {
8181                         err: Box::into_raw(Box::new(e)),
8182                 },
8183                 result_ok: false,
8184         }
8185 }
8186 #[no_mangle]
8187 /// Frees any resources used by the CResult_NetAddressDecodeErrorZ.
8188 pub extern "C" fn CResult_NetAddressDecodeErrorZ_free(_res: CResult_NetAddressDecodeErrorZ) { }
8189 impl Drop for CResult_NetAddressDecodeErrorZ {
8190         fn drop(&mut self) {
8191                 if self.result_ok {
8192                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
8193                                 let _ = unsafe { Box::from_raw(self.contents.result) };
8194                         }
8195                 } else {
8196                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
8197                                 let _ = unsafe { Box::from_raw(self.contents.err) };
8198                         }
8199                 }
8200         }
8201 }
8202 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::NetAddress, crate::lightning::ln::msgs::DecodeError>> for CResult_NetAddressDecodeErrorZ {
8203         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::NetAddress, crate::lightning::ln::msgs::DecodeError>) -> Self {
8204                 let contents = if o.result_ok {
8205                         let result = unsafe { o.contents.result };
8206                         unsafe { o.contents.result = std::ptr::null_mut() };
8207                         CResult_NetAddressDecodeErrorZPtr { result }
8208                 } else {
8209                         let err = unsafe { o.contents.err };
8210                         unsafe { o.contents.err = std::ptr::null_mut(); }
8211                         CResult_NetAddressDecodeErrorZPtr { err }
8212                 };
8213                 Self {
8214                         contents,
8215                         result_ok: o.result_ok,
8216                 }
8217         }
8218 }
8219 impl Clone for CResult_NetAddressDecodeErrorZ {
8220         fn clone(&self) -> Self {
8221                 if self.result_ok {
8222                         Self { result_ok: true, contents: CResult_NetAddressDecodeErrorZPtr {
8223                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::NetAddress>::clone(unsafe { &*self.contents.result })))
8224                         } }
8225                 } else {
8226                         Self { result_ok: false, contents: CResult_NetAddressDecodeErrorZPtr {
8227                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
8228                         } }
8229                 }
8230         }
8231 }
8232 #[no_mangle]
8233 /// Creates a new CResult_NetAddressDecodeErrorZ which has the same data as `orig`
8234 /// but with all dynamically-allocated buffers duplicated in new buffers.
8235 pub extern "C" fn CResult_NetAddressDecodeErrorZ_clone(orig: &CResult_NetAddressDecodeErrorZ) -> CResult_NetAddressDecodeErrorZ { orig.clone() }
8236 #[repr(C)]
8237 /// A dynamically-allocated array of crate::lightning::ln::msgs::UpdateAddHTLCs of arbitrary size.
8238 /// This corresponds to std::vector in C++
8239 pub struct CVec_UpdateAddHTLCZ {
8240         /// The elements in the array.
8241         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
8242         pub data: *mut crate::lightning::ln::msgs::UpdateAddHTLC,
8243         /// The number of elements pointed to by `data`.
8244         pub datalen: usize
8245 }
8246 impl CVec_UpdateAddHTLCZ {
8247         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::UpdateAddHTLC> {
8248                 if self.datalen == 0 { return Vec::new(); }
8249                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
8250                 self.data = std::ptr::null_mut();
8251                 self.datalen = 0;
8252                 ret
8253         }
8254         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::UpdateAddHTLC] {
8255                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
8256         }
8257 }
8258 impl From<Vec<crate::lightning::ln::msgs::UpdateAddHTLC>> for CVec_UpdateAddHTLCZ {
8259         fn from(v: Vec<crate::lightning::ln::msgs::UpdateAddHTLC>) -> Self {
8260                 let datalen = v.len();
8261                 let data = Box::into_raw(v.into_boxed_slice());
8262                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
8263         }
8264 }
8265 #[no_mangle]
8266 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
8267 pub extern "C" fn CVec_UpdateAddHTLCZ_free(_res: CVec_UpdateAddHTLCZ) { }
8268 impl Drop for CVec_UpdateAddHTLCZ {
8269         fn drop(&mut self) {
8270                 if self.datalen == 0 { return; }
8271                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
8272         }
8273 }
8274 impl Clone for CVec_UpdateAddHTLCZ {
8275         fn clone(&self) -> Self {
8276                 let mut res = Vec::new();
8277                 if self.datalen == 0 { return Self::from(res); }
8278                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
8279                 Self::from(res)
8280         }
8281 }
8282 #[repr(C)]
8283 /// A dynamically-allocated array of crate::lightning::ln::msgs::UpdateFulfillHTLCs of arbitrary size.
8284 /// This corresponds to std::vector in C++
8285 pub struct CVec_UpdateFulfillHTLCZ {
8286         /// The elements in the array.
8287         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
8288         pub data: *mut crate::lightning::ln::msgs::UpdateFulfillHTLC,
8289         /// The number of elements pointed to by `data`.
8290         pub datalen: usize
8291 }
8292 impl CVec_UpdateFulfillHTLCZ {
8293         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::UpdateFulfillHTLC> {
8294                 if self.datalen == 0 { return Vec::new(); }
8295                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
8296                 self.data = std::ptr::null_mut();
8297                 self.datalen = 0;
8298                 ret
8299         }
8300         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::UpdateFulfillHTLC] {
8301                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
8302         }
8303 }
8304 impl From<Vec<crate::lightning::ln::msgs::UpdateFulfillHTLC>> for CVec_UpdateFulfillHTLCZ {
8305         fn from(v: Vec<crate::lightning::ln::msgs::UpdateFulfillHTLC>) -> Self {
8306                 let datalen = v.len();
8307                 let data = Box::into_raw(v.into_boxed_slice());
8308                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
8309         }
8310 }
8311 #[no_mangle]
8312 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
8313 pub extern "C" fn CVec_UpdateFulfillHTLCZ_free(_res: CVec_UpdateFulfillHTLCZ) { }
8314 impl Drop for CVec_UpdateFulfillHTLCZ {
8315         fn drop(&mut self) {
8316                 if self.datalen == 0 { return; }
8317                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
8318         }
8319 }
8320 impl Clone for CVec_UpdateFulfillHTLCZ {
8321         fn clone(&self) -> Self {
8322                 let mut res = Vec::new();
8323                 if self.datalen == 0 { return Self::from(res); }
8324                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
8325                 Self::from(res)
8326         }
8327 }
8328 #[repr(C)]
8329 /// A dynamically-allocated array of crate::lightning::ln::msgs::UpdateFailHTLCs of arbitrary size.
8330 /// This corresponds to std::vector in C++
8331 pub struct CVec_UpdateFailHTLCZ {
8332         /// The elements in the array.
8333         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
8334         pub data: *mut crate::lightning::ln::msgs::UpdateFailHTLC,
8335         /// The number of elements pointed to by `data`.
8336         pub datalen: usize
8337 }
8338 impl CVec_UpdateFailHTLCZ {
8339         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::UpdateFailHTLC> {
8340                 if self.datalen == 0 { return Vec::new(); }
8341                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
8342                 self.data = std::ptr::null_mut();
8343                 self.datalen = 0;
8344                 ret
8345         }
8346         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::UpdateFailHTLC] {
8347                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
8348         }
8349 }
8350 impl From<Vec<crate::lightning::ln::msgs::UpdateFailHTLC>> for CVec_UpdateFailHTLCZ {
8351         fn from(v: Vec<crate::lightning::ln::msgs::UpdateFailHTLC>) -> Self {
8352                 let datalen = v.len();
8353                 let data = Box::into_raw(v.into_boxed_slice());
8354                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
8355         }
8356 }
8357 #[no_mangle]
8358 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
8359 pub extern "C" fn CVec_UpdateFailHTLCZ_free(_res: CVec_UpdateFailHTLCZ) { }
8360 impl Drop for CVec_UpdateFailHTLCZ {
8361         fn drop(&mut self) {
8362                 if self.datalen == 0 { return; }
8363                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
8364         }
8365 }
8366 impl Clone for CVec_UpdateFailHTLCZ {
8367         fn clone(&self) -> Self {
8368                 let mut res = Vec::new();
8369                 if self.datalen == 0 { return Self::from(res); }
8370                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
8371                 Self::from(res)
8372         }
8373 }
8374 #[repr(C)]
8375 /// A dynamically-allocated array of crate::lightning::ln::msgs::UpdateFailMalformedHTLCs of arbitrary size.
8376 /// This corresponds to std::vector in C++
8377 pub struct CVec_UpdateFailMalformedHTLCZ {
8378         /// The elements in the array.
8379         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
8380         pub data: *mut crate::lightning::ln::msgs::UpdateFailMalformedHTLC,
8381         /// The number of elements pointed to by `data`.
8382         pub datalen: usize
8383 }
8384 impl CVec_UpdateFailMalformedHTLCZ {
8385         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::UpdateFailMalformedHTLC> {
8386                 if self.datalen == 0 { return Vec::new(); }
8387                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
8388                 self.data = std::ptr::null_mut();
8389                 self.datalen = 0;
8390                 ret
8391         }
8392         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::UpdateFailMalformedHTLC] {
8393                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
8394         }
8395 }
8396 impl From<Vec<crate::lightning::ln::msgs::UpdateFailMalformedHTLC>> for CVec_UpdateFailMalformedHTLCZ {
8397         fn from(v: Vec<crate::lightning::ln::msgs::UpdateFailMalformedHTLC>) -> Self {
8398                 let datalen = v.len();
8399                 let data = Box::into_raw(v.into_boxed_slice());
8400                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
8401         }
8402 }
8403 #[no_mangle]
8404 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
8405 pub extern "C" fn CVec_UpdateFailMalformedHTLCZ_free(_res: CVec_UpdateFailMalformedHTLCZ) { }
8406 impl Drop for CVec_UpdateFailMalformedHTLCZ {
8407         fn drop(&mut self) {
8408                 if self.datalen == 0 { return; }
8409                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
8410         }
8411 }
8412 impl Clone for CVec_UpdateFailMalformedHTLCZ {
8413         fn clone(&self) -> Self {
8414                 let mut res = Vec::new();
8415                 if self.datalen == 0 { return Self::from(res); }
8416                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
8417                 Self::from(res)
8418         }
8419 }
8420 #[repr(C)]
8421 /// The contents of CResult_AcceptChannelDecodeErrorZ
8422 pub union CResult_AcceptChannelDecodeErrorZPtr {
8423         /// A pointer to the contents in the success state.
8424         /// Reading from this pointer when `result_ok` is not set is undefined.
8425         pub result: *mut crate::lightning::ln::msgs::AcceptChannel,
8426         /// A pointer to the contents in the error state.
8427         /// Reading from this pointer when `result_ok` is set is undefined.
8428         pub err: *mut crate::lightning::ln::msgs::DecodeError,
8429 }
8430 #[repr(C)]
8431 /// A CResult_AcceptChannelDecodeErrorZ represents the result of a fallible operation,
8432 /// containing a crate::lightning::ln::msgs::AcceptChannel on success and a crate::lightning::ln::msgs::DecodeError on failure.
8433 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8434 pub struct CResult_AcceptChannelDecodeErrorZ {
8435         /// The contents of this CResult_AcceptChannelDecodeErrorZ, accessible via either
8436         /// `err` or `result` depending on the state of `result_ok`.
8437         pub contents: CResult_AcceptChannelDecodeErrorZPtr,
8438         /// Whether this CResult_AcceptChannelDecodeErrorZ represents a success state.
8439         pub result_ok: bool,
8440 }
8441 #[no_mangle]
8442 /// Creates a new CResult_AcceptChannelDecodeErrorZ in the success state.
8443 pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_ok(o: crate::lightning::ln::msgs::AcceptChannel) -> CResult_AcceptChannelDecodeErrorZ {
8444         CResult_AcceptChannelDecodeErrorZ {
8445                 contents: CResult_AcceptChannelDecodeErrorZPtr {
8446                         result: Box::into_raw(Box::new(o)),
8447                 },
8448                 result_ok: true,
8449         }
8450 }
8451 #[no_mangle]
8452 /// Creates a new CResult_AcceptChannelDecodeErrorZ in the error state.
8453 pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_AcceptChannelDecodeErrorZ {
8454         CResult_AcceptChannelDecodeErrorZ {
8455                 contents: CResult_AcceptChannelDecodeErrorZPtr {
8456                         err: Box::into_raw(Box::new(e)),
8457                 },
8458                 result_ok: false,
8459         }
8460 }
8461 #[no_mangle]
8462 /// Frees any resources used by the CResult_AcceptChannelDecodeErrorZ.
8463 pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_free(_res: CResult_AcceptChannelDecodeErrorZ) { }
8464 impl Drop for CResult_AcceptChannelDecodeErrorZ {
8465         fn drop(&mut self) {
8466                 if self.result_ok {
8467                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
8468                                 let _ = unsafe { Box::from_raw(self.contents.result) };
8469                         }
8470                 } else {
8471                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
8472                                 let _ = unsafe { Box::from_raw(self.contents.err) };
8473                         }
8474                 }
8475         }
8476 }
8477 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::AcceptChannel, crate::lightning::ln::msgs::DecodeError>> for CResult_AcceptChannelDecodeErrorZ {
8478         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::AcceptChannel, crate::lightning::ln::msgs::DecodeError>) -> Self {
8479                 let contents = if o.result_ok {
8480                         let result = unsafe { o.contents.result };
8481                         unsafe { o.contents.result = std::ptr::null_mut() };
8482                         CResult_AcceptChannelDecodeErrorZPtr { result }
8483                 } else {
8484                         let err = unsafe { o.contents.err };
8485                         unsafe { o.contents.err = std::ptr::null_mut(); }
8486                         CResult_AcceptChannelDecodeErrorZPtr { err }
8487                 };
8488                 Self {
8489                         contents,
8490                         result_ok: o.result_ok,
8491                 }
8492         }
8493 }
8494 impl Clone for CResult_AcceptChannelDecodeErrorZ {
8495         fn clone(&self) -> Self {
8496                 if self.result_ok {
8497                         Self { result_ok: true, contents: CResult_AcceptChannelDecodeErrorZPtr {
8498                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::AcceptChannel>::clone(unsafe { &*self.contents.result })))
8499                         } }
8500                 } else {
8501                         Self { result_ok: false, contents: CResult_AcceptChannelDecodeErrorZPtr {
8502                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
8503                         } }
8504                 }
8505         }
8506 }
8507 #[no_mangle]
8508 /// Creates a new CResult_AcceptChannelDecodeErrorZ which has the same data as `orig`
8509 /// but with all dynamically-allocated buffers duplicated in new buffers.
8510 pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_clone(orig: &CResult_AcceptChannelDecodeErrorZ) -> CResult_AcceptChannelDecodeErrorZ { orig.clone() }
8511 #[repr(C)]
8512 /// The contents of CResult_AnnouncementSignaturesDecodeErrorZ
8513 pub union CResult_AnnouncementSignaturesDecodeErrorZPtr {
8514         /// A pointer to the contents in the success state.
8515         /// Reading from this pointer when `result_ok` is not set is undefined.
8516         pub result: *mut crate::lightning::ln::msgs::AnnouncementSignatures,
8517         /// A pointer to the contents in the error state.
8518         /// Reading from this pointer when `result_ok` is set is undefined.
8519         pub err: *mut crate::lightning::ln::msgs::DecodeError,
8520 }
8521 #[repr(C)]
8522 /// A CResult_AnnouncementSignaturesDecodeErrorZ represents the result of a fallible operation,
8523 /// containing a crate::lightning::ln::msgs::AnnouncementSignatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
8524 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8525 pub struct CResult_AnnouncementSignaturesDecodeErrorZ {
8526         /// The contents of this CResult_AnnouncementSignaturesDecodeErrorZ, accessible via either
8527         /// `err` or `result` depending on the state of `result_ok`.
8528         pub contents: CResult_AnnouncementSignaturesDecodeErrorZPtr,
8529         /// Whether this CResult_AnnouncementSignaturesDecodeErrorZ represents a success state.
8530         pub result_ok: bool,
8531 }
8532 #[no_mangle]
8533 /// Creates a new CResult_AnnouncementSignaturesDecodeErrorZ in the success state.
8534 pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_ok(o: crate::lightning::ln::msgs::AnnouncementSignatures) -> CResult_AnnouncementSignaturesDecodeErrorZ {
8535         CResult_AnnouncementSignaturesDecodeErrorZ {
8536                 contents: CResult_AnnouncementSignaturesDecodeErrorZPtr {
8537                         result: Box::into_raw(Box::new(o)),
8538                 },
8539                 result_ok: true,
8540         }
8541 }
8542 #[no_mangle]
8543 /// Creates a new CResult_AnnouncementSignaturesDecodeErrorZ in the error state.
8544 pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_AnnouncementSignaturesDecodeErrorZ {
8545         CResult_AnnouncementSignaturesDecodeErrorZ {
8546                 contents: CResult_AnnouncementSignaturesDecodeErrorZPtr {
8547                         err: Box::into_raw(Box::new(e)),
8548                 },
8549                 result_ok: false,
8550         }
8551 }
8552 #[no_mangle]
8553 /// Frees any resources used by the CResult_AnnouncementSignaturesDecodeErrorZ.
8554 pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_free(_res: CResult_AnnouncementSignaturesDecodeErrorZ) { }
8555 impl Drop for CResult_AnnouncementSignaturesDecodeErrorZ {
8556         fn drop(&mut self) {
8557                 if self.result_ok {
8558                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
8559                                 let _ = unsafe { Box::from_raw(self.contents.result) };
8560                         }
8561                 } else {
8562                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
8563                                 let _ = unsafe { Box::from_raw(self.contents.err) };
8564                         }
8565                 }
8566         }
8567 }
8568 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::AnnouncementSignatures, crate::lightning::ln::msgs::DecodeError>> for CResult_AnnouncementSignaturesDecodeErrorZ {
8569         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::AnnouncementSignatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
8570                 let contents = if o.result_ok {
8571                         let result = unsafe { o.contents.result };
8572                         unsafe { o.contents.result = std::ptr::null_mut() };
8573                         CResult_AnnouncementSignaturesDecodeErrorZPtr { result }
8574                 } else {
8575                         let err = unsafe { o.contents.err };
8576                         unsafe { o.contents.err = std::ptr::null_mut(); }
8577                         CResult_AnnouncementSignaturesDecodeErrorZPtr { err }
8578                 };
8579                 Self {
8580                         contents,
8581                         result_ok: o.result_ok,
8582                 }
8583         }
8584 }
8585 impl Clone for CResult_AnnouncementSignaturesDecodeErrorZ {
8586         fn clone(&self) -> Self {
8587                 if self.result_ok {
8588                         Self { result_ok: true, contents: CResult_AnnouncementSignaturesDecodeErrorZPtr {
8589                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::AnnouncementSignatures>::clone(unsafe { &*self.contents.result })))
8590                         } }
8591                 } else {
8592                         Self { result_ok: false, contents: CResult_AnnouncementSignaturesDecodeErrorZPtr {
8593                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
8594                         } }
8595                 }
8596         }
8597 }
8598 #[no_mangle]
8599 /// Creates a new CResult_AnnouncementSignaturesDecodeErrorZ which has the same data as `orig`
8600 /// but with all dynamically-allocated buffers duplicated in new buffers.
8601 pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_clone(orig: &CResult_AnnouncementSignaturesDecodeErrorZ) -> CResult_AnnouncementSignaturesDecodeErrorZ { orig.clone() }
8602 #[repr(C)]
8603 /// The contents of CResult_ChannelReestablishDecodeErrorZ
8604 pub union CResult_ChannelReestablishDecodeErrorZPtr {
8605         /// A pointer to the contents in the success state.
8606         /// Reading from this pointer when `result_ok` is not set is undefined.
8607         pub result: *mut crate::lightning::ln::msgs::ChannelReestablish,
8608         /// A pointer to the contents in the error state.
8609         /// Reading from this pointer when `result_ok` is set is undefined.
8610         pub err: *mut crate::lightning::ln::msgs::DecodeError,
8611 }
8612 #[repr(C)]
8613 /// A CResult_ChannelReestablishDecodeErrorZ represents the result of a fallible operation,
8614 /// containing a crate::lightning::ln::msgs::ChannelReestablish on success and a crate::lightning::ln::msgs::DecodeError on failure.
8615 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8616 pub struct CResult_ChannelReestablishDecodeErrorZ {
8617         /// The contents of this CResult_ChannelReestablishDecodeErrorZ, accessible via either
8618         /// `err` or `result` depending on the state of `result_ok`.
8619         pub contents: CResult_ChannelReestablishDecodeErrorZPtr,
8620         /// Whether this CResult_ChannelReestablishDecodeErrorZ represents a success state.
8621         pub result_ok: bool,
8622 }
8623 #[no_mangle]
8624 /// Creates a new CResult_ChannelReestablishDecodeErrorZ in the success state.
8625 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ChannelReestablish) -> CResult_ChannelReestablishDecodeErrorZ {
8626         CResult_ChannelReestablishDecodeErrorZ {
8627                 contents: CResult_ChannelReestablishDecodeErrorZPtr {
8628                         result: Box::into_raw(Box::new(o)),
8629                 },
8630                 result_ok: true,
8631         }
8632 }
8633 #[no_mangle]
8634 /// Creates a new CResult_ChannelReestablishDecodeErrorZ in the error state.
8635 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelReestablishDecodeErrorZ {
8636         CResult_ChannelReestablishDecodeErrorZ {
8637                 contents: CResult_ChannelReestablishDecodeErrorZPtr {
8638                         err: Box::into_raw(Box::new(e)),
8639                 },
8640                 result_ok: false,
8641         }
8642 }
8643 #[no_mangle]
8644 /// Frees any resources used by the CResult_ChannelReestablishDecodeErrorZ.
8645 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_free(_res: CResult_ChannelReestablishDecodeErrorZ) { }
8646 impl Drop for CResult_ChannelReestablishDecodeErrorZ {
8647         fn drop(&mut self) {
8648                 if self.result_ok {
8649                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
8650                                 let _ = unsafe { Box::from_raw(self.contents.result) };
8651                         }
8652                 } else {
8653                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
8654                                 let _ = unsafe { Box::from_raw(self.contents.err) };
8655                         }
8656                 }
8657         }
8658 }
8659 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelReestablish, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelReestablishDecodeErrorZ {
8660         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelReestablish, crate::lightning::ln::msgs::DecodeError>) -> Self {
8661                 let contents = if o.result_ok {
8662                         let result = unsafe { o.contents.result };
8663                         unsafe { o.contents.result = std::ptr::null_mut() };
8664                         CResult_ChannelReestablishDecodeErrorZPtr { result }
8665                 } else {
8666                         let err = unsafe { o.contents.err };
8667                         unsafe { o.contents.err = std::ptr::null_mut(); }
8668                         CResult_ChannelReestablishDecodeErrorZPtr { err }
8669                 };
8670                 Self {
8671                         contents,
8672                         result_ok: o.result_ok,
8673                 }
8674         }
8675 }
8676 impl Clone for CResult_ChannelReestablishDecodeErrorZ {
8677         fn clone(&self) -> Self {
8678                 if self.result_ok {
8679                         Self { result_ok: true, contents: CResult_ChannelReestablishDecodeErrorZPtr {
8680                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ChannelReestablish>::clone(unsafe { &*self.contents.result })))
8681                         } }
8682                 } else {
8683                         Self { result_ok: false, contents: CResult_ChannelReestablishDecodeErrorZPtr {
8684                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
8685                         } }
8686                 }
8687         }
8688 }
8689 #[no_mangle]
8690 /// Creates a new CResult_ChannelReestablishDecodeErrorZ which has the same data as `orig`
8691 /// but with all dynamically-allocated buffers duplicated in new buffers.
8692 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_clone(orig: &CResult_ChannelReestablishDecodeErrorZ) -> CResult_ChannelReestablishDecodeErrorZ { orig.clone() }
8693 #[repr(C)]
8694 /// The contents of CResult_ClosingSignedDecodeErrorZ
8695 pub union CResult_ClosingSignedDecodeErrorZPtr {
8696         /// A pointer to the contents in the success state.
8697         /// Reading from this pointer when `result_ok` is not set is undefined.
8698         pub result: *mut crate::lightning::ln::msgs::ClosingSigned,
8699         /// A pointer to the contents in the error state.
8700         /// Reading from this pointer when `result_ok` is set is undefined.
8701         pub err: *mut crate::lightning::ln::msgs::DecodeError,
8702 }
8703 #[repr(C)]
8704 /// A CResult_ClosingSignedDecodeErrorZ represents the result of a fallible operation,
8705 /// containing a crate::lightning::ln::msgs::ClosingSigned on success and a crate::lightning::ln::msgs::DecodeError on failure.
8706 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8707 pub struct CResult_ClosingSignedDecodeErrorZ {
8708         /// The contents of this CResult_ClosingSignedDecodeErrorZ, accessible via either
8709         /// `err` or `result` depending on the state of `result_ok`.
8710         pub contents: CResult_ClosingSignedDecodeErrorZPtr,
8711         /// Whether this CResult_ClosingSignedDecodeErrorZ represents a success state.
8712         pub result_ok: bool,
8713 }
8714 #[no_mangle]
8715 /// Creates a new CResult_ClosingSignedDecodeErrorZ in the success state.
8716 pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ClosingSigned) -> CResult_ClosingSignedDecodeErrorZ {
8717         CResult_ClosingSignedDecodeErrorZ {
8718                 contents: CResult_ClosingSignedDecodeErrorZPtr {
8719                         result: Box::into_raw(Box::new(o)),
8720                 },
8721                 result_ok: true,
8722         }
8723 }
8724 #[no_mangle]
8725 /// Creates a new CResult_ClosingSignedDecodeErrorZ in the error state.
8726 pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ClosingSignedDecodeErrorZ {
8727         CResult_ClosingSignedDecodeErrorZ {
8728                 contents: CResult_ClosingSignedDecodeErrorZPtr {
8729                         err: Box::into_raw(Box::new(e)),
8730                 },
8731                 result_ok: false,
8732         }
8733 }
8734 #[no_mangle]
8735 /// Frees any resources used by the CResult_ClosingSignedDecodeErrorZ.
8736 pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_free(_res: CResult_ClosingSignedDecodeErrorZ) { }
8737 impl Drop for CResult_ClosingSignedDecodeErrorZ {
8738         fn drop(&mut self) {
8739                 if self.result_ok {
8740                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
8741                                 let _ = unsafe { Box::from_raw(self.contents.result) };
8742                         }
8743                 } else {
8744                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
8745                                 let _ = unsafe { Box::from_raw(self.contents.err) };
8746                         }
8747                 }
8748         }
8749 }
8750 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ClosingSigned, crate::lightning::ln::msgs::DecodeError>> for CResult_ClosingSignedDecodeErrorZ {
8751         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ClosingSigned, crate::lightning::ln::msgs::DecodeError>) -> Self {
8752                 let contents = if o.result_ok {
8753                         let result = unsafe { o.contents.result };
8754                         unsafe { o.contents.result = std::ptr::null_mut() };
8755                         CResult_ClosingSignedDecodeErrorZPtr { result }
8756                 } else {
8757                         let err = unsafe { o.contents.err };
8758                         unsafe { o.contents.err = std::ptr::null_mut(); }
8759                         CResult_ClosingSignedDecodeErrorZPtr { err }
8760                 };
8761                 Self {
8762                         contents,
8763                         result_ok: o.result_ok,
8764                 }
8765         }
8766 }
8767 impl Clone for CResult_ClosingSignedDecodeErrorZ {
8768         fn clone(&self) -> Self {
8769                 if self.result_ok {
8770                         Self { result_ok: true, contents: CResult_ClosingSignedDecodeErrorZPtr {
8771                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ClosingSigned>::clone(unsafe { &*self.contents.result })))
8772                         } }
8773                 } else {
8774                         Self { result_ok: false, contents: CResult_ClosingSignedDecodeErrorZPtr {
8775                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
8776                         } }
8777                 }
8778         }
8779 }
8780 #[no_mangle]
8781 /// Creates a new CResult_ClosingSignedDecodeErrorZ which has the same data as `orig`
8782 /// but with all dynamically-allocated buffers duplicated in new buffers.
8783 pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_clone(orig: &CResult_ClosingSignedDecodeErrorZ) -> CResult_ClosingSignedDecodeErrorZ { orig.clone() }
8784 #[repr(C)]
8785 /// The contents of CResult_ClosingSignedFeeRangeDecodeErrorZ
8786 pub union CResult_ClosingSignedFeeRangeDecodeErrorZPtr {
8787         /// A pointer to the contents in the success state.
8788         /// Reading from this pointer when `result_ok` is not set is undefined.
8789         pub result: *mut crate::lightning::ln::msgs::ClosingSignedFeeRange,
8790         /// A pointer to the contents in the error state.
8791         /// Reading from this pointer when `result_ok` is set is undefined.
8792         pub err: *mut crate::lightning::ln::msgs::DecodeError,
8793 }
8794 #[repr(C)]
8795 /// A CResult_ClosingSignedFeeRangeDecodeErrorZ represents the result of a fallible operation,
8796 /// containing a crate::lightning::ln::msgs::ClosingSignedFeeRange on success and a crate::lightning::ln::msgs::DecodeError on failure.
8797 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8798 pub struct CResult_ClosingSignedFeeRangeDecodeErrorZ {
8799         /// The contents of this CResult_ClosingSignedFeeRangeDecodeErrorZ, accessible via either
8800         /// `err` or `result` depending on the state of `result_ok`.
8801         pub contents: CResult_ClosingSignedFeeRangeDecodeErrorZPtr,
8802         /// Whether this CResult_ClosingSignedFeeRangeDecodeErrorZ represents a success state.
8803         pub result_ok: bool,
8804 }
8805 #[no_mangle]
8806 /// Creates a new CResult_ClosingSignedFeeRangeDecodeErrorZ in the success state.
8807 pub extern "C" fn CResult_ClosingSignedFeeRangeDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ClosingSignedFeeRange) -> CResult_ClosingSignedFeeRangeDecodeErrorZ {
8808         CResult_ClosingSignedFeeRangeDecodeErrorZ {
8809                 contents: CResult_ClosingSignedFeeRangeDecodeErrorZPtr {
8810                         result: Box::into_raw(Box::new(o)),
8811                 },
8812                 result_ok: true,
8813         }
8814 }
8815 #[no_mangle]
8816 /// Creates a new CResult_ClosingSignedFeeRangeDecodeErrorZ in the error state.
8817 pub extern "C" fn CResult_ClosingSignedFeeRangeDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ClosingSignedFeeRangeDecodeErrorZ {
8818         CResult_ClosingSignedFeeRangeDecodeErrorZ {
8819                 contents: CResult_ClosingSignedFeeRangeDecodeErrorZPtr {
8820                         err: Box::into_raw(Box::new(e)),
8821                 },
8822                 result_ok: false,
8823         }
8824 }
8825 #[no_mangle]
8826 /// Frees any resources used by the CResult_ClosingSignedFeeRangeDecodeErrorZ.
8827 pub extern "C" fn CResult_ClosingSignedFeeRangeDecodeErrorZ_free(_res: CResult_ClosingSignedFeeRangeDecodeErrorZ) { }
8828 impl Drop for CResult_ClosingSignedFeeRangeDecodeErrorZ {
8829         fn drop(&mut self) {
8830                 if self.result_ok {
8831                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
8832                                 let _ = unsafe { Box::from_raw(self.contents.result) };
8833                         }
8834                 } else {
8835                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
8836                                 let _ = unsafe { Box::from_raw(self.contents.err) };
8837                         }
8838                 }
8839         }
8840 }
8841 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ClosingSignedFeeRange, crate::lightning::ln::msgs::DecodeError>> for CResult_ClosingSignedFeeRangeDecodeErrorZ {
8842         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ClosingSignedFeeRange, crate::lightning::ln::msgs::DecodeError>) -> Self {
8843                 let contents = if o.result_ok {
8844                         let result = unsafe { o.contents.result };
8845                         unsafe { o.contents.result = std::ptr::null_mut() };
8846                         CResult_ClosingSignedFeeRangeDecodeErrorZPtr { result }
8847                 } else {
8848                         let err = unsafe { o.contents.err };
8849                         unsafe { o.contents.err = std::ptr::null_mut(); }
8850                         CResult_ClosingSignedFeeRangeDecodeErrorZPtr { err }
8851                 };
8852                 Self {
8853                         contents,
8854                         result_ok: o.result_ok,
8855                 }
8856         }
8857 }
8858 impl Clone for CResult_ClosingSignedFeeRangeDecodeErrorZ {
8859         fn clone(&self) -> Self {
8860                 if self.result_ok {
8861                         Self { result_ok: true, contents: CResult_ClosingSignedFeeRangeDecodeErrorZPtr {
8862                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ClosingSignedFeeRange>::clone(unsafe { &*self.contents.result })))
8863                         } }
8864                 } else {
8865                         Self { result_ok: false, contents: CResult_ClosingSignedFeeRangeDecodeErrorZPtr {
8866                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
8867                         } }
8868                 }
8869         }
8870 }
8871 #[no_mangle]
8872 /// Creates a new CResult_ClosingSignedFeeRangeDecodeErrorZ which has the same data as `orig`
8873 /// but with all dynamically-allocated buffers duplicated in new buffers.
8874 pub extern "C" fn CResult_ClosingSignedFeeRangeDecodeErrorZ_clone(orig: &CResult_ClosingSignedFeeRangeDecodeErrorZ) -> CResult_ClosingSignedFeeRangeDecodeErrorZ { orig.clone() }
8875 #[repr(C)]
8876 /// The contents of CResult_CommitmentSignedDecodeErrorZ
8877 pub union CResult_CommitmentSignedDecodeErrorZPtr {
8878         /// A pointer to the contents in the success state.
8879         /// Reading from this pointer when `result_ok` is not set is undefined.
8880         pub result: *mut crate::lightning::ln::msgs::CommitmentSigned,
8881         /// A pointer to the contents in the error state.
8882         /// Reading from this pointer when `result_ok` is set is undefined.
8883         pub err: *mut crate::lightning::ln::msgs::DecodeError,
8884 }
8885 #[repr(C)]
8886 /// A CResult_CommitmentSignedDecodeErrorZ represents the result of a fallible operation,
8887 /// containing a crate::lightning::ln::msgs::CommitmentSigned on success and a crate::lightning::ln::msgs::DecodeError on failure.
8888 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8889 pub struct CResult_CommitmentSignedDecodeErrorZ {
8890         /// The contents of this CResult_CommitmentSignedDecodeErrorZ, accessible via either
8891         /// `err` or `result` depending on the state of `result_ok`.
8892         pub contents: CResult_CommitmentSignedDecodeErrorZPtr,
8893         /// Whether this CResult_CommitmentSignedDecodeErrorZ represents a success state.
8894         pub result_ok: bool,
8895 }
8896 #[no_mangle]
8897 /// Creates a new CResult_CommitmentSignedDecodeErrorZ in the success state.
8898 pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_ok(o: crate::lightning::ln::msgs::CommitmentSigned) -> CResult_CommitmentSignedDecodeErrorZ {
8899         CResult_CommitmentSignedDecodeErrorZ {
8900                 contents: CResult_CommitmentSignedDecodeErrorZPtr {
8901                         result: Box::into_raw(Box::new(o)),
8902                 },
8903                 result_ok: true,
8904         }
8905 }
8906 #[no_mangle]
8907 /// Creates a new CResult_CommitmentSignedDecodeErrorZ in the error state.
8908 pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_CommitmentSignedDecodeErrorZ {
8909         CResult_CommitmentSignedDecodeErrorZ {
8910                 contents: CResult_CommitmentSignedDecodeErrorZPtr {
8911                         err: Box::into_raw(Box::new(e)),
8912                 },
8913                 result_ok: false,
8914         }
8915 }
8916 #[no_mangle]
8917 /// Frees any resources used by the CResult_CommitmentSignedDecodeErrorZ.
8918 pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_free(_res: CResult_CommitmentSignedDecodeErrorZ) { }
8919 impl Drop for CResult_CommitmentSignedDecodeErrorZ {
8920         fn drop(&mut self) {
8921                 if self.result_ok {
8922                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
8923                                 let _ = unsafe { Box::from_raw(self.contents.result) };
8924                         }
8925                 } else {
8926                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
8927                                 let _ = unsafe { Box::from_raw(self.contents.err) };
8928                         }
8929                 }
8930         }
8931 }
8932 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::CommitmentSigned, crate::lightning::ln::msgs::DecodeError>> for CResult_CommitmentSignedDecodeErrorZ {
8933         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::CommitmentSigned, crate::lightning::ln::msgs::DecodeError>) -> Self {
8934                 let contents = if o.result_ok {
8935                         let result = unsafe { o.contents.result };
8936                         unsafe { o.contents.result = std::ptr::null_mut() };
8937                         CResult_CommitmentSignedDecodeErrorZPtr { result }
8938                 } else {
8939                         let err = unsafe { o.contents.err };
8940                         unsafe { o.contents.err = std::ptr::null_mut(); }
8941                         CResult_CommitmentSignedDecodeErrorZPtr { err }
8942                 };
8943                 Self {
8944                         contents,
8945                         result_ok: o.result_ok,
8946                 }
8947         }
8948 }
8949 impl Clone for CResult_CommitmentSignedDecodeErrorZ {
8950         fn clone(&self) -> Self {
8951                 if self.result_ok {
8952                         Self { result_ok: true, contents: CResult_CommitmentSignedDecodeErrorZPtr {
8953                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::CommitmentSigned>::clone(unsafe { &*self.contents.result })))
8954                         } }
8955                 } else {
8956                         Self { result_ok: false, contents: CResult_CommitmentSignedDecodeErrorZPtr {
8957                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
8958                         } }
8959                 }
8960         }
8961 }
8962 #[no_mangle]
8963 /// Creates a new CResult_CommitmentSignedDecodeErrorZ which has the same data as `orig`
8964 /// but with all dynamically-allocated buffers duplicated in new buffers.
8965 pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_clone(orig: &CResult_CommitmentSignedDecodeErrorZ) -> CResult_CommitmentSignedDecodeErrorZ { orig.clone() }
8966 #[repr(C)]
8967 /// The contents of CResult_FundingCreatedDecodeErrorZ
8968 pub union CResult_FundingCreatedDecodeErrorZPtr {
8969         /// A pointer to the contents in the success state.
8970         /// Reading from this pointer when `result_ok` is not set is undefined.
8971         pub result: *mut crate::lightning::ln::msgs::FundingCreated,
8972         /// A pointer to the contents in the error state.
8973         /// Reading from this pointer when `result_ok` is set is undefined.
8974         pub err: *mut crate::lightning::ln::msgs::DecodeError,
8975 }
8976 #[repr(C)]
8977 /// A CResult_FundingCreatedDecodeErrorZ represents the result of a fallible operation,
8978 /// containing a crate::lightning::ln::msgs::FundingCreated on success and a crate::lightning::ln::msgs::DecodeError on failure.
8979 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8980 pub struct CResult_FundingCreatedDecodeErrorZ {
8981         /// The contents of this CResult_FundingCreatedDecodeErrorZ, accessible via either
8982         /// `err` or `result` depending on the state of `result_ok`.
8983         pub contents: CResult_FundingCreatedDecodeErrorZPtr,
8984         /// Whether this CResult_FundingCreatedDecodeErrorZ represents a success state.
8985         pub result_ok: bool,
8986 }
8987 #[no_mangle]
8988 /// Creates a new CResult_FundingCreatedDecodeErrorZ in the success state.
8989 pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_ok(o: crate::lightning::ln::msgs::FundingCreated) -> CResult_FundingCreatedDecodeErrorZ {
8990         CResult_FundingCreatedDecodeErrorZ {
8991                 contents: CResult_FundingCreatedDecodeErrorZPtr {
8992                         result: Box::into_raw(Box::new(o)),
8993                 },
8994                 result_ok: true,
8995         }
8996 }
8997 #[no_mangle]
8998 /// Creates a new CResult_FundingCreatedDecodeErrorZ in the error state.
8999 pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_FundingCreatedDecodeErrorZ {
9000         CResult_FundingCreatedDecodeErrorZ {
9001                 contents: CResult_FundingCreatedDecodeErrorZPtr {
9002                         err: Box::into_raw(Box::new(e)),
9003                 },
9004                 result_ok: false,
9005         }
9006 }
9007 #[no_mangle]
9008 /// Frees any resources used by the CResult_FundingCreatedDecodeErrorZ.
9009 pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_free(_res: CResult_FundingCreatedDecodeErrorZ) { }
9010 impl Drop for CResult_FundingCreatedDecodeErrorZ {
9011         fn drop(&mut self) {
9012                 if self.result_ok {
9013                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
9014                                 let _ = unsafe { Box::from_raw(self.contents.result) };
9015                         }
9016                 } else {
9017                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
9018                                 let _ = unsafe { Box::from_raw(self.contents.err) };
9019                         }
9020                 }
9021         }
9022 }
9023 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::FundingCreated, crate::lightning::ln::msgs::DecodeError>> for CResult_FundingCreatedDecodeErrorZ {
9024         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::FundingCreated, crate::lightning::ln::msgs::DecodeError>) -> Self {
9025                 let contents = if o.result_ok {
9026                         let result = unsafe { o.contents.result };
9027                         unsafe { o.contents.result = std::ptr::null_mut() };
9028                         CResult_FundingCreatedDecodeErrorZPtr { result }
9029                 } else {
9030                         let err = unsafe { o.contents.err };
9031                         unsafe { o.contents.err = std::ptr::null_mut(); }
9032                         CResult_FundingCreatedDecodeErrorZPtr { err }
9033                 };
9034                 Self {
9035                         contents,
9036                         result_ok: o.result_ok,
9037                 }
9038         }
9039 }
9040 impl Clone for CResult_FundingCreatedDecodeErrorZ {
9041         fn clone(&self) -> Self {
9042                 if self.result_ok {
9043                         Self { result_ok: true, contents: CResult_FundingCreatedDecodeErrorZPtr {
9044                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::FundingCreated>::clone(unsafe { &*self.contents.result })))
9045                         } }
9046                 } else {
9047                         Self { result_ok: false, contents: CResult_FundingCreatedDecodeErrorZPtr {
9048                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
9049                         } }
9050                 }
9051         }
9052 }
9053 #[no_mangle]
9054 /// Creates a new CResult_FundingCreatedDecodeErrorZ which has the same data as `orig`
9055 /// but with all dynamically-allocated buffers duplicated in new buffers.
9056 pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_clone(orig: &CResult_FundingCreatedDecodeErrorZ) -> CResult_FundingCreatedDecodeErrorZ { orig.clone() }
9057 #[repr(C)]
9058 /// The contents of CResult_FundingSignedDecodeErrorZ
9059 pub union CResult_FundingSignedDecodeErrorZPtr {
9060         /// A pointer to the contents in the success state.
9061         /// Reading from this pointer when `result_ok` is not set is undefined.
9062         pub result: *mut crate::lightning::ln::msgs::FundingSigned,
9063         /// A pointer to the contents in the error state.
9064         /// Reading from this pointer when `result_ok` is set is undefined.
9065         pub err: *mut crate::lightning::ln::msgs::DecodeError,
9066 }
9067 #[repr(C)]
9068 /// A CResult_FundingSignedDecodeErrorZ represents the result of a fallible operation,
9069 /// containing a crate::lightning::ln::msgs::FundingSigned on success and a crate::lightning::ln::msgs::DecodeError on failure.
9070 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9071 pub struct CResult_FundingSignedDecodeErrorZ {
9072         /// The contents of this CResult_FundingSignedDecodeErrorZ, accessible via either
9073         /// `err` or `result` depending on the state of `result_ok`.
9074         pub contents: CResult_FundingSignedDecodeErrorZPtr,
9075         /// Whether this CResult_FundingSignedDecodeErrorZ represents a success state.
9076         pub result_ok: bool,
9077 }
9078 #[no_mangle]
9079 /// Creates a new CResult_FundingSignedDecodeErrorZ in the success state.
9080 pub extern "C" fn CResult_FundingSignedDecodeErrorZ_ok(o: crate::lightning::ln::msgs::FundingSigned) -> CResult_FundingSignedDecodeErrorZ {
9081         CResult_FundingSignedDecodeErrorZ {
9082                 contents: CResult_FundingSignedDecodeErrorZPtr {
9083                         result: Box::into_raw(Box::new(o)),
9084                 },
9085                 result_ok: true,
9086         }
9087 }
9088 #[no_mangle]
9089 /// Creates a new CResult_FundingSignedDecodeErrorZ in the error state.
9090 pub extern "C" fn CResult_FundingSignedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_FundingSignedDecodeErrorZ {
9091         CResult_FundingSignedDecodeErrorZ {
9092                 contents: CResult_FundingSignedDecodeErrorZPtr {
9093                         err: Box::into_raw(Box::new(e)),
9094                 },
9095                 result_ok: false,
9096         }
9097 }
9098 #[no_mangle]
9099 /// Frees any resources used by the CResult_FundingSignedDecodeErrorZ.
9100 pub extern "C" fn CResult_FundingSignedDecodeErrorZ_free(_res: CResult_FundingSignedDecodeErrorZ) { }
9101 impl Drop for CResult_FundingSignedDecodeErrorZ {
9102         fn drop(&mut self) {
9103                 if self.result_ok {
9104                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
9105                                 let _ = unsafe { Box::from_raw(self.contents.result) };
9106                         }
9107                 } else {
9108                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
9109                                 let _ = unsafe { Box::from_raw(self.contents.err) };
9110                         }
9111                 }
9112         }
9113 }
9114 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::FundingSigned, crate::lightning::ln::msgs::DecodeError>> for CResult_FundingSignedDecodeErrorZ {
9115         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::FundingSigned, crate::lightning::ln::msgs::DecodeError>) -> Self {
9116                 let contents = if o.result_ok {
9117                         let result = unsafe { o.contents.result };
9118                         unsafe { o.contents.result = std::ptr::null_mut() };
9119                         CResult_FundingSignedDecodeErrorZPtr { result }
9120                 } else {
9121                         let err = unsafe { o.contents.err };
9122                         unsafe { o.contents.err = std::ptr::null_mut(); }
9123                         CResult_FundingSignedDecodeErrorZPtr { err }
9124                 };
9125                 Self {
9126                         contents,
9127                         result_ok: o.result_ok,
9128                 }
9129         }
9130 }
9131 impl Clone for CResult_FundingSignedDecodeErrorZ {
9132         fn clone(&self) -> Self {
9133                 if self.result_ok {
9134                         Self { result_ok: true, contents: CResult_FundingSignedDecodeErrorZPtr {
9135                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::FundingSigned>::clone(unsafe { &*self.contents.result })))
9136                         } }
9137                 } else {
9138                         Self { result_ok: false, contents: CResult_FundingSignedDecodeErrorZPtr {
9139                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
9140                         } }
9141                 }
9142         }
9143 }
9144 #[no_mangle]
9145 /// Creates a new CResult_FundingSignedDecodeErrorZ which has the same data as `orig`
9146 /// but with all dynamically-allocated buffers duplicated in new buffers.
9147 pub extern "C" fn CResult_FundingSignedDecodeErrorZ_clone(orig: &CResult_FundingSignedDecodeErrorZ) -> CResult_FundingSignedDecodeErrorZ { orig.clone() }
9148 #[repr(C)]
9149 /// The contents of CResult_FundingLockedDecodeErrorZ
9150 pub union CResult_FundingLockedDecodeErrorZPtr {
9151         /// A pointer to the contents in the success state.
9152         /// Reading from this pointer when `result_ok` is not set is undefined.
9153         pub result: *mut crate::lightning::ln::msgs::FundingLocked,
9154         /// A pointer to the contents in the error state.
9155         /// Reading from this pointer when `result_ok` is set is undefined.
9156         pub err: *mut crate::lightning::ln::msgs::DecodeError,
9157 }
9158 #[repr(C)]
9159 /// A CResult_FundingLockedDecodeErrorZ represents the result of a fallible operation,
9160 /// containing a crate::lightning::ln::msgs::FundingLocked on success and a crate::lightning::ln::msgs::DecodeError on failure.
9161 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9162 pub struct CResult_FundingLockedDecodeErrorZ {
9163         /// The contents of this CResult_FundingLockedDecodeErrorZ, accessible via either
9164         /// `err` or `result` depending on the state of `result_ok`.
9165         pub contents: CResult_FundingLockedDecodeErrorZPtr,
9166         /// Whether this CResult_FundingLockedDecodeErrorZ represents a success state.
9167         pub result_ok: bool,
9168 }
9169 #[no_mangle]
9170 /// Creates a new CResult_FundingLockedDecodeErrorZ in the success state.
9171 pub extern "C" fn CResult_FundingLockedDecodeErrorZ_ok(o: crate::lightning::ln::msgs::FundingLocked) -> CResult_FundingLockedDecodeErrorZ {
9172         CResult_FundingLockedDecodeErrorZ {
9173                 contents: CResult_FundingLockedDecodeErrorZPtr {
9174                         result: Box::into_raw(Box::new(o)),
9175                 },
9176                 result_ok: true,
9177         }
9178 }
9179 #[no_mangle]
9180 /// Creates a new CResult_FundingLockedDecodeErrorZ in the error state.
9181 pub extern "C" fn CResult_FundingLockedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_FundingLockedDecodeErrorZ {
9182         CResult_FundingLockedDecodeErrorZ {
9183                 contents: CResult_FundingLockedDecodeErrorZPtr {
9184                         err: Box::into_raw(Box::new(e)),
9185                 },
9186                 result_ok: false,
9187         }
9188 }
9189 #[no_mangle]
9190 /// Frees any resources used by the CResult_FundingLockedDecodeErrorZ.
9191 pub extern "C" fn CResult_FundingLockedDecodeErrorZ_free(_res: CResult_FundingLockedDecodeErrorZ) { }
9192 impl Drop for CResult_FundingLockedDecodeErrorZ {
9193         fn drop(&mut self) {
9194                 if self.result_ok {
9195                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
9196                                 let _ = unsafe { Box::from_raw(self.contents.result) };
9197                         }
9198                 } else {
9199                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
9200                                 let _ = unsafe { Box::from_raw(self.contents.err) };
9201                         }
9202                 }
9203         }
9204 }
9205 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::FundingLocked, crate::lightning::ln::msgs::DecodeError>> for CResult_FundingLockedDecodeErrorZ {
9206         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::FundingLocked, crate::lightning::ln::msgs::DecodeError>) -> Self {
9207                 let contents = if o.result_ok {
9208                         let result = unsafe { o.contents.result };
9209                         unsafe { o.contents.result = std::ptr::null_mut() };
9210                         CResult_FundingLockedDecodeErrorZPtr { result }
9211                 } else {
9212                         let err = unsafe { o.contents.err };
9213                         unsafe { o.contents.err = std::ptr::null_mut(); }
9214                         CResult_FundingLockedDecodeErrorZPtr { err }
9215                 };
9216                 Self {
9217                         contents,
9218                         result_ok: o.result_ok,
9219                 }
9220         }
9221 }
9222 impl Clone for CResult_FundingLockedDecodeErrorZ {
9223         fn clone(&self) -> Self {
9224                 if self.result_ok {
9225                         Self { result_ok: true, contents: CResult_FundingLockedDecodeErrorZPtr {
9226                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::FundingLocked>::clone(unsafe { &*self.contents.result })))
9227                         } }
9228                 } else {
9229                         Self { result_ok: false, contents: CResult_FundingLockedDecodeErrorZPtr {
9230                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
9231                         } }
9232                 }
9233         }
9234 }
9235 #[no_mangle]
9236 /// Creates a new CResult_FundingLockedDecodeErrorZ which has the same data as `orig`
9237 /// but with all dynamically-allocated buffers duplicated in new buffers.
9238 pub extern "C" fn CResult_FundingLockedDecodeErrorZ_clone(orig: &CResult_FundingLockedDecodeErrorZ) -> CResult_FundingLockedDecodeErrorZ { orig.clone() }
9239 #[repr(C)]
9240 /// The contents of CResult_InitDecodeErrorZ
9241 pub union CResult_InitDecodeErrorZPtr {
9242         /// A pointer to the contents in the success state.
9243         /// Reading from this pointer when `result_ok` is not set is undefined.
9244         pub result: *mut crate::lightning::ln::msgs::Init,
9245         /// A pointer to the contents in the error state.
9246         /// Reading from this pointer when `result_ok` is set is undefined.
9247         pub err: *mut crate::lightning::ln::msgs::DecodeError,
9248 }
9249 #[repr(C)]
9250 /// A CResult_InitDecodeErrorZ represents the result of a fallible operation,
9251 /// containing a crate::lightning::ln::msgs::Init on success and a crate::lightning::ln::msgs::DecodeError on failure.
9252 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9253 pub struct CResult_InitDecodeErrorZ {
9254         /// The contents of this CResult_InitDecodeErrorZ, accessible via either
9255         /// `err` or `result` depending on the state of `result_ok`.
9256         pub contents: CResult_InitDecodeErrorZPtr,
9257         /// Whether this CResult_InitDecodeErrorZ represents a success state.
9258         pub result_ok: bool,
9259 }
9260 #[no_mangle]
9261 /// Creates a new CResult_InitDecodeErrorZ in the success state.
9262 pub extern "C" fn CResult_InitDecodeErrorZ_ok(o: crate::lightning::ln::msgs::Init) -> CResult_InitDecodeErrorZ {
9263         CResult_InitDecodeErrorZ {
9264                 contents: CResult_InitDecodeErrorZPtr {
9265                         result: Box::into_raw(Box::new(o)),
9266                 },
9267                 result_ok: true,
9268         }
9269 }
9270 #[no_mangle]
9271 /// Creates a new CResult_InitDecodeErrorZ in the error state.
9272 pub extern "C" fn CResult_InitDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_InitDecodeErrorZ {
9273         CResult_InitDecodeErrorZ {
9274                 contents: CResult_InitDecodeErrorZPtr {
9275                         err: Box::into_raw(Box::new(e)),
9276                 },
9277                 result_ok: false,
9278         }
9279 }
9280 #[no_mangle]
9281 /// Frees any resources used by the CResult_InitDecodeErrorZ.
9282 pub extern "C" fn CResult_InitDecodeErrorZ_free(_res: CResult_InitDecodeErrorZ) { }
9283 impl Drop for CResult_InitDecodeErrorZ {
9284         fn drop(&mut self) {
9285                 if self.result_ok {
9286                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
9287                                 let _ = unsafe { Box::from_raw(self.contents.result) };
9288                         }
9289                 } else {
9290                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
9291                                 let _ = unsafe { Box::from_raw(self.contents.err) };
9292                         }
9293                 }
9294         }
9295 }
9296 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::Init, crate::lightning::ln::msgs::DecodeError>> for CResult_InitDecodeErrorZ {
9297         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::Init, crate::lightning::ln::msgs::DecodeError>) -> Self {
9298                 let contents = if o.result_ok {
9299                         let result = unsafe { o.contents.result };
9300                         unsafe { o.contents.result = std::ptr::null_mut() };
9301                         CResult_InitDecodeErrorZPtr { result }
9302                 } else {
9303                         let err = unsafe { o.contents.err };
9304                         unsafe { o.contents.err = std::ptr::null_mut(); }
9305                         CResult_InitDecodeErrorZPtr { err }
9306                 };
9307                 Self {
9308                         contents,
9309                         result_ok: o.result_ok,
9310                 }
9311         }
9312 }
9313 impl Clone for CResult_InitDecodeErrorZ {
9314         fn clone(&self) -> Self {
9315                 if self.result_ok {
9316                         Self { result_ok: true, contents: CResult_InitDecodeErrorZPtr {
9317                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::Init>::clone(unsafe { &*self.contents.result })))
9318                         } }
9319                 } else {
9320                         Self { result_ok: false, contents: CResult_InitDecodeErrorZPtr {
9321                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
9322                         } }
9323                 }
9324         }
9325 }
9326 #[no_mangle]
9327 /// Creates a new CResult_InitDecodeErrorZ which has the same data as `orig`
9328 /// but with all dynamically-allocated buffers duplicated in new buffers.
9329 pub extern "C" fn CResult_InitDecodeErrorZ_clone(orig: &CResult_InitDecodeErrorZ) -> CResult_InitDecodeErrorZ { orig.clone() }
9330 #[repr(C)]
9331 /// The contents of CResult_OpenChannelDecodeErrorZ
9332 pub union CResult_OpenChannelDecodeErrorZPtr {
9333         /// A pointer to the contents in the success state.
9334         /// Reading from this pointer when `result_ok` is not set is undefined.
9335         pub result: *mut crate::lightning::ln::msgs::OpenChannel,
9336         /// A pointer to the contents in the error state.
9337         /// Reading from this pointer when `result_ok` is set is undefined.
9338         pub err: *mut crate::lightning::ln::msgs::DecodeError,
9339 }
9340 #[repr(C)]
9341 /// A CResult_OpenChannelDecodeErrorZ represents the result of a fallible operation,
9342 /// containing a crate::lightning::ln::msgs::OpenChannel on success and a crate::lightning::ln::msgs::DecodeError on failure.
9343 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9344 pub struct CResult_OpenChannelDecodeErrorZ {
9345         /// The contents of this CResult_OpenChannelDecodeErrorZ, accessible via either
9346         /// `err` or `result` depending on the state of `result_ok`.
9347         pub contents: CResult_OpenChannelDecodeErrorZPtr,
9348         /// Whether this CResult_OpenChannelDecodeErrorZ represents a success state.
9349         pub result_ok: bool,
9350 }
9351 #[no_mangle]
9352 /// Creates a new CResult_OpenChannelDecodeErrorZ in the success state.
9353 pub extern "C" fn CResult_OpenChannelDecodeErrorZ_ok(o: crate::lightning::ln::msgs::OpenChannel) -> CResult_OpenChannelDecodeErrorZ {
9354         CResult_OpenChannelDecodeErrorZ {
9355                 contents: CResult_OpenChannelDecodeErrorZPtr {
9356                         result: Box::into_raw(Box::new(o)),
9357                 },
9358                 result_ok: true,
9359         }
9360 }
9361 #[no_mangle]
9362 /// Creates a new CResult_OpenChannelDecodeErrorZ in the error state.
9363 pub extern "C" fn CResult_OpenChannelDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_OpenChannelDecodeErrorZ {
9364         CResult_OpenChannelDecodeErrorZ {
9365                 contents: CResult_OpenChannelDecodeErrorZPtr {
9366                         err: Box::into_raw(Box::new(e)),
9367                 },
9368                 result_ok: false,
9369         }
9370 }
9371 #[no_mangle]
9372 /// Frees any resources used by the CResult_OpenChannelDecodeErrorZ.
9373 pub extern "C" fn CResult_OpenChannelDecodeErrorZ_free(_res: CResult_OpenChannelDecodeErrorZ) { }
9374 impl Drop for CResult_OpenChannelDecodeErrorZ {
9375         fn drop(&mut self) {
9376                 if self.result_ok {
9377                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
9378                                 let _ = unsafe { Box::from_raw(self.contents.result) };
9379                         }
9380                 } else {
9381                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
9382                                 let _ = unsafe { Box::from_raw(self.contents.err) };
9383                         }
9384                 }
9385         }
9386 }
9387 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::OpenChannel, crate::lightning::ln::msgs::DecodeError>> for CResult_OpenChannelDecodeErrorZ {
9388         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::OpenChannel, crate::lightning::ln::msgs::DecodeError>) -> Self {
9389                 let contents = if o.result_ok {
9390                         let result = unsafe { o.contents.result };
9391                         unsafe { o.contents.result = std::ptr::null_mut() };
9392                         CResult_OpenChannelDecodeErrorZPtr { result }
9393                 } else {
9394                         let err = unsafe { o.contents.err };
9395                         unsafe { o.contents.err = std::ptr::null_mut(); }
9396                         CResult_OpenChannelDecodeErrorZPtr { err }
9397                 };
9398                 Self {
9399                         contents,
9400                         result_ok: o.result_ok,
9401                 }
9402         }
9403 }
9404 impl Clone for CResult_OpenChannelDecodeErrorZ {
9405         fn clone(&self) -> Self {
9406                 if self.result_ok {
9407                         Self { result_ok: true, contents: CResult_OpenChannelDecodeErrorZPtr {
9408                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::OpenChannel>::clone(unsafe { &*self.contents.result })))
9409                         } }
9410                 } else {
9411                         Self { result_ok: false, contents: CResult_OpenChannelDecodeErrorZPtr {
9412                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
9413                         } }
9414                 }
9415         }
9416 }
9417 #[no_mangle]
9418 /// Creates a new CResult_OpenChannelDecodeErrorZ which has the same data as `orig`
9419 /// but with all dynamically-allocated buffers duplicated in new buffers.
9420 pub extern "C" fn CResult_OpenChannelDecodeErrorZ_clone(orig: &CResult_OpenChannelDecodeErrorZ) -> CResult_OpenChannelDecodeErrorZ { orig.clone() }
9421 #[repr(C)]
9422 /// The contents of CResult_RevokeAndACKDecodeErrorZ
9423 pub union CResult_RevokeAndACKDecodeErrorZPtr {
9424         /// A pointer to the contents in the success state.
9425         /// Reading from this pointer when `result_ok` is not set is undefined.
9426         pub result: *mut crate::lightning::ln::msgs::RevokeAndACK,
9427         /// A pointer to the contents in the error state.
9428         /// Reading from this pointer when `result_ok` is set is undefined.
9429         pub err: *mut crate::lightning::ln::msgs::DecodeError,
9430 }
9431 #[repr(C)]
9432 /// A CResult_RevokeAndACKDecodeErrorZ represents the result of a fallible operation,
9433 /// containing a crate::lightning::ln::msgs::RevokeAndACK on success and a crate::lightning::ln::msgs::DecodeError on failure.
9434 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9435 pub struct CResult_RevokeAndACKDecodeErrorZ {
9436         /// The contents of this CResult_RevokeAndACKDecodeErrorZ, accessible via either
9437         /// `err` or `result` depending on the state of `result_ok`.
9438         pub contents: CResult_RevokeAndACKDecodeErrorZPtr,
9439         /// Whether this CResult_RevokeAndACKDecodeErrorZ represents a success state.
9440         pub result_ok: bool,
9441 }
9442 #[no_mangle]
9443 /// Creates a new CResult_RevokeAndACKDecodeErrorZ in the success state.
9444 pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_ok(o: crate::lightning::ln::msgs::RevokeAndACK) -> CResult_RevokeAndACKDecodeErrorZ {
9445         CResult_RevokeAndACKDecodeErrorZ {
9446                 contents: CResult_RevokeAndACKDecodeErrorZPtr {
9447                         result: Box::into_raw(Box::new(o)),
9448                 },
9449                 result_ok: true,
9450         }
9451 }
9452 #[no_mangle]
9453 /// Creates a new CResult_RevokeAndACKDecodeErrorZ in the error state.
9454 pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RevokeAndACKDecodeErrorZ {
9455         CResult_RevokeAndACKDecodeErrorZ {
9456                 contents: CResult_RevokeAndACKDecodeErrorZPtr {
9457                         err: Box::into_raw(Box::new(e)),
9458                 },
9459                 result_ok: false,
9460         }
9461 }
9462 #[no_mangle]
9463 /// Frees any resources used by the CResult_RevokeAndACKDecodeErrorZ.
9464 pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_free(_res: CResult_RevokeAndACKDecodeErrorZ) { }
9465 impl Drop for CResult_RevokeAndACKDecodeErrorZ {
9466         fn drop(&mut self) {
9467                 if self.result_ok {
9468                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
9469                                 let _ = unsafe { Box::from_raw(self.contents.result) };
9470                         }
9471                 } else {
9472                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
9473                                 let _ = unsafe { Box::from_raw(self.contents.err) };
9474                         }
9475                 }
9476         }
9477 }
9478 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::RevokeAndACK, crate::lightning::ln::msgs::DecodeError>> for CResult_RevokeAndACKDecodeErrorZ {
9479         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::RevokeAndACK, crate::lightning::ln::msgs::DecodeError>) -> Self {
9480                 let contents = if o.result_ok {
9481                         let result = unsafe { o.contents.result };
9482                         unsafe { o.contents.result = std::ptr::null_mut() };
9483                         CResult_RevokeAndACKDecodeErrorZPtr { result }
9484                 } else {
9485                         let err = unsafe { o.contents.err };
9486                         unsafe { o.contents.err = std::ptr::null_mut(); }
9487                         CResult_RevokeAndACKDecodeErrorZPtr { err }
9488                 };
9489                 Self {
9490                         contents,
9491                         result_ok: o.result_ok,
9492                 }
9493         }
9494 }
9495 impl Clone for CResult_RevokeAndACKDecodeErrorZ {
9496         fn clone(&self) -> Self {
9497                 if self.result_ok {
9498                         Self { result_ok: true, contents: CResult_RevokeAndACKDecodeErrorZPtr {
9499                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::RevokeAndACK>::clone(unsafe { &*self.contents.result })))
9500                         } }
9501                 } else {
9502                         Self { result_ok: false, contents: CResult_RevokeAndACKDecodeErrorZPtr {
9503                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
9504                         } }
9505                 }
9506         }
9507 }
9508 #[no_mangle]
9509 /// Creates a new CResult_RevokeAndACKDecodeErrorZ which has the same data as `orig`
9510 /// but with all dynamically-allocated buffers duplicated in new buffers.
9511 pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_clone(orig: &CResult_RevokeAndACKDecodeErrorZ) -> CResult_RevokeAndACKDecodeErrorZ { orig.clone() }
9512 #[repr(C)]
9513 /// The contents of CResult_ShutdownDecodeErrorZ
9514 pub union CResult_ShutdownDecodeErrorZPtr {
9515         /// A pointer to the contents in the success state.
9516         /// Reading from this pointer when `result_ok` is not set is undefined.
9517         pub result: *mut crate::lightning::ln::msgs::Shutdown,
9518         /// A pointer to the contents in the error state.
9519         /// Reading from this pointer when `result_ok` is set is undefined.
9520         pub err: *mut crate::lightning::ln::msgs::DecodeError,
9521 }
9522 #[repr(C)]
9523 /// A CResult_ShutdownDecodeErrorZ represents the result of a fallible operation,
9524 /// containing a crate::lightning::ln::msgs::Shutdown on success and a crate::lightning::ln::msgs::DecodeError on failure.
9525 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9526 pub struct CResult_ShutdownDecodeErrorZ {
9527         /// The contents of this CResult_ShutdownDecodeErrorZ, accessible via either
9528         /// `err` or `result` depending on the state of `result_ok`.
9529         pub contents: CResult_ShutdownDecodeErrorZPtr,
9530         /// Whether this CResult_ShutdownDecodeErrorZ represents a success state.
9531         pub result_ok: bool,
9532 }
9533 #[no_mangle]
9534 /// Creates a new CResult_ShutdownDecodeErrorZ in the success state.
9535 pub extern "C" fn CResult_ShutdownDecodeErrorZ_ok(o: crate::lightning::ln::msgs::Shutdown) -> CResult_ShutdownDecodeErrorZ {
9536         CResult_ShutdownDecodeErrorZ {
9537                 contents: CResult_ShutdownDecodeErrorZPtr {
9538                         result: Box::into_raw(Box::new(o)),
9539                 },
9540                 result_ok: true,
9541         }
9542 }
9543 #[no_mangle]
9544 /// Creates a new CResult_ShutdownDecodeErrorZ in the error state.
9545 pub extern "C" fn CResult_ShutdownDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ShutdownDecodeErrorZ {
9546         CResult_ShutdownDecodeErrorZ {
9547                 contents: CResult_ShutdownDecodeErrorZPtr {
9548                         err: Box::into_raw(Box::new(e)),
9549                 },
9550                 result_ok: false,
9551         }
9552 }
9553 #[no_mangle]
9554 /// Frees any resources used by the CResult_ShutdownDecodeErrorZ.
9555 pub extern "C" fn CResult_ShutdownDecodeErrorZ_free(_res: CResult_ShutdownDecodeErrorZ) { }
9556 impl Drop for CResult_ShutdownDecodeErrorZ {
9557         fn drop(&mut self) {
9558                 if self.result_ok {
9559                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
9560                                 let _ = unsafe { Box::from_raw(self.contents.result) };
9561                         }
9562                 } else {
9563                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
9564                                 let _ = unsafe { Box::from_raw(self.contents.err) };
9565                         }
9566                 }
9567         }
9568 }
9569 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::Shutdown, crate::lightning::ln::msgs::DecodeError>> for CResult_ShutdownDecodeErrorZ {
9570         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::Shutdown, crate::lightning::ln::msgs::DecodeError>) -> Self {
9571                 let contents = if o.result_ok {
9572                         let result = unsafe { o.contents.result };
9573                         unsafe { o.contents.result = std::ptr::null_mut() };
9574                         CResult_ShutdownDecodeErrorZPtr { result }
9575                 } else {
9576                         let err = unsafe { o.contents.err };
9577                         unsafe { o.contents.err = std::ptr::null_mut(); }
9578                         CResult_ShutdownDecodeErrorZPtr { err }
9579                 };
9580                 Self {
9581                         contents,
9582                         result_ok: o.result_ok,
9583                 }
9584         }
9585 }
9586 impl Clone for CResult_ShutdownDecodeErrorZ {
9587         fn clone(&self) -> Self {
9588                 if self.result_ok {
9589                         Self { result_ok: true, contents: CResult_ShutdownDecodeErrorZPtr {
9590                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::Shutdown>::clone(unsafe { &*self.contents.result })))
9591                         } }
9592                 } else {
9593                         Self { result_ok: false, contents: CResult_ShutdownDecodeErrorZPtr {
9594                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
9595                         } }
9596                 }
9597         }
9598 }
9599 #[no_mangle]
9600 /// Creates a new CResult_ShutdownDecodeErrorZ which has the same data as `orig`
9601 /// but with all dynamically-allocated buffers duplicated in new buffers.
9602 pub extern "C" fn CResult_ShutdownDecodeErrorZ_clone(orig: &CResult_ShutdownDecodeErrorZ) -> CResult_ShutdownDecodeErrorZ { orig.clone() }
9603 #[repr(C)]
9604 /// The contents of CResult_UpdateFailHTLCDecodeErrorZ
9605 pub union CResult_UpdateFailHTLCDecodeErrorZPtr {
9606         /// A pointer to the contents in the success state.
9607         /// Reading from this pointer when `result_ok` is not set is undefined.
9608         pub result: *mut crate::lightning::ln::msgs::UpdateFailHTLC,
9609         /// A pointer to the contents in the error state.
9610         /// Reading from this pointer when `result_ok` is set is undefined.
9611         pub err: *mut crate::lightning::ln::msgs::DecodeError,
9612 }
9613 #[repr(C)]
9614 /// A CResult_UpdateFailHTLCDecodeErrorZ represents the result of a fallible operation,
9615 /// containing a crate::lightning::ln::msgs::UpdateFailHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
9616 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9617 pub struct CResult_UpdateFailHTLCDecodeErrorZ {
9618         /// The contents of this CResult_UpdateFailHTLCDecodeErrorZ, accessible via either
9619         /// `err` or `result` depending on the state of `result_ok`.
9620         pub contents: CResult_UpdateFailHTLCDecodeErrorZPtr,
9621         /// Whether this CResult_UpdateFailHTLCDecodeErrorZ represents a success state.
9622         pub result_ok: bool,
9623 }
9624 #[no_mangle]
9625 /// Creates a new CResult_UpdateFailHTLCDecodeErrorZ in the success state.
9626 pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateFailHTLC) -> CResult_UpdateFailHTLCDecodeErrorZ {
9627         CResult_UpdateFailHTLCDecodeErrorZ {
9628                 contents: CResult_UpdateFailHTLCDecodeErrorZPtr {
9629                         result: Box::into_raw(Box::new(o)),
9630                 },
9631                 result_ok: true,
9632         }
9633 }
9634 #[no_mangle]
9635 /// Creates a new CResult_UpdateFailHTLCDecodeErrorZ in the error state.
9636 pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateFailHTLCDecodeErrorZ {
9637         CResult_UpdateFailHTLCDecodeErrorZ {
9638                 contents: CResult_UpdateFailHTLCDecodeErrorZPtr {
9639                         err: Box::into_raw(Box::new(e)),
9640                 },
9641                 result_ok: false,
9642         }
9643 }
9644 #[no_mangle]
9645 /// Frees any resources used by the CResult_UpdateFailHTLCDecodeErrorZ.
9646 pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_free(_res: CResult_UpdateFailHTLCDecodeErrorZ) { }
9647 impl Drop for CResult_UpdateFailHTLCDecodeErrorZ {
9648         fn drop(&mut self) {
9649                 if self.result_ok {
9650                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
9651                                 let _ = unsafe { Box::from_raw(self.contents.result) };
9652                         }
9653                 } else {
9654                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
9655                                 let _ = unsafe { Box::from_raw(self.contents.err) };
9656                         }
9657                 }
9658         }
9659 }
9660 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFailHTLC, crate::lightning::ln::msgs::DecodeError>> for CResult_UpdateFailHTLCDecodeErrorZ {
9661         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFailHTLC, crate::lightning::ln::msgs::DecodeError>) -> Self {
9662                 let contents = if o.result_ok {
9663                         let result = unsafe { o.contents.result };
9664                         unsafe { o.contents.result = std::ptr::null_mut() };
9665                         CResult_UpdateFailHTLCDecodeErrorZPtr { result }
9666                 } else {
9667                         let err = unsafe { o.contents.err };
9668                         unsafe { o.contents.err = std::ptr::null_mut(); }
9669                         CResult_UpdateFailHTLCDecodeErrorZPtr { err }
9670                 };
9671                 Self {
9672                         contents,
9673                         result_ok: o.result_ok,
9674                 }
9675         }
9676 }
9677 impl Clone for CResult_UpdateFailHTLCDecodeErrorZ {
9678         fn clone(&self) -> Self {
9679                 if self.result_ok {
9680                         Self { result_ok: true, contents: CResult_UpdateFailHTLCDecodeErrorZPtr {
9681                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UpdateFailHTLC>::clone(unsafe { &*self.contents.result })))
9682                         } }
9683                 } else {
9684                         Self { result_ok: false, contents: CResult_UpdateFailHTLCDecodeErrorZPtr {
9685                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
9686                         } }
9687                 }
9688         }
9689 }
9690 #[no_mangle]
9691 /// Creates a new CResult_UpdateFailHTLCDecodeErrorZ which has the same data as `orig`
9692 /// but with all dynamically-allocated buffers duplicated in new buffers.
9693 pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_clone(orig: &CResult_UpdateFailHTLCDecodeErrorZ) -> CResult_UpdateFailHTLCDecodeErrorZ { orig.clone() }
9694 #[repr(C)]
9695 /// The contents of CResult_UpdateFailMalformedHTLCDecodeErrorZ
9696 pub union CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
9697         /// A pointer to the contents in the success state.
9698         /// Reading from this pointer when `result_ok` is not set is undefined.
9699         pub result: *mut crate::lightning::ln::msgs::UpdateFailMalformedHTLC,
9700         /// A pointer to the contents in the error state.
9701         /// Reading from this pointer when `result_ok` is set is undefined.
9702         pub err: *mut crate::lightning::ln::msgs::DecodeError,
9703 }
9704 #[repr(C)]
9705 /// A CResult_UpdateFailMalformedHTLCDecodeErrorZ represents the result of a fallible operation,
9706 /// containing a crate::lightning::ln::msgs::UpdateFailMalformedHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
9707 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9708 pub struct CResult_UpdateFailMalformedHTLCDecodeErrorZ {
9709         /// The contents of this CResult_UpdateFailMalformedHTLCDecodeErrorZ, accessible via either
9710         /// `err` or `result` depending on the state of `result_ok`.
9711         pub contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr,
9712         /// Whether this CResult_UpdateFailMalformedHTLCDecodeErrorZ represents a success state.
9713         pub result_ok: bool,
9714 }
9715 #[no_mangle]
9716 /// Creates a new CResult_UpdateFailMalformedHTLCDecodeErrorZ in the success state.
9717 pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateFailMalformedHTLC) -> CResult_UpdateFailMalformedHTLCDecodeErrorZ {
9718         CResult_UpdateFailMalformedHTLCDecodeErrorZ {
9719                 contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
9720                         result: Box::into_raw(Box::new(o)),
9721                 },
9722                 result_ok: true,
9723         }
9724 }
9725 #[no_mangle]
9726 /// Creates a new CResult_UpdateFailMalformedHTLCDecodeErrorZ in the error state.
9727 pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateFailMalformedHTLCDecodeErrorZ {
9728         CResult_UpdateFailMalformedHTLCDecodeErrorZ {
9729                 contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
9730                         err: Box::into_raw(Box::new(e)),
9731                 },
9732                 result_ok: false,
9733         }
9734 }
9735 #[no_mangle]
9736 /// Frees any resources used by the CResult_UpdateFailMalformedHTLCDecodeErrorZ.
9737 pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_free(_res: CResult_UpdateFailMalformedHTLCDecodeErrorZ) { }
9738 impl Drop for CResult_UpdateFailMalformedHTLCDecodeErrorZ {
9739         fn drop(&mut self) {
9740                 if self.result_ok {
9741                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
9742                                 let _ = unsafe { Box::from_raw(self.contents.result) };
9743                         }
9744                 } else {
9745                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
9746                                 let _ = unsafe { Box::from_raw(self.contents.err) };
9747                         }
9748                 }
9749         }
9750 }
9751 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFailMalformedHTLC, crate::lightning::ln::msgs::DecodeError>> for CResult_UpdateFailMalformedHTLCDecodeErrorZ {
9752         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFailMalformedHTLC, crate::lightning::ln::msgs::DecodeError>) -> Self {
9753                 let contents = if o.result_ok {
9754                         let result = unsafe { o.contents.result };
9755                         unsafe { o.contents.result = std::ptr::null_mut() };
9756                         CResult_UpdateFailMalformedHTLCDecodeErrorZPtr { result }
9757                 } else {
9758                         let err = unsafe { o.contents.err };
9759                         unsafe { o.contents.err = std::ptr::null_mut(); }
9760                         CResult_UpdateFailMalformedHTLCDecodeErrorZPtr { err }
9761                 };
9762                 Self {
9763                         contents,
9764                         result_ok: o.result_ok,
9765                 }
9766         }
9767 }
9768 impl Clone for CResult_UpdateFailMalformedHTLCDecodeErrorZ {
9769         fn clone(&self) -> Self {
9770                 if self.result_ok {
9771                         Self { result_ok: true, contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
9772                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UpdateFailMalformedHTLC>::clone(unsafe { &*self.contents.result })))
9773                         } }
9774                 } else {
9775                         Self { result_ok: false, contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
9776                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
9777                         } }
9778                 }
9779         }
9780 }
9781 #[no_mangle]
9782 /// Creates a new CResult_UpdateFailMalformedHTLCDecodeErrorZ which has the same data as `orig`
9783 /// but with all dynamically-allocated buffers duplicated in new buffers.
9784 pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone(orig: &CResult_UpdateFailMalformedHTLCDecodeErrorZ) -> CResult_UpdateFailMalformedHTLCDecodeErrorZ { orig.clone() }
9785 #[repr(C)]
9786 /// The contents of CResult_UpdateFeeDecodeErrorZ
9787 pub union CResult_UpdateFeeDecodeErrorZPtr {
9788         /// A pointer to the contents in the success state.
9789         /// Reading from this pointer when `result_ok` is not set is undefined.
9790         pub result: *mut crate::lightning::ln::msgs::UpdateFee,
9791         /// A pointer to the contents in the error state.
9792         /// Reading from this pointer when `result_ok` is set is undefined.
9793         pub err: *mut crate::lightning::ln::msgs::DecodeError,
9794 }
9795 #[repr(C)]
9796 /// A CResult_UpdateFeeDecodeErrorZ represents the result of a fallible operation,
9797 /// containing a crate::lightning::ln::msgs::UpdateFee on success and a crate::lightning::ln::msgs::DecodeError on failure.
9798 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9799 pub struct CResult_UpdateFeeDecodeErrorZ {
9800         /// The contents of this CResult_UpdateFeeDecodeErrorZ, accessible via either
9801         /// `err` or `result` depending on the state of `result_ok`.
9802         pub contents: CResult_UpdateFeeDecodeErrorZPtr,
9803         /// Whether this CResult_UpdateFeeDecodeErrorZ represents a success state.
9804         pub result_ok: bool,
9805 }
9806 #[no_mangle]
9807 /// Creates a new CResult_UpdateFeeDecodeErrorZ in the success state.
9808 pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateFee) -> CResult_UpdateFeeDecodeErrorZ {
9809         CResult_UpdateFeeDecodeErrorZ {
9810                 contents: CResult_UpdateFeeDecodeErrorZPtr {
9811                         result: Box::into_raw(Box::new(o)),
9812                 },
9813                 result_ok: true,
9814         }
9815 }
9816 #[no_mangle]
9817 /// Creates a new CResult_UpdateFeeDecodeErrorZ in the error state.
9818 pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateFeeDecodeErrorZ {
9819         CResult_UpdateFeeDecodeErrorZ {
9820                 contents: CResult_UpdateFeeDecodeErrorZPtr {
9821                         err: Box::into_raw(Box::new(e)),
9822                 },
9823                 result_ok: false,
9824         }
9825 }
9826 #[no_mangle]
9827 /// Frees any resources used by the CResult_UpdateFeeDecodeErrorZ.
9828 pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_free(_res: CResult_UpdateFeeDecodeErrorZ) { }
9829 impl Drop for CResult_UpdateFeeDecodeErrorZ {
9830         fn drop(&mut self) {
9831                 if self.result_ok {
9832                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
9833                                 let _ = unsafe { Box::from_raw(self.contents.result) };
9834                         }
9835                 } else {
9836                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
9837                                 let _ = unsafe { Box::from_raw(self.contents.err) };
9838                         }
9839                 }
9840         }
9841 }
9842 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFee, crate::lightning::ln::msgs::DecodeError>> for CResult_UpdateFeeDecodeErrorZ {
9843         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFee, crate::lightning::ln::msgs::DecodeError>) -> Self {
9844                 let contents = if o.result_ok {
9845                         let result = unsafe { o.contents.result };
9846                         unsafe { o.contents.result = std::ptr::null_mut() };
9847                         CResult_UpdateFeeDecodeErrorZPtr { result }
9848                 } else {
9849                         let err = unsafe { o.contents.err };
9850                         unsafe { o.contents.err = std::ptr::null_mut(); }
9851                         CResult_UpdateFeeDecodeErrorZPtr { err }
9852                 };
9853                 Self {
9854                         contents,
9855                         result_ok: o.result_ok,
9856                 }
9857         }
9858 }
9859 impl Clone for CResult_UpdateFeeDecodeErrorZ {
9860         fn clone(&self) -> Self {
9861                 if self.result_ok {
9862                         Self { result_ok: true, contents: CResult_UpdateFeeDecodeErrorZPtr {
9863                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UpdateFee>::clone(unsafe { &*self.contents.result })))
9864                         } }
9865                 } else {
9866                         Self { result_ok: false, contents: CResult_UpdateFeeDecodeErrorZPtr {
9867                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
9868                         } }
9869                 }
9870         }
9871 }
9872 #[no_mangle]
9873 /// Creates a new CResult_UpdateFeeDecodeErrorZ which has the same data as `orig`
9874 /// but with all dynamically-allocated buffers duplicated in new buffers.
9875 pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_clone(orig: &CResult_UpdateFeeDecodeErrorZ) -> CResult_UpdateFeeDecodeErrorZ { orig.clone() }
9876 #[repr(C)]
9877 /// The contents of CResult_UpdateFulfillHTLCDecodeErrorZ
9878 pub union CResult_UpdateFulfillHTLCDecodeErrorZPtr {
9879         /// A pointer to the contents in the success state.
9880         /// Reading from this pointer when `result_ok` is not set is undefined.
9881         pub result: *mut crate::lightning::ln::msgs::UpdateFulfillHTLC,
9882         /// A pointer to the contents in the error state.
9883         /// Reading from this pointer when `result_ok` is set is undefined.
9884         pub err: *mut crate::lightning::ln::msgs::DecodeError,
9885 }
9886 #[repr(C)]
9887 /// A CResult_UpdateFulfillHTLCDecodeErrorZ represents the result of a fallible operation,
9888 /// containing a crate::lightning::ln::msgs::UpdateFulfillHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
9889 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9890 pub struct CResult_UpdateFulfillHTLCDecodeErrorZ {
9891         /// The contents of this CResult_UpdateFulfillHTLCDecodeErrorZ, accessible via either
9892         /// `err` or `result` depending on the state of `result_ok`.
9893         pub contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr,
9894         /// Whether this CResult_UpdateFulfillHTLCDecodeErrorZ represents a success state.
9895         pub result_ok: bool,
9896 }
9897 #[no_mangle]
9898 /// Creates a new CResult_UpdateFulfillHTLCDecodeErrorZ in the success state.
9899 pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateFulfillHTLC) -> CResult_UpdateFulfillHTLCDecodeErrorZ {
9900         CResult_UpdateFulfillHTLCDecodeErrorZ {
9901                 contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr {
9902                         result: Box::into_raw(Box::new(o)),
9903                 },
9904                 result_ok: true,
9905         }
9906 }
9907 #[no_mangle]
9908 /// Creates a new CResult_UpdateFulfillHTLCDecodeErrorZ in the error state.
9909 pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateFulfillHTLCDecodeErrorZ {
9910         CResult_UpdateFulfillHTLCDecodeErrorZ {
9911                 contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr {
9912                         err: Box::into_raw(Box::new(e)),
9913                 },
9914                 result_ok: false,
9915         }
9916 }
9917 #[no_mangle]
9918 /// Frees any resources used by the CResult_UpdateFulfillHTLCDecodeErrorZ.
9919 pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_free(_res: CResult_UpdateFulfillHTLCDecodeErrorZ) { }
9920 impl Drop for CResult_UpdateFulfillHTLCDecodeErrorZ {
9921         fn drop(&mut self) {
9922                 if self.result_ok {
9923                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
9924                                 let _ = unsafe { Box::from_raw(self.contents.result) };
9925                         }
9926                 } else {
9927                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
9928                                 let _ = unsafe { Box::from_raw(self.contents.err) };
9929                         }
9930                 }
9931         }
9932 }
9933 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFulfillHTLC, crate::lightning::ln::msgs::DecodeError>> for CResult_UpdateFulfillHTLCDecodeErrorZ {
9934         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFulfillHTLC, crate::lightning::ln::msgs::DecodeError>) -> Self {
9935                 let contents = if o.result_ok {
9936                         let result = unsafe { o.contents.result };
9937                         unsafe { o.contents.result = std::ptr::null_mut() };
9938                         CResult_UpdateFulfillHTLCDecodeErrorZPtr { result }
9939                 } else {
9940                         let err = unsafe { o.contents.err };
9941                         unsafe { o.contents.err = std::ptr::null_mut(); }
9942                         CResult_UpdateFulfillHTLCDecodeErrorZPtr { err }
9943                 };
9944                 Self {
9945                         contents,
9946                         result_ok: o.result_ok,
9947                 }
9948         }
9949 }
9950 impl Clone for CResult_UpdateFulfillHTLCDecodeErrorZ {
9951         fn clone(&self) -> Self {
9952                 if self.result_ok {
9953                         Self { result_ok: true, contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr {
9954                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UpdateFulfillHTLC>::clone(unsafe { &*self.contents.result })))
9955                         } }
9956                 } else {
9957                         Self { result_ok: false, contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr {
9958                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
9959                         } }
9960                 }
9961         }
9962 }
9963 #[no_mangle]
9964 /// Creates a new CResult_UpdateFulfillHTLCDecodeErrorZ which has the same data as `orig`
9965 /// but with all dynamically-allocated buffers duplicated in new buffers.
9966 pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_clone(orig: &CResult_UpdateFulfillHTLCDecodeErrorZ) -> CResult_UpdateFulfillHTLCDecodeErrorZ { orig.clone() }
9967 #[repr(C)]
9968 /// The contents of CResult_UpdateAddHTLCDecodeErrorZ
9969 pub union CResult_UpdateAddHTLCDecodeErrorZPtr {
9970         /// A pointer to the contents in the success state.
9971         /// Reading from this pointer when `result_ok` is not set is undefined.
9972         pub result: *mut crate::lightning::ln::msgs::UpdateAddHTLC,
9973         /// A pointer to the contents in the error state.
9974         /// Reading from this pointer when `result_ok` is set is undefined.
9975         pub err: *mut crate::lightning::ln::msgs::DecodeError,
9976 }
9977 #[repr(C)]
9978 /// A CResult_UpdateAddHTLCDecodeErrorZ represents the result of a fallible operation,
9979 /// containing a crate::lightning::ln::msgs::UpdateAddHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
9980 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9981 pub struct CResult_UpdateAddHTLCDecodeErrorZ {
9982         /// The contents of this CResult_UpdateAddHTLCDecodeErrorZ, accessible via either
9983         /// `err` or `result` depending on the state of `result_ok`.
9984         pub contents: CResult_UpdateAddHTLCDecodeErrorZPtr,
9985         /// Whether this CResult_UpdateAddHTLCDecodeErrorZ represents a success state.
9986         pub result_ok: bool,
9987 }
9988 #[no_mangle]
9989 /// Creates a new CResult_UpdateAddHTLCDecodeErrorZ in the success state.
9990 pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateAddHTLC) -> CResult_UpdateAddHTLCDecodeErrorZ {
9991         CResult_UpdateAddHTLCDecodeErrorZ {
9992                 contents: CResult_UpdateAddHTLCDecodeErrorZPtr {
9993                         result: Box::into_raw(Box::new(o)),
9994                 },
9995                 result_ok: true,
9996         }
9997 }
9998 #[no_mangle]
9999 /// Creates a new CResult_UpdateAddHTLCDecodeErrorZ in the error state.
10000 pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateAddHTLCDecodeErrorZ {
10001         CResult_UpdateAddHTLCDecodeErrorZ {
10002                 contents: CResult_UpdateAddHTLCDecodeErrorZPtr {
10003                         err: Box::into_raw(Box::new(e)),
10004                 },
10005                 result_ok: false,
10006         }
10007 }
10008 #[no_mangle]
10009 /// Frees any resources used by the CResult_UpdateAddHTLCDecodeErrorZ.
10010 pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_free(_res: CResult_UpdateAddHTLCDecodeErrorZ) { }
10011 impl Drop for CResult_UpdateAddHTLCDecodeErrorZ {
10012         fn drop(&mut self) {
10013                 if self.result_ok {
10014                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
10015                                 let _ = unsafe { Box::from_raw(self.contents.result) };
10016                         }
10017                 } else {
10018                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
10019                                 let _ = unsafe { Box::from_raw(self.contents.err) };
10020                         }
10021                 }
10022         }
10023 }
10024 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateAddHTLC, crate::lightning::ln::msgs::DecodeError>> for CResult_UpdateAddHTLCDecodeErrorZ {
10025         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateAddHTLC, crate::lightning::ln::msgs::DecodeError>) -> Self {
10026                 let contents = if o.result_ok {
10027                         let result = unsafe { o.contents.result };
10028                         unsafe { o.contents.result = std::ptr::null_mut() };
10029                         CResult_UpdateAddHTLCDecodeErrorZPtr { result }
10030                 } else {
10031                         let err = unsafe { o.contents.err };
10032                         unsafe { o.contents.err = std::ptr::null_mut(); }
10033                         CResult_UpdateAddHTLCDecodeErrorZPtr { err }
10034                 };
10035                 Self {
10036                         contents,
10037                         result_ok: o.result_ok,
10038                 }
10039         }
10040 }
10041 impl Clone for CResult_UpdateAddHTLCDecodeErrorZ {
10042         fn clone(&self) -> Self {
10043                 if self.result_ok {
10044                         Self { result_ok: true, contents: CResult_UpdateAddHTLCDecodeErrorZPtr {
10045                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UpdateAddHTLC>::clone(unsafe { &*self.contents.result })))
10046                         } }
10047                 } else {
10048                         Self { result_ok: false, contents: CResult_UpdateAddHTLCDecodeErrorZPtr {
10049                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
10050                         } }
10051                 }
10052         }
10053 }
10054 #[no_mangle]
10055 /// Creates a new CResult_UpdateAddHTLCDecodeErrorZ which has the same data as `orig`
10056 /// but with all dynamically-allocated buffers duplicated in new buffers.
10057 pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_clone(orig: &CResult_UpdateAddHTLCDecodeErrorZ) -> CResult_UpdateAddHTLCDecodeErrorZ { orig.clone() }
10058 #[repr(C)]
10059 /// The contents of CResult_PingDecodeErrorZ
10060 pub union CResult_PingDecodeErrorZPtr {
10061         /// A pointer to the contents in the success state.
10062         /// Reading from this pointer when `result_ok` is not set is undefined.
10063         pub result: *mut crate::lightning::ln::msgs::Ping,
10064         /// A pointer to the contents in the error state.
10065         /// Reading from this pointer when `result_ok` is set is undefined.
10066         pub err: *mut crate::lightning::ln::msgs::DecodeError,
10067 }
10068 #[repr(C)]
10069 /// A CResult_PingDecodeErrorZ represents the result of a fallible operation,
10070 /// containing a crate::lightning::ln::msgs::Ping on success and a crate::lightning::ln::msgs::DecodeError on failure.
10071 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10072 pub struct CResult_PingDecodeErrorZ {
10073         /// The contents of this CResult_PingDecodeErrorZ, accessible via either
10074         /// `err` or `result` depending on the state of `result_ok`.
10075         pub contents: CResult_PingDecodeErrorZPtr,
10076         /// Whether this CResult_PingDecodeErrorZ represents a success state.
10077         pub result_ok: bool,
10078 }
10079 #[no_mangle]
10080 /// Creates a new CResult_PingDecodeErrorZ in the success state.
10081 pub extern "C" fn CResult_PingDecodeErrorZ_ok(o: crate::lightning::ln::msgs::Ping) -> CResult_PingDecodeErrorZ {
10082         CResult_PingDecodeErrorZ {
10083                 contents: CResult_PingDecodeErrorZPtr {
10084                         result: Box::into_raw(Box::new(o)),
10085                 },
10086                 result_ok: true,
10087         }
10088 }
10089 #[no_mangle]
10090 /// Creates a new CResult_PingDecodeErrorZ in the error state.
10091 pub extern "C" fn CResult_PingDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_PingDecodeErrorZ {
10092         CResult_PingDecodeErrorZ {
10093                 contents: CResult_PingDecodeErrorZPtr {
10094                         err: Box::into_raw(Box::new(e)),
10095                 },
10096                 result_ok: false,
10097         }
10098 }
10099 #[no_mangle]
10100 /// Frees any resources used by the CResult_PingDecodeErrorZ.
10101 pub extern "C" fn CResult_PingDecodeErrorZ_free(_res: CResult_PingDecodeErrorZ) { }
10102 impl Drop for CResult_PingDecodeErrorZ {
10103         fn drop(&mut self) {
10104                 if self.result_ok {
10105                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
10106                                 let _ = unsafe { Box::from_raw(self.contents.result) };
10107                         }
10108                 } else {
10109                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
10110                                 let _ = unsafe { Box::from_raw(self.contents.err) };
10111                         }
10112                 }
10113         }
10114 }
10115 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::Ping, crate::lightning::ln::msgs::DecodeError>> for CResult_PingDecodeErrorZ {
10116         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::Ping, crate::lightning::ln::msgs::DecodeError>) -> Self {
10117                 let contents = if o.result_ok {
10118                         let result = unsafe { o.contents.result };
10119                         unsafe { o.contents.result = std::ptr::null_mut() };
10120                         CResult_PingDecodeErrorZPtr { result }
10121                 } else {
10122                         let err = unsafe { o.contents.err };
10123                         unsafe { o.contents.err = std::ptr::null_mut(); }
10124                         CResult_PingDecodeErrorZPtr { err }
10125                 };
10126                 Self {
10127                         contents,
10128                         result_ok: o.result_ok,
10129                 }
10130         }
10131 }
10132 impl Clone for CResult_PingDecodeErrorZ {
10133         fn clone(&self) -> Self {
10134                 if self.result_ok {
10135                         Self { result_ok: true, contents: CResult_PingDecodeErrorZPtr {
10136                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::Ping>::clone(unsafe { &*self.contents.result })))
10137                         } }
10138                 } else {
10139                         Self { result_ok: false, contents: CResult_PingDecodeErrorZPtr {
10140                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
10141                         } }
10142                 }
10143         }
10144 }
10145 #[no_mangle]
10146 /// Creates a new CResult_PingDecodeErrorZ which has the same data as `orig`
10147 /// but with all dynamically-allocated buffers duplicated in new buffers.
10148 pub extern "C" fn CResult_PingDecodeErrorZ_clone(orig: &CResult_PingDecodeErrorZ) -> CResult_PingDecodeErrorZ { orig.clone() }
10149 #[repr(C)]
10150 /// The contents of CResult_PongDecodeErrorZ
10151 pub union CResult_PongDecodeErrorZPtr {
10152         /// A pointer to the contents in the success state.
10153         /// Reading from this pointer when `result_ok` is not set is undefined.
10154         pub result: *mut crate::lightning::ln::msgs::Pong,
10155         /// A pointer to the contents in the error state.
10156         /// Reading from this pointer when `result_ok` is set is undefined.
10157         pub err: *mut crate::lightning::ln::msgs::DecodeError,
10158 }
10159 #[repr(C)]
10160 /// A CResult_PongDecodeErrorZ represents the result of a fallible operation,
10161 /// containing a crate::lightning::ln::msgs::Pong on success and a crate::lightning::ln::msgs::DecodeError on failure.
10162 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10163 pub struct CResult_PongDecodeErrorZ {
10164         /// The contents of this CResult_PongDecodeErrorZ, accessible via either
10165         /// `err` or `result` depending on the state of `result_ok`.
10166         pub contents: CResult_PongDecodeErrorZPtr,
10167         /// Whether this CResult_PongDecodeErrorZ represents a success state.
10168         pub result_ok: bool,
10169 }
10170 #[no_mangle]
10171 /// Creates a new CResult_PongDecodeErrorZ in the success state.
10172 pub extern "C" fn CResult_PongDecodeErrorZ_ok(o: crate::lightning::ln::msgs::Pong) -> CResult_PongDecodeErrorZ {
10173         CResult_PongDecodeErrorZ {
10174                 contents: CResult_PongDecodeErrorZPtr {
10175                         result: Box::into_raw(Box::new(o)),
10176                 },
10177                 result_ok: true,
10178         }
10179 }
10180 #[no_mangle]
10181 /// Creates a new CResult_PongDecodeErrorZ in the error state.
10182 pub extern "C" fn CResult_PongDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_PongDecodeErrorZ {
10183         CResult_PongDecodeErrorZ {
10184                 contents: CResult_PongDecodeErrorZPtr {
10185                         err: Box::into_raw(Box::new(e)),
10186                 },
10187                 result_ok: false,
10188         }
10189 }
10190 #[no_mangle]
10191 /// Frees any resources used by the CResult_PongDecodeErrorZ.
10192 pub extern "C" fn CResult_PongDecodeErrorZ_free(_res: CResult_PongDecodeErrorZ) { }
10193 impl Drop for CResult_PongDecodeErrorZ {
10194         fn drop(&mut self) {
10195                 if self.result_ok {
10196                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
10197                                 let _ = unsafe { Box::from_raw(self.contents.result) };
10198                         }
10199                 } else {
10200                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
10201                                 let _ = unsafe { Box::from_raw(self.contents.err) };
10202                         }
10203                 }
10204         }
10205 }
10206 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::Pong, crate::lightning::ln::msgs::DecodeError>> for CResult_PongDecodeErrorZ {
10207         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::Pong, crate::lightning::ln::msgs::DecodeError>) -> Self {
10208                 let contents = if o.result_ok {
10209                         let result = unsafe { o.contents.result };
10210                         unsafe { o.contents.result = std::ptr::null_mut() };
10211                         CResult_PongDecodeErrorZPtr { result }
10212                 } else {
10213                         let err = unsafe { o.contents.err };
10214                         unsafe { o.contents.err = std::ptr::null_mut(); }
10215                         CResult_PongDecodeErrorZPtr { err }
10216                 };
10217                 Self {
10218                         contents,
10219                         result_ok: o.result_ok,
10220                 }
10221         }
10222 }
10223 impl Clone for CResult_PongDecodeErrorZ {
10224         fn clone(&self) -> Self {
10225                 if self.result_ok {
10226                         Self { result_ok: true, contents: CResult_PongDecodeErrorZPtr {
10227                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::Pong>::clone(unsafe { &*self.contents.result })))
10228                         } }
10229                 } else {
10230                         Self { result_ok: false, contents: CResult_PongDecodeErrorZPtr {
10231                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
10232                         } }
10233                 }
10234         }
10235 }
10236 #[no_mangle]
10237 /// Creates a new CResult_PongDecodeErrorZ which has the same data as `orig`
10238 /// but with all dynamically-allocated buffers duplicated in new buffers.
10239 pub extern "C" fn CResult_PongDecodeErrorZ_clone(orig: &CResult_PongDecodeErrorZ) -> CResult_PongDecodeErrorZ { orig.clone() }
10240 #[repr(C)]
10241 /// The contents of CResult_UnsignedChannelAnnouncementDecodeErrorZ
10242 pub union CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
10243         /// A pointer to the contents in the success state.
10244         /// Reading from this pointer when `result_ok` is not set is undefined.
10245         pub result: *mut crate::lightning::ln::msgs::UnsignedChannelAnnouncement,
10246         /// A pointer to the contents in the error state.
10247         /// Reading from this pointer when `result_ok` is set is undefined.
10248         pub err: *mut crate::lightning::ln::msgs::DecodeError,
10249 }
10250 #[repr(C)]
10251 /// A CResult_UnsignedChannelAnnouncementDecodeErrorZ represents the result of a fallible operation,
10252 /// containing a crate::lightning::ln::msgs::UnsignedChannelAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
10253 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10254 pub struct CResult_UnsignedChannelAnnouncementDecodeErrorZ {
10255         /// The contents of this CResult_UnsignedChannelAnnouncementDecodeErrorZ, accessible via either
10256         /// `err` or `result` depending on the state of `result_ok`.
10257         pub contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr,
10258         /// Whether this CResult_UnsignedChannelAnnouncementDecodeErrorZ represents a success state.
10259         pub result_ok: bool,
10260 }
10261 #[no_mangle]
10262 /// Creates a new CResult_UnsignedChannelAnnouncementDecodeErrorZ in the success state.
10263 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UnsignedChannelAnnouncement) -> CResult_UnsignedChannelAnnouncementDecodeErrorZ {
10264         CResult_UnsignedChannelAnnouncementDecodeErrorZ {
10265                 contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
10266                         result: Box::into_raw(Box::new(o)),
10267                 },
10268                 result_ok: true,
10269         }
10270 }
10271 #[no_mangle]
10272 /// Creates a new CResult_UnsignedChannelAnnouncementDecodeErrorZ in the error state.
10273 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UnsignedChannelAnnouncementDecodeErrorZ {
10274         CResult_UnsignedChannelAnnouncementDecodeErrorZ {
10275                 contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
10276                         err: Box::into_raw(Box::new(e)),
10277                 },
10278                 result_ok: false,
10279         }
10280 }
10281 #[no_mangle]
10282 /// Frees any resources used by the CResult_UnsignedChannelAnnouncementDecodeErrorZ.
10283 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_free(_res: CResult_UnsignedChannelAnnouncementDecodeErrorZ) { }
10284 impl Drop for CResult_UnsignedChannelAnnouncementDecodeErrorZ {
10285         fn drop(&mut self) {
10286                 if self.result_ok {
10287                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
10288                                 let _ = unsafe { Box::from_raw(self.contents.result) };
10289                         }
10290                 } else {
10291                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
10292                                 let _ = unsafe { Box::from_raw(self.contents.err) };
10293                         }
10294                 }
10295         }
10296 }
10297 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedChannelAnnouncement, crate::lightning::ln::msgs::DecodeError>> for CResult_UnsignedChannelAnnouncementDecodeErrorZ {
10298         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedChannelAnnouncement, crate::lightning::ln::msgs::DecodeError>) -> Self {
10299                 let contents = if o.result_ok {
10300                         let result = unsafe { o.contents.result };
10301                         unsafe { o.contents.result = std::ptr::null_mut() };
10302                         CResult_UnsignedChannelAnnouncementDecodeErrorZPtr { result }
10303                 } else {
10304                         let err = unsafe { o.contents.err };
10305                         unsafe { o.contents.err = std::ptr::null_mut(); }
10306                         CResult_UnsignedChannelAnnouncementDecodeErrorZPtr { err }
10307                 };
10308                 Self {
10309                         contents,
10310                         result_ok: o.result_ok,
10311                 }
10312         }
10313 }
10314 impl Clone for CResult_UnsignedChannelAnnouncementDecodeErrorZ {
10315         fn clone(&self) -> Self {
10316                 if self.result_ok {
10317                         Self { result_ok: true, contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
10318                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UnsignedChannelAnnouncement>::clone(unsafe { &*self.contents.result })))
10319                         } }
10320                 } else {
10321                         Self { result_ok: false, contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
10322                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
10323                         } }
10324                 }
10325         }
10326 }
10327 #[no_mangle]
10328 /// Creates a new CResult_UnsignedChannelAnnouncementDecodeErrorZ which has the same data as `orig`
10329 /// but with all dynamically-allocated buffers duplicated in new buffers.
10330 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone(orig: &CResult_UnsignedChannelAnnouncementDecodeErrorZ) -> CResult_UnsignedChannelAnnouncementDecodeErrorZ { orig.clone() }
10331 #[repr(C)]
10332 /// The contents of CResult_ChannelAnnouncementDecodeErrorZ
10333 pub union CResult_ChannelAnnouncementDecodeErrorZPtr {
10334         /// A pointer to the contents in the success state.
10335         /// Reading from this pointer when `result_ok` is not set is undefined.
10336         pub result: *mut crate::lightning::ln::msgs::ChannelAnnouncement,
10337         /// A pointer to the contents in the error state.
10338         /// Reading from this pointer when `result_ok` is set is undefined.
10339         pub err: *mut crate::lightning::ln::msgs::DecodeError,
10340 }
10341 #[repr(C)]
10342 /// A CResult_ChannelAnnouncementDecodeErrorZ represents the result of a fallible operation,
10343 /// containing a crate::lightning::ln::msgs::ChannelAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
10344 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10345 pub struct CResult_ChannelAnnouncementDecodeErrorZ {
10346         /// The contents of this CResult_ChannelAnnouncementDecodeErrorZ, accessible via either
10347         /// `err` or `result` depending on the state of `result_ok`.
10348         pub contents: CResult_ChannelAnnouncementDecodeErrorZPtr,
10349         /// Whether this CResult_ChannelAnnouncementDecodeErrorZ represents a success state.
10350         pub result_ok: bool,
10351 }
10352 #[no_mangle]
10353 /// Creates a new CResult_ChannelAnnouncementDecodeErrorZ in the success state.
10354 pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ChannelAnnouncement) -> CResult_ChannelAnnouncementDecodeErrorZ {
10355         CResult_ChannelAnnouncementDecodeErrorZ {
10356                 contents: CResult_ChannelAnnouncementDecodeErrorZPtr {
10357                         result: Box::into_raw(Box::new(o)),
10358                 },
10359                 result_ok: true,
10360         }
10361 }
10362 #[no_mangle]
10363 /// Creates a new CResult_ChannelAnnouncementDecodeErrorZ in the error state.
10364 pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelAnnouncementDecodeErrorZ {
10365         CResult_ChannelAnnouncementDecodeErrorZ {
10366                 contents: CResult_ChannelAnnouncementDecodeErrorZPtr {
10367                         err: Box::into_raw(Box::new(e)),
10368                 },
10369                 result_ok: false,
10370         }
10371 }
10372 #[no_mangle]
10373 /// Frees any resources used by the CResult_ChannelAnnouncementDecodeErrorZ.
10374 pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_free(_res: CResult_ChannelAnnouncementDecodeErrorZ) { }
10375 impl Drop for CResult_ChannelAnnouncementDecodeErrorZ {
10376         fn drop(&mut self) {
10377                 if self.result_ok {
10378                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
10379                                 let _ = unsafe { Box::from_raw(self.contents.result) };
10380                         }
10381                 } else {
10382                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
10383                                 let _ = unsafe { Box::from_raw(self.contents.err) };
10384                         }
10385                 }
10386         }
10387 }
10388 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelAnnouncement, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelAnnouncementDecodeErrorZ {
10389         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelAnnouncement, crate::lightning::ln::msgs::DecodeError>) -> Self {
10390                 let contents = if o.result_ok {
10391                         let result = unsafe { o.contents.result };
10392                         unsafe { o.contents.result = std::ptr::null_mut() };
10393                         CResult_ChannelAnnouncementDecodeErrorZPtr { result }
10394                 } else {
10395                         let err = unsafe { o.contents.err };
10396                         unsafe { o.contents.err = std::ptr::null_mut(); }
10397                         CResult_ChannelAnnouncementDecodeErrorZPtr { err }
10398                 };
10399                 Self {
10400                         contents,
10401                         result_ok: o.result_ok,
10402                 }
10403         }
10404 }
10405 impl Clone for CResult_ChannelAnnouncementDecodeErrorZ {
10406         fn clone(&self) -> Self {
10407                 if self.result_ok {
10408                         Self { result_ok: true, contents: CResult_ChannelAnnouncementDecodeErrorZPtr {
10409                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ChannelAnnouncement>::clone(unsafe { &*self.contents.result })))
10410                         } }
10411                 } else {
10412                         Self { result_ok: false, contents: CResult_ChannelAnnouncementDecodeErrorZPtr {
10413                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
10414                         } }
10415                 }
10416         }
10417 }
10418 #[no_mangle]
10419 /// Creates a new CResult_ChannelAnnouncementDecodeErrorZ which has the same data as `orig`
10420 /// but with all dynamically-allocated buffers duplicated in new buffers.
10421 pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_clone(orig: &CResult_ChannelAnnouncementDecodeErrorZ) -> CResult_ChannelAnnouncementDecodeErrorZ { orig.clone() }
10422 #[repr(C)]
10423 /// The contents of CResult_UnsignedChannelUpdateDecodeErrorZ
10424 pub union CResult_UnsignedChannelUpdateDecodeErrorZPtr {
10425         /// A pointer to the contents in the success state.
10426         /// Reading from this pointer when `result_ok` is not set is undefined.
10427         pub result: *mut crate::lightning::ln::msgs::UnsignedChannelUpdate,
10428         /// A pointer to the contents in the error state.
10429         /// Reading from this pointer when `result_ok` is set is undefined.
10430         pub err: *mut crate::lightning::ln::msgs::DecodeError,
10431 }
10432 #[repr(C)]
10433 /// A CResult_UnsignedChannelUpdateDecodeErrorZ represents the result of a fallible operation,
10434 /// containing a crate::lightning::ln::msgs::UnsignedChannelUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
10435 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10436 pub struct CResult_UnsignedChannelUpdateDecodeErrorZ {
10437         /// The contents of this CResult_UnsignedChannelUpdateDecodeErrorZ, accessible via either
10438         /// `err` or `result` depending on the state of `result_ok`.
10439         pub contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr,
10440         /// Whether this CResult_UnsignedChannelUpdateDecodeErrorZ represents a success state.
10441         pub result_ok: bool,
10442 }
10443 #[no_mangle]
10444 /// Creates a new CResult_UnsignedChannelUpdateDecodeErrorZ in the success state.
10445 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UnsignedChannelUpdate) -> CResult_UnsignedChannelUpdateDecodeErrorZ {
10446         CResult_UnsignedChannelUpdateDecodeErrorZ {
10447                 contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr {
10448                         result: Box::into_raw(Box::new(o)),
10449                 },
10450                 result_ok: true,
10451         }
10452 }
10453 #[no_mangle]
10454 /// Creates a new CResult_UnsignedChannelUpdateDecodeErrorZ in the error state.
10455 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UnsignedChannelUpdateDecodeErrorZ {
10456         CResult_UnsignedChannelUpdateDecodeErrorZ {
10457                 contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr {
10458                         err: Box::into_raw(Box::new(e)),
10459                 },
10460                 result_ok: false,
10461         }
10462 }
10463 #[no_mangle]
10464 /// Frees any resources used by the CResult_UnsignedChannelUpdateDecodeErrorZ.
10465 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_free(_res: CResult_UnsignedChannelUpdateDecodeErrorZ) { }
10466 impl Drop for CResult_UnsignedChannelUpdateDecodeErrorZ {
10467         fn drop(&mut self) {
10468                 if self.result_ok {
10469                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
10470                                 let _ = unsafe { Box::from_raw(self.contents.result) };
10471                         }
10472                 } else {
10473                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
10474                                 let _ = unsafe { Box::from_raw(self.contents.err) };
10475                         }
10476                 }
10477         }
10478 }
10479 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedChannelUpdate, crate::lightning::ln::msgs::DecodeError>> for CResult_UnsignedChannelUpdateDecodeErrorZ {
10480         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedChannelUpdate, crate::lightning::ln::msgs::DecodeError>) -> Self {
10481                 let contents = if o.result_ok {
10482                         let result = unsafe { o.contents.result };
10483                         unsafe { o.contents.result = std::ptr::null_mut() };
10484                         CResult_UnsignedChannelUpdateDecodeErrorZPtr { result }
10485                 } else {
10486                         let err = unsafe { o.contents.err };
10487                         unsafe { o.contents.err = std::ptr::null_mut(); }
10488                         CResult_UnsignedChannelUpdateDecodeErrorZPtr { err }
10489                 };
10490                 Self {
10491                         contents,
10492                         result_ok: o.result_ok,
10493                 }
10494         }
10495 }
10496 impl Clone for CResult_UnsignedChannelUpdateDecodeErrorZ {
10497         fn clone(&self) -> Self {
10498                 if self.result_ok {
10499                         Self { result_ok: true, contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr {
10500                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UnsignedChannelUpdate>::clone(unsafe { &*self.contents.result })))
10501                         } }
10502                 } else {
10503                         Self { result_ok: false, contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr {
10504                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
10505                         } }
10506                 }
10507         }
10508 }
10509 #[no_mangle]
10510 /// Creates a new CResult_UnsignedChannelUpdateDecodeErrorZ which has the same data as `orig`
10511 /// but with all dynamically-allocated buffers duplicated in new buffers.
10512 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_clone(orig: &CResult_UnsignedChannelUpdateDecodeErrorZ) -> CResult_UnsignedChannelUpdateDecodeErrorZ { orig.clone() }
10513 #[repr(C)]
10514 /// The contents of CResult_ChannelUpdateDecodeErrorZ
10515 pub union CResult_ChannelUpdateDecodeErrorZPtr {
10516         /// A pointer to the contents in the success state.
10517         /// Reading from this pointer when `result_ok` is not set is undefined.
10518         pub result: *mut crate::lightning::ln::msgs::ChannelUpdate,
10519         /// A pointer to the contents in the error state.
10520         /// Reading from this pointer when `result_ok` is set is undefined.
10521         pub err: *mut crate::lightning::ln::msgs::DecodeError,
10522 }
10523 #[repr(C)]
10524 /// A CResult_ChannelUpdateDecodeErrorZ represents the result of a fallible operation,
10525 /// containing a crate::lightning::ln::msgs::ChannelUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
10526 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10527 pub struct CResult_ChannelUpdateDecodeErrorZ {
10528         /// The contents of this CResult_ChannelUpdateDecodeErrorZ, accessible via either
10529         /// `err` or `result` depending on the state of `result_ok`.
10530         pub contents: CResult_ChannelUpdateDecodeErrorZPtr,
10531         /// Whether this CResult_ChannelUpdateDecodeErrorZ represents a success state.
10532         pub result_ok: bool,
10533 }
10534 #[no_mangle]
10535 /// Creates a new CResult_ChannelUpdateDecodeErrorZ in the success state.
10536 pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ChannelUpdate) -> CResult_ChannelUpdateDecodeErrorZ {
10537         CResult_ChannelUpdateDecodeErrorZ {
10538                 contents: CResult_ChannelUpdateDecodeErrorZPtr {
10539                         result: Box::into_raw(Box::new(o)),
10540                 },
10541                 result_ok: true,
10542         }
10543 }
10544 #[no_mangle]
10545 /// Creates a new CResult_ChannelUpdateDecodeErrorZ in the error state.
10546 pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelUpdateDecodeErrorZ {
10547         CResult_ChannelUpdateDecodeErrorZ {
10548                 contents: CResult_ChannelUpdateDecodeErrorZPtr {
10549                         err: Box::into_raw(Box::new(e)),
10550                 },
10551                 result_ok: false,
10552         }
10553 }
10554 #[no_mangle]
10555 /// Frees any resources used by the CResult_ChannelUpdateDecodeErrorZ.
10556 pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_free(_res: CResult_ChannelUpdateDecodeErrorZ) { }
10557 impl Drop for CResult_ChannelUpdateDecodeErrorZ {
10558         fn drop(&mut self) {
10559                 if self.result_ok {
10560                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
10561                                 let _ = unsafe { Box::from_raw(self.contents.result) };
10562                         }
10563                 } else {
10564                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
10565                                 let _ = unsafe { Box::from_raw(self.contents.err) };
10566                         }
10567                 }
10568         }
10569 }
10570 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelUpdate, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelUpdateDecodeErrorZ {
10571         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelUpdate, crate::lightning::ln::msgs::DecodeError>) -> Self {
10572                 let contents = if o.result_ok {
10573                         let result = unsafe { o.contents.result };
10574                         unsafe { o.contents.result = std::ptr::null_mut() };
10575                         CResult_ChannelUpdateDecodeErrorZPtr { result }
10576                 } else {
10577                         let err = unsafe { o.contents.err };
10578                         unsafe { o.contents.err = std::ptr::null_mut(); }
10579                         CResult_ChannelUpdateDecodeErrorZPtr { err }
10580                 };
10581                 Self {
10582                         contents,
10583                         result_ok: o.result_ok,
10584                 }
10585         }
10586 }
10587 impl Clone for CResult_ChannelUpdateDecodeErrorZ {
10588         fn clone(&self) -> Self {
10589                 if self.result_ok {
10590                         Self { result_ok: true, contents: CResult_ChannelUpdateDecodeErrorZPtr {
10591                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ChannelUpdate>::clone(unsafe { &*self.contents.result })))
10592                         } }
10593                 } else {
10594                         Self { result_ok: false, contents: CResult_ChannelUpdateDecodeErrorZPtr {
10595                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
10596                         } }
10597                 }
10598         }
10599 }
10600 #[no_mangle]
10601 /// Creates a new CResult_ChannelUpdateDecodeErrorZ which has the same data as `orig`
10602 /// but with all dynamically-allocated buffers duplicated in new buffers.
10603 pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_clone(orig: &CResult_ChannelUpdateDecodeErrorZ) -> CResult_ChannelUpdateDecodeErrorZ { orig.clone() }
10604 #[repr(C)]
10605 /// The contents of CResult_ErrorMessageDecodeErrorZ
10606 pub union CResult_ErrorMessageDecodeErrorZPtr {
10607         /// A pointer to the contents in the success state.
10608         /// Reading from this pointer when `result_ok` is not set is undefined.
10609         pub result: *mut crate::lightning::ln::msgs::ErrorMessage,
10610         /// A pointer to the contents in the error state.
10611         /// Reading from this pointer when `result_ok` is set is undefined.
10612         pub err: *mut crate::lightning::ln::msgs::DecodeError,
10613 }
10614 #[repr(C)]
10615 /// A CResult_ErrorMessageDecodeErrorZ represents the result of a fallible operation,
10616 /// containing a crate::lightning::ln::msgs::ErrorMessage on success and a crate::lightning::ln::msgs::DecodeError on failure.
10617 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10618 pub struct CResult_ErrorMessageDecodeErrorZ {
10619         /// The contents of this CResult_ErrorMessageDecodeErrorZ, accessible via either
10620         /// `err` or `result` depending on the state of `result_ok`.
10621         pub contents: CResult_ErrorMessageDecodeErrorZPtr,
10622         /// Whether this CResult_ErrorMessageDecodeErrorZ represents a success state.
10623         pub result_ok: bool,
10624 }
10625 #[no_mangle]
10626 /// Creates a new CResult_ErrorMessageDecodeErrorZ in the success state.
10627 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ErrorMessage) -> CResult_ErrorMessageDecodeErrorZ {
10628         CResult_ErrorMessageDecodeErrorZ {
10629                 contents: CResult_ErrorMessageDecodeErrorZPtr {
10630                         result: Box::into_raw(Box::new(o)),
10631                 },
10632                 result_ok: true,
10633         }
10634 }
10635 #[no_mangle]
10636 /// Creates a new CResult_ErrorMessageDecodeErrorZ in the error state.
10637 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ErrorMessageDecodeErrorZ {
10638         CResult_ErrorMessageDecodeErrorZ {
10639                 contents: CResult_ErrorMessageDecodeErrorZPtr {
10640                         err: Box::into_raw(Box::new(e)),
10641                 },
10642                 result_ok: false,
10643         }
10644 }
10645 #[no_mangle]
10646 /// Frees any resources used by the CResult_ErrorMessageDecodeErrorZ.
10647 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_free(_res: CResult_ErrorMessageDecodeErrorZ) { }
10648 impl Drop for CResult_ErrorMessageDecodeErrorZ {
10649         fn drop(&mut self) {
10650                 if self.result_ok {
10651                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
10652                                 let _ = unsafe { Box::from_raw(self.contents.result) };
10653                         }
10654                 } else {
10655                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
10656                                 let _ = unsafe { Box::from_raw(self.contents.err) };
10657                         }
10658                 }
10659         }
10660 }
10661 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ErrorMessage, crate::lightning::ln::msgs::DecodeError>> for CResult_ErrorMessageDecodeErrorZ {
10662         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ErrorMessage, crate::lightning::ln::msgs::DecodeError>) -> Self {
10663                 let contents = if o.result_ok {
10664                         let result = unsafe { o.contents.result };
10665                         unsafe { o.contents.result = std::ptr::null_mut() };
10666                         CResult_ErrorMessageDecodeErrorZPtr { result }
10667                 } else {
10668                         let err = unsafe { o.contents.err };
10669                         unsafe { o.contents.err = std::ptr::null_mut(); }
10670                         CResult_ErrorMessageDecodeErrorZPtr { err }
10671                 };
10672                 Self {
10673                         contents,
10674                         result_ok: o.result_ok,
10675                 }
10676         }
10677 }
10678 impl Clone for CResult_ErrorMessageDecodeErrorZ {
10679         fn clone(&self) -> Self {
10680                 if self.result_ok {
10681                         Self { result_ok: true, contents: CResult_ErrorMessageDecodeErrorZPtr {
10682                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ErrorMessage>::clone(unsafe { &*self.contents.result })))
10683                         } }
10684                 } else {
10685                         Self { result_ok: false, contents: CResult_ErrorMessageDecodeErrorZPtr {
10686                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
10687                         } }
10688                 }
10689         }
10690 }
10691 #[no_mangle]
10692 /// Creates a new CResult_ErrorMessageDecodeErrorZ which has the same data as `orig`
10693 /// but with all dynamically-allocated buffers duplicated in new buffers.
10694 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_clone(orig: &CResult_ErrorMessageDecodeErrorZ) -> CResult_ErrorMessageDecodeErrorZ { orig.clone() }
10695 #[repr(C)]
10696 /// The contents of CResult_UnsignedNodeAnnouncementDecodeErrorZ
10697 pub union CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
10698         /// A pointer to the contents in the success state.
10699         /// Reading from this pointer when `result_ok` is not set is undefined.
10700         pub result: *mut crate::lightning::ln::msgs::UnsignedNodeAnnouncement,
10701         /// A pointer to the contents in the error state.
10702         /// Reading from this pointer when `result_ok` is set is undefined.
10703         pub err: *mut crate::lightning::ln::msgs::DecodeError,
10704 }
10705 #[repr(C)]
10706 /// A CResult_UnsignedNodeAnnouncementDecodeErrorZ represents the result of a fallible operation,
10707 /// containing a crate::lightning::ln::msgs::UnsignedNodeAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
10708 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10709 pub struct CResult_UnsignedNodeAnnouncementDecodeErrorZ {
10710         /// The contents of this CResult_UnsignedNodeAnnouncementDecodeErrorZ, accessible via either
10711         /// `err` or `result` depending on the state of `result_ok`.
10712         pub contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr,
10713         /// Whether this CResult_UnsignedNodeAnnouncementDecodeErrorZ represents a success state.
10714         pub result_ok: bool,
10715 }
10716 #[no_mangle]
10717 /// Creates a new CResult_UnsignedNodeAnnouncementDecodeErrorZ in the success state.
10718 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UnsignedNodeAnnouncement) -> CResult_UnsignedNodeAnnouncementDecodeErrorZ {
10719         CResult_UnsignedNodeAnnouncementDecodeErrorZ {
10720                 contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
10721                         result: Box::into_raw(Box::new(o)),
10722                 },
10723                 result_ok: true,
10724         }
10725 }
10726 #[no_mangle]
10727 /// Creates a new CResult_UnsignedNodeAnnouncementDecodeErrorZ in the error state.
10728 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UnsignedNodeAnnouncementDecodeErrorZ {
10729         CResult_UnsignedNodeAnnouncementDecodeErrorZ {
10730                 contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
10731                         err: Box::into_raw(Box::new(e)),
10732                 },
10733                 result_ok: false,
10734         }
10735 }
10736 #[no_mangle]
10737 /// Frees any resources used by the CResult_UnsignedNodeAnnouncementDecodeErrorZ.
10738 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_free(_res: CResult_UnsignedNodeAnnouncementDecodeErrorZ) { }
10739 impl Drop for CResult_UnsignedNodeAnnouncementDecodeErrorZ {
10740         fn drop(&mut self) {
10741                 if self.result_ok {
10742                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
10743                                 let _ = unsafe { Box::from_raw(self.contents.result) };
10744                         }
10745                 } else {
10746                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
10747                                 let _ = unsafe { Box::from_raw(self.contents.err) };
10748                         }
10749                 }
10750         }
10751 }
10752 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedNodeAnnouncement, crate::lightning::ln::msgs::DecodeError>> for CResult_UnsignedNodeAnnouncementDecodeErrorZ {
10753         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedNodeAnnouncement, crate::lightning::ln::msgs::DecodeError>) -> Self {
10754                 let contents = if o.result_ok {
10755                         let result = unsafe { o.contents.result };
10756                         unsafe { o.contents.result = std::ptr::null_mut() };
10757                         CResult_UnsignedNodeAnnouncementDecodeErrorZPtr { result }
10758                 } else {
10759                         let err = unsafe { o.contents.err };
10760                         unsafe { o.contents.err = std::ptr::null_mut(); }
10761                         CResult_UnsignedNodeAnnouncementDecodeErrorZPtr { err }
10762                 };
10763                 Self {
10764                         contents,
10765                         result_ok: o.result_ok,
10766                 }
10767         }
10768 }
10769 impl Clone for CResult_UnsignedNodeAnnouncementDecodeErrorZ {
10770         fn clone(&self) -> Self {
10771                 if self.result_ok {
10772                         Self { result_ok: true, contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
10773                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UnsignedNodeAnnouncement>::clone(unsafe { &*self.contents.result })))
10774                         } }
10775                 } else {
10776                         Self { result_ok: false, contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
10777                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
10778                         } }
10779                 }
10780         }
10781 }
10782 #[no_mangle]
10783 /// Creates a new CResult_UnsignedNodeAnnouncementDecodeErrorZ which has the same data as `orig`
10784 /// but with all dynamically-allocated buffers duplicated in new buffers.
10785 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone(orig: &CResult_UnsignedNodeAnnouncementDecodeErrorZ) -> CResult_UnsignedNodeAnnouncementDecodeErrorZ { orig.clone() }
10786 #[repr(C)]
10787 /// The contents of CResult_NodeAnnouncementDecodeErrorZ
10788 pub union CResult_NodeAnnouncementDecodeErrorZPtr {
10789         /// A pointer to the contents in the success state.
10790         /// Reading from this pointer when `result_ok` is not set is undefined.
10791         pub result: *mut crate::lightning::ln::msgs::NodeAnnouncement,
10792         /// A pointer to the contents in the error state.
10793         /// Reading from this pointer when `result_ok` is set is undefined.
10794         pub err: *mut crate::lightning::ln::msgs::DecodeError,
10795 }
10796 #[repr(C)]
10797 /// A CResult_NodeAnnouncementDecodeErrorZ represents the result of a fallible operation,
10798 /// containing a crate::lightning::ln::msgs::NodeAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
10799 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10800 pub struct CResult_NodeAnnouncementDecodeErrorZ {
10801         /// The contents of this CResult_NodeAnnouncementDecodeErrorZ, accessible via either
10802         /// `err` or `result` depending on the state of `result_ok`.
10803         pub contents: CResult_NodeAnnouncementDecodeErrorZPtr,
10804         /// Whether this CResult_NodeAnnouncementDecodeErrorZ represents a success state.
10805         pub result_ok: bool,
10806 }
10807 #[no_mangle]
10808 /// Creates a new CResult_NodeAnnouncementDecodeErrorZ in the success state.
10809 pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_ok(o: crate::lightning::ln::msgs::NodeAnnouncement) -> CResult_NodeAnnouncementDecodeErrorZ {
10810         CResult_NodeAnnouncementDecodeErrorZ {
10811                 contents: CResult_NodeAnnouncementDecodeErrorZPtr {
10812                         result: Box::into_raw(Box::new(o)),
10813                 },
10814                 result_ok: true,
10815         }
10816 }
10817 #[no_mangle]
10818 /// Creates a new CResult_NodeAnnouncementDecodeErrorZ in the error state.
10819 pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeAnnouncementDecodeErrorZ {
10820         CResult_NodeAnnouncementDecodeErrorZ {
10821                 contents: CResult_NodeAnnouncementDecodeErrorZPtr {
10822                         err: Box::into_raw(Box::new(e)),
10823                 },
10824                 result_ok: false,
10825         }
10826 }
10827 #[no_mangle]
10828 /// Frees any resources used by the CResult_NodeAnnouncementDecodeErrorZ.
10829 pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_free(_res: CResult_NodeAnnouncementDecodeErrorZ) { }
10830 impl Drop for CResult_NodeAnnouncementDecodeErrorZ {
10831         fn drop(&mut self) {
10832                 if self.result_ok {
10833                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
10834                                 let _ = unsafe { Box::from_raw(self.contents.result) };
10835                         }
10836                 } else {
10837                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
10838                                 let _ = unsafe { Box::from_raw(self.contents.err) };
10839                         }
10840                 }
10841         }
10842 }
10843 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::NodeAnnouncement, crate::lightning::ln::msgs::DecodeError>> for CResult_NodeAnnouncementDecodeErrorZ {
10844         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::NodeAnnouncement, crate::lightning::ln::msgs::DecodeError>) -> Self {
10845                 let contents = if o.result_ok {
10846                         let result = unsafe { o.contents.result };
10847                         unsafe { o.contents.result = std::ptr::null_mut() };
10848                         CResult_NodeAnnouncementDecodeErrorZPtr { result }
10849                 } else {
10850                         let err = unsafe { o.contents.err };
10851                         unsafe { o.contents.err = std::ptr::null_mut(); }
10852                         CResult_NodeAnnouncementDecodeErrorZPtr { err }
10853                 };
10854                 Self {
10855                         contents,
10856                         result_ok: o.result_ok,
10857                 }
10858         }
10859 }
10860 impl Clone for CResult_NodeAnnouncementDecodeErrorZ {
10861         fn clone(&self) -> Self {
10862                 if self.result_ok {
10863                         Self { result_ok: true, contents: CResult_NodeAnnouncementDecodeErrorZPtr {
10864                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::NodeAnnouncement>::clone(unsafe { &*self.contents.result })))
10865                         } }
10866                 } else {
10867                         Self { result_ok: false, contents: CResult_NodeAnnouncementDecodeErrorZPtr {
10868                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
10869                         } }
10870                 }
10871         }
10872 }
10873 #[no_mangle]
10874 /// Creates a new CResult_NodeAnnouncementDecodeErrorZ which has the same data as `orig`
10875 /// but with all dynamically-allocated buffers duplicated in new buffers.
10876 pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_clone(orig: &CResult_NodeAnnouncementDecodeErrorZ) -> CResult_NodeAnnouncementDecodeErrorZ { orig.clone() }
10877 #[repr(C)]
10878 /// The contents of CResult_QueryShortChannelIdsDecodeErrorZ
10879 pub union CResult_QueryShortChannelIdsDecodeErrorZPtr {
10880         /// A pointer to the contents in the success state.
10881         /// Reading from this pointer when `result_ok` is not set is undefined.
10882         pub result: *mut crate::lightning::ln::msgs::QueryShortChannelIds,
10883         /// A pointer to the contents in the error state.
10884         /// Reading from this pointer when `result_ok` is set is undefined.
10885         pub err: *mut crate::lightning::ln::msgs::DecodeError,
10886 }
10887 #[repr(C)]
10888 /// A CResult_QueryShortChannelIdsDecodeErrorZ represents the result of a fallible operation,
10889 /// containing a crate::lightning::ln::msgs::QueryShortChannelIds on success and a crate::lightning::ln::msgs::DecodeError on failure.
10890 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10891 pub struct CResult_QueryShortChannelIdsDecodeErrorZ {
10892         /// The contents of this CResult_QueryShortChannelIdsDecodeErrorZ, accessible via either
10893         /// `err` or `result` depending on the state of `result_ok`.
10894         pub contents: CResult_QueryShortChannelIdsDecodeErrorZPtr,
10895         /// Whether this CResult_QueryShortChannelIdsDecodeErrorZ represents a success state.
10896         pub result_ok: bool,
10897 }
10898 #[no_mangle]
10899 /// Creates a new CResult_QueryShortChannelIdsDecodeErrorZ in the success state.
10900 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_ok(o: crate::lightning::ln::msgs::QueryShortChannelIds) -> CResult_QueryShortChannelIdsDecodeErrorZ {
10901         CResult_QueryShortChannelIdsDecodeErrorZ {
10902                 contents: CResult_QueryShortChannelIdsDecodeErrorZPtr {
10903                         result: Box::into_raw(Box::new(o)),
10904                 },
10905                 result_ok: true,
10906         }
10907 }
10908 #[no_mangle]
10909 /// Creates a new CResult_QueryShortChannelIdsDecodeErrorZ in the error state.
10910 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_QueryShortChannelIdsDecodeErrorZ {
10911         CResult_QueryShortChannelIdsDecodeErrorZ {
10912                 contents: CResult_QueryShortChannelIdsDecodeErrorZPtr {
10913                         err: Box::into_raw(Box::new(e)),
10914                 },
10915                 result_ok: false,
10916         }
10917 }
10918 #[no_mangle]
10919 /// Frees any resources used by the CResult_QueryShortChannelIdsDecodeErrorZ.
10920 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_free(_res: CResult_QueryShortChannelIdsDecodeErrorZ) { }
10921 impl Drop for CResult_QueryShortChannelIdsDecodeErrorZ {
10922         fn drop(&mut self) {
10923                 if self.result_ok {
10924                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
10925                                 let _ = unsafe { Box::from_raw(self.contents.result) };
10926                         }
10927                 } else {
10928                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
10929                                 let _ = unsafe { Box::from_raw(self.contents.err) };
10930                         }
10931                 }
10932         }
10933 }
10934 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::QueryShortChannelIds, crate::lightning::ln::msgs::DecodeError>> for CResult_QueryShortChannelIdsDecodeErrorZ {
10935         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::QueryShortChannelIds, crate::lightning::ln::msgs::DecodeError>) -> Self {
10936                 let contents = if o.result_ok {
10937                         let result = unsafe { o.contents.result };
10938                         unsafe { o.contents.result = std::ptr::null_mut() };
10939                         CResult_QueryShortChannelIdsDecodeErrorZPtr { result }
10940                 } else {
10941                         let err = unsafe { o.contents.err };
10942                         unsafe { o.contents.err = std::ptr::null_mut(); }
10943                         CResult_QueryShortChannelIdsDecodeErrorZPtr { err }
10944                 };
10945                 Self {
10946                         contents,
10947                         result_ok: o.result_ok,
10948                 }
10949         }
10950 }
10951 impl Clone for CResult_QueryShortChannelIdsDecodeErrorZ {
10952         fn clone(&self) -> Self {
10953                 if self.result_ok {
10954                         Self { result_ok: true, contents: CResult_QueryShortChannelIdsDecodeErrorZPtr {
10955                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::QueryShortChannelIds>::clone(unsafe { &*self.contents.result })))
10956                         } }
10957                 } else {
10958                         Self { result_ok: false, contents: CResult_QueryShortChannelIdsDecodeErrorZPtr {
10959                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
10960                         } }
10961                 }
10962         }
10963 }
10964 #[no_mangle]
10965 /// Creates a new CResult_QueryShortChannelIdsDecodeErrorZ which has the same data as `orig`
10966 /// but with all dynamically-allocated buffers duplicated in new buffers.
10967 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_clone(orig: &CResult_QueryShortChannelIdsDecodeErrorZ) -> CResult_QueryShortChannelIdsDecodeErrorZ { orig.clone() }
10968 #[repr(C)]
10969 /// The contents of CResult_ReplyShortChannelIdsEndDecodeErrorZ
10970 pub union CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
10971         /// A pointer to the contents in the success state.
10972         /// Reading from this pointer when `result_ok` is not set is undefined.
10973         pub result: *mut crate::lightning::ln::msgs::ReplyShortChannelIdsEnd,
10974         /// A pointer to the contents in the error state.
10975         /// Reading from this pointer when `result_ok` is set is undefined.
10976         pub err: *mut crate::lightning::ln::msgs::DecodeError,
10977 }
10978 #[repr(C)]
10979 /// A CResult_ReplyShortChannelIdsEndDecodeErrorZ represents the result of a fallible operation,
10980 /// containing a crate::lightning::ln::msgs::ReplyShortChannelIdsEnd on success and a crate::lightning::ln::msgs::DecodeError on failure.
10981 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10982 pub struct CResult_ReplyShortChannelIdsEndDecodeErrorZ {
10983         /// The contents of this CResult_ReplyShortChannelIdsEndDecodeErrorZ, accessible via either
10984         /// `err` or `result` depending on the state of `result_ok`.
10985         pub contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr,
10986         /// Whether this CResult_ReplyShortChannelIdsEndDecodeErrorZ represents a success state.
10987         pub result_ok: bool,
10988 }
10989 #[no_mangle]
10990 /// Creates a new CResult_ReplyShortChannelIdsEndDecodeErrorZ in the success state.
10991 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ReplyShortChannelIdsEnd) -> CResult_ReplyShortChannelIdsEndDecodeErrorZ {
10992         CResult_ReplyShortChannelIdsEndDecodeErrorZ {
10993                 contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
10994                         result: Box::into_raw(Box::new(o)),
10995                 },
10996                 result_ok: true,
10997         }
10998 }
10999 #[no_mangle]
11000 /// Creates a new CResult_ReplyShortChannelIdsEndDecodeErrorZ in the error state.
11001 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ReplyShortChannelIdsEndDecodeErrorZ {
11002         CResult_ReplyShortChannelIdsEndDecodeErrorZ {
11003                 contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
11004                         err: Box::into_raw(Box::new(e)),
11005                 },
11006                 result_ok: false,
11007         }
11008 }
11009 #[no_mangle]
11010 /// Frees any resources used by the CResult_ReplyShortChannelIdsEndDecodeErrorZ.
11011 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_free(_res: CResult_ReplyShortChannelIdsEndDecodeErrorZ) { }
11012 impl Drop for CResult_ReplyShortChannelIdsEndDecodeErrorZ {
11013         fn drop(&mut self) {
11014                 if self.result_ok {
11015                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
11016                                 let _ = unsafe { Box::from_raw(self.contents.result) };
11017                         }
11018                 } else {
11019                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
11020                                 let _ = unsafe { Box::from_raw(self.contents.err) };
11021                         }
11022                 }
11023         }
11024 }
11025 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ReplyShortChannelIdsEnd, crate::lightning::ln::msgs::DecodeError>> for CResult_ReplyShortChannelIdsEndDecodeErrorZ {
11026         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ReplyShortChannelIdsEnd, crate::lightning::ln::msgs::DecodeError>) -> Self {
11027                 let contents = if o.result_ok {
11028                         let result = unsafe { o.contents.result };
11029                         unsafe { o.contents.result = std::ptr::null_mut() };
11030                         CResult_ReplyShortChannelIdsEndDecodeErrorZPtr { result }
11031                 } else {
11032                         let err = unsafe { o.contents.err };
11033                         unsafe { o.contents.err = std::ptr::null_mut(); }
11034                         CResult_ReplyShortChannelIdsEndDecodeErrorZPtr { err }
11035                 };
11036                 Self {
11037                         contents,
11038                         result_ok: o.result_ok,
11039                 }
11040         }
11041 }
11042 impl Clone for CResult_ReplyShortChannelIdsEndDecodeErrorZ {
11043         fn clone(&self) -> Self {
11044                 if self.result_ok {
11045                         Self { result_ok: true, contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
11046                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ReplyShortChannelIdsEnd>::clone(unsafe { &*self.contents.result })))
11047                         } }
11048                 } else {
11049                         Self { result_ok: false, contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
11050                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
11051                         } }
11052                 }
11053         }
11054 }
11055 #[no_mangle]
11056 /// Creates a new CResult_ReplyShortChannelIdsEndDecodeErrorZ which has the same data as `orig`
11057 /// but with all dynamically-allocated buffers duplicated in new buffers.
11058 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone(orig: &CResult_ReplyShortChannelIdsEndDecodeErrorZ) -> CResult_ReplyShortChannelIdsEndDecodeErrorZ { orig.clone() }
11059 #[repr(C)]
11060 /// The contents of CResult_QueryChannelRangeDecodeErrorZ
11061 pub union CResult_QueryChannelRangeDecodeErrorZPtr {
11062         /// A pointer to the contents in the success state.
11063         /// Reading from this pointer when `result_ok` is not set is undefined.
11064         pub result: *mut crate::lightning::ln::msgs::QueryChannelRange,
11065         /// A pointer to the contents in the error state.
11066         /// Reading from this pointer when `result_ok` is set is undefined.
11067         pub err: *mut crate::lightning::ln::msgs::DecodeError,
11068 }
11069 #[repr(C)]
11070 /// A CResult_QueryChannelRangeDecodeErrorZ represents the result of a fallible operation,
11071 /// containing a crate::lightning::ln::msgs::QueryChannelRange on success and a crate::lightning::ln::msgs::DecodeError on failure.
11072 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11073 pub struct CResult_QueryChannelRangeDecodeErrorZ {
11074         /// The contents of this CResult_QueryChannelRangeDecodeErrorZ, accessible via either
11075         /// `err` or `result` depending on the state of `result_ok`.
11076         pub contents: CResult_QueryChannelRangeDecodeErrorZPtr,
11077         /// Whether this CResult_QueryChannelRangeDecodeErrorZ represents a success state.
11078         pub result_ok: bool,
11079 }
11080 #[no_mangle]
11081 /// Creates a new CResult_QueryChannelRangeDecodeErrorZ in the success state.
11082 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_ok(o: crate::lightning::ln::msgs::QueryChannelRange) -> CResult_QueryChannelRangeDecodeErrorZ {
11083         CResult_QueryChannelRangeDecodeErrorZ {
11084                 contents: CResult_QueryChannelRangeDecodeErrorZPtr {
11085                         result: Box::into_raw(Box::new(o)),
11086                 },
11087                 result_ok: true,
11088         }
11089 }
11090 #[no_mangle]
11091 /// Creates a new CResult_QueryChannelRangeDecodeErrorZ in the error state.
11092 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_QueryChannelRangeDecodeErrorZ {
11093         CResult_QueryChannelRangeDecodeErrorZ {
11094                 contents: CResult_QueryChannelRangeDecodeErrorZPtr {
11095                         err: Box::into_raw(Box::new(e)),
11096                 },
11097                 result_ok: false,
11098         }
11099 }
11100 #[no_mangle]
11101 /// Frees any resources used by the CResult_QueryChannelRangeDecodeErrorZ.
11102 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_free(_res: CResult_QueryChannelRangeDecodeErrorZ) { }
11103 impl Drop for CResult_QueryChannelRangeDecodeErrorZ {
11104         fn drop(&mut self) {
11105                 if self.result_ok {
11106                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
11107                                 let _ = unsafe { Box::from_raw(self.contents.result) };
11108                         }
11109                 } else {
11110                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
11111                                 let _ = unsafe { Box::from_raw(self.contents.err) };
11112                         }
11113                 }
11114         }
11115 }
11116 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::QueryChannelRange, crate::lightning::ln::msgs::DecodeError>> for CResult_QueryChannelRangeDecodeErrorZ {
11117         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::QueryChannelRange, crate::lightning::ln::msgs::DecodeError>) -> Self {
11118                 let contents = if o.result_ok {
11119                         let result = unsafe { o.contents.result };
11120                         unsafe { o.contents.result = std::ptr::null_mut() };
11121                         CResult_QueryChannelRangeDecodeErrorZPtr { result }
11122                 } else {
11123                         let err = unsafe { o.contents.err };
11124                         unsafe { o.contents.err = std::ptr::null_mut(); }
11125                         CResult_QueryChannelRangeDecodeErrorZPtr { err }
11126                 };
11127                 Self {
11128                         contents,
11129                         result_ok: o.result_ok,
11130                 }
11131         }
11132 }
11133 impl Clone for CResult_QueryChannelRangeDecodeErrorZ {
11134         fn clone(&self) -> Self {
11135                 if self.result_ok {
11136                         Self { result_ok: true, contents: CResult_QueryChannelRangeDecodeErrorZPtr {
11137                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::QueryChannelRange>::clone(unsafe { &*self.contents.result })))
11138                         } }
11139                 } else {
11140                         Self { result_ok: false, contents: CResult_QueryChannelRangeDecodeErrorZPtr {
11141                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
11142                         } }
11143                 }
11144         }
11145 }
11146 #[no_mangle]
11147 /// Creates a new CResult_QueryChannelRangeDecodeErrorZ which has the same data as `orig`
11148 /// but with all dynamically-allocated buffers duplicated in new buffers.
11149 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_clone(orig: &CResult_QueryChannelRangeDecodeErrorZ) -> CResult_QueryChannelRangeDecodeErrorZ { orig.clone() }
11150 #[repr(C)]
11151 /// The contents of CResult_ReplyChannelRangeDecodeErrorZ
11152 pub union CResult_ReplyChannelRangeDecodeErrorZPtr {
11153         /// A pointer to the contents in the success state.
11154         /// Reading from this pointer when `result_ok` is not set is undefined.
11155         pub result: *mut crate::lightning::ln::msgs::ReplyChannelRange,
11156         /// A pointer to the contents in the error state.
11157         /// Reading from this pointer when `result_ok` is set is undefined.
11158         pub err: *mut crate::lightning::ln::msgs::DecodeError,
11159 }
11160 #[repr(C)]
11161 /// A CResult_ReplyChannelRangeDecodeErrorZ represents the result of a fallible operation,
11162 /// containing a crate::lightning::ln::msgs::ReplyChannelRange on success and a crate::lightning::ln::msgs::DecodeError on failure.
11163 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11164 pub struct CResult_ReplyChannelRangeDecodeErrorZ {
11165         /// The contents of this CResult_ReplyChannelRangeDecodeErrorZ, accessible via either
11166         /// `err` or `result` depending on the state of `result_ok`.
11167         pub contents: CResult_ReplyChannelRangeDecodeErrorZPtr,
11168         /// Whether this CResult_ReplyChannelRangeDecodeErrorZ represents a success state.
11169         pub result_ok: bool,
11170 }
11171 #[no_mangle]
11172 /// Creates a new CResult_ReplyChannelRangeDecodeErrorZ in the success state.
11173 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ReplyChannelRange) -> CResult_ReplyChannelRangeDecodeErrorZ {
11174         CResult_ReplyChannelRangeDecodeErrorZ {
11175                 contents: CResult_ReplyChannelRangeDecodeErrorZPtr {
11176                         result: Box::into_raw(Box::new(o)),
11177                 },
11178                 result_ok: true,
11179         }
11180 }
11181 #[no_mangle]
11182 /// Creates a new CResult_ReplyChannelRangeDecodeErrorZ in the error state.
11183 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ReplyChannelRangeDecodeErrorZ {
11184         CResult_ReplyChannelRangeDecodeErrorZ {
11185                 contents: CResult_ReplyChannelRangeDecodeErrorZPtr {
11186                         err: Box::into_raw(Box::new(e)),
11187                 },
11188                 result_ok: false,
11189         }
11190 }
11191 #[no_mangle]
11192 /// Frees any resources used by the CResult_ReplyChannelRangeDecodeErrorZ.
11193 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_free(_res: CResult_ReplyChannelRangeDecodeErrorZ) { }
11194 impl Drop for CResult_ReplyChannelRangeDecodeErrorZ {
11195         fn drop(&mut self) {
11196                 if self.result_ok {
11197                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
11198                                 let _ = unsafe { Box::from_raw(self.contents.result) };
11199                         }
11200                 } else {
11201                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
11202                                 let _ = unsafe { Box::from_raw(self.contents.err) };
11203                         }
11204                 }
11205         }
11206 }
11207 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ReplyChannelRange, crate::lightning::ln::msgs::DecodeError>> for CResult_ReplyChannelRangeDecodeErrorZ {
11208         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ReplyChannelRange, crate::lightning::ln::msgs::DecodeError>) -> Self {
11209                 let contents = if o.result_ok {
11210                         let result = unsafe { o.contents.result };
11211                         unsafe { o.contents.result = std::ptr::null_mut() };
11212                         CResult_ReplyChannelRangeDecodeErrorZPtr { result }
11213                 } else {
11214                         let err = unsafe { o.contents.err };
11215                         unsafe { o.contents.err = std::ptr::null_mut(); }
11216                         CResult_ReplyChannelRangeDecodeErrorZPtr { err }
11217                 };
11218                 Self {
11219                         contents,
11220                         result_ok: o.result_ok,
11221                 }
11222         }
11223 }
11224 impl Clone for CResult_ReplyChannelRangeDecodeErrorZ {
11225         fn clone(&self) -> Self {
11226                 if self.result_ok {
11227                         Self { result_ok: true, contents: CResult_ReplyChannelRangeDecodeErrorZPtr {
11228                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ReplyChannelRange>::clone(unsafe { &*self.contents.result })))
11229                         } }
11230                 } else {
11231                         Self { result_ok: false, contents: CResult_ReplyChannelRangeDecodeErrorZPtr {
11232                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
11233                         } }
11234                 }
11235         }
11236 }
11237 #[no_mangle]
11238 /// Creates a new CResult_ReplyChannelRangeDecodeErrorZ which has the same data as `orig`
11239 /// but with all dynamically-allocated buffers duplicated in new buffers.
11240 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_clone(orig: &CResult_ReplyChannelRangeDecodeErrorZ) -> CResult_ReplyChannelRangeDecodeErrorZ { orig.clone() }
11241 #[repr(C)]
11242 /// The contents of CResult_GossipTimestampFilterDecodeErrorZ
11243 pub union CResult_GossipTimestampFilterDecodeErrorZPtr {
11244         /// A pointer to the contents in the success state.
11245         /// Reading from this pointer when `result_ok` is not set is undefined.
11246         pub result: *mut crate::lightning::ln::msgs::GossipTimestampFilter,
11247         /// A pointer to the contents in the error state.
11248         /// Reading from this pointer when `result_ok` is set is undefined.
11249         pub err: *mut crate::lightning::ln::msgs::DecodeError,
11250 }
11251 #[repr(C)]
11252 /// A CResult_GossipTimestampFilterDecodeErrorZ represents the result of a fallible operation,
11253 /// containing a crate::lightning::ln::msgs::GossipTimestampFilter on success and a crate::lightning::ln::msgs::DecodeError on failure.
11254 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11255 pub struct CResult_GossipTimestampFilterDecodeErrorZ {
11256         /// The contents of this CResult_GossipTimestampFilterDecodeErrorZ, accessible via either
11257         /// `err` or `result` depending on the state of `result_ok`.
11258         pub contents: CResult_GossipTimestampFilterDecodeErrorZPtr,
11259         /// Whether this CResult_GossipTimestampFilterDecodeErrorZ represents a success state.
11260         pub result_ok: bool,
11261 }
11262 #[no_mangle]
11263 /// Creates a new CResult_GossipTimestampFilterDecodeErrorZ in the success state.
11264 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_ok(o: crate::lightning::ln::msgs::GossipTimestampFilter) -> CResult_GossipTimestampFilterDecodeErrorZ {
11265         CResult_GossipTimestampFilterDecodeErrorZ {
11266                 contents: CResult_GossipTimestampFilterDecodeErrorZPtr {
11267                         result: Box::into_raw(Box::new(o)),
11268                 },
11269                 result_ok: true,
11270         }
11271 }
11272 #[no_mangle]
11273 /// Creates a new CResult_GossipTimestampFilterDecodeErrorZ in the error state.
11274 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_GossipTimestampFilterDecodeErrorZ {
11275         CResult_GossipTimestampFilterDecodeErrorZ {
11276                 contents: CResult_GossipTimestampFilterDecodeErrorZPtr {
11277                         err: Box::into_raw(Box::new(e)),
11278                 },
11279                 result_ok: false,
11280         }
11281 }
11282 #[no_mangle]
11283 /// Frees any resources used by the CResult_GossipTimestampFilterDecodeErrorZ.
11284 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_free(_res: CResult_GossipTimestampFilterDecodeErrorZ) { }
11285 impl Drop for CResult_GossipTimestampFilterDecodeErrorZ {
11286         fn drop(&mut self) {
11287                 if self.result_ok {
11288                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
11289                                 let _ = unsafe { Box::from_raw(self.contents.result) };
11290                         }
11291                 } else {
11292                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
11293                                 let _ = unsafe { Box::from_raw(self.contents.err) };
11294                         }
11295                 }
11296         }
11297 }
11298 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::GossipTimestampFilter, crate::lightning::ln::msgs::DecodeError>> for CResult_GossipTimestampFilterDecodeErrorZ {
11299         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::GossipTimestampFilter, crate::lightning::ln::msgs::DecodeError>) -> Self {
11300                 let contents = if o.result_ok {
11301                         let result = unsafe { o.contents.result };
11302                         unsafe { o.contents.result = std::ptr::null_mut() };
11303                         CResult_GossipTimestampFilterDecodeErrorZPtr { result }
11304                 } else {
11305                         let err = unsafe { o.contents.err };
11306                         unsafe { o.contents.err = std::ptr::null_mut(); }
11307                         CResult_GossipTimestampFilterDecodeErrorZPtr { err }
11308                 };
11309                 Self {
11310                         contents,
11311                         result_ok: o.result_ok,
11312                 }
11313         }
11314 }
11315 impl Clone for CResult_GossipTimestampFilterDecodeErrorZ {
11316         fn clone(&self) -> Self {
11317                 if self.result_ok {
11318                         Self { result_ok: true, contents: CResult_GossipTimestampFilterDecodeErrorZPtr {
11319                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::GossipTimestampFilter>::clone(unsafe { &*self.contents.result })))
11320                         } }
11321                 } else {
11322                         Self { result_ok: false, contents: CResult_GossipTimestampFilterDecodeErrorZPtr {
11323                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
11324                         } }
11325                 }
11326         }
11327 }
11328 #[no_mangle]
11329 /// Creates a new CResult_GossipTimestampFilterDecodeErrorZ which has the same data as `orig`
11330 /// but with all dynamically-allocated buffers duplicated in new buffers.
11331 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_clone(orig: &CResult_GossipTimestampFilterDecodeErrorZ) -> CResult_GossipTimestampFilterDecodeErrorZ { orig.clone() }
11332 #[repr(C)]
11333 /// The contents of CResult_InvoiceSignOrCreationErrorZ
11334 pub union CResult_InvoiceSignOrCreationErrorZPtr {
11335         /// A pointer to the contents in the success state.
11336         /// Reading from this pointer when `result_ok` is not set is undefined.
11337         pub result: *mut crate::lightning_invoice::Invoice,
11338         /// A pointer to the contents in the error state.
11339         /// Reading from this pointer when `result_ok` is set is undefined.
11340         pub err: *mut crate::lightning_invoice::SignOrCreationError,
11341 }
11342 #[repr(C)]
11343 /// A CResult_InvoiceSignOrCreationErrorZ represents the result of a fallible operation,
11344 /// containing a crate::lightning_invoice::Invoice on success and a crate::lightning_invoice::SignOrCreationError on failure.
11345 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11346 pub struct CResult_InvoiceSignOrCreationErrorZ {
11347         /// The contents of this CResult_InvoiceSignOrCreationErrorZ, accessible via either
11348         /// `err` or `result` depending on the state of `result_ok`.
11349         pub contents: CResult_InvoiceSignOrCreationErrorZPtr,
11350         /// Whether this CResult_InvoiceSignOrCreationErrorZ represents a success state.
11351         pub result_ok: bool,
11352 }
11353 #[no_mangle]
11354 /// Creates a new CResult_InvoiceSignOrCreationErrorZ in the success state.
11355 pub extern "C" fn CResult_InvoiceSignOrCreationErrorZ_ok(o: crate::lightning_invoice::Invoice) -> CResult_InvoiceSignOrCreationErrorZ {
11356         CResult_InvoiceSignOrCreationErrorZ {
11357                 contents: CResult_InvoiceSignOrCreationErrorZPtr {
11358                         result: Box::into_raw(Box::new(o)),
11359                 },
11360                 result_ok: true,
11361         }
11362 }
11363 #[no_mangle]
11364 /// Creates a new CResult_InvoiceSignOrCreationErrorZ in the error state.
11365 pub extern "C" fn CResult_InvoiceSignOrCreationErrorZ_err(e: crate::lightning_invoice::SignOrCreationError) -> CResult_InvoiceSignOrCreationErrorZ {
11366         CResult_InvoiceSignOrCreationErrorZ {
11367                 contents: CResult_InvoiceSignOrCreationErrorZPtr {
11368                         err: Box::into_raw(Box::new(e)),
11369                 },
11370                 result_ok: false,
11371         }
11372 }
11373 #[no_mangle]
11374 /// Frees any resources used by the CResult_InvoiceSignOrCreationErrorZ.
11375 pub extern "C" fn CResult_InvoiceSignOrCreationErrorZ_free(_res: CResult_InvoiceSignOrCreationErrorZ) { }
11376 impl Drop for CResult_InvoiceSignOrCreationErrorZ {
11377         fn drop(&mut self) {
11378                 if self.result_ok {
11379                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
11380                                 let _ = unsafe { Box::from_raw(self.contents.result) };
11381                         }
11382                 } else {
11383                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
11384                                 let _ = unsafe { Box::from_raw(self.contents.err) };
11385                         }
11386                 }
11387         }
11388 }
11389 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::Invoice, crate::lightning_invoice::SignOrCreationError>> for CResult_InvoiceSignOrCreationErrorZ {
11390         fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::Invoice, crate::lightning_invoice::SignOrCreationError>) -> Self {
11391                 let contents = if o.result_ok {
11392                         let result = unsafe { o.contents.result };
11393                         unsafe { o.contents.result = std::ptr::null_mut() };
11394                         CResult_InvoiceSignOrCreationErrorZPtr { result }
11395                 } else {
11396                         let err = unsafe { o.contents.err };
11397                         unsafe { o.contents.err = std::ptr::null_mut(); }
11398                         CResult_InvoiceSignOrCreationErrorZPtr { err }
11399                 };
11400                 Self {
11401                         contents,
11402                         result_ok: o.result_ok,
11403                 }
11404         }
11405 }
11406 impl Clone for CResult_InvoiceSignOrCreationErrorZ {
11407         fn clone(&self) -> Self {
11408                 if self.result_ok {
11409                         Self { result_ok: true, contents: CResult_InvoiceSignOrCreationErrorZPtr {
11410                                 result: Box::into_raw(Box::new(<crate::lightning_invoice::Invoice>::clone(unsafe { &*self.contents.result })))
11411                         } }
11412                 } else {
11413                         Self { result_ok: false, contents: CResult_InvoiceSignOrCreationErrorZPtr {
11414                                 err: Box::into_raw(Box::new(<crate::lightning_invoice::SignOrCreationError>::clone(unsafe { &*self.contents.err })))
11415                         } }
11416                 }
11417         }
11418 }
11419 #[no_mangle]
11420 /// Creates a new CResult_InvoiceSignOrCreationErrorZ which has the same data as `orig`
11421 /// but with all dynamically-allocated buffers duplicated in new buffers.
11422 pub extern "C" fn CResult_InvoiceSignOrCreationErrorZ_clone(orig: &CResult_InvoiceSignOrCreationErrorZ) -> CResult_InvoiceSignOrCreationErrorZ { orig.clone() }