Regenerate auto-generated bindings
[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_NoneErrorZ
1224 pub union CResult_NoneErrorZPtr {
1225         /// Note that this value is always NULL, as there are no contents in the OK variant
1226         pub result: *mut std::ffi::c_void,
1227         /// A pointer to the contents in the error state.
1228         /// Reading from this pointer when `result_ok` is set is undefined.
1229         pub err: *mut crate::c_types::IOError,
1230 }
1231 #[repr(C)]
1232 /// A CResult_NoneErrorZ represents the result of a fallible operation,
1233 /// containing a () on success and a crate::c_types::IOError on failure.
1234 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1235 pub struct CResult_NoneErrorZ {
1236         /// The contents of this CResult_NoneErrorZ, accessible via either
1237         /// `err` or `result` depending on the state of `result_ok`.
1238         pub contents: CResult_NoneErrorZPtr,
1239         /// Whether this CResult_NoneErrorZ represents a success state.
1240         pub result_ok: bool,
1241 }
1242 #[no_mangle]
1243 /// Creates a new CResult_NoneErrorZ in the success state.
1244 pub extern "C" fn CResult_NoneErrorZ_ok() -> CResult_NoneErrorZ {
1245         CResult_NoneErrorZ {
1246                 contents: CResult_NoneErrorZPtr {
1247                         result: std::ptr::null_mut(),
1248                 },
1249                 result_ok: true,
1250         }
1251 }
1252 #[no_mangle]
1253 /// Creates a new CResult_NoneErrorZ in the error state.
1254 pub extern "C" fn CResult_NoneErrorZ_err(e: crate::c_types::IOError) -> CResult_NoneErrorZ {
1255         CResult_NoneErrorZ {
1256                 contents: CResult_NoneErrorZPtr {
1257                         err: Box::into_raw(Box::new(e)),
1258                 },
1259                 result_ok: false,
1260         }
1261 }
1262 #[no_mangle]
1263 /// Frees any resources used by the CResult_NoneErrorZ.
1264 pub extern "C" fn CResult_NoneErrorZ_free(_res: CResult_NoneErrorZ) { }
1265 impl Drop for CResult_NoneErrorZ {
1266         fn drop(&mut self) {
1267                 if self.result_ok {
1268                 } else {
1269                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
1270                                 let _ = unsafe { Box::from_raw(self.contents.err) };
1271                         }
1272                 }
1273         }
1274 }
1275 impl From<crate::c_types::CResultTempl<(), crate::c_types::IOError>> for CResult_NoneErrorZ {
1276         fn from(mut o: crate::c_types::CResultTempl<(), crate::c_types::IOError>) -> Self {
1277                 let contents = if o.result_ok {
1278                         let _ = unsafe { Box::from_raw(o.contents.result) };
1279                         o.contents.result = std::ptr::null_mut();
1280                         CResult_NoneErrorZPtr { result: std::ptr::null_mut() }
1281                 } else {
1282                         let err = unsafe { o.contents.err };
1283                         unsafe { o.contents.err = std::ptr::null_mut(); }
1284                         CResult_NoneErrorZPtr { err }
1285                 };
1286                 Self {
1287                         contents,
1288                         result_ok: o.result_ok,
1289                 }
1290         }
1291 }
1292 impl Clone for CResult_NoneErrorZ {
1293         fn clone(&self) -> Self {
1294                 if self.result_ok {
1295                         Self { result_ok: true, contents: CResult_NoneErrorZPtr {
1296                                 result: std::ptr::null_mut()
1297                         } }
1298                 } else {
1299                         Self { result_ok: false, contents: CResult_NoneErrorZPtr {
1300                                 err: Box::into_raw(Box::new(<crate::c_types::IOError>::clone(unsafe { &*self.contents.err })))
1301                         } }
1302                 }
1303         }
1304 }
1305 #[no_mangle]
1306 /// Creates a new CResult_NoneErrorZ which has the same data as `orig`
1307 /// but with all dynamically-allocated buffers duplicated in new buffers.
1308 pub extern "C" fn CResult_NoneErrorZ_clone(orig: &CResult_NoneErrorZ) -> CResult_NoneErrorZ { orig.clone() }
1309 #[repr(C)]
1310 /// The contents of CResult_RouteHopDecodeErrorZ
1311 pub union CResult_RouteHopDecodeErrorZPtr {
1312         /// A pointer to the contents in the success state.
1313         /// Reading from this pointer when `result_ok` is not set is undefined.
1314         pub result: *mut crate::lightning::routing::router::RouteHop,
1315         /// A pointer to the contents in the error state.
1316         /// Reading from this pointer when `result_ok` is set is undefined.
1317         pub err: *mut crate::lightning::ln::msgs::DecodeError,
1318 }
1319 #[repr(C)]
1320 /// A CResult_RouteHopDecodeErrorZ represents the result of a fallible operation,
1321 /// containing a crate::lightning::routing::router::RouteHop on success and a crate::lightning::ln::msgs::DecodeError on failure.
1322 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1323 pub struct CResult_RouteHopDecodeErrorZ {
1324         /// The contents of this CResult_RouteHopDecodeErrorZ, accessible via either
1325         /// `err` or `result` depending on the state of `result_ok`.
1326         pub contents: CResult_RouteHopDecodeErrorZPtr,
1327         /// Whether this CResult_RouteHopDecodeErrorZ represents a success state.
1328         pub result_ok: bool,
1329 }
1330 #[no_mangle]
1331 /// Creates a new CResult_RouteHopDecodeErrorZ in the success state.
1332 pub extern "C" fn CResult_RouteHopDecodeErrorZ_ok(o: crate::lightning::routing::router::RouteHop) -> CResult_RouteHopDecodeErrorZ {
1333         CResult_RouteHopDecodeErrorZ {
1334                 contents: CResult_RouteHopDecodeErrorZPtr {
1335                         result: Box::into_raw(Box::new(o)),
1336                 },
1337                 result_ok: true,
1338         }
1339 }
1340 #[no_mangle]
1341 /// Creates a new CResult_RouteHopDecodeErrorZ in the error state.
1342 pub extern "C" fn CResult_RouteHopDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RouteHopDecodeErrorZ {
1343         CResult_RouteHopDecodeErrorZ {
1344                 contents: CResult_RouteHopDecodeErrorZPtr {
1345                         err: Box::into_raw(Box::new(e)),
1346                 },
1347                 result_ok: false,
1348         }
1349 }
1350 #[no_mangle]
1351 /// Frees any resources used by the CResult_RouteHopDecodeErrorZ.
1352 pub extern "C" fn CResult_RouteHopDecodeErrorZ_free(_res: CResult_RouteHopDecodeErrorZ) { }
1353 impl Drop for CResult_RouteHopDecodeErrorZ {
1354         fn drop(&mut self) {
1355                 if self.result_ok {
1356                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
1357                                 let _ = unsafe { Box::from_raw(self.contents.result) };
1358                         }
1359                 } else {
1360                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
1361                                 let _ = unsafe { Box::from_raw(self.contents.err) };
1362                         }
1363                 }
1364         }
1365 }
1366 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::RouteHop, crate::lightning::ln::msgs::DecodeError>> for CResult_RouteHopDecodeErrorZ {
1367         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::RouteHop, crate::lightning::ln::msgs::DecodeError>) -> Self {
1368                 let contents = if o.result_ok {
1369                         let result = unsafe { o.contents.result };
1370                         unsafe { o.contents.result = std::ptr::null_mut() };
1371                         CResult_RouteHopDecodeErrorZPtr { result }
1372                 } else {
1373                         let err = unsafe { o.contents.err };
1374                         unsafe { o.contents.err = std::ptr::null_mut(); }
1375                         CResult_RouteHopDecodeErrorZPtr { err }
1376                 };
1377                 Self {
1378                         contents,
1379                         result_ok: o.result_ok,
1380                 }
1381         }
1382 }
1383 impl Clone for CResult_RouteHopDecodeErrorZ {
1384         fn clone(&self) -> Self {
1385                 if self.result_ok {
1386                         Self { result_ok: true, contents: CResult_RouteHopDecodeErrorZPtr {
1387                                 result: Box::into_raw(Box::new(<crate::lightning::routing::router::RouteHop>::clone(unsafe { &*self.contents.result })))
1388                         } }
1389                 } else {
1390                         Self { result_ok: false, contents: CResult_RouteHopDecodeErrorZPtr {
1391                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
1392                         } }
1393                 }
1394         }
1395 }
1396 #[no_mangle]
1397 /// Creates a new CResult_RouteHopDecodeErrorZ which has the same data as `orig`
1398 /// but with all dynamically-allocated buffers duplicated in new buffers.
1399 pub extern "C" fn CResult_RouteHopDecodeErrorZ_clone(orig: &CResult_RouteHopDecodeErrorZ) -> CResult_RouteHopDecodeErrorZ { orig.clone() }
1400 #[repr(C)]
1401 /// A dynamically-allocated array of crate::lightning::routing::router::RouteHops of arbitrary size.
1402 /// This corresponds to std::vector in C++
1403 pub struct CVec_RouteHopZ {
1404         /// The elements in the array.
1405         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
1406         pub data: *mut crate::lightning::routing::router::RouteHop,
1407         /// The number of elements pointed to by `data`.
1408         pub datalen: usize
1409 }
1410 impl CVec_RouteHopZ {
1411         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::routing::router::RouteHop> {
1412                 if self.datalen == 0 { return Vec::new(); }
1413                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
1414                 self.data = std::ptr::null_mut();
1415                 self.datalen = 0;
1416                 ret
1417         }
1418         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::routing::router::RouteHop] {
1419                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
1420         }
1421 }
1422 impl From<Vec<crate::lightning::routing::router::RouteHop>> for CVec_RouteHopZ {
1423         fn from(v: Vec<crate::lightning::routing::router::RouteHop>) -> Self {
1424                 let datalen = v.len();
1425                 let data = Box::into_raw(v.into_boxed_slice());
1426                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
1427         }
1428 }
1429 #[no_mangle]
1430 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
1431 pub extern "C" fn CVec_RouteHopZ_free(_res: CVec_RouteHopZ) { }
1432 impl Drop for CVec_RouteHopZ {
1433         fn drop(&mut self) {
1434                 if self.datalen == 0 { return; }
1435                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
1436         }
1437 }
1438 impl Clone for CVec_RouteHopZ {
1439         fn clone(&self) -> Self {
1440                 let mut res = Vec::new();
1441                 if self.datalen == 0 { return Self::from(res); }
1442                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
1443                 Self::from(res)
1444         }
1445 }
1446 #[repr(C)]
1447 /// A dynamically-allocated array of crate::c_types::derived::CVec_RouteHopZs of arbitrary size.
1448 /// This corresponds to std::vector in C++
1449 pub struct CVec_CVec_RouteHopZZ {
1450         /// The elements in the array.
1451         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
1452         pub data: *mut crate::c_types::derived::CVec_RouteHopZ,
1453         /// The number of elements pointed to by `data`.
1454         pub datalen: usize
1455 }
1456 impl CVec_CVec_RouteHopZZ {
1457         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::CVec_RouteHopZ> {
1458                 if self.datalen == 0 { return Vec::new(); }
1459                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
1460                 self.data = std::ptr::null_mut();
1461                 self.datalen = 0;
1462                 ret
1463         }
1464         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::CVec_RouteHopZ] {
1465                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
1466         }
1467 }
1468 impl From<Vec<crate::c_types::derived::CVec_RouteHopZ>> for CVec_CVec_RouteHopZZ {
1469         fn from(v: Vec<crate::c_types::derived::CVec_RouteHopZ>) -> Self {
1470                 let datalen = v.len();
1471                 let data = Box::into_raw(v.into_boxed_slice());
1472                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
1473         }
1474 }
1475 #[no_mangle]
1476 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
1477 pub extern "C" fn CVec_CVec_RouteHopZZ_free(_res: CVec_CVec_RouteHopZZ) { }
1478 impl Drop for CVec_CVec_RouteHopZZ {
1479         fn drop(&mut self) {
1480                 if self.datalen == 0 { return; }
1481                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
1482         }
1483 }
1484 impl Clone for CVec_CVec_RouteHopZZ {
1485         fn clone(&self) -> Self {
1486                 let mut res = Vec::new();
1487                 if self.datalen == 0 { return Self::from(res); }
1488                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
1489                 Self::from(res)
1490         }
1491 }
1492 #[repr(C)]
1493 /// The contents of CResult_RouteDecodeErrorZ
1494 pub union CResult_RouteDecodeErrorZPtr {
1495         /// A pointer to the contents in the success state.
1496         /// Reading from this pointer when `result_ok` is not set is undefined.
1497         pub result: *mut crate::lightning::routing::router::Route,
1498         /// A pointer to the contents in the error state.
1499         /// Reading from this pointer when `result_ok` is set is undefined.
1500         pub err: *mut crate::lightning::ln::msgs::DecodeError,
1501 }
1502 #[repr(C)]
1503 /// A CResult_RouteDecodeErrorZ represents the result of a fallible operation,
1504 /// containing a crate::lightning::routing::router::Route on success and a crate::lightning::ln::msgs::DecodeError on failure.
1505 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1506 pub struct CResult_RouteDecodeErrorZ {
1507         /// The contents of this CResult_RouteDecodeErrorZ, accessible via either
1508         /// `err` or `result` depending on the state of `result_ok`.
1509         pub contents: CResult_RouteDecodeErrorZPtr,
1510         /// Whether this CResult_RouteDecodeErrorZ represents a success state.
1511         pub result_ok: bool,
1512 }
1513 #[no_mangle]
1514 /// Creates a new CResult_RouteDecodeErrorZ in the success state.
1515 pub extern "C" fn CResult_RouteDecodeErrorZ_ok(o: crate::lightning::routing::router::Route) -> CResult_RouteDecodeErrorZ {
1516         CResult_RouteDecodeErrorZ {
1517                 contents: CResult_RouteDecodeErrorZPtr {
1518                         result: Box::into_raw(Box::new(o)),
1519                 },
1520                 result_ok: true,
1521         }
1522 }
1523 #[no_mangle]
1524 /// Creates a new CResult_RouteDecodeErrorZ in the error state.
1525 pub extern "C" fn CResult_RouteDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RouteDecodeErrorZ {
1526         CResult_RouteDecodeErrorZ {
1527                 contents: CResult_RouteDecodeErrorZPtr {
1528                         err: Box::into_raw(Box::new(e)),
1529                 },
1530                 result_ok: false,
1531         }
1532 }
1533 #[no_mangle]
1534 /// Frees any resources used by the CResult_RouteDecodeErrorZ.
1535 pub extern "C" fn CResult_RouteDecodeErrorZ_free(_res: CResult_RouteDecodeErrorZ) { }
1536 impl Drop for CResult_RouteDecodeErrorZ {
1537         fn drop(&mut self) {
1538                 if self.result_ok {
1539                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
1540                                 let _ = unsafe { Box::from_raw(self.contents.result) };
1541                         }
1542                 } else {
1543                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
1544                                 let _ = unsafe { Box::from_raw(self.contents.err) };
1545                         }
1546                 }
1547         }
1548 }
1549 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::Route, crate::lightning::ln::msgs::DecodeError>> for CResult_RouteDecodeErrorZ {
1550         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::Route, crate::lightning::ln::msgs::DecodeError>) -> Self {
1551                 let contents = if o.result_ok {
1552                         let result = unsafe { o.contents.result };
1553                         unsafe { o.contents.result = std::ptr::null_mut() };
1554                         CResult_RouteDecodeErrorZPtr { result }
1555                 } else {
1556                         let err = unsafe { o.contents.err };
1557                         unsafe { o.contents.err = std::ptr::null_mut(); }
1558                         CResult_RouteDecodeErrorZPtr { err }
1559                 };
1560                 Self {
1561                         contents,
1562                         result_ok: o.result_ok,
1563                 }
1564         }
1565 }
1566 impl Clone for CResult_RouteDecodeErrorZ {
1567         fn clone(&self) -> Self {
1568                 if self.result_ok {
1569                         Self { result_ok: true, contents: CResult_RouteDecodeErrorZPtr {
1570                                 result: Box::into_raw(Box::new(<crate::lightning::routing::router::Route>::clone(unsafe { &*self.contents.result })))
1571                         } }
1572                 } else {
1573                         Self { result_ok: false, contents: CResult_RouteDecodeErrorZPtr {
1574                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
1575                         } }
1576                 }
1577         }
1578 }
1579 #[no_mangle]
1580 /// Creates a new CResult_RouteDecodeErrorZ which has the same data as `orig`
1581 /// but with all dynamically-allocated buffers duplicated in new buffers.
1582 pub extern "C" fn CResult_RouteDecodeErrorZ_clone(orig: &CResult_RouteDecodeErrorZ) -> CResult_RouteDecodeErrorZ { orig.clone() }
1583 #[repr(C)]
1584 #[derive(Clone)]
1585 /// An enum which can either contain a u64 or not
1586 pub enum COption_u64Z {
1587         /// When we're in this state, this COption_u64Z contains a u64
1588         Some(u64),
1589         /// When we're in this state, this COption_u64Z contains nothing
1590         None
1591 }
1592 impl COption_u64Z {
1593         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
1594                 if let Self::Some(_) = self { true } else { false }
1595         }
1596         #[allow(unused)] pub(crate) fn take(mut self) -> u64 {
1597                 if let Self::Some(v) = self { v } else { unreachable!() }
1598         }
1599 }
1600 #[no_mangle]
1601 /// Constructs a new COption_u64Z containing a u64
1602 pub extern "C" fn COption_u64Z_some(o: u64) -> COption_u64Z {
1603         COption_u64Z::Some(o)
1604 }
1605 #[no_mangle]
1606 /// Constructs a new COption_u64Z containing nothing
1607 pub extern "C" fn COption_u64Z_none() -> COption_u64Z {
1608         COption_u64Z::None
1609 }
1610 #[no_mangle]
1611 /// Frees any resources associated with the u64, if we are in the Some state
1612 pub extern "C" fn COption_u64Z_free(_res: COption_u64Z) { }
1613 #[no_mangle]
1614 /// Creates a new COption_u64Z which has the same data as `orig`
1615 /// but with all dynamically-allocated buffers duplicated in new buffers.
1616 pub extern "C" fn COption_u64Z_clone(orig: &COption_u64Z) -> COption_u64Z { orig.clone() }
1617 #[repr(C)]
1618 /// A dynamically-allocated array of crate::lightning::ln::channelmanager::ChannelDetailss of arbitrary size.
1619 /// This corresponds to std::vector in C++
1620 pub struct CVec_ChannelDetailsZ {
1621         /// The elements in the array.
1622         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
1623         pub data: *mut crate::lightning::ln::channelmanager::ChannelDetails,
1624         /// The number of elements pointed to by `data`.
1625         pub datalen: usize
1626 }
1627 impl CVec_ChannelDetailsZ {
1628         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::channelmanager::ChannelDetails> {
1629                 if self.datalen == 0 { return Vec::new(); }
1630                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
1631                 self.data = std::ptr::null_mut();
1632                 self.datalen = 0;
1633                 ret
1634         }
1635         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::channelmanager::ChannelDetails] {
1636                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
1637         }
1638 }
1639 impl From<Vec<crate::lightning::ln::channelmanager::ChannelDetails>> for CVec_ChannelDetailsZ {
1640         fn from(v: Vec<crate::lightning::ln::channelmanager::ChannelDetails>) -> Self {
1641                 let datalen = v.len();
1642                 let data = Box::into_raw(v.into_boxed_slice());
1643                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
1644         }
1645 }
1646 #[no_mangle]
1647 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
1648 pub extern "C" fn CVec_ChannelDetailsZ_free(_res: CVec_ChannelDetailsZ) { }
1649 impl Drop for CVec_ChannelDetailsZ {
1650         fn drop(&mut self) {
1651                 if self.datalen == 0 { return; }
1652                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
1653         }
1654 }
1655 impl Clone for CVec_ChannelDetailsZ {
1656         fn clone(&self) -> Self {
1657                 let mut res = Vec::new();
1658                 if self.datalen == 0 { return Self::from(res); }
1659                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
1660                 Self::from(res)
1661         }
1662 }
1663 #[repr(C)]
1664 /// A dynamically-allocated array of crate::lightning::routing::router::RouteHintHops of arbitrary size.
1665 /// This corresponds to std::vector in C++
1666 pub struct CVec_RouteHintHopZ {
1667         /// The elements in the array.
1668         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
1669         pub data: *mut crate::lightning::routing::router::RouteHintHop,
1670         /// The number of elements pointed to by `data`.
1671         pub datalen: usize
1672 }
1673 impl CVec_RouteHintHopZ {
1674         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::routing::router::RouteHintHop> {
1675                 if self.datalen == 0 { return Vec::new(); }
1676                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
1677                 self.data = std::ptr::null_mut();
1678                 self.datalen = 0;
1679                 ret
1680         }
1681         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::routing::router::RouteHintHop] {
1682                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
1683         }
1684 }
1685 impl From<Vec<crate::lightning::routing::router::RouteHintHop>> for CVec_RouteHintHopZ {
1686         fn from(v: Vec<crate::lightning::routing::router::RouteHintHop>) -> Self {
1687                 let datalen = v.len();
1688                 let data = Box::into_raw(v.into_boxed_slice());
1689                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
1690         }
1691 }
1692 #[no_mangle]
1693 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
1694 pub extern "C" fn CVec_RouteHintHopZ_free(_res: CVec_RouteHintHopZ) { }
1695 impl Drop for CVec_RouteHintHopZ {
1696         fn drop(&mut self) {
1697                 if self.datalen == 0 { return; }
1698                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
1699         }
1700 }
1701 impl Clone for CVec_RouteHintHopZ {
1702         fn clone(&self) -> Self {
1703                 let mut res = Vec::new();
1704                 if self.datalen == 0 { return Self::from(res); }
1705                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
1706                 Self::from(res)
1707         }
1708 }
1709 #[repr(C)]
1710 /// The contents of CResult_RouteLightningErrorZ
1711 pub union CResult_RouteLightningErrorZPtr {
1712         /// A pointer to the contents in the success state.
1713         /// Reading from this pointer when `result_ok` is not set is undefined.
1714         pub result: *mut crate::lightning::routing::router::Route,
1715         /// A pointer to the contents in the error state.
1716         /// Reading from this pointer when `result_ok` is set is undefined.
1717         pub err: *mut crate::lightning::ln::msgs::LightningError,
1718 }
1719 #[repr(C)]
1720 /// A CResult_RouteLightningErrorZ represents the result of a fallible operation,
1721 /// containing a crate::lightning::routing::router::Route on success and a crate::lightning::ln::msgs::LightningError on failure.
1722 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1723 pub struct CResult_RouteLightningErrorZ {
1724         /// The contents of this CResult_RouteLightningErrorZ, accessible via either
1725         /// `err` or `result` depending on the state of `result_ok`.
1726         pub contents: CResult_RouteLightningErrorZPtr,
1727         /// Whether this CResult_RouteLightningErrorZ represents a success state.
1728         pub result_ok: bool,
1729 }
1730 #[no_mangle]
1731 /// Creates a new CResult_RouteLightningErrorZ in the success state.
1732 pub extern "C" fn CResult_RouteLightningErrorZ_ok(o: crate::lightning::routing::router::Route) -> CResult_RouteLightningErrorZ {
1733         CResult_RouteLightningErrorZ {
1734                 contents: CResult_RouteLightningErrorZPtr {
1735                         result: Box::into_raw(Box::new(o)),
1736                 },
1737                 result_ok: true,
1738         }
1739 }
1740 #[no_mangle]
1741 /// Creates a new CResult_RouteLightningErrorZ in the error state.
1742 pub extern "C" fn CResult_RouteLightningErrorZ_err(e: crate::lightning::ln::msgs::LightningError) -> CResult_RouteLightningErrorZ {
1743         CResult_RouteLightningErrorZ {
1744                 contents: CResult_RouteLightningErrorZPtr {
1745                         err: Box::into_raw(Box::new(e)),
1746                 },
1747                 result_ok: false,
1748         }
1749 }
1750 #[no_mangle]
1751 /// Frees any resources used by the CResult_RouteLightningErrorZ.
1752 pub extern "C" fn CResult_RouteLightningErrorZ_free(_res: CResult_RouteLightningErrorZ) { }
1753 impl Drop for CResult_RouteLightningErrorZ {
1754         fn drop(&mut self) {
1755                 if self.result_ok {
1756                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
1757                                 let _ = unsafe { Box::from_raw(self.contents.result) };
1758                         }
1759                 } else {
1760                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
1761                                 let _ = unsafe { Box::from_raw(self.contents.err) };
1762                         }
1763                 }
1764         }
1765 }
1766 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::Route, crate::lightning::ln::msgs::LightningError>> for CResult_RouteLightningErrorZ {
1767         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::Route, crate::lightning::ln::msgs::LightningError>) -> Self {
1768                 let contents = if o.result_ok {
1769                         let result = unsafe { o.contents.result };
1770                         unsafe { o.contents.result = std::ptr::null_mut() };
1771                         CResult_RouteLightningErrorZPtr { result }
1772                 } else {
1773                         let err = unsafe { o.contents.err };
1774                         unsafe { o.contents.err = std::ptr::null_mut(); }
1775                         CResult_RouteLightningErrorZPtr { err }
1776                 };
1777                 Self {
1778                         contents,
1779                         result_ok: o.result_ok,
1780                 }
1781         }
1782 }
1783 impl Clone for CResult_RouteLightningErrorZ {
1784         fn clone(&self) -> Self {
1785                 if self.result_ok {
1786                         Self { result_ok: true, contents: CResult_RouteLightningErrorZPtr {
1787                                 result: Box::into_raw(Box::new(<crate::lightning::routing::router::Route>::clone(unsafe { &*self.contents.result })))
1788                         } }
1789                 } else {
1790                         Self { result_ok: false, contents: CResult_RouteLightningErrorZPtr {
1791                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::LightningError>::clone(unsafe { &*self.contents.err })))
1792                         } }
1793                 }
1794         }
1795 }
1796 #[no_mangle]
1797 /// Creates a new CResult_RouteLightningErrorZ which has the same data as `orig`
1798 /// but with all dynamically-allocated buffers duplicated in new buffers.
1799 pub extern "C" fn CResult_RouteLightningErrorZ_clone(orig: &CResult_RouteLightningErrorZ) -> CResult_RouteLightningErrorZ { orig.clone() }
1800 #[repr(C)]
1801 /// The contents of CResult_TxOutAccessErrorZ
1802 pub union CResult_TxOutAccessErrorZPtr {
1803         /// A pointer to the contents in the success state.
1804         /// Reading from this pointer when `result_ok` is not set is undefined.
1805         pub result: *mut crate::c_types::TxOut,
1806         /// A pointer to the contents in the error state.
1807         /// Reading from this pointer when `result_ok` is set is undefined.
1808         pub err: *mut crate::lightning::chain::AccessError,
1809 }
1810 #[repr(C)]
1811 /// A CResult_TxOutAccessErrorZ represents the result of a fallible operation,
1812 /// containing a crate::c_types::TxOut on success and a crate::lightning::chain::AccessError on failure.
1813 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1814 pub struct CResult_TxOutAccessErrorZ {
1815         /// The contents of this CResult_TxOutAccessErrorZ, accessible via either
1816         /// `err` or `result` depending on the state of `result_ok`.
1817         pub contents: CResult_TxOutAccessErrorZPtr,
1818         /// Whether this CResult_TxOutAccessErrorZ represents a success state.
1819         pub result_ok: bool,
1820 }
1821 #[no_mangle]
1822 /// Creates a new CResult_TxOutAccessErrorZ in the success state.
1823 pub extern "C" fn CResult_TxOutAccessErrorZ_ok(o: crate::c_types::TxOut) -> CResult_TxOutAccessErrorZ {
1824         CResult_TxOutAccessErrorZ {
1825                 contents: CResult_TxOutAccessErrorZPtr {
1826                         result: Box::into_raw(Box::new(o)),
1827                 },
1828                 result_ok: true,
1829         }
1830 }
1831 #[no_mangle]
1832 /// Creates a new CResult_TxOutAccessErrorZ in the error state.
1833 pub extern "C" fn CResult_TxOutAccessErrorZ_err(e: crate::lightning::chain::AccessError) -> CResult_TxOutAccessErrorZ {
1834         CResult_TxOutAccessErrorZ {
1835                 contents: CResult_TxOutAccessErrorZPtr {
1836                         err: Box::into_raw(Box::new(e)),
1837                 },
1838                 result_ok: false,
1839         }
1840 }
1841 #[no_mangle]
1842 /// Frees any resources used by the CResult_TxOutAccessErrorZ.
1843 pub extern "C" fn CResult_TxOutAccessErrorZ_free(_res: CResult_TxOutAccessErrorZ) { }
1844 impl Drop for CResult_TxOutAccessErrorZ {
1845         fn drop(&mut self) {
1846                 if self.result_ok {
1847                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
1848                                 let _ = unsafe { Box::from_raw(self.contents.result) };
1849                         }
1850                 } else {
1851                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
1852                                 let _ = unsafe { Box::from_raw(self.contents.err) };
1853                         }
1854                 }
1855         }
1856 }
1857 impl From<crate::c_types::CResultTempl<crate::c_types::TxOut, crate::lightning::chain::AccessError>> for CResult_TxOutAccessErrorZ {
1858         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::TxOut, crate::lightning::chain::AccessError>) -> Self {
1859                 let contents = if o.result_ok {
1860                         let result = unsafe { o.contents.result };
1861                         unsafe { o.contents.result = std::ptr::null_mut() };
1862                         CResult_TxOutAccessErrorZPtr { result }
1863                 } else {
1864                         let err = unsafe { o.contents.err };
1865                         unsafe { o.contents.err = std::ptr::null_mut(); }
1866                         CResult_TxOutAccessErrorZPtr { err }
1867                 };
1868                 Self {
1869                         contents,
1870                         result_ok: o.result_ok,
1871                 }
1872         }
1873 }
1874 impl Clone for CResult_TxOutAccessErrorZ {
1875         fn clone(&self) -> Self {
1876                 if self.result_ok {
1877                         Self { result_ok: true, contents: CResult_TxOutAccessErrorZPtr {
1878                                 result: Box::into_raw(Box::new(<crate::c_types::TxOut>::clone(unsafe { &*self.contents.result })))
1879                         } }
1880                 } else {
1881                         Self { result_ok: false, contents: CResult_TxOutAccessErrorZPtr {
1882                                 err: Box::into_raw(Box::new(<crate::lightning::chain::AccessError>::clone(unsafe { &*self.contents.err })))
1883                         } }
1884                 }
1885         }
1886 }
1887 #[no_mangle]
1888 /// Creates a new CResult_TxOutAccessErrorZ which has the same data as `orig`
1889 /// but with all dynamically-allocated buffers duplicated in new buffers.
1890 pub extern "C" fn CResult_TxOutAccessErrorZ_clone(orig: &CResult_TxOutAccessErrorZ) -> CResult_TxOutAccessErrorZ { orig.clone() }
1891 #[repr(C)]
1892 /// A tuple of 2 elements. See the individual fields for the types contained.
1893 pub struct C2Tuple_usizeTransactionZ {
1894         /// The element at position 0
1895         pub a: usize,
1896         /// The element at position 1
1897         pub b: crate::c_types::Transaction,
1898 }
1899 impl From<(usize, crate::c_types::Transaction)> for C2Tuple_usizeTransactionZ {
1900         fn from (tup: (usize, crate::c_types::Transaction)) -> Self {
1901                 Self {
1902                         a: tup.0,
1903                         b: tup.1,
1904                 }
1905         }
1906 }
1907 impl C2Tuple_usizeTransactionZ {
1908         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (usize, crate::c_types::Transaction) {
1909                 (self.a, self.b)
1910         }
1911 }
1912 impl Clone for C2Tuple_usizeTransactionZ {
1913         fn clone(&self) -> Self {
1914                 Self {
1915                         a: self.a.clone(),
1916                         b: self.b.clone(),
1917                 }
1918         }
1919 }
1920 #[no_mangle]
1921 /// Creates a new tuple which has the same data as `orig`
1922 /// but with all dynamically-allocated buffers duplicated in new buffers.
1923 pub extern "C" fn C2Tuple_usizeTransactionZ_clone(orig: &C2Tuple_usizeTransactionZ) -> C2Tuple_usizeTransactionZ { orig.clone() }
1924 /// Creates a new C2Tuple_usizeTransactionZ from the contained elements.
1925 #[no_mangle]
1926 pub extern "C" fn C2Tuple_usizeTransactionZ_new(a: usize, b: crate::c_types::Transaction) -> C2Tuple_usizeTransactionZ {
1927         C2Tuple_usizeTransactionZ { a, b, }
1928 }
1929
1930 #[no_mangle]
1931 /// Frees any resources used by the C2Tuple_usizeTransactionZ.
1932 pub extern "C" fn C2Tuple_usizeTransactionZ_free(_res: C2Tuple_usizeTransactionZ) { }
1933 #[repr(C)]
1934 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_usizeTransactionZs of arbitrary size.
1935 /// This corresponds to std::vector in C++
1936 pub struct CVec_C2Tuple_usizeTransactionZZ {
1937         /// The elements in the array.
1938         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
1939         pub data: *mut crate::c_types::derived::C2Tuple_usizeTransactionZ,
1940         /// The number of elements pointed to by `data`.
1941         pub datalen: usize
1942 }
1943 impl CVec_C2Tuple_usizeTransactionZZ {
1944         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_usizeTransactionZ> {
1945                 if self.datalen == 0 { return Vec::new(); }
1946                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
1947                 self.data = std::ptr::null_mut();
1948                 self.datalen = 0;
1949                 ret
1950         }
1951         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_usizeTransactionZ] {
1952                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
1953         }
1954 }
1955 impl From<Vec<crate::c_types::derived::C2Tuple_usizeTransactionZ>> for CVec_C2Tuple_usizeTransactionZZ {
1956         fn from(v: Vec<crate::c_types::derived::C2Tuple_usizeTransactionZ>) -> Self {
1957                 let datalen = v.len();
1958                 let data = Box::into_raw(v.into_boxed_slice());
1959                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
1960         }
1961 }
1962 #[no_mangle]
1963 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
1964 pub extern "C" fn CVec_C2Tuple_usizeTransactionZZ_free(_res: CVec_C2Tuple_usizeTransactionZZ) { }
1965 impl Drop for CVec_C2Tuple_usizeTransactionZZ {
1966         fn drop(&mut self) {
1967                 if self.datalen == 0 { return; }
1968                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
1969         }
1970 }
1971 impl Clone for CVec_C2Tuple_usizeTransactionZZ {
1972         fn clone(&self) -> Self {
1973                 let mut res = Vec::new();
1974                 if self.datalen == 0 { return Self::from(res); }
1975                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
1976                 Self::from(res)
1977         }
1978 }
1979 #[repr(C)]
1980 /// A dynamically-allocated array of crate::c_types::ThirtyTwoBytess of arbitrary size.
1981 /// This corresponds to std::vector in C++
1982 pub struct CVec_TxidZ {
1983         /// The elements in the array.
1984         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
1985         pub data: *mut crate::c_types::ThirtyTwoBytes,
1986         /// The number of elements pointed to by `data`.
1987         pub datalen: usize
1988 }
1989 impl CVec_TxidZ {
1990         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::ThirtyTwoBytes> {
1991                 if self.datalen == 0 { return Vec::new(); }
1992                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
1993                 self.data = std::ptr::null_mut();
1994                 self.datalen = 0;
1995                 ret
1996         }
1997         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::ThirtyTwoBytes] {
1998                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
1999         }
2000 }
2001 impl From<Vec<crate::c_types::ThirtyTwoBytes>> for CVec_TxidZ {
2002         fn from(v: Vec<crate::c_types::ThirtyTwoBytes>) -> Self {
2003                 let datalen = v.len();
2004                 let data = Box::into_raw(v.into_boxed_slice());
2005                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
2006         }
2007 }
2008 #[no_mangle]
2009 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
2010 pub extern "C" fn CVec_TxidZ_free(_res: CVec_TxidZ) { }
2011 impl Drop for CVec_TxidZ {
2012         fn drop(&mut self) {
2013                 if self.datalen == 0 { return; }
2014                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
2015         }
2016 }
2017 impl Clone for CVec_TxidZ {
2018         fn clone(&self) -> Self {
2019                 let mut res = Vec::new();
2020                 if self.datalen == 0 { return Self::from(res); }
2021                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
2022                 Self::from(res)
2023         }
2024 }
2025 #[repr(C)]
2026 /// The contents of CResult_NoneChannelMonitorUpdateErrZ
2027 pub union CResult_NoneChannelMonitorUpdateErrZPtr {
2028         /// Note that this value is always NULL, as there are no contents in the OK variant
2029         pub result: *mut std::ffi::c_void,
2030         /// A pointer to the contents in the error state.
2031         /// Reading from this pointer when `result_ok` is set is undefined.
2032         pub err: *mut crate::lightning::chain::channelmonitor::ChannelMonitorUpdateErr,
2033 }
2034 #[repr(C)]
2035 /// A CResult_NoneChannelMonitorUpdateErrZ represents the result of a fallible operation,
2036 /// containing a () on success and a crate::lightning::chain::channelmonitor::ChannelMonitorUpdateErr on failure.
2037 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2038 pub struct CResult_NoneChannelMonitorUpdateErrZ {
2039         /// The contents of this CResult_NoneChannelMonitorUpdateErrZ, accessible via either
2040         /// `err` or `result` depending on the state of `result_ok`.
2041         pub contents: CResult_NoneChannelMonitorUpdateErrZPtr,
2042         /// Whether this CResult_NoneChannelMonitorUpdateErrZ represents a success state.
2043         pub result_ok: bool,
2044 }
2045 #[no_mangle]
2046 /// Creates a new CResult_NoneChannelMonitorUpdateErrZ in the success state.
2047 pub extern "C" fn CResult_NoneChannelMonitorUpdateErrZ_ok() -> CResult_NoneChannelMonitorUpdateErrZ {
2048         CResult_NoneChannelMonitorUpdateErrZ {
2049                 contents: CResult_NoneChannelMonitorUpdateErrZPtr {
2050                         result: std::ptr::null_mut(),
2051                 },
2052                 result_ok: true,
2053         }
2054 }
2055 #[no_mangle]
2056 /// Creates a new CResult_NoneChannelMonitorUpdateErrZ in the error state.
2057 pub extern "C" fn CResult_NoneChannelMonitorUpdateErrZ_err(e: crate::lightning::chain::channelmonitor::ChannelMonitorUpdateErr) -> CResult_NoneChannelMonitorUpdateErrZ {
2058         CResult_NoneChannelMonitorUpdateErrZ {
2059                 contents: CResult_NoneChannelMonitorUpdateErrZPtr {
2060                         err: Box::into_raw(Box::new(e)),
2061                 },
2062                 result_ok: false,
2063         }
2064 }
2065 #[no_mangle]
2066 /// Frees any resources used by the CResult_NoneChannelMonitorUpdateErrZ.
2067 pub extern "C" fn CResult_NoneChannelMonitorUpdateErrZ_free(_res: CResult_NoneChannelMonitorUpdateErrZ) { }
2068 impl Drop for CResult_NoneChannelMonitorUpdateErrZ {
2069         fn drop(&mut self) {
2070                 if self.result_ok {
2071                 } else {
2072                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
2073                                 let _ = unsafe { Box::from_raw(self.contents.err) };
2074                         }
2075                 }
2076         }
2077 }
2078 impl From<crate::c_types::CResultTempl<(), crate::lightning::chain::channelmonitor::ChannelMonitorUpdateErr>> for CResult_NoneChannelMonitorUpdateErrZ {
2079         fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::chain::channelmonitor::ChannelMonitorUpdateErr>) -> Self {
2080                 let contents = if o.result_ok {
2081                         let _ = unsafe { Box::from_raw(o.contents.result) };
2082                         o.contents.result = std::ptr::null_mut();
2083                         CResult_NoneChannelMonitorUpdateErrZPtr { result: std::ptr::null_mut() }
2084                 } else {
2085                         let err = unsafe { o.contents.err };
2086                         unsafe { o.contents.err = std::ptr::null_mut(); }
2087                         CResult_NoneChannelMonitorUpdateErrZPtr { err }
2088                 };
2089                 Self {
2090                         contents,
2091                         result_ok: o.result_ok,
2092                 }
2093         }
2094 }
2095 impl Clone for CResult_NoneChannelMonitorUpdateErrZ {
2096         fn clone(&self) -> Self {
2097                 if self.result_ok {
2098                         Self { result_ok: true, contents: CResult_NoneChannelMonitorUpdateErrZPtr {
2099                                 result: std::ptr::null_mut()
2100                         } }
2101                 } else {
2102                         Self { result_ok: false, contents: CResult_NoneChannelMonitorUpdateErrZPtr {
2103                                 err: Box::into_raw(Box::new(<crate::lightning::chain::channelmonitor::ChannelMonitorUpdateErr>::clone(unsafe { &*self.contents.err })))
2104                         } }
2105                 }
2106         }
2107 }
2108 #[no_mangle]
2109 /// Creates a new CResult_NoneChannelMonitorUpdateErrZ which has the same data as `orig`
2110 /// but with all dynamically-allocated buffers duplicated in new buffers.
2111 pub extern "C" fn CResult_NoneChannelMonitorUpdateErrZ_clone(orig: &CResult_NoneChannelMonitorUpdateErrZ) -> CResult_NoneChannelMonitorUpdateErrZ { orig.clone() }
2112 #[repr(C)]
2113 /// A dynamically-allocated array of crate::lightning::chain::channelmonitor::MonitorEvents of arbitrary size.
2114 /// This corresponds to std::vector in C++
2115 pub struct CVec_MonitorEventZ {
2116         /// The elements in the array.
2117         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2118         pub data: *mut crate::lightning::chain::channelmonitor::MonitorEvent,
2119         /// The number of elements pointed to by `data`.
2120         pub datalen: usize
2121 }
2122 impl CVec_MonitorEventZ {
2123         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::chain::channelmonitor::MonitorEvent> {
2124                 if self.datalen == 0 { return Vec::new(); }
2125                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
2126                 self.data = std::ptr::null_mut();
2127                 self.datalen = 0;
2128                 ret
2129         }
2130         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::chain::channelmonitor::MonitorEvent] {
2131                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
2132         }
2133 }
2134 impl From<Vec<crate::lightning::chain::channelmonitor::MonitorEvent>> for CVec_MonitorEventZ {
2135         fn from(v: Vec<crate::lightning::chain::channelmonitor::MonitorEvent>) -> Self {
2136                 let datalen = v.len();
2137                 let data = Box::into_raw(v.into_boxed_slice());
2138                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
2139         }
2140 }
2141 #[no_mangle]
2142 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
2143 pub extern "C" fn CVec_MonitorEventZ_free(_res: CVec_MonitorEventZ) { }
2144 impl Drop for CVec_MonitorEventZ {
2145         fn drop(&mut self) {
2146                 if self.datalen == 0 { return; }
2147                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
2148         }
2149 }
2150 impl Clone for CVec_MonitorEventZ {
2151         fn clone(&self) -> Self {
2152                 let mut res = Vec::new();
2153                 if self.datalen == 0 { return Self::from(res); }
2154                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
2155                 Self::from(res)
2156         }
2157 }
2158 #[repr(C)]
2159 #[derive(Clone)]
2160 /// An enum which can either contain a crate::c_types::derived::C2Tuple_usizeTransactionZ or not
2161 pub enum COption_C2Tuple_usizeTransactionZZ {
2162         /// When we're in this state, this COption_C2Tuple_usizeTransactionZZ contains a crate::c_types::derived::C2Tuple_usizeTransactionZ
2163         Some(crate::c_types::derived::C2Tuple_usizeTransactionZ),
2164         /// When we're in this state, this COption_C2Tuple_usizeTransactionZZ contains nothing
2165         None
2166 }
2167 impl COption_C2Tuple_usizeTransactionZZ {
2168         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
2169                 if let Self::Some(_) = self { true } else { false }
2170         }
2171         #[allow(unused)] pub(crate) fn take(mut self) -> crate::c_types::derived::C2Tuple_usizeTransactionZ {
2172                 if let Self::Some(v) = self { v } else { unreachable!() }
2173         }
2174 }
2175 #[no_mangle]
2176 /// Constructs a new COption_C2Tuple_usizeTransactionZZ containing a crate::c_types::derived::C2Tuple_usizeTransactionZ
2177 pub extern "C" fn COption_C2Tuple_usizeTransactionZZ_some(o: crate::c_types::derived::C2Tuple_usizeTransactionZ) -> COption_C2Tuple_usizeTransactionZZ {
2178         COption_C2Tuple_usizeTransactionZZ::Some(o)
2179 }
2180 #[no_mangle]
2181 /// Constructs a new COption_C2Tuple_usizeTransactionZZ containing nothing
2182 pub extern "C" fn COption_C2Tuple_usizeTransactionZZ_none() -> COption_C2Tuple_usizeTransactionZZ {
2183         COption_C2Tuple_usizeTransactionZZ::None
2184 }
2185 #[no_mangle]
2186 /// Frees any resources associated with the crate::c_types::derived::C2Tuple_usizeTransactionZ, if we are in the Some state
2187 pub extern "C" fn COption_C2Tuple_usizeTransactionZZ_free(_res: COption_C2Tuple_usizeTransactionZZ) { }
2188 #[no_mangle]
2189 /// Creates a new COption_C2Tuple_usizeTransactionZZ which has the same data as `orig`
2190 /// but with all dynamically-allocated buffers duplicated in new buffers.
2191 pub extern "C" fn COption_C2Tuple_usizeTransactionZZ_clone(orig: &COption_C2Tuple_usizeTransactionZZ) -> COption_C2Tuple_usizeTransactionZZ { orig.clone() }
2192 #[repr(C)]
2193 /// A dynamically-allocated array of crate::lightning::chain::keysinterface::SpendableOutputDescriptors of arbitrary size.
2194 /// This corresponds to std::vector in C++
2195 pub struct CVec_SpendableOutputDescriptorZ {
2196         /// The elements in the array.
2197         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2198         pub data: *mut crate::lightning::chain::keysinterface::SpendableOutputDescriptor,
2199         /// The number of elements pointed to by `data`.
2200         pub datalen: usize
2201 }
2202 impl CVec_SpendableOutputDescriptorZ {
2203         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::chain::keysinterface::SpendableOutputDescriptor> {
2204                 if self.datalen == 0 { return Vec::new(); }
2205                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
2206                 self.data = std::ptr::null_mut();
2207                 self.datalen = 0;
2208                 ret
2209         }
2210         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::chain::keysinterface::SpendableOutputDescriptor] {
2211                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
2212         }
2213 }
2214 impl From<Vec<crate::lightning::chain::keysinterface::SpendableOutputDescriptor>> for CVec_SpendableOutputDescriptorZ {
2215         fn from(v: Vec<crate::lightning::chain::keysinterface::SpendableOutputDescriptor>) -> Self {
2216                 let datalen = v.len();
2217                 let data = Box::into_raw(v.into_boxed_slice());
2218                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
2219         }
2220 }
2221 #[no_mangle]
2222 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
2223 pub extern "C" fn CVec_SpendableOutputDescriptorZ_free(_res: CVec_SpendableOutputDescriptorZ) { }
2224 impl Drop for CVec_SpendableOutputDescriptorZ {
2225         fn drop(&mut self) {
2226                 if self.datalen == 0 { return; }
2227                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
2228         }
2229 }
2230 impl Clone for CVec_SpendableOutputDescriptorZ {
2231         fn clone(&self) -> Self {
2232                 let mut res = Vec::new();
2233                 if self.datalen == 0 { return Self::from(res); }
2234                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
2235                 Self::from(res)
2236         }
2237 }
2238 #[repr(C)]
2239 /// A dynamically-allocated array of crate::lightning::util::events::MessageSendEvents of arbitrary size.
2240 /// This corresponds to std::vector in C++
2241 pub struct CVec_MessageSendEventZ {
2242         /// The elements in the array.
2243         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2244         pub data: *mut crate::lightning::util::events::MessageSendEvent,
2245         /// The number of elements pointed to by `data`.
2246         pub datalen: usize
2247 }
2248 impl CVec_MessageSendEventZ {
2249         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::util::events::MessageSendEvent> {
2250                 if self.datalen == 0 { return Vec::new(); }
2251                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
2252                 self.data = std::ptr::null_mut();
2253                 self.datalen = 0;
2254                 ret
2255         }
2256         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::util::events::MessageSendEvent] {
2257                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
2258         }
2259 }
2260 impl From<Vec<crate::lightning::util::events::MessageSendEvent>> for CVec_MessageSendEventZ {
2261         fn from(v: Vec<crate::lightning::util::events::MessageSendEvent>) -> Self {
2262                 let datalen = v.len();
2263                 let data = Box::into_raw(v.into_boxed_slice());
2264                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
2265         }
2266 }
2267 #[no_mangle]
2268 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
2269 pub extern "C" fn CVec_MessageSendEventZ_free(_res: CVec_MessageSendEventZ) { }
2270 impl Drop for CVec_MessageSendEventZ {
2271         fn drop(&mut self) {
2272                 if self.datalen == 0 { return; }
2273                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
2274         }
2275 }
2276 impl Clone for CVec_MessageSendEventZ {
2277         fn clone(&self) -> Self {
2278                 let mut res = Vec::new();
2279                 if self.datalen == 0 { return Self::from(res); }
2280                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
2281                 Self::from(res)
2282         }
2283 }
2284 #[repr(C)]
2285 /// The contents of CResult_InitFeaturesDecodeErrorZ
2286 pub union CResult_InitFeaturesDecodeErrorZPtr {
2287         /// A pointer to the contents in the success state.
2288         /// Reading from this pointer when `result_ok` is not set is undefined.
2289         pub result: *mut crate::lightning::ln::features::InitFeatures,
2290         /// A pointer to the contents in the error state.
2291         /// Reading from this pointer when `result_ok` is set is undefined.
2292         pub err: *mut crate::lightning::ln::msgs::DecodeError,
2293 }
2294 #[repr(C)]
2295 /// A CResult_InitFeaturesDecodeErrorZ represents the result of a fallible operation,
2296 /// containing a crate::lightning::ln::features::InitFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
2297 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2298 pub struct CResult_InitFeaturesDecodeErrorZ {
2299         /// The contents of this CResult_InitFeaturesDecodeErrorZ, accessible via either
2300         /// `err` or `result` depending on the state of `result_ok`.
2301         pub contents: CResult_InitFeaturesDecodeErrorZPtr,
2302         /// Whether this CResult_InitFeaturesDecodeErrorZ represents a success state.
2303         pub result_ok: bool,
2304 }
2305 #[no_mangle]
2306 /// Creates a new CResult_InitFeaturesDecodeErrorZ in the success state.
2307 pub extern "C" fn CResult_InitFeaturesDecodeErrorZ_ok(o: crate::lightning::ln::features::InitFeatures) -> CResult_InitFeaturesDecodeErrorZ {
2308         CResult_InitFeaturesDecodeErrorZ {
2309                 contents: CResult_InitFeaturesDecodeErrorZPtr {
2310                         result: Box::into_raw(Box::new(o)),
2311                 },
2312                 result_ok: true,
2313         }
2314 }
2315 #[no_mangle]
2316 /// Creates a new CResult_InitFeaturesDecodeErrorZ in the error state.
2317 pub extern "C" fn CResult_InitFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_InitFeaturesDecodeErrorZ {
2318         CResult_InitFeaturesDecodeErrorZ {
2319                 contents: CResult_InitFeaturesDecodeErrorZPtr {
2320                         err: Box::into_raw(Box::new(e)),
2321                 },
2322                 result_ok: false,
2323         }
2324 }
2325 #[no_mangle]
2326 /// Frees any resources used by the CResult_InitFeaturesDecodeErrorZ.
2327 pub extern "C" fn CResult_InitFeaturesDecodeErrorZ_free(_res: CResult_InitFeaturesDecodeErrorZ) { }
2328 impl Drop for CResult_InitFeaturesDecodeErrorZ {
2329         fn drop(&mut self) {
2330                 if self.result_ok {
2331                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
2332                                 let _ = unsafe { Box::from_raw(self.contents.result) };
2333                         }
2334                 } else {
2335                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
2336                                 let _ = unsafe { Box::from_raw(self.contents.err) };
2337                         }
2338                 }
2339         }
2340 }
2341 impl From<crate::c_types::CResultTempl<crate::lightning::ln::features::InitFeatures, crate::lightning::ln::msgs::DecodeError>> for CResult_InitFeaturesDecodeErrorZ {
2342         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::features::InitFeatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
2343                 let contents = if o.result_ok {
2344                         let result = unsafe { o.contents.result };
2345                         unsafe { o.contents.result = std::ptr::null_mut() };
2346                         CResult_InitFeaturesDecodeErrorZPtr { result }
2347                 } else {
2348                         let err = unsafe { o.contents.err };
2349                         unsafe { o.contents.err = std::ptr::null_mut(); }
2350                         CResult_InitFeaturesDecodeErrorZPtr { err }
2351                 };
2352                 Self {
2353                         contents,
2354                         result_ok: o.result_ok,
2355                 }
2356         }
2357 }
2358 #[repr(C)]
2359 /// The contents of CResult_NodeFeaturesDecodeErrorZ
2360 pub union CResult_NodeFeaturesDecodeErrorZPtr {
2361         /// A pointer to the contents in the success state.
2362         /// Reading from this pointer when `result_ok` is not set is undefined.
2363         pub result: *mut crate::lightning::ln::features::NodeFeatures,
2364         /// A pointer to the contents in the error state.
2365         /// Reading from this pointer when `result_ok` is set is undefined.
2366         pub err: *mut crate::lightning::ln::msgs::DecodeError,
2367 }
2368 #[repr(C)]
2369 /// A CResult_NodeFeaturesDecodeErrorZ represents the result of a fallible operation,
2370 /// containing a crate::lightning::ln::features::NodeFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
2371 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2372 pub struct CResult_NodeFeaturesDecodeErrorZ {
2373         /// The contents of this CResult_NodeFeaturesDecodeErrorZ, accessible via either
2374         /// `err` or `result` depending on the state of `result_ok`.
2375         pub contents: CResult_NodeFeaturesDecodeErrorZPtr,
2376         /// Whether this CResult_NodeFeaturesDecodeErrorZ represents a success state.
2377         pub result_ok: bool,
2378 }
2379 #[no_mangle]
2380 /// Creates a new CResult_NodeFeaturesDecodeErrorZ in the success state.
2381 pub extern "C" fn CResult_NodeFeaturesDecodeErrorZ_ok(o: crate::lightning::ln::features::NodeFeatures) -> CResult_NodeFeaturesDecodeErrorZ {
2382         CResult_NodeFeaturesDecodeErrorZ {
2383                 contents: CResult_NodeFeaturesDecodeErrorZPtr {
2384                         result: Box::into_raw(Box::new(o)),
2385                 },
2386                 result_ok: true,
2387         }
2388 }
2389 #[no_mangle]
2390 /// Creates a new CResult_NodeFeaturesDecodeErrorZ in the error state.
2391 pub extern "C" fn CResult_NodeFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeFeaturesDecodeErrorZ {
2392         CResult_NodeFeaturesDecodeErrorZ {
2393                 contents: CResult_NodeFeaturesDecodeErrorZPtr {
2394                         err: Box::into_raw(Box::new(e)),
2395                 },
2396                 result_ok: false,
2397         }
2398 }
2399 #[no_mangle]
2400 /// Frees any resources used by the CResult_NodeFeaturesDecodeErrorZ.
2401 pub extern "C" fn CResult_NodeFeaturesDecodeErrorZ_free(_res: CResult_NodeFeaturesDecodeErrorZ) { }
2402 impl Drop for CResult_NodeFeaturesDecodeErrorZ {
2403         fn drop(&mut self) {
2404                 if self.result_ok {
2405                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
2406                                 let _ = unsafe { Box::from_raw(self.contents.result) };
2407                         }
2408                 } else {
2409                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
2410                                 let _ = unsafe { Box::from_raw(self.contents.err) };
2411                         }
2412                 }
2413         }
2414 }
2415 impl From<crate::c_types::CResultTempl<crate::lightning::ln::features::NodeFeatures, crate::lightning::ln::msgs::DecodeError>> for CResult_NodeFeaturesDecodeErrorZ {
2416         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::features::NodeFeatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
2417                 let contents = if o.result_ok {
2418                         let result = unsafe { o.contents.result };
2419                         unsafe { o.contents.result = std::ptr::null_mut() };
2420                         CResult_NodeFeaturesDecodeErrorZPtr { result }
2421                 } else {
2422                         let err = unsafe { o.contents.err };
2423                         unsafe { o.contents.err = std::ptr::null_mut(); }
2424                         CResult_NodeFeaturesDecodeErrorZPtr { err }
2425                 };
2426                 Self {
2427                         contents,
2428                         result_ok: o.result_ok,
2429                 }
2430         }
2431 }
2432 #[repr(C)]
2433 /// The contents of CResult_ChannelFeaturesDecodeErrorZ
2434 pub union CResult_ChannelFeaturesDecodeErrorZPtr {
2435         /// A pointer to the contents in the success state.
2436         /// Reading from this pointer when `result_ok` is not set is undefined.
2437         pub result: *mut crate::lightning::ln::features::ChannelFeatures,
2438         /// A pointer to the contents in the error state.
2439         /// Reading from this pointer when `result_ok` is set is undefined.
2440         pub err: *mut crate::lightning::ln::msgs::DecodeError,
2441 }
2442 #[repr(C)]
2443 /// A CResult_ChannelFeaturesDecodeErrorZ represents the result of a fallible operation,
2444 /// containing a crate::lightning::ln::features::ChannelFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
2445 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2446 pub struct CResult_ChannelFeaturesDecodeErrorZ {
2447         /// The contents of this CResult_ChannelFeaturesDecodeErrorZ, accessible via either
2448         /// `err` or `result` depending on the state of `result_ok`.
2449         pub contents: CResult_ChannelFeaturesDecodeErrorZPtr,
2450         /// Whether this CResult_ChannelFeaturesDecodeErrorZ represents a success state.
2451         pub result_ok: bool,
2452 }
2453 #[no_mangle]
2454 /// Creates a new CResult_ChannelFeaturesDecodeErrorZ in the success state.
2455 pub extern "C" fn CResult_ChannelFeaturesDecodeErrorZ_ok(o: crate::lightning::ln::features::ChannelFeatures) -> CResult_ChannelFeaturesDecodeErrorZ {
2456         CResult_ChannelFeaturesDecodeErrorZ {
2457                 contents: CResult_ChannelFeaturesDecodeErrorZPtr {
2458                         result: Box::into_raw(Box::new(o)),
2459                 },
2460                 result_ok: true,
2461         }
2462 }
2463 #[no_mangle]
2464 /// Creates a new CResult_ChannelFeaturesDecodeErrorZ in the error state.
2465 pub extern "C" fn CResult_ChannelFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelFeaturesDecodeErrorZ {
2466         CResult_ChannelFeaturesDecodeErrorZ {
2467                 contents: CResult_ChannelFeaturesDecodeErrorZPtr {
2468                         err: Box::into_raw(Box::new(e)),
2469                 },
2470                 result_ok: false,
2471         }
2472 }
2473 #[no_mangle]
2474 /// Frees any resources used by the CResult_ChannelFeaturesDecodeErrorZ.
2475 pub extern "C" fn CResult_ChannelFeaturesDecodeErrorZ_free(_res: CResult_ChannelFeaturesDecodeErrorZ) { }
2476 impl Drop for CResult_ChannelFeaturesDecodeErrorZ {
2477         fn drop(&mut self) {
2478                 if self.result_ok {
2479                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
2480                                 let _ = unsafe { Box::from_raw(self.contents.result) };
2481                         }
2482                 } else {
2483                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
2484                                 let _ = unsafe { Box::from_raw(self.contents.err) };
2485                         }
2486                 }
2487         }
2488 }
2489 impl From<crate::c_types::CResultTempl<crate::lightning::ln::features::ChannelFeatures, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelFeaturesDecodeErrorZ {
2490         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::features::ChannelFeatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
2491                 let contents = if o.result_ok {
2492                         let result = unsafe { o.contents.result };
2493                         unsafe { o.contents.result = std::ptr::null_mut() };
2494                         CResult_ChannelFeaturesDecodeErrorZPtr { result }
2495                 } else {
2496                         let err = unsafe { o.contents.err };
2497                         unsafe { o.contents.err = std::ptr::null_mut(); }
2498                         CResult_ChannelFeaturesDecodeErrorZPtr { err }
2499                 };
2500                 Self {
2501                         contents,
2502                         result_ok: o.result_ok,
2503                 }
2504         }
2505 }
2506 #[repr(C)]
2507 /// The contents of CResult_InvoiceFeaturesDecodeErrorZ
2508 pub union CResult_InvoiceFeaturesDecodeErrorZPtr {
2509         /// A pointer to the contents in the success state.
2510         /// Reading from this pointer when `result_ok` is not set is undefined.
2511         pub result: *mut crate::lightning::ln::features::InvoiceFeatures,
2512         /// A pointer to the contents in the error state.
2513         /// Reading from this pointer when `result_ok` is set is undefined.
2514         pub err: *mut crate::lightning::ln::msgs::DecodeError,
2515 }
2516 #[repr(C)]
2517 /// A CResult_InvoiceFeaturesDecodeErrorZ represents the result of a fallible operation,
2518 /// containing a crate::lightning::ln::features::InvoiceFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
2519 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2520 pub struct CResult_InvoiceFeaturesDecodeErrorZ {
2521         /// The contents of this CResult_InvoiceFeaturesDecodeErrorZ, accessible via either
2522         /// `err` or `result` depending on the state of `result_ok`.
2523         pub contents: CResult_InvoiceFeaturesDecodeErrorZPtr,
2524         /// Whether this CResult_InvoiceFeaturesDecodeErrorZ represents a success state.
2525         pub result_ok: bool,
2526 }
2527 #[no_mangle]
2528 /// Creates a new CResult_InvoiceFeaturesDecodeErrorZ in the success state.
2529 pub extern "C" fn CResult_InvoiceFeaturesDecodeErrorZ_ok(o: crate::lightning::ln::features::InvoiceFeatures) -> CResult_InvoiceFeaturesDecodeErrorZ {
2530         CResult_InvoiceFeaturesDecodeErrorZ {
2531                 contents: CResult_InvoiceFeaturesDecodeErrorZPtr {
2532                         result: Box::into_raw(Box::new(o)),
2533                 },
2534                 result_ok: true,
2535         }
2536 }
2537 #[no_mangle]
2538 /// Creates a new CResult_InvoiceFeaturesDecodeErrorZ in the error state.
2539 pub extern "C" fn CResult_InvoiceFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_InvoiceFeaturesDecodeErrorZ {
2540         CResult_InvoiceFeaturesDecodeErrorZ {
2541                 contents: CResult_InvoiceFeaturesDecodeErrorZPtr {
2542                         err: Box::into_raw(Box::new(e)),
2543                 },
2544                 result_ok: false,
2545         }
2546 }
2547 #[no_mangle]
2548 /// Frees any resources used by the CResult_InvoiceFeaturesDecodeErrorZ.
2549 pub extern "C" fn CResult_InvoiceFeaturesDecodeErrorZ_free(_res: CResult_InvoiceFeaturesDecodeErrorZ) { }
2550 impl Drop for CResult_InvoiceFeaturesDecodeErrorZ {
2551         fn drop(&mut self) {
2552                 if self.result_ok {
2553                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
2554                                 let _ = unsafe { Box::from_raw(self.contents.result) };
2555                         }
2556                 } else {
2557                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
2558                                 let _ = unsafe { Box::from_raw(self.contents.err) };
2559                         }
2560                 }
2561         }
2562 }
2563 impl From<crate::c_types::CResultTempl<crate::lightning::ln::features::InvoiceFeatures, crate::lightning::ln::msgs::DecodeError>> for CResult_InvoiceFeaturesDecodeErrorZ {
2564         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::features::InvoiceFeatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
2565                 let contents = if o.result_ok {
2566                         let result = unsafe { o.contents.result };
2567                         unsafe { o.contents.result = std::ptr::null_mut() };
2568                         CResult_InvoiceFeaturesDecodeErrorZPtr { result }
2569                 } else {
2570                         let err = unsafe { o.contents.err };
2571                         unsafe { o.contents.err = std::ptr::null_mut(); }
2572                         CResult_InvoiceFeaturesDecodeErrorZPtr { err }
2573                 };
2574                 Self {
2575                         contents,
2576                         result_ok: o.result_ok,
2577                 }
2578         }
2579 }
2580 #[repr(C)]
2581 /// The contents of CResult_DelayedPaymentOutputDescriptorDecodeErrorZ
2582 pub union CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr {
2583         /// A pointer to the contents in the success state.
2584         /// Reading from this pointer when `result_ok` is not set is undefined.
2585         pub result: *mut crate::lightning::chain::keysinterface::DelayedPaymentOutputDescriptor,
2586         /// A pointer to the contents in the error state.
2587         /// Reading from this pointer when `result_ok` is set is undefined.
2588         pub err: *mut crate::lightning::ln::msgs::DecodeError,
2589 }
2590 #[repr(C)]
2591 /// A CResult_DelayedPaymentOutputDescriptorDecodeErrorZ represents the result of a fallible operation,
2592 /// containing a crate::lightning::chain::keysinterface::DelayedPaymentOutputDescriptor on success and a crate::lightning::ln::msgs::DecodeError on failure.
2593 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2594 pub struct CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
2595         /// The contents of this CResult_DelayedPaymentOutputDescriptorDecodeErrorZ, accessible via either
2596         /// `err` or `result` depending on the state of `result_ok`.
2597         pub contents: CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr,
2598         /// Whether this CResult_DelayedPaymentOutputDescriptorDecodeErrorZ represents a success state.
2599         pub result_ok: bool,
2600 }
2601 #[no_mangle]
2602 /// Creates a new CResult_DelayedPaymentOutputDescriptorDecodeErrorZ in the success state.
2603 pub extern "C" fn CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_ok(o: crate::lightning::chain::keysinterface::DelayedPaymentOutputDescriptor) -> CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
2604         CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
2605                 contents: CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr {
2606                         result: Box::into_raw(Box::new(o)),
2607                 },
2608                 result_ok: true,
2609         }
2610 }
2611 #[no_mangle]
2612 /// Creates a new CResult_DelayedPaymentOutputDescriptorDecodeErrorZ in the error state.
2613 pub extern "C" fn CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
2614         CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
2615                 contents: CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr {
2616                         err: Box::into_raw(Box::new(e)),
2617                 },
2618                 result_ok: false,
2619         }
2620 }
2621 #[no_mangle]
2622 /// Frees any resources used by the CResult_DelayedPaymentOutputDescriptorDecodeErrorZ.
2623 pub extern "C" fn CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_free(_res: CResult_DelayedPaymentOutputDescriptorDecodeErrorZ) { }
2624 impl Drop for CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
2625         fn drop(&mut self) {
2626                 if self.result_ok {
2627                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
2628                                 let _ = unsafe { Box::from_raw(self.contents.result) };
2629                         }
2630                 } else {
2631                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
2632                                 let _ = unsafe { Box::from_raw(self.contents.err) };
2633                         }
2634                 }
2635         }
2636 }
2637 impl From<crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::DelayedPaymentOutputDescriptor, crate::lightning::ln::msgs::DecodeError>> for CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
2638         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::DelayedPaymentOutputDescriptor, crate::lightning::ln::msgs::DecodeError>) -> Self {
2639                 let contents = if o.result_ok {
2640                         let result = unsafe { o.contents.result };
2641                         unsafe { o.contents.result = std::ptr::null_mut() };
2642                         CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr { result }
2643                 } else {
2644                         let err = unsafe { o.contents.err };
2645                         unsafe { o.contents.err = std::ptr::null_mut(); }
2646                         CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr { err }
2647                 };
2648                 Self {
2649                         contents,
2650                         result_ok: o.result_ok,
2651                 }
2652         }
2653 }
2654 impl Clone for CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
2655         fn clone(&self) -> Self {
2656                 if self.result_ok {
2657                         Self { result_ok: true, contents: CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr {
2658                                 result: Box::into_raw(Box::new(<crate::lightning::chain::keysinterface::DelayedPaymentOutputDescriptor>::clone(unsafe { &*self.contents.result })))
2659                         } }
2660                 } else {
2661                         Self { result_ok: false, contents: CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr {
2662                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
2663                         } }
2664                 }
2665         }
2666 }
2667 #[no_mangle]
2668 /// Creates a new CResult_DelayedPaymentOutputDescriptorDecodeErrorZ which has the same data as `orig`
2669 /// but with all dynamically-allocated buffers duplicated in new buffers.
2670 pub extern "C" fn CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone(orig: &CResult_DelayedPaymentOutputDescriptorDecodeErrorZ) -> CResult_DelayedPaymentOutputDescriptorDecodeErrorZ { orig.clone() }
2671 #[repr(C)]
2672 /// The contents of CResult_StaticPaymentOutputDescriptorDecodeErrorZ
2673 pub union CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr {
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::chain::keysinterface::StaticPaymentOutputDescriptor,
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_StaticPaymentOutputDescriptorDecodeErrorZ represents the result of a fallible operation,
2683 /// containing a crate::lightning::chain::keysinterface::StaticPaymentOutputDescriptor 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_StaticPaymentOutputDescriptorDecodeErrorZ {
2686         /// The contents of this CResult_StaticPaymentOutputDescriptorDecodeErrorZ, accessible via either
2687         /// `err` or `result` depending on the state of `result_ok`.
2688         pub contents: CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr,
2689         /// Whether this CResult_StaticPaymentOutputDescriptorDecodeErrorZ represents a success state.
2690         pub result_ok: bool,
2691 }
2692 #[no_mangle]
2693 /// Creates a new CResult_StaticPaymentOutputDescriptorDecodeErrorZ in the success state.
2694 pub extern "C" fn CResult_StaticPaymentOutputDescriptorDecodeErrorZ_ok(o: crate::lightning::chain::keysinterface::StaticPaymentOutputDescriptor) -> CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
2695         CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
2696                 contents: CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr {
2697                         result: Box::into_raw(Box::new(o)),
2698                 },
2699                 result_ok: true,
2700         }
2701 }
2702 #[no_mangle]
2703 /// Creates a new CResult_StaticPaymentOutputDescriptorDecodeErrorZ in the error state.
2704 pub extern "C" fn CResult_StaticPaymentOutputDescriptorDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
2705         CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
2706                 contents: CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr {
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_StaticPaymentOutputDescriptorDecodeErrorZ.
2714 pub extern "C" fn CResult_StaticPaymentOutputDescriptorDecodeErrorZ_free(_res: CResult_StaticPaymentOutputDescriptorDecodeErrorZ) { }
2715 impl Drop for CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
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::chain::keysinterface::StaticPaymentOutputDescriptor, crate::lightning::ln::msgs::DecodeError>> for CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
2729         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::StaticPaymentOutputDescriptor, 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_StaticPaymentOutputDescriptorDecodeErrorZPtr { result }
2734                 } else {
2735                         let err = unsafe { o.contents.err };
2736                         unsafe { o.contents.err = std::ptr::null_mut(); }
2737                         CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr { err }
2738                 };
2739                 Self {
2740                         contents,
2741                         result_ok: o.result_ok,
2742                 }
2743         }
2744 }
2745 impl Clone for CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
2746         fn clone(&self) -> Self {
2747                 if self.result_ok {
2748                         Self { result_ok: true, contents: CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr {
2749                                 result: Box::into_raw(Box::new(<crate::lightning::chain::keysinterface::StaticPaymentOutputDescriptor>::clone(unsafe { &*self.contents.result })))
2750                         } }
2751                 } else {
2752                         Self { result_ok: false, contents: CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr {
2753                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
2754                         } }
2755                 }
2756         }
2757 }
2758 #[no_mangle]
2759 /// Creates a new CResult_StaticPaymentOutputDescriptorDecodeErrorZ which has the same data as `orig`
2760 /// but with all dynamically-allocated buffers duplicated in new buffers.
2761 pub extern "C" fn CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone(orig: &CResult_StaticPaymentOutputDescriptorDecodeErrorZ) -> CResult_StaticPaymentOutputDescriptorDecodeErrorZ { orig.clone() }
2762 #[repr(C)]
2763 /// The contents of CResult_SpendableOutputDescriptorDecodeErrorZ
2764 pub union CResult_SpendableOutputDescriptorDecodeErrorZPtr {
2765         /// A pointer to the contents in the success state.
2766         /// Reading from this pointer when `result_ok` is not set is undefined.
2767         pub result: *mut crate::lightning::chain::keysinterface::SpendableOutputDescriptor,
2768         /// A pointer to the contents in the error state.
2769         /// Reading from this pointer when `result_ok` is set is undefined.
2770         pub err: *mut crate::lightning::ln::msgs::DecodeError,
2771 }
2772 #[repr(C)]
2773 /// A CResult_SpendableOutputDescriptorDecodeErrorZ represents the result of a fallible operation,
2774 /// containing a crate::lightning::chain::keysinterface::SpendableOutputDescriptor on success and a crate::lightning::ln::msgs::DecodeError on failure.
2775 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2776 pub struct CResult_SpendableOutputDescriptorDecodeErrorZ {
2777         /// The contents of this CResult_SpendableOutputDescriptorDecodeErrorZ, accessible via either
2778         /// `err` or `result` depending on the state of `result_ok`.
2779         pub contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr,
2780         /// Whether this CResult_SpendableOutputDescriptorDecodeErrorZ represents a success state.
2781         pub result_ok: bool,
2782 }
2783 #[no_mangle]
2784 /// Creates a new CResult_SpendableOutputDescriptorDecodeErrorZ in the success state.
2785 pub extern "C" fn CResult_SpendableOutputDescriptorDecodeErrorZ_ok(o: crate::lightning::chain::keysinterface::SpendableOutputDescriptor) -> CResult_SpendableOutputDescriptorDecodeErrorZ {
2786         CResult_SpendableOutputDescriptorDecodeErrorZ {
2787                 contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr {
2788                         result: Box::into_raw(Box::new(o)),
2789                 },
2790                 result_ok: true,
2791         }
2792 }
2793 #[no_mangle]
2794 /// Creates a new CResult_SpendableOutputDescriptorDecodeErrorZ in the error state.
2795 pub extern "C" fn CResult_SpendableOutputDescriptorDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_SpendableOutputDescriptorDecodeErrorZ {
2796         CResult_SpendableOutputDescriptorDecodeErrorZ {
2797                 contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr {
2798                         err: Box::into_raw(Box::new(e)),
2799                 },
2800                 result_ok: false,
2801         }
2802 }
2803 #[no_mangle]
2804 /// Frees any resources used by the CResult_SpendableOutputDescriptorDecodeErrorZ.
2805 pub extern "C" fn CResult_SpendableOutputDescriptorDecodeErrorZ_free(_res: CResult_SpendableOutputDescriptorDecodeErrorZ) { }
2806 impl Drop for CResult_SpendableOutputDescriptorDecodeErrorZ {
2807         fn drop(&mut self) {
2808                 if self.result_ok {
2809                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
2810                                 let _ = unsafe { Box::from_raw(self.contents.result) };
2811                         }
2812                 } else {
2813                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
2814                                 let _ = unsafe { Box::from_raw(self.contents.err) };
2815                         }
2816                 }
2817         }
2818 }
2819 impl From<crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::SpendableOutputDescriptor, crate::lightning::ln::msgs::DecodeError>> for CResult_SpendableOutputDescriptorDecodeErrorZ {
2820         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::SpendableOutputDescriptor, crate::lightning::ln::msgs::DecodeError>) -> Self {
2821                 let contents = if o.result_ok {
2822                         let result = unsafe { o.contents.result };
2823                         unsafe { o.contents.result = std::ptr::null_mut() };
2824                         CResult_SpendableOutputDescriptorDecodeErrorZPtr { result }
2825                 } else {
2826                         let err = unsafe { o.contents.err };
2827                         unsafe { o.contents.err = std::ptr::null_mut(); }
2828                         CResult_SpendableOutputDescriptorDecodeErrorZPtr { err }
2829                 };
2830                 Self {
2831                         contents,
2832                         result_ok: o.result_ok,
2833                 }
2834         }
2835 }
2836 impl Clone for CResult_SpendableOutputDescriptorDecodeErrorZ {
2837         fn clone(&self) -> Self {
2838                 if self.result_ok {
2839                         Self { result_ok: true, contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr {
2840                                 result: Box::into_raw(Box::new(<crate::lightning::chain::keysinterface::SpendableOutputDescriptor>::clone(unsafe { &*self.contents.result })))
2841                         } }
2842                 } else {
2843                         Self { result_ok: false, contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr {
2844                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
2845                         } }
2846                 }
2847         }
2848 }
2849 #[no_mangle]
2850 /// Creates a new CResult_SpendableOutputDescriptorDecodeErrorZ which has the same data as `orig`
2851 /// but with all dynamically-allocated buffers duplicated in new buffers.
2852 pub extern "C" fn CResult_SpendableOutputDescriptorDecodeErrorZ_clone(orig: &CResult_SpendableOutputDescriptorDecodeErrorZ) -> CResult_SpendableOutputDescriptorDecodeErrorZ { orig.clone() }
2853 #[repr(C)]
2854 /// A tuple of 2 elements. See the individual fields for the types contained.
2855 pub struct C2Tuple_SignatureCVec_SignatureZZ {
2856         /// The element at position 0
2857         pub a: crate::c_types::Signature,
2858         /// The element at position 1
2859         pub b: crate::c_types::derived::CVec_SignatureZ,
2860 }
2861 impl From<(crate::c_types::Signature, crate::c_types::derived::CVec_SignatureZ)> for C2Tuple_SignatureCVec_SignatureZZ {
2862         fn from (tup: (crate::c_types::Signature, crate::c_types::derived::CVec_SignatureZ)) -> Self {
2863                 Self {
2864                         a: tup.0,
2865                         b: tup.1,
2866                 }
2867         }
2868 }
2869 impl C2Tuple_SignatureCVec_SignatureZZ {
2870         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::Signature, crate::c_types::derived::CVec_SignatureZ) {
2871                 (self.a, self.b)
2872         }
2873 }
2874 impl Clone for C2Tuple_SignatureCVec_SignatureZZ {
2875         fn clone(&self) -> Self {
2876                 Self {
2877                         a: self.a.clone(),
2878                         b: self.b.clone(),
2879                 }
2880         }
2881 }
2882 #[no_mangle]
2883 /// Creates a new tuple which has the same data as `orig`
2884 /// but with all dynamically-allocated buffers duplicated in new buffers.
2885 pub extern "C" fn C2Tuple_SignatureCVec_SignatureZZ_clone(orig: &C2Tuple_SignatureCVec_SignatureZZ) -> C2Tuple_SignatureCVec_SignatureZZ { orig.clone() }
2886 /// Creates a new C2Tuple_SignatureCVec_SignatureZZ from the contained elements.
2887 #[no_mangle]
2888 pub extern "C" fn C2Tuple_SignatureCVec_SignatureZZ_new(a: crate::c_types::Signature, b: crate::c_types::derived::CVec_SignatureZ) -> C2Tuple_SignatureCVec_SignatureZZ {
2889         C2Tuple_SignatureCVec_SignatureZZ { a, b, }
2890 }
2891
2892 #[no_mangle]
2893 /// Frees any resources used by the C2Tuple_SignatureCVec_SignatureZZ.
2894 pub extern "C" fn C2Tuple_SignatureCVec_SignatureZZ_free(_res: C2Tuple_SignatureCVec_SignatureZZ) { }
2895 #[repr(C)]
2896 /// The contents of CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ
2897 pub union CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
2898         /// A pointer to the contents in the success state.
2899         /// Reading from this pointer when `result_ok` is not set is undefined.
2900         pub result: *mut crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ,
2901         /// Note that this value is always NULL, as there are no contents in the Err variant
2902         pub err: *mut std::ffi::c_void,
2903 }
2904 #[repr(C)]
2905 /// A CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ represents the result of a fallible operation,
2906 /// containing a crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ on success and a () on failure.
2907 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2908 pub struct CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
2909         /// The contents of this CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ, accessible via either
2910         /// `err` or `result` depending on the state of `result_ok`.
2911         pub contents: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr,
2912         /// Whether this CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ represents a success state.
2913         pub result_ok: bool,
2914 }
2915 #[no_mangle]
2916 /// Creates a new CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ in the success state.
2917 pub extern "C" fn CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_ok(o: crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ) -> CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
2918         CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
2919                 contents: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
2920                         result: Box::into_raw(Box::new(o)),
2921                 },
2922                 result_ok: true,
2923         }
2924 }
2925 #[no_mangle]
2926 /// Creates a new CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ in the error state.
2927 pub extern "C" fn CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_err() -> CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
2928         CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
2929                 contents: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
2930                         err: std::ptr::null_mut(),
2931                 },
2932                 result_ok: false,
2933         }
2934 }
2935 #[no_mangle]
2936 /// Frees any resources used by the CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ.
2937 pub extern "C" fn CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_free(_res: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ) { }
2938 impl Drop for CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
2939         fn drop(&mut self) {
2940                 if self.result_ok {
2941                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
2942                                 let _ = unsafe { Box::from_raw(self.contents.result) };
2943                         }
2944                 } else {
2945                 }
2946         }
2947 }
2948 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ, ()>> for CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
2949         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ, ()>) -> Self {
2950                 let contents = if o.result_ok {
2951                         let result = unsafe { o.contents.result };
2952                         unsafe { o.contents.result = std::ptr::null_mut() };
2953                         CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr { result }
2954                 } else {
2955                         let _ = unsafe { Box::from_raw(o.contents.err) };
2956                         o.contents.err = std::ptr::null_mut();
2957                         CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr { err: std::ptr::null_mut() }
2958                 };
2959                 Self {
2960                         contents,
2961                         result_ok: o.result_ok,
2962                 }
2963         }
2964 }
2965 impl Clone for CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
2966         fn clone(&self) -> Self {
2967                 if self.result_ok {
2968                         Self { result_ok: true, contents: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
2969                                 result: Box::into_raw(Box::new(<crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ>::clone(unsafe { &*self.contents.result })))
2970                         } }
2971                 } else {
2972                         Self { result_ok: false, contents: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
2973                                 err: std::ptr::null_mut()
2974                         } }
2975                 }
2976         }
2977 }
2978 #[no_mangle]
2979 /// Creates a new CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ which has the same data as `orig`
2980 /// but with all dynamically-allocated buffers duplicated in new buffers.
2981 pub extern "C" fn CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone(orig: &CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ) -> CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ { orig.clone() }
2982 #[repr(C)]
2983 /// The contents of CResult_SignatureNoneZ
2984 pub union CResult_SignatureNoneZPtr {
2985         /// A pointer to the contents in the success state.
2986         /// Reading from this pointer when `result_ok` is not set is undefined.
2987         pub result: *mut crate::c_types::Signature,
2988         /// Note that this value is always NULL, as there are no contents in the Err variant
2989         pub err: *mut std::ffi::c_void,
2990 }
2991 #[repr(C)]
2992 /// A CResult_SignatureNoneZ represents the result of a fallible operation,
2993 /// containing a crate::c_types::Signature on success and a () on failure.
2994 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2995 pub struct CResult_SignatureNoneZ {
2996         /// The contents of this CResult_SignatureNoneZ, accessible via either
2997         /// `err` or `result` depending on the state of `result_ok`.
2998         pub contents: CResult_SignatureNoneZPtr,
2999         /// Whether this CResult_SignatureNoneZ represents a success state.
3000         pub result_ok: bool,
3001 }
3002 #[no_mangle]
3003 /// Creates a new CResult_SignatureNoneZ in the success state.
3004 pub extern "C" fn CResult_SignatureNoneZ_ok(o: crate::c_types::Signature) -> CResult_SignatureNoneZ {
3005         CResult_SignatureNoneZ {
3006                 contents: CResult_SignatureNoneZPtr {
3007                         result: Box::into_raw(Box::new(o)),
3008                 },
3009                 result_ok: true,
3010         }
3011 }
3012 #[no_mangle]
3013 /// Creates a new CResult_SignatureNoneZ in the error state.
3014 pub extern "C" fn CResult_SignatureNoneZ_err() -> CResult_SignatureNoneZ {
3015         CResult_SignatureNoneZ {
3016                 contents: CResult_SignatureNoneZPtr {
3017                         err: std::ptr::null_mut(),
3018                 },
3019                 result_ok: false,
3020         }
3021 }
3022 #[no_mangle]
3023 /// Frees any resources used by the CResult_SignatureNoneZ.
3024 pub extern "C" fn CResult_SignatureNoneZ_free(_res: CResult_SignatureNoneZ) { }
3025 impl Drop for CResult_SignatureNoneZ {
3026         fn drop(&mut self) {
3027                 if self.result_ok {
3028                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
3029                                 let _ = unsafe { Box::from_raw(self.contents.result) };
3030                         }
3031                 } else {
3032                 }
3033         }
3034 }
3035 impl From<crate::c_types::CResultTempl<crate::c_types::Signature, ()>> for CResult_SignatureNoneZ {
3036         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::Signature, ()>) -> Self {
3037                 let contents = if o.result_ok {
3038                         let result = unsafe { o.contents.result };
3039                         unsafe { o.contents.result = std::ptr::null_mut() };
3040                         CResult_SignatureNoneZPtr { result }
3041                 } else {
3042                         let _ = unsafe { Box::from_raw(o.contents.err) };
3043                         o.contents.err = std::ptr::null_mut();
3044                         CResult_SignatureNoneZPtr { err: std::ptr::null_mut() }
3045                 };
3046                 Self {
3047                         contents,
3048                         result_ok: o.result_ok,
3049                 }
3050         }
3051 }
3052 impl Clone for CResult_SignatureNoneZ {
3053         fn clone(&self) -> Self {
3054                 if self.result_ok {
3055                         Self { result_ok: true, contents: CResult_SignatureNoneZPtr {
3056                                 result: Box::into_raw(Box::new(<crate::c_types::Signature>::clone(unsafe { &*self.contents.result })))
3057                         } }
3058                 } else {
3059                         Self { result_ok: false, contents: CResult_SignatureNoneZPtr {
3060                                 err: std::ptr::null_mut()
3061                         } }
3062                 }
3063         }
3064 }
3065 #[no_mangle]
3066 /// Creates a new CResult_SignatureNoneZ which has the same data as `orig`
3067 /// but with all dynamically-allocated buffers duplicated in new buffers.
3068 pub extern "C" fn CResult_SignatureNoneZ_clone(orig: &CResult_SignatureNoneZ) -> CResult_SignatureNoneZ { orig.clone() }
3069 #[repr(C)]
3070 /// The contents of CResult_SignDecodeErrorZ
3071 pub union CResult_SignDecodeErrorZPtr {
3072         /// A pointer to the contents in the success state.
3073         /// Reading from this pointer when `result_ok` is not set is undefined.
3074         pub result: *mut crate::lightning::chain::keysinterface::Sign,
3075         /// A pointer to the contents in the error state.
3076         /// Reading from this pointer when `result_ok` is set is undefined.
3077         pub err: *mut crate::lightning::ln::msgs::DecodeError,
3078 }
3079 #[repr(C)]
3080 /// A CResult_SignDecodeErrorZ represents the result of a fallible operation,
3081 /// containing a crate::lightning::chain::keysinterface::Sign on success and a crate::lightning::ln::msgs::DecodeError on failure.
3082 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3083 pub struct CResult_SignDecodeErrorZ {
3084         /// The contents of this CResult_SignDecodeErrorZ, accessible via either
3085         /// `err` or `result` depending on the state of `result_ok`.
3086         pub contents: CResult_SignDecodeErrorZPtr,
3087         /// Whether this CResult_SignDecodeErrorZ represents a success state.
3088         pub result_ok: bool,
3089 }
3090 #[no_mangle]
3091 /// Creates a new CResult_SignDecodeErrorZ in the success state.
3092 pub extern "C" fn CResult_SignDecodeErrorZ_ok(o: crate::lightning::chain::keysinterface::Sign) -> CResult_SignDecodeErrorZ {
3093         CResult_SignDecodeErrorZ {
3094                 contents: CResult_SignDecodeErrorZPtr {
3095                         result: Box::into_raw(Box::new(o)),
3096                 },
3097                 result_ok: true,
3098         }
3099 }
3100 #[no_mangle]
3101 /// Creates a new CResult_SignDecodeErrorZ in the error state.
3102 pub extern "C" fn CResult_SignDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_SignDecodeErrorZ {
3103         CResult_SignDecodeErrorZ {
3104                 contents: CResult_SignDecodeErrorZPtr {
3105                         err: Box::into_raw(Box::new(e)),
3106                 },
3107                 result_ok: false,
3108         }
3109 }
3110 #[no_mangle]
3111 /// Frees any resources used by the CResult_SignDecodeErrorZ.
3112 pub extern "C" fn CResult_SignDecodeErrorZ_free(_res: CResult_SignDecodeErrorZ) { }
3113 impl Drop for CResult_SignDecodeErrorZ {
3114         fn drop(&mut self) {
3115                 if self.result_ok {
3116                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
3117                                 let _ = unsafe { Box::from_raw(self.contents.result) };
3118                         }
3119                 } else {
3120                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
3121                                 let _ = unsafe { Box::from_raw(self.contents.err) };
3122                         }
3123                 }
3124         }
3125 }
3126 impl From<crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::Sign, crate::lightning::ln::msgs::DecodeError>> for CResult_SignDecodeErrorZ {
3127         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::Sign, crate::lightning::ln::msgs::DecodeError>) -> Self {
3128                 let contents = if o.result_ok {
3129                         let result = unsafe { o.contents.result };
3130                         unsafe { o.contents.result = std::ptr::null_mut() };
3131                         CResult_SignDecodeErrorZPtr { result }
3132                 } else {
3133                         let err = unsafe { o.contents.err };
3134                         unsafe { o.contents.err = std::ptr::null_mut(); }
3135                         CResult_SignDecodeErrorZPtr { err }
3136                 };
3137                 Self {
3138                         contents,
3139                         result_ok: o.result_ok,
3140                 }
3141         }
3142 }
3143 impl Clone for CResult_SignDecodeErrorZ {
3144         fn clone(&self) -> Self {
3145                 if self.result_ok {
3146                         Self { result_ok: true, contents: CResult_SignDecodeErrorZPtr {
3147                                 result: Box::into_raw(Box::new(<crate::lightning::chain::keysinterface::Sign>::clone(unsafe { &*self.contents.result })))
3148                         } }
3149                 } else {
3150                         Self { result_ok: false, contents: CResult_SignDecodeErrorZPtr {
3151                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
3152                         } }
3153                 }
3154         }
3155 }
3156 #[no_mangle]
3157 /// Creates a new CResult_SignDecodeErrorZ which has the same data as `orig`
3158 /// but with all dynamically-allocated buffers duplicated in new buffers.
3159 pub extern "C" fn CResult_SignDecodeErrorZ_clone(orig: &CResult_SignDecodeErrorZ) -> CResult_SignDecodeErrorZ { orig.clone() }
3160 #[repr(C)]
3161 /// A dynamically-allocated array of u8s of arbitrary size.
3162 /// This corresponds to std::vector in C++
3163 pub struct CVec_u8Z {
3164         /// The elements in the array.
3165         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3166         pub data: *mut u8,
3167         /// The number of elements pointed to by `data`.
3168         pub datalen: usize
3169 }
3170 impl CVec_u8Z {
3171         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<u8> {
3172                 if self.datalen == 0 { return Vec::new(); }
3173                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
3174                 self.data = std::ptr::null_mut();
3175                 self.datalen = 0;
3176                 ret
3177         }
3178         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[u8] {
3179                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
3180         }
3181 }
3182 impl From<Vec<u8>> for CVec_u8Z {
3183         fn from(v: Vec<u8>) -> Self {
3184                 let datalen = v.len();
3185                 let data = Box::into_raw(v.into_boxed_slice());
3186                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
3187         }
3188 }
3189 #[no_mangle]
3190 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
3191 pub extern "C" fn CVec_u8Z_free(_res: CVec_u8Z) { }
3192 impl Drop for CVec_u8Z {
3193         fn drop(&mut self) {
3194                 if self.datalen == 0 { return; }
3195                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
3196         }
3197 }
3198 impl Clone for CVec_u8Z {
3199         fn clone(&self) -> Self {
3200                 let mut res = Vec::new();
3201                 if self.datalen == 0 { return Self::from(res); }
3202                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
3203                 Self::from(res)
3204         }
3205 }
3206 #[repr(C)]
3207 /// The contents of CResult_RecoverableSignatureNoneZ
3208 pub union CResult_RecoverableSignatureNoneZPtr {
3209         /// A pointer to the contents in the success state.
3210         /// Reading from this pointer when `result_ok` is not set is undefined.
3211         pub result: *mut crate::c_types::RecoverableSignature,
3212         /// Note that this value is always NULL, as there are no contents in the Err variant
3213         pub err: *mut std::ffi::c_void,
3214 }
3215 #[repr(C)]
3216 /// A CResult_RecoverableSignatureNoneZ represents the result of a fallible operation,
3217 /// containing a crate::c_types::RecoverableSignature on success and a () on failure.
3218 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3219 pub struct CResult_RecoverableSignatureNoneZ {
3220         /// The contents of this CResult_RecoverableSignatureNoneZ, accessible via either
3221         /// `err` or `result` depending on the state of `result_ok`.
3222         pub contents: CResult_RecoverableSignatureNoneZPtr,
3223         /// Whether this CResult_RecoverableSignatureNoneZ represents a success state.
3224         pub result_ok: bool,
3225 }
3226 #[no_mangle]
3227 /// Creates a new CResult_RecoverableSignatureNoneZ in the success state.
3228 pub extern "C" fn CResult_RecoverableSignatureNoneZ_ok(o: crate::c_types::RecoverableSignature) -> CResult_RecoverableSignatureNoneZ {
3229         CResult_RecoverableSignatureNoneZ {
3230                 contents: CResult_RecoverableSignatureNoneZPtr {
3231                         result: Box::into_raw(Box::new(o)),
3232                 },
3233                 result_ok: true,
3234         }
3235 }
3236 #[no_mangle]
3237 /// Creates a new CResult_RecoverableSignatureNoneZ in the error state.
3238 pub extern "C" fn CResult_RecoverableSignatureNoneZ_err() -> CResult_RecoverableSignatureNoneZ {
3239         CResult_RecoverableSignatureNoneZ {
3240                 contents: CResult_RecoverableSignatureNoneZPtr {
3241                         err: std::ptr::null_mut(),
3242                 },
3243                 result_ok: false,
3244         }
3245 }
3246 #[no_mangle]
3247 /// Frees any resources used by the CResult_RecoverableSignatureNoneZ.
3248 pub extern "C" fn CResult_RecoverableSignatureNoneZ_free(_res: CResult_RecoverableSignatureNoneZ) { }
3249 impl Drop for CResult_RecoverableSignatureNoneZ {
3250         fn drop(&mut self) {
3251                 if self.result_ok {
3252                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
3253                                 let _ = unsafe { Box::from_raw(self.contents.result) };
3254                         }
3255                 } else {
3256                 }
3257         }
3258 }
3259 impl From<crate::c_types::CResultTempl<crate::c_types::RecoverableSignature, ()>> for CResult_RecoverableSignatureNoneZ {
3260         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::RecoverableSignature, ()>) -> Self {
3261                 let contents = if o.result_ok {
3262                         let result = unsafe { o.contents.result };
3263                         unsafe { o.contents.result = std::ptr::null_mut() };
3264                         CResult_RecoverableSignatureNoneZPtr { result }
3265                 } else {
3266                         let _ = unsafe { Box::from_raw(o.contents.err) };
3267                         o.contents.err = std::ptr::null_mut();
3268                         CResult_RecoverableSignatureNoneZPtr { err: std::ptr::null_mut() }
3269                 };
3270                 Self {
3271                         contents,
3272                         result_ok: o.result_ok,
3273                 }
3274         }
3275 }
3276 impl Clone for CResult_RecoverableSignatureNoneZ {
3277         fn clone(&self) -> Self {
3278                 if self.result_ok {
3279                         Self { result_ok: true, contents: CResult_RecoverableSignatureNoneZPtr {
3280                                 result: Box::into_raw(Box::new(<crate::c_types::RecoverableSignature>::clone(unsafe { &*self.contents.result })))
3281                         } }
3282                 } else {
3283                         Self { result_ok: false, contents: CResult_RecoverableSignatureNoneZPtr {
3284                                 err: std::ptr::null_mut()
3285                         } }
3286                 }
3287         }
3288 }
3289 #[no_mangle]
3290 /// Creates a new CResult_RecoverableSignatureNoneZ which has the same data as `orig`
3291 /// but with all dynamically-allocated buffers duplicated in new buffers.
3292 pub extern "C" fn CResult_RecoverableSignatureNoneZ_clone(orig: &CResult_RecoverableSignatureNoneZ) -> CResult_RecoverableSignatureNoneZ { orig.clone() }
3293 #[repr(C)]
3294 /// A dynamically-allocated array of crate::c_types::derived::CVec_u8Zs of arbitrary size.
3295 /// This corresponds to std::vector in C++
3296 pub struct CVec_CVec_u8ZZ {
3297         /// The elements in the array.
3298         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3299         pub data: *mut crate::c_types::derived::CVec_u8Z,
3300         /// The number of elements pointed to by `data`.
3301         pub datalen: usize
3302 }
3303 impl CVec_CVec_u8ZZ {
3304         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::CVec_u8Z> {
3305                 if self.datalen == 0 { return Vec::new(); }
3306                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
3307                 self.data = std::ptr::null_mut();
3308                 self.datalen = 0;
3309                 ret
3310         }
3311         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::CVec_u8Z] {
3312                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
3313         }
3314 }
3315 impl From<Vec<crate::c_types::derived::CVec_u8Z>> for CVec_CVec_u8ZZ {
3316         fn from(v: Vec<crate::c_types::derived::CVec_u8Z>) -> Self {
3317                 let datalen = v.len();
3318                 let data = Box::into_raw(v.into_boxed_slice());
3319                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
3320         }
3321 }
3322 #[no_mangle]
3323 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
3324 pub extern "C" fn CVec_CVec_u8ZZ_free(_res: CVec_CVec_u8ZZ) { }
3325 impl Drop for CVec_CVec_u8ZZ {
3326         fn drop(&mut self) {
3327                 if self.datalen == 0 { return; }
3328                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
3329         }
3330 }
3331 impl Clone for CVec_CVec_u8ZZ {
3332         fn clone(&self) -> Self {
3333                 let mut res = Vec::new();
3334                 if self.datalen == 0 { return Self::from(res); }
3335                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
3336                 Self::from(res)
3337         }
3338 }
3339 #[repr(C)]
3340 /// The contents of CResult_CVec_CVec_u8ZZNoneZ
3341 pub union CResult_CVec_CVec_u8ZZNoneZPtr {
3342         /// A pointer to the contents in the success state.
3343         /// Reading from this pointer when `result_ok` is not set is undefined.
3344         pub result: *mut crate::c_types::derived::CVec_CVec_u8ZZ,
3345         /// Note that this value is always NULL, as there are no contents in the Err variant
3346         pub err: *mut std::ffi::c_void,
3347 }
3348 #[repr(C)]
3349 /// A CResult_CVec_CVec_u8ZZNoneZ represents the result of a fallible operation,
3350 /// containing a crate::c_types::derived::CVec_CVec_u8ZZ on success and a () on failure.
3351 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3352 pub struct CResult_CVec_CVec_u8ZZNoneZ {
3353         /// The contents of this CResult_CVec_CVec_u8ZZNoneZ, accessible via either
3354         /// `err` or `result` depending on the state of `result_ok`.
3355         pub contents: CResult_CVec_CVec_u8ZZNoneZPtr,
3356         /// Whether this CResult_CVec_CVec_u8ZZNoneZ represents a success state.
3357         pub result_ok: bool,
3358 }
3359 #[no_mangle]
3360 /// Creates a new CResult_CVec_CVec_u8ZZNoneZ in the success state.
3361 pub extern "C" fn CResult_CVec_CVec_u8ZZNoneZ_ok(o: crate::c_types::derived::CVec_CVec_u8ZZ) -> CResult_CVec_CVec_u8ZZNoneZ {
3362         CResult_CVec_CVec_u8ZZNoneZ {
3363                 contents: CResult_CVec_CVec_u8ZZNoneZPtr {
3364                         result: Box::into_raw(Box::new(o)),
3365                 },
3366                 result_ok: true,
3367         }
3368 }
3369 #[no_mangle]
3370 /// Creates a new CResult_CVec_CVec_u8ZZNoneZ in the error state.
3371 pub extern "C" fn CResult_CVec_CVec_u8ZZNoneZ_err() -> CResult_CVec_CVec_u8ZZNoneZ {
3372         CResult_CVec_CVec_u8ZZNoneZ {
3373                 contents: CResult_CVec_CVec_u8ZZNoneZPtr {
3374                         err: std::ptr::null_mut(),
3375                 },
3376                 result_ok: false,
3377         }
3378 }
3379 #[no_mangle]
3380 /// Frees any resources used by the CResult_CVec_CVec_u8ZZNoneZ.
3381 pub extern "C" fn CResult_CVec_CVec_u8ZZNoneZ_free(_res: CResult_CVec_CVec_u8ZZNoneZ) { }
3382 impl Drop for CResult_CVec_CVec_u8ZZNoneZ {
3383         fn drop(&mut self) {
3384                 if self.result_ok {
3385                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
3386                                 let _ = unsafe { Box::from_raw(self.contents.result) };
3387                         }
3388                 } else {
3389                 }
3390         }
3391 }
3392 impl From<crate::c_types::CResultTempl<crate::c_types::derived::CVec_CVec_u8ZZ, ()>> for CResult_CVec_CVec_u8ZZNoneZ {
3393         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CVec_CVec_u8ZZ, ()>) -> Self {
3394                 let contents = if o.result_ok {
3395                         let result = unsafe { o.contents.result };
3396                         unsafe { o.contents.result = std::ptr::null_mut() };
3397                         CResult_CVec_CVec_u8ZZNoneZPtr { result }
3398                 } else {
3399                         let _ = unsafe { Box::from_raw(o.contents.err) };
3400                         o.contents.err = std::ptr::null_mut();
3401                         CResult_CVec_CVec_u8ZZNoneZPtr { err: std::ptr::null_mut() }
3402                 };
3403                 Self {
3404                         contents,
3405                         result_ok: o.result_ok,
3406                 }
3407         }
3408 }
3409 impl Clone for CResult_CVec_CVec_u8ZZNoneZ {
3410         fn clone(&self) -> Self {
3411                 if self.result_ok {
3412                         Self { result_ok: true, contents: CResult_CVec_CVec_u8ZZNoneZPtr {
3413                                 result: Box::into_raw(Box::new(<crate::c_types::derived::CVec_CVec_u8ZZ>::clone(unsafe { &*self.contents.result })))
3414                         } }
3415                 } else {
3416                         Self { result_ok: false, contents: CResult_CVec_CVec_u8ZZNoneZPtr {
3417                                 err: std::ptr::null_mut()
3418                         } }
3419                 }
3420         }
3421 }
3422 #[no_mangle]
3423 /// Creates a new CResult_CVec_CVec_u8ZZNoneZ which has the same data as `orig`
3424 /// but with all dynamically-allocated buffers duplicated in new buffers.
3425 pub extern "C" fn CResult_CVec_CVec_u8ZZNoneZ_clone(orig: &CResult_CVec_CVec_u8ZZNoneZ) -> CResult_CVec_CVec_u8ZZNoneZ { orig.clone() }
3426 #[repr(C)]
3427 /// The contents of CResult_InMemorySignerDecodeErrorZ
3428 pub union CResult_InMemorySignerDecodeErrorZPtr {
3429         /// A pointer to the contents in the success state.
3430         /// Reading from this pointer when `result_ok` is not set is undefined.
3431         pub result: *mut crate::lightning::chain::keysinterface::InMemorySigner,
3432         /// A pointer to the contents in the error state.
3433         /// Reading from this pointer when `result_ok` is set is undefined.
3434         pub err: *mut crate::lightning::ln::msgs::DecodeError,
3435 }
3436 #[repr(C)]
3437 /// A CResult_InMemorySignerDecodeErrorZ represents the result of a fallible operation,
3438 /// containing a crate::lightning::chain::keysinterface::InMemorySigner on success and a crate::lightning::ln::msgs::DecodeError on failure.
3439 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3440 pub struct CResult_InMemorySignerDecodeErrorZ {
3441         /// The contents of this CResult_InMemorySignerDecodeErrorZ, accessible via either
3442         /// `err` or `result` depending on the state of `result_ok`.
3443         pub contents: CResult_InMemorySignerDecodeErrorZPtr,
3444         /// Whether this CResult_InMemorySignerDecodeErrorZ represents a success state.
3445         pub result_ok: bool,
3446 }
3447 #[no_mangle]
3448 /// Creates a new CResult_InMemorySignerDecodeErrorZ in the success state.
3449 pub extern "C" fn CResult_InMemorySignerDecodeErrorZ_ok(o: crate::lightning::chain::keysinterface::InMemorySigner) -> CResult_InMemorySignerDecodeErrorZ {
3450         CResult_InMemorySignerDecodeErrorZ {
3451                 contents: CResult_InMemorySignerDecodeErrorZPtr {
3452                         result: Box::into_raw(Box::new(o)),
3453                 },
3454                 result_ok: true,
3455         }
3456 }
3457 #[no_mangle]
3458 /// Creates a new CResult_InMemorySignerDecodeErrorZ in the error state.
3459 pub extern "C" fn CResult_InMemorySignerDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_InMemorySignerDecodeErrorZ {
3460         CResult_InMemorySignerDecodeErrorZ {
3461                 contents: CResult_InMemorySignerDecodeErrorZPtr {
3462                         err: Box::into_raw(Box::new(e)),
3463                 },
3464                 result_ok: false,
3465         }
3466 }
3467 #[no_mangle]
3468 /// Frees any resources used by the CResult_InMemorySignerDecodeErrorZ.
3469 pub extern "C" fn CResult_InMemorySignerDecodeErrorZ_free(_res: CResult_InMemorySignerDecodeErrorZ) { }
3470 impl Drop for CResult_InMemorySignerDecodeErrorZ {
3471         fn drop(&mut self) {
3472                 if self.result_ok {
3473                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
3474                                 let _ = unsafe { Box::from_raw(self.contents.result) };
3475                         }
3476                 } else {
3477                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
3478                                 let _ = unsafe { Box::from_raw(self.contents.err) };
3479                         }
3480                 }
3481         }
3482 }
3483 impl From<crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::InMemorySigner, crate::lightning::ln::msgs::DecodeError>> for CResult_InMemorySignerDecodeErrorZ {
3484         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::InMemorySigner, crate::lightning::ln::msgs::DecodeError>) -> Self {
3485                 let contents = if o.result_ok {
3486                         let result = unsafe { o.contents.result };
3487                         unsafe { o.contents.result = std::ptr::null_mut() };
3488                         CResult_InMemorySignerDecodeErrorZPtr { result }
3489                 } else {
3490                         let err = unsafe { o.contents.err };
3491                         unsafe { o.contents.err = std::ptr::null_mut(); }
3492                         CResult_InMemorySignerDecodeErrorZPtr { err }
3493                 };
3494                 Self {
3495                         contents,
3496                         result_ok: o.result_ok,
3497                 }
3498         }
3499 }
3500 impl Clone for CResult_InMemorySignerDecodeErrorZ {
3501         fn clone(&self) -> Self {
3502                 if self.result_ok {
3503                         Self { result_ok: true, contents: CResult_InMemorySignerDecodeErrorZPtr {
3504                                 result: Box::into_raw(Box::new(<crate::lightning::chain::keysinterface::InMemorySigner>::clone(unsafe { &*self.contents.result })))
3505                         } }
3506                 } else {
3507                         Self { result_ok: false, contents: CResult_InMemorySignerDecodeErrorZPtr {
3508                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
3509                         } }
3510                 }
3511         }
3512 }
3513 #[no_mangle]
3514 /// Creates a new CResult_InMemorySignerDecodeErrorZ which has the same data as `orig`
3515 /// but with all dynamically-allocated buffers duplicated in new buffers.
3516 pub extern "C" fn CResult_InMemorySignerDecodeErrorZ_clone(orig: &CResult_InMemorySignerDecodeErrorZ) -> CResult_InMemorySignerDecodeErrorZ { orig.clone() }
3517 #[repr(C)]
3518 /// A dynamically-allocated array of crate::c_types::TxOuts of arbitrary size.
3519 /// This corresponds to std::vector in C++
3520 pub struct CVec_TxOutZ {
3521         /// The elements in the array.
3522         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3523         pub data: *mut crate::c_types::TxOut,
3524         /// The number of elements pointed to by `data`.
3525         pub datalen: usize
3526 }
3527 impl CVec_TxOutZ {
3528         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::TxOut> {
3529                 if self.datalen == 0 { return Vec::new(); }
3530                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
3531                 self.data = std::ptr::null_mut();
3532                 self.datalen = 0;
3533                 ret
3534         }
3535         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::TxOut] {
3536                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
3537         }
3538 }
3539 impl From<Vec<crate::c_types::TxOut>> for CVec_TxOutZ {
3540         fn from(v: Vec<crate::c_types::TxOut>) -> Self {
3541                 let datalen = v.len();
3542                 let data = Box::into_raw(v.into_boxed_slice());
3543                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
3544         }
3545 }
3546 #[no_mangle]
3547 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
3548 pub extern "C" fn CVec_TxOutZ_free(_res: CVec_TxOutZ) { }
3549 impl Drop for CVec_TxOutZ {
3550         fn drop(&mut self) {
3551                 if self.datalen == 0 { return; }
3552                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
3553         }
3554 }
3555 impl Clone for CVec_TxOutZ {
3556         fn clone(&self) -> Self {
3557                 let mut res = Vec::new();
3558                 if self.datalen == 0 { return Self::from(res); }
3559                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
3560                 Self::from(res)
3561         }
3562 }
3563 #[repr(C)]
3564 /// The contents of CResult_TransactionNoneZ
3565 pub union CResult_TransactionNoneZPtr {
3566         /// A pointer to the contents in the success state.
3567         /// Reading from this pointer when `result_ok` is not set is undefined.
3568         pub result: *mut crate::c_types::Transaction,
3569         /// Note that this value is always NULL, as there are no contents in the Err variant
3570         pub err: *mut std::ffi::c_void,
3571 }
3572 #[repr(C)]
3573 /// A CResult_TransactionNoneZ represents the result of a fallible operation,
3574 /// containing a crate::c_types::Transaction on success and a () on failure.
3575 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3576 pub struct CResult_TransactionNoneZ {
3577         /// The contents of this CResult_TransactionNoneZ, accessible via either
3578         /// `err` or `result` depending on the state of `result_ok`.
3579         pub contents: CResult_TransactionNoneZPtr,
3580         /// Whether this CResult_TransactionNoneZ represents a success state.
3581         pub result_ok: bool,
3582 }
3583 #[no_mangle]
3584 /// Creates a new CResult_TransactionNoneZ in the success state.
3585 pub extern "C" fn CResult_TransactionNoneZ_ok(o: crate::c_types::Transaction) -> CResult_TransactionNoneZ {
3586         CResult_TransactionNoneZ {
3587                 contents: CResult_TransactionNoneZPtr {
3588                         result: Box::into_raw(Box::new(o)),
3589                 },
3590                 result_ok: true,
3591         }
3592 }
3593 #[no_mangle]
3594 /// Creates a new CResult_TransactionNoneZ in the error state.
3595 pub extern "C" fn CResult_TransactionNoneZ_err() -> CResult_TransactionNoneZ {
3596         CResult_TransactionNoneZ {
3597                 contents: CResult_TransactionNoneZPtr {
3598                         err: std::ptr::null_mut(),
3599                 },
3600                 result_ok: false,
3601         }
3602 }
3603 #[no_mangle]
3604 /// Frees any resources used by the CResult_TransactionNoneZ.
3605 pub extern "C" fn CResult_TransactionNoneZ_free(_res: CResult_TransactionNoneZ) { }
3606 impl Drop for CResult_TransactionNoneZ {
3607         fn drop(&mut self) {
3608                 if self.result_ok {
3609                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
3610                                 let _ = unsafe { Box::from_raw(self.contents.result) };
3611                         }
3612                 } else {
3613                 }
3614         }
3615 }
3616 impl From<crate::c_types::CResultTempl<crate::c_types::Transaction, ()>> for CResult_TransactionNoneZ {
3617         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::Transaction, ()>) -> Self {
3618                 let contents = if o.result_ok {
3619                         let result = unsafe { o.contents.result };
3620                         unsafe { o.contents.result = std::ptr::null_mut() };
3621                         CResult_TransactionNoneZPtr { result }
3622                 } else {
3623                         let _ = unsafe { Box::from_raw(o.contents.err) };
3624                         o.contents.err = std::ptr::null_mut();
3625                         CResult_TransactionNoneZPtr { err: std::ptr::null_mut() }
3626                 };
3627                 Self {
3628                         contents,
3629                         result_ok: o.result_ok,
3630                 }
3631         }
3632 }
3633 impl Clone for CResult_TransactionNoneZ {
3634         fn clone(&self) -> Self {
3635                 if self.result_ok {
3636                         Self { result_ok: true, contents: CResult_TransactionNoneZPtr {
3637                                 result: Box::into_raw(Box::new(<crate::c_types::Transaction>::clone(unsafe { &*self.contents.result })))
3638                         } }
3639                 } else {
3640                         Self { result_ok: false, contents: CResult_TransactionNoneZPtr {
3641                                 err: std::ptr::null_mut()
3642                         } }
3643                 }
3644         }
3645 }
3646 #[no_mangle]
3647 /// Creates a new CResult_TransactionNoneZ which has the same data as `orig`
3648 /// but with all dynamically-allocated buffers duplicated in new buffers.
3649 pub extern "C" fn CResult_TransactionNoneZ_clone(orig: &CResult_TransactionNoneZ) -> CResult_TransactionNoneZ { orig.clone() }
3650 #[repr(C)]
3651 /// A tuple of 2 elements. See the individual fields for the types contained.
3652 pub struct C2Tuple_BlockHashChannelMonitorZ {
3653         /// The element at position 0
3654         pub a: crate::c_types::ThirtyTwoBytes,
3655         /// The element at position 1
3656         pub b: crate::lightning::chain::channelmonitor::ChannelMonitor,
3657 }
3658 impl From<(crate::c_types::ThirtyTwoBytes, crate::lightning::chain::channelmonitor::ChannelMonitor)> for C2Tuple_BlockHashChannelMonitorZ {
3659         fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::lightning::chain::channelmonitor::ChannelMonitor)) -> Self {
3660                 Self {
3661                         a: tup.0,
3662                         b: tup.1,
3663                 }
3664         }
3665 }
3666 impl C2Tuple_BlockHashChannelMonitorZ {
3667         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::lightning::chain::channelmonitor::ChannelMonitor) {
3668                 (self.a, self.b)
3669         }
3670 }
3671 /// Creates a new C2Tuple_BlockHashChannelMonitorZ from the contained elements.
3672 #[no_mangle]
3673 pub extern "C" fn C2Tuple_BlockHashChannelMonitorZ_new(a: crate::c_types::ThirtyTwoBytes, b: crate::lightning::chain::channelmonitor::ChannelMonitor) -> C2Tuple_BlockHashChannelMonitorZ {
3674         C2Tuple_BlockHashChannelMonitorZ { a, b, }
3675 }
3676
3677 #[no_mangle]
3678 /// Frees any resources used by the C2Tuple_BlockHashChannelMonitorZ.
3679 pub extern "C" fn C2Tuple_BlockHashChannelMonitorZ_free(_res: C2Tuple_BlockHashChannelMonitorZ) { }
3680 #[repr(C)]
3681 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZs of arbitrary size.
3682 /// This corresponds to std::vector in C++
3683 pub struct CVec_C2Tuple_BlockHashChannelMonitorZZ {
3684         /// The elements in the array.
3685         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3686         pub data: *mut crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ,
3687         /// The number of elements pointed to by `data`.
3688         pub datalen: usize
3689 }
3690 impl CVec_C2Tuple_BlockHashChannelMonitorZZ {
3691         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ> {
3692                 if self.datalen == 0 { return Vec::new(); }
3693                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
3694                 self.data = std::ptr::null_mut();
3695                 self.datalen = 0;
3696                 ret
3697         }
3698         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ] {
3699                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
3700         }
3701 }
3702 impl From<Vec<crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ>> for CVec_C2Tuple_BlockHashChannelMonitorZZ {
3703         fn from(v: Vec<crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ>) -> Self {
3704                 let datalen = v.len();
3705                 let data = Box::into_raw(v.into_boxed_slice());
3706                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
3707         }
3708 }
3709 #[no_mangle]
3710 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
3711 pub extern "C" fn CVec_C2Tuple_BlockHashChannelMonitorZZ_free(_res: CVec_C2Tuple_BlockHashChannelMonitorZZ) { }
3712 impl Drop for CVec_C2Tuple_BlockHashChannelMonitorZZ {
3713         fn drop(&mut self) {
3714                 if self.datalen == 0 { return; }
3715                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
3716         }
3717 }
3718 #[repr(C)]
3719 /// The contents of CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ
3720 pub union CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr {
3721         /// A pointer to the contents in the success state.
3722         /// Reading from this pointer when `result_ok` is not set is undefined.
3723         pub result: *mut crate::c_types::derived::CVec_C2Tuple_BlockHashChannelMonitorZZ,
3724         /// A pointer to the contents in the error state.
3725         /// Reading from this pointer when `result_ok` is set is undefined.
3726         pub err: *mut crate::c_types::IOError,
3727 }
3728 #[repr(C)]
3729 /// A CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ represents the result of a fallible operation,
3730 /// containing a crate::c_types::derived::CVec_C2Tuple_BlockHashChannelMonitorZZ on success and a crate::c_types::IOError on failure.
3731 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3732 pub struct CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
3733         /// The contents of this CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ, accessible via either
3734         /// `err` or `result` depending on the state of `result_ok`.
3735         pub contents: CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr,
3736         /// Whether this CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ represents a success state.
3737         pub result_ok: bool,
3738 }
3739 #[no_mangle]
3740 /// Creates a new CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ in the success state.
3741 pub extern "C" fn CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_ok(o: crate::c_types::derived::CVec_C2Tuple_BlockHashChannelMonitorZZ) -> CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
3742         CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
3743                 contents: CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr {
3744                         result: Box::into_raw(Box::new(o)),
3745                 },
3746                 result_ok: true,
3747         }
3748 }
3749 #[no_mangle]
3750 /// Creates a new CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ in the error state.
3751 pub extern "C" fn CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_err(e: crate::c_types::IOError) -> CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
3752         CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
3753                 contents: CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr {
3754                         err: Box::into_raw(Box::new(e)),
3755                 },
3756                 result_ok: false,
3757         }
3758 }
3759 #[no_mangle]
3760 /// Frees any resources used by the CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ.
3761 pub extern "C" fn CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_free(_res: CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ) { }
3762 impl Drop for CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
3763         fn drop(&mut self) {
3764                 if self.result_ok {
3765                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
3766                                 let _ = unsafe { Box::from_raw(self.contents.result) };
3767                         }
3768                 } else {
3769                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
3770                                 let _ = unsafe { Box::from_raw(self.contents.err) };
3771                         }
3772                 }
3773         }
3774 }
3775 impl From<crate::c_types::CResultTempl<crate::c_types::derived::CVec_C2Tuple_BlockHashChannelMonitorZZ, crate::c_types::IOError>> for CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
3776         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CVec_C2Tuple_BlockHashChannelMonitorZZ, crate::c_types::IOError>) -> Self {
3777                 let contents = if o.result_ok {
3778                         let result = unsafe { o.contents.result };
3779                         unsafe { o.contents.result = std::ptr::null_mut() };
3780                         CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr { result }
3781                 } else {
3782                         let err = unsafe { o.contents.err };
3783                         unsafe { o.contents.err = std::ptr::null_mut(); }
3784                         CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr { err }
3785                 };
3786                 Self {
3787                         contents,
3788                         result_ok: o.result_ok,
3789                 }
3790         }
3791 }
3792 #[repr(C)]
3793 /// The contents of CResult_NoneAPIErrorZ
3794 pub union CResult_NoneAPIErrorZPtr {
3795         /// Note that this value is always NULL, as there are no contents in the OK variant
3796         pub result: *mut std::ffi::c_void,
3797         /// A pointer to the contents in the error state.
3798         /// Reading from this pointer when `result_ok` is set is undefined.
3799         pub err: *mut crate::lightning::util::errors::APIError,
3800 }
3801 #[repr(C)]
3802 /// A CResult_NoneAPIErrorZ represents the result of a fallible operation,
3803 /// containing a () on success and a crate::lightning::util::errors::APIError on failure.
3804 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3805 pub struct CResult_NoneAPIErrorZ {
3806         /// The contents of this CResult_NoneAPIErrorZ, accessible via either
3807         /// `err` or `result` depending on the state of `result_ok`.
3808         pub contents: CResult_NoneAPIErrorZPtr,
3809         /// Whether this CResult_NoneAPIErrorZ represents a success state.
3810         pub result_ok: bool,
3811 }
3812 #[no_mangle]
3813 /// Creates a new CResult_NoneAPIErrorZ in the success state.
3814 pub extern "C" fn CResult_NoneAPIErrorZ_ok() -> CResult_NoneAPIErrorZ {
3815         CResult_NoneAPIErrorZ {
3816                 contents: CResult_NoneAPIErrorZPtr {
3817                         result: std::ptr::null_mut(),
3818                 },
3819                 result_ok: true,
3820         }
3821 }
3822 #[no_mangle]
3823 /// Creates a new CResult_NoneAPIErrorZ in the error state.
3824 pub extern "C" fn CResult_NoneAPIErrorZ_err(e: crate::lightning::util::errors::APIError) -> CResult_NoneAPIErrorZ {
3825         CResult_NoneAPIErrorZ {
3826                 contents: CResult_NoneAPIErrorZPtr {
3827                         err: Box::into_raw(Box::new(e)),
3828                 },
3829                 result_ok: false,
3830         }
3831 }
3832 #[no_mangle]
3833 /// Frees any resources used by the CResult_NoneAPIErrorZ.
3834 pub extern "C" fn CResult_NoneAPIErrorZ_free(_res: CResult_NoneAPIErrorZ) { }
3835 impl Drop for CResult_NoneAPIErrorZ {
3836         fn drop(&mut self) {
3837                 if self.result_ok {
3838                 } else {
3839                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
3840                                 let _ = unsafe { Box::from_raw(self.contents.err) };
3841                         }
3842                 }
3843         }
3844 }
3845 impl From<crate::c_types::CResultTempl<(), crate::lightning::util::errors::APIError>> for CResult_NoneAPIErrorZ {
3846         fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::util::errors::APIError>) -> Self {
3847                 let contents = if o.result_ok {
3848                         let _ = unsafe { Box::from_raw(o.contents.result) };
3849                         o.contents.result = std::ptr::null_mut();
3850                         CResult_NoneAPIErrorZPtr { result: std::ptr::null_mut() }
3851                 } else {
3852                         let err = unsafe { o.contents.err };
3853                         unsafe { o.contents.err = std::ptr::null_mut(); }
3854                         CResult_NoneAPIErrorZPtr { err }
3855                 };
3856                 Self {
3857                         contents,
3858                         result_ok: o.result_ok,
3859                 }
3860         }
3861 }
3862 impl Clone for CResult_NoneAPIErrorZ {
3863         fn clone(&self) -> Self {
3864                 if self.result_ok {
3865                         Self { result_ok: true, contents: CResult_NoneAPIErrorZPtr {
3866                                 result: std::ptr::null_mut()
3867                         } }
3868                 } else {
3869                         Self { result_ok: false, contents: CResult_NoneAPIErrorZPtr {
3870                                 err: Box::into_raw(Box::new(<crate::lightning::util::errors::APIError>::clone(unsafe { &*self.contents.err })))
3871                         } }
3872                 }
3873         }
3874 }
3875 #[no_mangle]
3876 /// Creates a new CResult_NoneAPIErrorZ which has the same data as `orig`
3877 /// but with all dynamically-allocated buffers duplicated in new buffers.
3878 pub extern "C" fn CResult_NoneAPIErrorZ_clone(orig: &CResult_NoneAPIErrorZ) -> CResult_NoneAPIErrorZ { orig.clone() }
3879 #[repr(C)]
3880 /// A dynamically-allocated array of crate::c_types::derived::CResult_NoneAPIErrorZs of arbitrary size.
3881 /// This corresponds to std::vector in C++
3882 pub struct CVec_CResult_NoneAPIErrorZZ {
3883         /// The elements in the array.
3884         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3885         pub data: *mut crate::c_types::derived::CResult_NoneAPIErrorZ,
3886         /// The number of elements pointed to by `data`.
3887         pub datalen: usize
3888 }
3889 impl CVec_CResult_NoneAPIErrorZZ {
3890         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::CResult_NoneAPIErrorZ> {
3891                 if self.datalen == 0 { return Vec::new(); }
3892                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
3893                 self.data = std::ptr::null_mut();
3894                 self.datalen = 0;
3895                 ret
3896         }
3897         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::CResult_NoneAPIErrorZ] {
3898                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
3899         }
3900 }
3901 impl From<Vec<crate::c_types::derived::CResult_NoneAPIErrorZ>> for CVec_CResult_NoneAPIErrorZZ {
3902         fn from(v: Vec<crate::c_types::derived::CResult_NoneAPIErrorZ>) -> Self {
3903                 let datalen = v.len();
3904                 let data = Box::into_raw(v.into_boxed_slice());
3905                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
3906         }
3907 }
3908 #[no_mangle]
3909 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
3910 pub extern "C" fn CVec_CResult_NoneAPIErrorZZ_free(_res: CVec_CResult_NoneAPIErrorZZ) { }
3911 impl Drop for CVec_CResult_NoneAPIErrorZZ {
3912         fn drop(&mut self) {
3913                 if self.datalen == 0 { return; }
3914                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
3915         }
3916 }
3917 impl Clone for CVec_CResult_NoneAPIErrorZZ {
3918         fn clone(&self) -> Self {
3919                 let mut res = Vec::new();
3920                 if self.datalen == 0 { return Self::from(res); }
3921                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
3922                 Self::from(res)
3923         }
3924 }
3925 #[repr(C)]
3926 /// A dynamically-allocated array of crate::lightning::util::errors::APIErrors of arbitrary size.
3927 /// This corresponds to std::vector in C++
3928 pub struct CVec_APIErrorZ {
3929         /// The elements in the array.
3930         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3931         pub data: *mut crate::lightning::util::errors::APIError,
3932         /// The number of elements pointed to by `data`.
3933         pub datalen: usize
3934 }
3935 impl CVec_APIErrorZ {
3936         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::util::errors::APIError> {
3937                 if self.datalen == 0 { return Vec::new(); }
3938                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
3939                 self.data = std::ptr::null_mut();
3940                 self.datalen = 0;
3941                 ret
3942         }
3943         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::util::errors::APIError] {
3944                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
3945         }
3946 }
3947 impl From<Vec<crate::lightning::util::errors::APIError>> for CVec_APIErrorZ {
3948         fn from(v: Vec<crate::lightning::util::errors::APIError>) -> Self {
3949                 let datalen = v.len();
3950                 let data = Box::into_raw(v.into_boxed_slice());
3951                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
3952         }
3953 }
3954 #[no_mangle]
3955 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
3956 pub extern "C" fn CVec_APIErrorZ_free(_res: CVec_APIErrorZ) { }
3957 impl Drop for CVec_APIErrorZ {
3958         fn drop(&mut self) {
3959                 if self.datalen == 0 { return; }
3960                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
3961         }
3962 }
3963 impl Clone for CVec_APIErrorZ {
3964         fn clone(&self) -> Self {
3965                 let mut res = Vec::new();
3966                 if self.datalen == 0 { return Self::from(res); }
3967                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
3968                 Self::from(res)
3969         }
3970 }
3971 #[repr(C)]
3972 /// The contents of CResult_NonePaymentSendFailureZ
3973 pub union CResult_NonePaymentSendFailureZPtr {
3974         /// Note that this value is always NULL, as there are no contents in the OK variant
3975         pub result: *mut std::ffi::c_void,
3976         /// A pointer to the contents in the error state.
3977         /// Reading from this pointer when `result_ok` is set is undefined.
3978         pub err: *mut crate::lightning::ln::channelmanager::PaymentSendFailure,
3979 }
3980 #[repr(C)]
3981 /// A CResult_NonePaymentSendFailureZ represents the result of a fallible operation,
3982 /// containing a () on success and a crate::lightning::ln::channelmanager::PaymentSendFailure on failure.
3983 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3984 pub struct CResult_NonePaymentSendFailureZ {
3985         /// The contents of this CResult_NonePaymentSendFailureZ, accessible via either
3986         /// `err` or `result` depending on the state of `result_ok`.
3987         pub contents: CResult_NonePaymentSendFailureZPtr,
3988         /// Whether this CResult_NonePaymentSendFailureZ represents a success state.
3989         pub result_ok: bool,
3990 }
3991 #[no_mangle]
3992 /// Creates a new CResult_NonePaymentSendFailureZ in the success state.
3993 pub extern "C" fn CResult_NonePaymentSendFailureZ_ok() -> CResult_NonePaymentSendFailureZ {
3994         CResult_NonePaymentSendFailureZ {
3995                 contents: CResult_NonePaymentSendFailureZPtr {
3996                         result: std::ptr::null_mut(),
3997                 },
3998                 result_ok: true,
3999         }
4000 }
4001 #[no_mangle]
4002 /// Creates a new CResult_NonePaymentSendFailureZ in the error state.
4003 pub extern "C" fn CResult_NonePaymentSendFailureZ_err(e: crate::lightning::ln::channelmanager::PaymentSendFailure) -> CResult_NonePaymentSendFailureZ {
4004         CResult_NonePaymentSendFailureZ {
4005                 contents: CResult_NonePaymentSendFailureZPtr {
4006                         err: Box::into_raw(Box::new(e)),
4007                 },
4008                 result_ok: false,
4009         }
4010 }
4011 #[no_mangle]
4012 /// Frees any resources used by the CResult_NonePaymentSendFailureZ.
4013 pub extern "C" fn CResult_NonePaymentSendFailureZ_free(_res: CResult_NonePaymentSendFailureZ) { }
4014 impl Drop for CResult_NonePaymentSendFailureZ {
4015         fn drop(&mut self) {
4016                 if self.result_ok {
4017                 } else {
4018                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
4019                                 let _ = unsafe { Box::from_raw(self.contents.err) };
4020                         }
4021                 }
4022         }
4023 }
4024 impl From<crate::c_types::CResultTempl<(), crate::lightning::ln::channelmanager::PaymentSendFailure>> for CResult_NonePaymentSendFailureZ {
4025         fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::ln::channelmanager::PaymentSendFailure>) -> Self {
4026                 let contents = if o.result_ok {
4027                         let _ = unsafe { Box::from_raw(o.contents.result) };
4028                         o.contents.result = std::ptr::null_mut();
4029                         CResult_NonePaymentSendFailureZPtr { result: std::ptr::null_mut() }
4030                 } else {
4031                         let err = unsafe { o.contents.err };
4032                         unsafe { o.contents.err = std::ptr::null_mut(); }
4033                         CResult_NonePaymentSendFailureZPtr { err }
4034                 };
4035                 Self {
4036                         contents,
4037                         result_ok: o.result_ok,
4038                 }
4039         }
4040 }
4041 impl Clone for CResult_NonePaymentSendFailureZ {
4042         fn clone(&self) -> Self {
4043                 if self.result_ok {
4044                         Self { result_ok: true, contents: CResult_NonePaymentSendFailureZPtr {
4045                                 result: std::ptr::null_mut()
4046                         } }
4047                 } else {
4048                         Self { result_ok: false, contents: CResult_NonePaymentSendFailureZPtr {
4049                                 err: Box::into_raw(Box::new(<crate::lightning::ln::channelmanager::PaymentSendFailure>::clone(unsafe { &*self.contents.err })))
4050                         } }
4051                 }
4052         }
4053 }
4054 #[no_mangle]
4055 /// Creates a new CResult_NonePaymentSendFailureZ which has the same data as `orig`
4056 /// but with all dynamically-allocated buffers duplicated in new buffers.
4057 pub extern "C" fn CResult_NonePaymentSendFailureZ_clone(orig: &CResult_NonePaymentSendFailureZ) -> CResult_NonePaymentSendFailureZ { orig.clone() }
4058 #[repr(C)]
4059 /// A dynamically-allocated array of crate::lightning::ln::msgs::NetAddresss of arbitrary size.
4060 /// This corresponds to std::vector in C++
4061 pub struct CVec_NetAddressZ {
4062         /// The elements in the array.
4063         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4064         pub data: *mut crate::lightning::ln::msgs::NetAddress,
4065         /// The number of elements pointed to by `data`.
4066         pub datalen: usize
4067 }
4068 impl CVec_NetAddressZ {
4069         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::NetAddress> {
4070                 if self.datalen == 0 { return Vec::new(); }
4071                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
4072                 self.data = std::ptr::null_mut();
4073                 self.datalen = 0;
4074                 ret
4075         }
4076         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::NetAddress] {
4077                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
4078         }
4079 }
4080 impl From<Vec<crate::lightning::ln::msgs::NetAddress>> for CVec_NetAddressZ {
4081         fn from(v: Vec<crate::lightning::ln::msgs::NetAddress>) -> Self {
4082                 let datalen = v.len();
4083                 let data = Box::into_raw(v.into_boxed_slice());
4084                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
4085         }
4086 }
4087 #[no_mangle]
4088 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
4089 pub extern "C" fn CVec_NetAddressZ_free(_res: CVec_NetAddressZ) { }
4090 impl Drop for CVec_NetAddressZ {
4091         fn drop(&mut self) {
4092                 if self.datalen == 0 { return; }
4093                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
4094         }
4095 }
4096 impl Clone for CVec_NetAddressZ {
4097         fn clone(&self) -> Self {
4098                 let mut res = Vec::new();
4099                 if self.datalen == 0 { return Self::from(res); }
4100                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
4101                 Self::from(res)
4102         }
4103 }
4104 #[repr(C)]
4105 /// A tuple of 2 elements. See the individual fields for the types contained.
4106 pub struct C2Tuple_PaymentHashPaymentSecretZ {
4107         /// The element at position 0
4108         pub a: crate::c_types::ThirtyTwoBytes,
4109         /// The element at position 1
4110         pub b: crate::c_types::ThirtyTwoBytes,
4111 }
4112 impl From<(crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes)> for C2Tuple_PaymentHashPaymentSecretZ {
4113         fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes)) -> Self {
4114                 Self {
4115                         a: tup.0,
4116                         b: tup.1,
4117                 }
4118         }
4119 }
4120 impl C2Tuple_PaymentHashPaymentSecretZ {
4121         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes) {
4122                 (self.a, self.b)
4123         }
4124 }
4125 impl Clone for C2Tuple_PaymentHashPaymentSecretZ {
4126         fn clone(&self) -> Self {
4127                 Self {
4128                         a: self.a.clone(),
4129                         b: self.b.clone(),
4130                 }
4131         }
4132 }
4133 #[no_mangle]
4134 /// Creates a new tuple which has the same data as `orig`
4135 /// but with all dynamically-allocated buffers duplicated in new buffers.
4136 pub extern "C" fn C2Tuple_PaymentHashPaymentSecretZ_clone(orig: &C2Tuple_PaymentHashPaymentSecretZ) -> C2Tuple_PaymentHashPaymentSecretZ { orig.clone() }
4137 /// Creates a new C2Tuple_PaymentHashPaymentSecretZ from the contained elements.
4138 #[no_mangle]
4139 pub extern "C" fn C2Tuple_PaymentHashPaymentSecretZ_new(a: crate::c_types::ThirtyTwoBytes, b: crate::c_types::ThirtyTwoBytes) -> C2Tuple_PaymentHashPaymentSecretZ {
4140         C2Tuple_PaymentHashPaymentSecretZ { a, b, }
4141 }
4142
4143 #[no_mangle]
4144 /// Frees any resources used by the C2Tuple_PaymentHashPaymentSecretZ.
4145 pub extern "C" fn C2Tuple_PaymentHashPaymentSecretZ_free(_res: C2Tuple_PaymentHashPaymentSecretZ) { }
4146 #[repr(C)]
4147 /// The contents of CResult_PaymentSecretAPIErrorZ
4148 pub union CResult_PaymentSecretAPIErrorZPtr {
4149         /// A pointer to the contents in the success state.
4150         /// Reading from this pointer when `result_ok` is not set is undefined.
4151         pub result: *mut crate::c_types::ThirtyTwoBytes,
4152         /// A pointer to the contents in the error state.
4153         /// Reading from this pointer when `result_ok` is set is undefined.
4154         pub err: *mut crate::lightning::util::errors::APIError,
4155 }
4156 #[repr(C)]
4157 /// A CResult_PaymentSecretAPIErrorZ represents the result of a fallible operation,
4158 /// containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning::util::errors::APIError on failure.
4159 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4160 pub struct CResult_PaymentSecretAPIErrorZ {
4161         /// The contents of this CResult_PaymentSecretAPIErrorZ, accessible via either
4162         /// `err` or `result` depending on the state of `result_ok`.
4163         pub contents: CResult_PaymentSecretAPIErrorZPtr,
4164         /// Whether this CResult_PaymentSecretAPIErrorZ represents a success state.
4165         pub result_ok: bool,
4166 }
4167 #[no_mangle]
4168 /// Creates a new CResult_PaymentSecretAPIErrorZ in the success state.
4169 pub extern "C" fn CResult_PaymentSecretAPIErrorZ_ok(o: crate::c_types::ThirtyTwoBytes) -> CResult_PaymentSecretAPIErrorZ {
4170         CResult_PaymentSecretAPIErrorZ {
4171                 contents: CResult_PaymentSecretAPIErrorZPtr {
4172                         result: Box::into_raw(Box::new(o)),
4173                 },
4174                 result_ok: true,
4175         }
4176 }
4177 #[no_mangle]
4178 /// Creates a new CResult_PaymentSecretAPIErrorZ in the error state.
4179 pub extern "C" fn CResult_PaymentSecretAPIErrorZ_err(e: crate::lightning::util::errors::APIError) -> CResult_PaymentSecretAPIErrorZ {
4180         CResult_PaymentSecretAPIErrorZ {
4181                 contents: CResult_PaymentSecretAPIErrorZPtr {
4182                         err: Box::into_raw(Box::new(e)),
4183                 },
4184                 result_ok: false,
4185         }
4186 }
4187 #[no_mangle]
4188 /// Frees any resources used by the CResult_PaymentSecretAPIErrorZ.
4189 pub extern "C" fn CResult_PaymentSecretAPIErrorZ_free(_res: CResult_PaymentSecretAPIErrorZ) { }
4190 impl Drop for CResult_PaymentSecretAPIErrorZ {
4191         fn drop(&mut self) {
4192                 if self.result_ok {
4193                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
4194                                 let _ = unsafe { Box::from_raw(self.contents.result) };
4195                         }
4196                 } else {
4197                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
4198                                 let _ = unsafe { Box::from_raw(self.contents.err) };
4199                         }
4200                 }
4201         }
4202 }
4203 impl From<crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::util::errors::APIError>> for CResult_PaymentSecretAPIErrorZ {
4204         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::util::errors::APIError>) -> Self {
4205                 let contents = if o.result_ok {
4206                         let result = unsafe { o.contents.result };
4207                         unsafe { o.contents.result = std::ptr::null_mut() };
4208                         CResult_PaymentSecretAPIErrorZPtr { result }
4209                 } else {
4210                         let err = unsafe { o.contents.err };
4211                         unsafe { o.contents.err = std::ptr::null_mut(); }
4212                         CResult_PaymentSecretAPIErrorZPtr { err }
4213                 };
4214                 Self {
4215                         contents,
4216                         result_ok: o.result_ok,
4217                 }
4218         }
4219 }
4220 impl Clone for CResult_PaymentSecretAPIErrorZ {
4221         fn clone(&self) -> Self {
4222                 if self.result_ok {
4223                         Self { result_ok: true, contents: CResult_PaymentSecretAPIErrorZPtr {
4224                                 result: Box::into_raw(Box::new(<crate::c_types::ThirtyTwoBytes>::clone(unsafe { &*self.contents.result })))
4225                         } }
4226                 } else {
4227                         Self { result_ok: false, contents: CResult_PaymentSecretAPIErrorZPtr {
4228                                 err: Box::into_raw(Box::new(<crate::lightning::util::errors::APIError>::clone(unsafe { &*self.contents.err })))
4229                         } }
4230                 }
4231         }
4232 }
4233 #[no_mangle]
4234 /// Creates a new CResult_PaymentSecretAPIErrorZ which has the same data as `orig`
4235 /// but with all dynamically-allocated buffers duplicated in new buffers.
4236 pub extern "C" fn CResult_PaymentSecretAPIErrorZ_clone(orig: &CResult_PaymentSecretAPIErrorZ) -> CResult_PaymentSecretAPIErrorZ { orig.clone() }
4237 #[repr(C)]
4238 /// A dynamically-allocated array of crate::lightning::chain::channelmonitor::ChannelMonitors of arbitrary size.
4239 /// This corresponds to std::vector in C++
4240 pub struct CVec_ChannelMonitorZ {
4241         /// The elements in the array.
4242         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4243         pub data: *mut crate::lightning::chain::channelmonitor::ChannelMonitor,
4244         /// The number of elements pointed to by `data`.
4245         pub datalen: usize
4246 }
4247 impl CVec_ChannelMonitorZ {
4248         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::chain::channelmonitor::ChannelMonitor> {
4249                 if self.datalen == 0 { return Vec::new(); }
4250                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
4251                 self.data = std::ptr::null_mut();
4252                 self.datalen = 0;
4253                 ret
4254         }
4255         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::chain::channelmonitor::ChannelMonitor] {
4256                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
4257         }
4258 }
4259 impl From<Vec<crate::lightning::chain::channelmonitor::ChannelMonitor>> for CVec_ChannelMonitorZ {
4260         fn from(v: Vec<crate::lightning::chain::channelmonitor::ChannelMonitor>) -> Self {
4261                 let datalen = v.len();
4262                 let data = Box::into_raw(v.into_boxed_slice());
4263                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
4264         }
4265 }
4266 #[no_mangle]
4267 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
4268 pub extern "C" fn CVec_ChannelMonitorZ_free(_res: CVec_ChannelMonitorZ) { }
4269 impl Drop for CVec_ChannelMonitorZ {
4270         fn drop(&mut self) {
4271                 if self.datalen == 0 { return; }
4272                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
4273         }
4274 }
4275 #[repr(C)]
4276 /// A tuple of 2 elements. See the individual fields for the types contained.
4277 pub struct C2Tuple_BlockHashChannelManagerZ {
4278         /// The element at position 0
4279         pub a: crate::c_types::ThirtyTwoBytes,
4280         /// The element at position 1
4281         pub b: crate::lightning::ln::channelmanager::ChannelManager,
4282 }
4283 impl From<(crate::c_types::ThirtyTwoBytes, crate::lightning::ln::channelmanager::ChannelManager)> for C2Tuple_BlockHashChannelManagerZ {
4284         fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::lightning::ln::channelmanager::ChannelManager)) -> Self {
4285                 Self {
4286                         a: tup.0,
4287                         b: tup.1,
4288                 }
4289         }
4290 }
4291 impl C2Tuple_BlockHashChannelManagerZ {
4292         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::lightning::ln::channelmanager::ChannelManager) {
4293                 (self.a, self.b)
4294         }
4295 }
4296 /// Creates a new C2Tuple_BlockHashChannelManagerZ from the contained elements.
4297 #[no_mangle]
4298 pub extern "C" fn C2Tuple_BlockHashChannelManagerZ_new(a: crate::c_types::ThirtyTwoBytes, b: crate::lightning::ln::channelmanager::ChannelManager) -> C2Tuple_BlockHashChannelManagerZ {
4299         C2Tuple_BlockHashChannelManagerZ { a, b, }
4300 }
4301
4302 #[no_mangle]
4303 /// Frees any resources used by the C2Tuple_BlockHashChannelManagerZ.
4304 pub extern "C" fn C2Tuple_BlockHashChannelManagerZ_free(_res: C2Tuple_BlockHashChannelManagerZ) { }
4305 #[repr(C)]
4306 /// The contents of CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ
4307 pub union CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr {
4308         /// A pointer to the contents in the success state.
4309         /// Reading from this pointer when `result_ok` is not set is undefined.
4310         pub result: *mut crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ,
4311         /// A pointer to the contents in the error state.
4312         /// Reading from this pointer when `result_ok` is set is undefined.
4313         pub err: *mut crate::lightning::ln::msgs::DecodeError,
4314 }
4315 #[repr(C)]
4316 /// A CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ represents the result of a fallible operation,
4317 /// containing a crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
4318 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4319 pub struct CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
4320         /// The contents of this CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ, accessible via either
4321         /// `err` or `result` depending on the state of `result_ok`.
4322         pub contents: CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr,
4323         /// Whether this CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ represents a success state.
4324         pub result_ok: bool,
4325 }
4326 #[no_mangle]
4327 /// Creates a new CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ in the success state.
4328 pub extern "C" fn CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_ok(o: crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ) -> CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
4329         CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
4330                 contents: CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr {
4331                         result: Box::into_raw(Box::new(o)),
4332                 },
4333                 result_ok: true,
4334         }
4335 }
4336 #[no_mangle]
4337 /// Creates a new CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ in the error state.
4338 pub extern "C" fn CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
4339         CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
4340                 contents: CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr {
4341                         err: Box::into_raw(Box::new(e)),
4342                 },
4343                 result_ok: false,
4344         }
4345 }
4346 #[no_mangle]
4347 /// Frees any resources used by the CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ.
4348 pub extern "C" fn CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_free(_res: CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ) { }
4349 impl Drop for CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
4350         fn drop(&mut self) {
4351                 if self.result_ok {
4352                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
4353                                 let _ = unsafe { Box::from_raw(self.contents.result) };
4354                         }
4355                 } else {
4356                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
4357                                 let _ = unsafe { Box::from_raw(self.contents.err) };
4358                         }
4359                 }
4360         }
4361 }
4362 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ, crate::lightning::ln::msgs::DecodeError>> for CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
4363         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
4364                 let contents = if o.result_ok {
4365                         let result = unsafe { o.contents.result };
4366                         unsafe { o.contents.result = std::ptr::null_mut() };
4367                         CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr { result }
4368                 } else {
4369                         let err = unsafe { o.contents.err };
4370                         unsafe { o.contents.err = std::ptr::null_mut(); }
4371                         CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr { err }
4372                 };
4373                 Self {
4374                         contents,
4375                         result_ok: o.result_ok,
4376                 }
4377         }
4378 }
4379 #[repr(C)]
4380 /// The contents of CResult_ChannelConfigDecodeErrorZ
4381 pub union CResult_ChannelConfigDecodeErrorZPtr {
4382         /// A pointer to the contents in the success state.
4383         /// Reading from this pointer when `result_ok` is not set is undefined.
4384         pub result: *mut crate::lightning::util::config::ChannelConfig,
4385         /// A pointer to the contents in the error state.
4386         /// Reading from this pointer when `result_ok` is set is undefined.
4387         pub err: *mut crate::lightning::ln::msgs::DecodeError,
4388 }
4389 #[repr(C)]
4390 /// A CResult_ChannelConfigDecodeErrorZ represents the result of a fallible operation,
4391 /// containing a crate::lightning::util::config::ChannelConfig on success and a crate::lightning::ln::msgs::DecodeError on failure.
4392 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4393 pub struct CResult_ChannelConfigDecodeErrorZ {
4394         /// The contents of this CResult_ChannelConfigDecodeErrorZ, accessible via either
4395         /// `err` or `result` depending on the state of `result_ok`.
4396         pub contents: CResult_ChannelConfigDecodeErrorZPtr,
4397         /// Whether this CResult_ChannelConfigDecodeErrorZ represents a success state.
4398         pub result_ok: bool,
4399 }
4400 #[no_mangle]
4401 /// Creates a new CResult_ChannelConfigDecodeErrorZ in the success state.
4402 pub extern "C" fn CResult_ChannelConfigDecodeErrorZ_ok(o: crate::lightning::util::config::ChannelConfig) -> CResult_ChannelConfigDecodeErrorZ {
4403         CResult_ChannelConfigDecodeErrorZ {
4404                 contents: CResult_ChannelConfigDecodeErrorZPtr {
4405                         result: Box::into_raw(Box::new(o)),
4406                 },
4407                 result_ok: true,
4408         }
4409 }
4410 #[no_mangle]
4411 /// Creates a new CResult_ChannelConfigDecodeErrorZ in the error state.
4412 pub extern "C" fn CResult_ChannelConfigDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelConfigDecodeErrorZ {
4413         CResult_ChannelConfigDecodeErrorZ {
4414                 contents: CResult_ChannelConfigDecodeErrorZPtr {
4415                         err: Box::into_raw(Box::new(e)),
4416                 },
4417                 result_ok: false,
4418         }
4419 }
4420 #[no_mangle]
4421 /// Frees any resources used by the CResult_ChannelConfigDecodeErrorZ.
4422 pub extern "C" fn CResult_ChannelConfigDecodeErrorZ_free(_res: CResult_ChannelConfigDecodeErrorZ) { }
4423 impl Drop for CResult_ChannelConfigDecodeErrorZ {
4424         fn drop(&mut self) {
4425                 if self.result_ok {
4426                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
4427                                 let _ = unsafe { Box::from_raw(self.contents.result) };
4428                         }
4429                 } else {
4430                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
4431                                 let _ = unsafe { Box::from_raw(self.contents.err) };
4432                         }
4433                 }
4434         }
4435 }
4436 impl From<crate::c_types::CResultTempl<crate::lightning::util::config::ChannelConfig, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelConfigDecodeErrorZ {
4437         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::util::config::ChannelConfig, crate::lightning::ln::msgs::DecodeError>) -> Self {
4438                 let contents = if o.result_ok {
4439                         let result = unsafe { o.contents.result };
4440                         unsafe { o.contents.result = std::ptr::null_mut() };
4441                         CResult_ChannelConfigDecodeErrorZPtr { result }
4442                 } else {
4443                         let err = unsafe { o.contents.err };
4444                         unsafe { o.contents.err = std::ptr::null_mut(); }
4445                         CResult_ChannelConfigDecodeErrorZPtr { err }
4446                 };
4447                 Self {
4448                         contents,
4449                         result_ok: o.result_ok,
4450                 }
4451         }
4452 }
4453 impl Clone for CResult_ChannelConfigDecodeErrorZ {
4454         fn clone(&self) -> Self {
4455                 if self.result_ok {
4456                         Self { result_ok: true, contents: CResult_ChannelConfigDecodeErrorZPtr {
4457                                 result: Box::into_raw(Box::new(<crate::lightning::util::config::ChannelConfig>::clone(unsafe { &*self.contents.result })))
4458                         } }
4459                 } else {
4460                         Self { result_ok: false, contents: CResult_ChannelConfigDecodeErrorZPtr {
4461                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
4462                         } }
4463                 }
4464         }
4465 }
4466 #[no_mangle]
4467 /// Creates a new CResult_ChannelConfigDecodeErrorZ which has the same data as `orig`
4468 /// but with all dynamically-allocated buffers duplicated in new buffers.
4469 pub extern "C" fn CResult_ChannelConfigDecodeErrorZ_clone(orig: &CResult_ChannelConfigDecodeErrorZ) -> CResult_ChannelConfigDecodeErrorZ { orig.clone() }
4470 #[repr(C)]
4471 /// The contents of CResult_OutPointDecodeErrorZ
4472 pub union CResult_OutPointDecodeErrorZPtr {
4473         /// A pointer to the contents in the success state.
4474         /// Reading from this pointer when `result_ok` is not set is undefined.
4475         pub result: *mut crate::lightning::chain::transaction::OutPoint,
4476         /// A pointer to the contents in the error state.
4477         /// Reading from this pointer when `result_ok` is set is undefined.
4478         pub err: *mut crate::lightning::ln::msgs::DecodeError,
4479 }
4480 #[repr(C)]
4481 /// A CResult_OutPointDecodeErrorZ represents the result of a fallible operation,
4482 /// containing a crate::lightning::chain::transaction::OutPoint on success and a crate::lightning::ln::msgs::DecodeError on failure.
4483 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4484 pub struct CResult_OutPointDecodeErrorZ {
4485         /// The contents of this CResult_OutPointDecodeErrorZ, accessible via either
4486         /// `err` or `result` depending on the state of `result_ok`.
4487         pub contents: CResult_OutPointDecodeErrorZPtr,
4488         /// Whether this CResult_OutPointDecodeErrorZ represents a success state.
4489         pub result_ok: bool,
4490 }
4491 #[no_mangle]
4492 /// Creates a new CResult_OutPointDecodeErrorZ in the success state.
4493 pub extern "C" fn CResult_OutPointDecodeErrorZ_ok(o: crate::lightning::chain::transaction::OutPoint) -> CResult_OutPointDecodeErrorZ {
4494         CResult_OutPointDecodeErrorZ {
4495                 contents: CResult_OutPointDecodeErrorZPtr {
4496                         result: Box::into_raw(Box::new(o)),
4497                 },
4498                 result_ok: true,
4499         }
4500 }
4501 #[no_mangle]
4502 /// Creates a new CResult_OutPointDecodeErrorZ in the error state.
4503 pub extern "C" fn CResult_OutPointDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_OutPointDecodeErrorZ {
4504         CResult_OutPointDecodeErrorZ {
4505                 contents: CResult_OutPointDecodeErrorZPtr {
4506                         err: Box::into_raw(Box::new(e)),
4507                 },
4508                 result_ok: false,
4509         }
4510 }
4511 #[no_mangle]
4512 /// Frees any resources used by the CResult_OutPointDecodeErrorZ.
4513 pub extern "C" fn CResult_OutPointDecodeErrorZ_free(_res: CResult_OutPointDecodeErrorZ) { }
4514 impl Drop for CResult_OutPointDecodeErrorZ {
4515         fn drop(&mut self) {
4516                 if self.result_ok {
4517                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
4518                                 let _ = unsafe { Box::from_raw(self.contents.result) };
4519                         }
4520                 } else {
4521                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
4522                                 let _ = unsafe { Box::from_raw(self.contents.err) };
4523                         }
4524                 }
4525         }
4526 }
4527 impl From<crate::c_types::CResultTempl<crate::lightning::chain::transaction::OutPoint, crate::lightning::ln::msgs::DecodeError>> for CResult_OutPointDecodeErrorZ {
4528         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::transaction::OutPoint, crate::lightning::ln::msgs::DecodeError>) -> Self {
4529                 let contents = if o.result_ok {
4530                         let result = unsafe { o.contents.result };
4531                         unsafe { o.contents.result = std::ptr::null_mut() };
4532                         CResult_OutPointDecodeErrorZPtr { result }
4533                 } else {
4534                         let err = unsafe { o.contents.err };
4535                         unsafe { o.contents.err = std::ptr::null_mut(); }
4536                         CResult_OutPointDecodeErrorZPtr { err }
4537                 };
4538                 Self {
4539                         contents,
4540                         result_ok: o.result_ok,
4541                 }
4542         }
4543 }
4544 impl Clone for CResult_OutPointDecodeErrorZ {
4545         fn clone(&self) -> Self {
4546                 if self.result_ok {
4547                         Self { result_ok: true, contents: CResult_OutPointDecodeErrorZPtr {
4548                                 result: Box::into_raw(Box::new(<crate::lightning::chain::transaction::OutPoint>::clone(unsafe { &*self.contents.result })))
4549                         } }
4550                 } else {
4551                         Self { result_ok: false, contents: CResult_OutPointDecodeErrorZPtr {
4552                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
4553                         } }
4554                 }
4555         }
4556 }
4557 #[no_mangle]
4558 /// Creates a new CResult_OutPointDecodeErrorZ which has the same data as `orig`
4559 /// but with all dynamically-allocated buffers duplicated in new buffers.
4560 pub extern "C" fn CResult_OutPointDecodeErrorZ_clone(orig: &CResult_OutPointDecodeErrorZ) -> CResult_OutPointDecodeErrorZ { orig.clone() }
4561 #[repr(C)]
4562 /// The contents of CResult_SiPrefixNoneZ
4563 pub union CResult_SiPrefixNoneZPtr {
4564         /// A pointer to the contents in the success state.
4565         /// Reading from this pointer when `result_ok` is not set is undefined.
4566         pub result: *mut crate::lightning_invoice::SiPrefix,
4567         /// Note that this value is always NULL, as there are no contents in the Err variant
4568         pub err: *mut std::ffi::c_void,
4569 }
4570 #[repr(C)]
4571 /// A CResult_SiPrefixNoneZ represents the result of a fallible operation,
4572 /// containing a crate::lightning_invoice::SiPrefix on success and a () on failure.
4573 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4574 pub struct CResult_SiPrefixNoneZ {
4575         /// The contents of this CResult_SiPrefixNoneZ, accessible via either
4576         /// `err` or `result` depending on the state of `result_ok`.
4577         pub contents: CResult_SiPrefixNoneZPtr,
4578         /// Whether this CResult_SiPrefixNoneZ represents a success state.
4579         pub result_ok: bool,
4580 }
4581 #[no_mangle]
4582 /// Creates a new CResult_SiPrefixNoneZ in the success state.
4583 pub extern "C" fn CResult_SiPrefixNoneZ_ok(o: crate::lightning_invoice::SiPrefix) -> CResult_SiPrefixNoneZ {
4584         CResult_SiPrefixNoneZ {
4585                 contents: CResult_SiPrefixNoneZPtr {
4586                         result: Box::into_raw(Box::new(o)),
4587                 },
4588                 result_ok: true,
4589         }
4590 }
4591 #[no_mangle]
4592 /// Creates a new CResult_SiPrefixNoneZ in the error state.
4593 pub extern "C" fn CResult_SiPrefixNoneZ_err() -> CResult_SiPrefixNoneZ {
4594         CResult_SiPrefixNoneZ {
4595                 contents: CResult_SiPrefixNoneZPtr {
4596                         err: std::ptr::null_mut(),
4597                 },
4598                 result_ok: false,
4599         }
4600 }
4601 #[no_mangle]
4602 /// Frees any resources used by the CResult_SiPrefixNoneZ.
4603 pub extern "C" fn CResult_SiPrefixNoneZ_free(_res: CResult_SiPrefixNoneZ) { }
4604 impl Drop for CResult_SiPrefixNoneZ {
4605         fn drop(&mut self) {
4606                 if self.result_ok {
4607                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
4608                                 let _ = unsafe { Box::from_raw(self.contents.result) };
4609                         }
4610                 } else {
4611                 }
4612         }
4613 }
4614 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::SiPrefix, ()>> for CResult_SiPrefixNoneZ {
4615         fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::SiPrefix, ()>) -> Self {
4616                 let contents = if o.result_ok {
4617                         let result = unsafe { o.contents.result };
4618                         unsafe { o.contents.result = std::ptr::null_mut() };
4619                         CResult_SiPrefixNoneZPtr { result }
4620                 } else {
4621                         let _ = unsafe { Box::from_raw(o.contents.err) };
4622                         o.contents.err = std::ptr::null_mut();
4623                         CResult_SiPrefixNoneZPtr { err: std::ptr::null_mut() }
4624                 };
4625                 Self {
4626                         contents,
4627                         result_ok: o.result_ok,
4628                 }
4629         }
4630 }
4631 impl Clone for CResult_SiPrefixNoneZ {
4632         fn clone(&self) -> Self {
4633                 if self.result_ok {
4634                         Self { result_ok: true, contents: CResult_SiPrefixNoneZPtr {
4635                                 result: Box::into_raw(Box::new(<crate::lightning_invoice::SiPrefix>::clone(unsafe { &*self.contents.result })))
4636                         } }
4637                 } else {
4638                         Self { result_ok: false, contents: CResult_SiPrefixNoneZPtr {
4639                                 err: std::ptr::null_mut()
4640                         } }
4641                 }
4642         }
4643 }
4644 #[no_mangle]
4645 /// Creates a new CResult_SiPrefixNoneZ which has the same data as `orig`
4646 /// but with all dynamically-allocated buffers duplicated in new buffers.
4647 pub extern "C" fn CResult_SiPrefixNoneZ_clone(orig: &CResult_SiPrefixNoneZ) -> CResult_SiPrefixNoneZ { orig.clone() }
4648 #[repr(C)]
4649 /// The contents of CResult_InvoiceNoneZ
4650 pub union CResult_InvoiceNoneZPtr {
4651         /// A pointer to the contents in the success state.
4652         /// Reading from this pointer when `result_ok` is not set is undefined.
4653         pub result: *mut crate::lightning_invoice::Invoice,
4654         /// Note that this value is always NULL, as there are no contents in the Err variant
4655         pub err: *mut std::ffi::c_void,
4656 }
4657 #[repr(C)]
4658 /// A CResult_InvoiceNoneZ represents the result of a fallible operation,
4659 /// containing a crate::lightning_invoice::Invoice on success and a () on failure.
4660 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4661 pub struct CResult_InvoiceNoneZ {
4662         /// The contents of this CResult_InvoiceNoneZ, accessible via either
4663         /// `err` or `result` depending on the state of `result_ok`.
4664         pub contents: CResult_InvoiceNoneZPtr,
4665         /// Whether this CResult_InvoiceNoneZ represents a success state.
4666         pub result_ok: bool,
4667 }
4668 #[no_mangle]
4669 /// Creates a new CResult_InvoiceNoneZ in the success state.
4670 pub extern "C" fn CResult_InvoiceNoneZ_ok(o: crate::lightning_invoice::Invoice) -> CResult_InvoiceNoneZ {
4671         CResult_InvoiceNoneZ {
4672                 contents: CResult_InvoiceNoneZPtr {
4673                         result: Box::into_raw(Box::new(o)),
4674                 },
4675                 result_ok: true,
4676         }
4677 }
4678 #[no_mangle]
4679 /// Creates a new CResult_InvoiceNoneZ in the error state.
4680 pub extern "C" fn CResult_InvoiceNoneZ_err() -> CResult_InvoiceNoneZ {
4681         CResult_InvoiceNoneZ {
4682                 contents: CResult_InvoiceNoneZPtr {
4683                         err: std::ptr::null_mut(),
4684                 },
4685                 result_ok: false,
4686         }
4687 }
4688 #[no_mangle]
4689 /// Frees any resources used by the CResult_InvoiceNoneZ.
4690 pub extern "C" fn CResult_InvoiceNoneZ_free(_res: CResult_InvoiceNoneZ) { }
4691 impl Drop for CResult_InvoiceNoneZ {
4692         fn drop(&mut self) {
4693                 if self.result_ok {
4694                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
4695                                 let _ = unsafe { Box::from_raw(self.contents.result) };
4696                         }
4697                 } else {
4698                 }
4699         }
4700 }
4701 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::Invoice, ()>> for CResult_InvoiceNoneZ {
4702         fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::Invoice, ()>) -> Self {
4703                 let contents = if o.result_ok {
4704                         let result = unsafe { o.contents.result };
4705                         unsafe { o.contents.result = std::ptr::null_mut() };
4706                         CResult_InvoiceNoneZPtr { result }
4707                 } else {
4708                         let _ = unsafe { Box::from_raw(o.contents.err) };
4709                         o.contents.err = std::ptr::null_mut();
4710                         CResult_InvoiceNoneZPtr { err: std::ptr::null_mut() }
4711                 };
4712                 Self {
4713                         contents,
4714                         result_ok: o.result_ok,
4715                 }
4716         }
4717 }
4718 impl Clone for CResult_InvoiceNoneZ {
4719         fn clone(&self) -> Self {
4720                 if self.result_ok {
4721                         Self { result_ok: true, contents: CResult_InvoiceNoneZPtr {
4722                                 result: Box::into_raw(Box::new(<crate::lightning_invoice::Invoice>::clone(unsafe { &*self.contents.result })))
4723                         } }
4724                 } else {
4725                         Self { result_ok: false, contents: CResult_InvoiceNoneZPtr {
4726                                 err: std::ptr::null_mut()
4727                         } }
4728                 }
4729         }
4730 }
4731 #[no_mangle]
4732 /// Creates a new CResult_InvoiceNoneZ which has the same data as `orig`
4733 /// but with all dynamically-allocated buffers duplicated in new buffers.
4734 pub extern "C" fn CResult_InvoiceNoneZ_clone(orig: &CResult_InvoiceNoneZ) -> CResult_InvoiceNoneZ { orig.clone() }
4735 #[repr(C)]
4736 /// The contents of CResult_SignedRawInvoiceNoneZ
4737 pub union CResult_SignedRawInvoiceNoneZPtr {
4738         /// A pointer to the contents in the success state.
4739         /// Reading from this pointer when `result_ok` is not set is undefined.
4740         pub result: *mut crate::lightning_invoice::SignedRawInvoice,
4741         /// Note that this value is always NULL, as there are no contents in the Err variant
4742         pub err: *mut std::ffi::c_void,
4743 }
4744 #[repr(C)]
4745 /// A CResult_SignedRawInvoiceNoneZ represents the result of a fallible operation,
4746 /// containing a crate::lightning_invoice::SignedRawInvoice on success and a () on failure.
4747 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4748 pub struct CResult_SignedRawInvoiceNoneZ {
4749         /// The contents of this CResult_SignedRawInvoiceNoneZ, accessible via either
4750         /// `err` or `result` depending on the state of `result_ok`.
4751         pub contents: CResult_SignedRawInvoiceNoneZPtr,
4752         /// Whether this CResult_SignedRawInvoiceNoneZ represents a success state.
4753         pub result_ok: bool,
4754 }
4755 #[no_mangle]
4756 /// Creates a new CResult_SignedRawInvoiceNoneZ in the success state.
4757 pub extern "C" fn CResult_SignedRawInvoiceNoneZ_ok(o: crate::lightning_invoice::SignedRawInvoice) -> CResult_SignedRawInvoiceNoneZ {
4758         CResult_SignedRawInvoiceNoneZ {
4759                 contents: CResult_SignedRawInvoiceNoneZPtr {
4760                         result: Box::into_raw(Box::new(o)),
4761                 },
4762                 result_ok: true,
4763         }
4764 }
4765 #[no_mangle]
4766 /// Creates a new CResult_SignedRawInvoiceNoneZ in the error state.
4767 pub extern "C" fn CResult_SignedRawInvoiceNoneZ_err() -> CResult_SignedRawInvoiceNoneZ {
4768         CResult_SignedRawInvoiceNoneZ {
4769                 contents: CResult_SignedRawInvoiceNoneZPtr {
4770                         err: std::ptr::null_mut(),
4771                 },
4772                 result_ok: false,
4773         }
4774 }
4775 #[no_mangle]
4776 /// Frees any resources used by the CResult_SignedRawInvoiceNoneZ.
4777 pub extern "C" fn CResult_SignedRawInvoiceNoneZ_free(_res: CResult_SignedRawInvoiceNoneZ) { }
4778 impl Drop for CResult_SignedRawInvoiceNoneZ {
4779         fn drop(&mut self) {
4780                 if self.result_ok {
4781                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
4782                                 let _ = unsafe { Box::from_raw(self.contents.result) };
4783                         }
4784                 } else {
4785                 }
4786         }
4787 }
4788 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::SignedRawInvoice, ()>> for CResult_SignedRawInvoiceNoneZ {
4789         fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::SignedRawInvoice, ()>) -> Self {
4790                 let contents = if o.result_ok {
4791                         let result = unsafe { o.contents.result };
4792                         unsafe { o.contents.result = std::ptr::null_mut() };
4793                         CResult_SignedRawInvoiceNoneZPtr { result }
4794                 } else {
4795                         let _ = unsafe { Box::from_raw(o.contents.err) };
4796                         o.contents.err = std::ptr::null_mut();
4797                         CResult_SignedRawInvoiceNoneZPtr { err: std::ptr::null_mut() }
4798                 };
4799                 Self {
4800                         contents,
4801                         result_ok: o.result_ok,
4802                 }
4803         }
4804 }
4805 impl Clone for CResult_SignedRawInvoiceNoneZ {
4806         fn clone(&self) -> Self {
4807                 if self.result_ok {
4808                         Self { result_ok: true, contents: CResult_SignedRawInvoiceNoneZPtr {
4809                                 result: Box::into_raw(Box::new(<crate::lightning_invoice::SignedRawInvoice>::clone(unsafe { &*self.contents.result })))
4810                         } }
4811                 } else {
4812                         Self { result_ok: false, contents: CResult_SignedRawInvoiceNoneZPtr {
4813                                 err: std::ptr::null_mut()
4814                         } }
4815                 }
4816         }
4817 }
4818 #[no_mangle]
4819 /// Creates a new CResult_SignedRawInvoiceNoneZ which has the same data as `orig`
4820 /// but with all dynamically-allocated buffers duplicated in new buffers.
4821 pub extern "C" fn CResult_SignedRawInvoiceNoneZ_clone(orig: &CResult_SignedRawInvoiceNoneZ) -> CResult_SignedRawInvoiceNoneZ { orig.clone() }
4822 #[repr(C)]
4823 /// A tuple of 3 elements. See the individual fields for the types contained.
4824 pub struct C3Tuple_RawInvoice_u832InvoiceSignatureZ {
4825         /// The element at position 0
4826         pub a: crate::lightning_invoice::RawInvoice,
4827         /// The element at position 1
4828         pub b: crate::c_types::ThirtyTwoBytes,
4829         /// The element at position 2
4830         pub c: crate::lightning_invoice::InvoiceSignature,
4831 }
4832 impl From<(crate::lightning_invoice::RawInvoice, crate::c_types::ThirtyTwoBytes, crate::lightning_invoice::InvoiceSignature)> for C3Tuple_RawInvoice_u832InvoiceSignatureZ {
4833         fn from (tup: (crate::lightning_invoice::RawInvoice, crate::c_types::ThirtyTwoBytes, crate::lightning_invoice::InvoiceSignature)) -> Self {
4834                 Self {
4835                         a: tup.0,
4836                         b: tup.1,
4837                         c: tup.2,
4838                 }
4839         }
4840 }
4841 impl C3Tuple_RawInvoice_u832InvoiceSignatureZ {
4842         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::lightning_invoice::RawInvoice, crate::c_types::ThirtyTwoBytes, crate::lightning_invoice::InvoiceSignature) {
4843                 (self.a, self.b, self.c)
4844         }
4845 }
4846 impl Clone for C3Tuple_RawInvoice_u832InvoiceSignatureZ {
4847         fn clone(&self) -> Self {
4848                 Self {
4849                         a: self.a.clone(),
4850                         b: self.b.clone(),
4851                         c: self.c.clone(),
4852                 }
4853         }
4854 }
4855 #[no_mangle]
4856 /// Creates a new tuple which has the same data as `orig`
4857 /// but with all dynamically-allocated buffers duplicated in new buffers.
4858 pub extern "C" fn C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone(orig: &C3Tuple_RawInvoice_u832InvoiceSignatureZ) -> C3Tuple_RawInvoice_u832InvoiceSignatureZ { orig.clone() }
4859 /// Creates a new C3Tuple_RawInvoice_u832InvoiceSignatureZ from the contained elements.
4860 #[no_mangle]
4861 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 {
4862         C3Tuple_RawInvoice_u832InvoiceSignatureZ { a, b, c, }
4863 }
4864
4865 #[no_mangle]
4866 /// Frees any resources used by the C3Tuple_RawInvoice_u832InvoiceSignatureZ.
4867 pub extern "C" fn C3Tuple_RawInvoice_u832InvoiceSignatureZ_free(_res: C3Tuple_RawInvoice_u832InvoiceSignatureZ) { }
4868 #[repr(C)]
4869 /// The contents of CResult_PayeePubKeyErrorZ
4870 pub union CResult_PayeePubKeyErrorZPtr {
4871         /// A pointer to the contents in the success state.
4872         /// Reading from this pointer when `result_ok` is not set is undefined.
4873         pub result: *mut crate::lightning_invoice::PayeePubKey,
4874         /// A pointer to the contents in the error state.
4875         /// Reading from this pointer when `result_ok` is set is undefined.
4876         pub err: *mut crate::c_types::Secp256k1Error,
4877 }
4878 #[repr(C)]
4879 /// A CResult_PayeePubKeyErrorZ represents the result of a fallible operation,
4880 /// containing a crate::lightning_invoice::PayeePubKey on success and a crate::c_types::Secp256k1Error on failure.
4881 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4882 pub struct CResult_PayeePubKeyErrorZ {
4883         /// The contents of this CResult_PayeePubKeyErrorZ, accessible via either
4884         /// `err` or `result` depending on the state of `result_ok`.
4885         pub contents: CResult_PayeePubKeyErrorZPtr,
4886         /// Whether this CResult_PayeePubKeyErrorZ represents a success state.
4887         pub result_ok: bool,
4888 }
4889 #[no_mangle]
4890 /// Creates a new CResult_PayeePubKeyErrorZ in the success state.
4891 pub extern "C" fn CResult_PayeePubKeyErrorZ_ok(o: crate::lightning_invoice::PayeePubKey) -> CResult_PayeePubKeyErrorZ {
4892         CResult_PayeePubKeyErrorZ {
4893                 contents: CResult_PayeePubKeyErrorZPtr {
4894                         result: Box::into_raw(Box::new(o)),
4895                 },
4896                 result_ok: true,
4897         }
4898 }
4899 #[no_mangle]
4900 /// Creates a new CResult_PayeePubKeyErrorZ in the error state.
4901 pub extern "C" fn CResult_PayeePubKeyErrorZ_err(e: crate::c_types::Secp256k1Error) -> CResult_PayeePubKeyErrorZ {
4902         CResult_PayeePubKeyErrorZ {
4903                 contents: CResult_PayeePubKeyErrorZPtr {
4904                         err: Box::into_raw(Box::new(e)),
4905                 },
4906                 result_ok: false,
4907         }
4908 }
4909 #[no_mangle]
4910 /// Frees any resources used by the CResult_PayeePubKeyErrorZ.
4911 pub extern "C" fn CResult_PayeePubKeyErrorZ_free(_res: CResult_PayeePubKeyErrorZ) { }
4912 impl Drop for CResult_PayeePubKeyErrorZ {
4913         fn drop(&mut self) {
4914                 if self.result_ok {
4915                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
4916                                 let _ = unsafe { Box::from_raw(self.contents.result) };
4917                         }
4918                 } else {
4919                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
4920                                 let _ = unsafe { Box::from_raw(self.contents.err) };
4921                         }
4922                 }
4923         }
4924 }
4925 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::PayeePubKey, crate::c_types::Secp256k1Error>> for CResult_PayeePubKeyErrorZ {
4926         fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::PayeePubKey, crate::c_types::Secp256k1Error>) -> Self {
4927                 let contents = if o.result_ok {
4928                         let result = unsafe { o.contents.result };
4929                         unsafe { o.contents.result = std::ptr::null_mut() };
4930                         CResult_PayeePubKeyErrorZPtr { result }
4931                 } else {
4932                         let err = unsafe { o.contents.err };
4933                         unsafe { o.contents.err = std::ptr::null_mut(); }
4934                         CResult_PayeePubKeyErrorZPtr { err }
4935                 };
4936                 Self {
4937                         contents,
4938                         result_ok: o.result_ok,
4939                 }
4940         }
4941 }
4942 impl Clone for CResult_PayeePubKeyErrorZ {
4943         fn clone(&self) -> Self {
4944                 if self.result_ok {
4945                         Self { result_ok: true, contents: CResult_PayeePubKeyErrorZPtr {
4946                                 result: Box::into_raw(Box::new(<crate::lightning_invoice::PayeePubKey>::clone(unsafe { &*self.contents.result })))
4947                         } }
4948                 } else {
4949                         Self { result_ok: false, contents: CResult_PayeePubKeyErrorZPtr {
4950                                 err: Box::into_raw(Box::new(<crate::c_types::Secp256k1Error>::clone(unsafe { &*self.contents.err })))
4951                         } }
4952                 }
4953         }
4954 }
4955 #[no_mangle]
4956 /// Creates a new CResult_PayeePubKeyErrorZ which has the same data as `orig`
4957 /// but with all dynamically-allocated buffers duplicated in new buffers.
4958 pub extern "C" fn CResult_PayeePubKeyErrorZ_clone(orig: &CResult_PayeePubKeyErrorZ) -> CResult_PayeePubKeyErrorZ { orig.clone() }
4959 #[repr(C)]
4960 /// A dynamically-allocated array of crate::lightning_invoice::RouteHints of arbitrary size.
4961 /// This corresponds to std::vector in C++
4962 pub struct CVec_RouteHintZ {
4963         /// The elements in the array.
4964         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4965         pub data: *mut crate::lightning_invoice::RouteHint,
4966         /// The number of elements pointed to by `data`.
4967         pub datalen: usize
4968 }
4969 impl CVec_RouteHintZ {
4970         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning_invoice::RouteHint> {
4971                 if self.datalen == 0 { return Vec::new(); }
4972                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
4973                 self.data = std::ptr::null_mut();
4974                 self.datalen = 0;
4975                 ret
4976         }
4977         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning_invoice::RouteHint] {
4978                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
4979         }
4980 }
4981 impl From<Vec<crate::lightning_invoice::RouteHint>> for CVec_RouteHintZ {
4982         fn from(v: Vec<crate::lightning_invoice::RouteHint>) -> Self {
4983                 let datalen = v.len();
4984                 let data = Box::into_raw(v.into_boxed_slice());
4985                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
4986         }
4987 }
4988 #[no_mangle]
4989 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
4990 pub extern "C" fn CVec_RouteHintZ_free(_res: CVec_RouteHintZ) { }
4991 impl Drop for CVec_RouteHintZ {
4992         fn drop(&mut self) {
4993                 if self.datalen == 0 { return; }
4994                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
4995         }
4996 }
4997 impl Clone for CVec_RouteHintZ {
4998         fn clone(&self) -> Self {
4999                 let mut res = Vec::new();
5000                 if self.datalen == 0 { return Self::from(res); }
5001                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
5002                 Self::from(res)
5003         }
5004 }
5005 #[repr(C)]
5006 /// The contents of CResult_PositiveTimestampCreationErrorZ
5007 pub union CResult_PositiveTimestampCreationErrorZPtr {
5008         /// A pointer to the contents in the success state.
5009         /// Reading from this pointer when `result_ok` is not set is undefined.
5010         pub result: *mut crate::lightning_invoice::PositiveTimestamp,
5011         /// A pointer to the contents in the error state.
5012         /// Reading from this pointer when `result_ok` is set is undefined.
5013         pub err: *mut crate::lightning_invoice::CreationError,
5014 }
5015 #[repr(C)]
5016 /// A CResult_PositiveTimestampCreationErrorZ represents the result of a fallible operation,
5017 /// containing a crate::lightning_invoice::PositiveTimestamp on success and a crate::lightning_invoice::CreationError on failure.
5018 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5019 pub struct CResult_PositiveTimestampCreationErrorZ {
5020         /// The contents of this CResult_PositiveTimestampCreationErrorZ, accessible via either
5021         /// `err` or `result` depending on the state of `result_ok`.
5022         pub contents: CResult_PositiveTimestampCreationErrorZPtr,
5023         /// Whether this CResult_PositiveTimestampCreationErrorZ represents a success state.
5024         pub result_ok: bool,
5025 }
5026 #[no_mangle]
5027 /// Creates a new CResult_PositiveTimestampCreationErrorZ in the success state.
5028 pub extern "C" fn CResult_PositiveTimestampCreationErrorZ_ok(o: crate::lightning_invoice::PositiveTimestamp) -> CResult_PositiveTimestampCreationErrorZ {
5029         CResult_PositiveTimestampCreationErrorZ {
5030                 contents: CResult_PositiveTimestampCreationErrorZPtr {
5031                         result: Box::into_raw(Box::new(o)),
5032                 },
5033                 result_ok: true,
5034         }
5035 }
5036 #[no_mangle]
5037 /// Creates a new CResult_PositiveTimestampCreationErrorZ in the error state.
5038 pub extern "C" fn CResult_PositiveTimestampCreationErrorZ_err(e: crate::lightning_invoice::CreationError) -> CResult_PositiveTimestampCreationErrorZ {
5039         CResult_PositiveTimestampCreationErrorZ {
5040                 contents: CResult_PositiveTimestampCreationErrorZPtr {
5041                         err: Box::into_raw(Box::new(e)),
5042                 },
5043                 result_ok: false,
5044         }
5045 }
5046 #[no_mangle]
5047 /// Frees any resources used by the CResult_PositiveTimestampCreationErrorZ.
5048 pub extern "C" fn CResult_PositiveTimestampCreationErrorZ_free(_res: CResult_PositiveTimestampCreationErrorZ) { }
5049 impl Drop for CResult_PositiveTimestampCreationErrorZ {
5050         fn drop(&mut self) {
5051                 if self.result_ok {
5052                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
5053                                 let _ = unsafe { Box::from_raw(self.contents.result) };
5054                         }
5055                 } else {
5056                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
5057                                 let _ = unsafe { Box::from_raw(self.contents.err) };
5058                         }
5059                 }
5060         }
5061 }
5062 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::PositiveTimestamp, crate::lightning_invoice::CreationError>> for CResult_PositiveTimestampCreationErrorZ {
5063         fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::PositiveTimestamp, crate::lightning_invoice::CreationError>) -> Self {
5064                 let contents = if o.result_ok {
5065                         let result = unsafe { o.contents.result };
5066                         unsafe { o.contents.result = std::ptr::null_mut() };
5067                         CResult_PositiveTimestampCreationErrorZPtr { result }
5068                 } else {
5069                         let err = unsafe { o.contents.err };
5070                         unsafe { o.contents.err = std::ptr::null_mut(); }
5071                         CResult_PositiveTimestampCreationErrorZPtr { err }
5072                 };
5073                 Self {
5074                         contents,
5075                         result_ok: o.result_ok,
5076                 }
5077         }
5078 }
5079 impl Clone for CResult_PositiveTimestampCreationErrorZ {
5080         fn clone(&self) -> Self {
5081                 if self.result_ok {
5082                         Self { result_ok: true, contents: CResult_PositiveTimestampCreationErrorZPtr {
5083                                 result: Box::into_raw(Box::new(<crate::lightning_invoice::PositiveTimestamp>::clone(unsafe { &*self.contents.result })))
5084                         } }
5085                 } else {
5086                         Self { result_ok: false, contents: CResult_PositiveTimestampCreationErrorZPtr {
5087                                 err: Box::into_raw(Box::new(<crate::lightning_invoice::CreationError>::clone(unsafe { &*self.contents.err })))
5088                         } }
5089                 }
5090         }
5091 }
5092 #[no_mangle]
5093 /// Creates a new CResult_PositiveTimestampCreationErrorZ which has the same data as `orig`
5094 /// but with all dynamically-allocated buffers duplicated in new buffers.
5095 pub extern "C" fn CResult_PositiveTimestampCreationErrorZ_clone(orig: &CResult_PositiveTimestampCreationErrorZ) -> CResult_PositiveTimestampCreationErrorZ { orig.clone() }
5096 #[repr(C)]
5097 /// The contents of CResult_NoneSemanticErrorZ
5098 pub union CResult_NoneSemanticErrorZPtr {
5099         /// Note that this value is always NULL, as there are no contents in the OK variant
5100         pub result: *mut std::ffi::c_void,
5101         /// A pointer to the contents in the error state.
5102         /// Reading from this pointer when `result_ok` is set is undefined.
5103         pub err: *mut crate::lightning_invoice::SemanticError,
5104 }
5105 #[repr(C)]
5106 /// A CResult_NoneSemanticErrorZ represents the result of a fallible operation,
5107 /// containing a () on success and a crate::lightning_invoice::SemanticError on failure.
5108 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5109 pub struct CResult_NoneSemanticErrorZ {
5110         /// The contents of this CResult_NoneSemanticErrorZ, accessible via either
5111         /// `err` or `result` depending on the state of `result_ok`.
5112         pub contents: CResult_NoneSemanticErrorZPtr,
5113         /// Whether this CResult_NoneSemanticErrorZ represents a success state.
5114         pub result_ok: bool,
5115 }
5116 #[no_mangle]
5117 /// Creates a new CResult_NoneSemanticErrorZ in the success state.
5118 pub extern "C" fn CResult_NoneSemanticErrorZ_ok() -> CResult_NoneSemanticErrorZ {
5119         CResult_NoneSemanticErrorZ {
5120                 contents: CResult_NoneSemanticErrorZPtr {
5121                         result: std::ptr::null_mut(),
5122                 },
5123                 result_ok: true,
5124         }
5125 }
5126 #[no_mangle]
5127 /// Creates a new CResult_NoneSemanticErrorZ in the error state.
5128 pub extern "C" fn CResult_NoneSemanticErrorZ_err(e: crate::lightning_invoice::SemanticError) -> CResult_NoneSemanticErrorZ {
5129         CResult_NoneSemanticErrorZ {
5130                 contents: CResult_NoneSemanticErrorZPtr {
5131                         err: Box::into_raw(Box::new(e)),
5132                 },
5133                 result_ok: false,
5134         }
5135 }
5136 #[no_mangle]
5137 /// Frees any resources used by the CResult_NoneSemanticErrorZ.
5138 pub extern "C" fn CResult_NoneSemanticErrorZ_free(_res: CResult_NoneSemanticErrorZ) { }
5139 impl Drop for CResult_NoneSemanticErrorZ {
5140         fn drop(&mut self) {
5141                 if self.result_ok {
5142                 } else {
5143                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
5144                                 let _ = unsafe { Box::from_raw(self.contents.err) };
5145                         }
5146                 }
5147         }
5148 }
5149 impl From<crate::c_types::CResultTempl<(), crate::lightning_invoice::SemanticError>> for CResult_NoneSemanticErrorZ {
5150         fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning_invoice::SemanticError>) -> Self {
5151                 let contents = if o.result_ok {
5152                         let _ = unsafe { Box::from_raw(o.contents.result) };
5153                         o.contents.result = std::ptr::null_mut();
5154                         CResult_NoneSemanticErrorZPtr { result: std::ptr::null_mut() }
5155                 } else {
5156                         let err = unsafe { o.contents.err };
5157                         unsafe { o.contents.err = std::ptr::null_mut(); }
5158                         CResult_NoneSemanticErrorZPtr { err }
5159                 };
5160                 Self {
5161                         contents,
5162                         result_ok: o.result_ok,
5163                 }
5164         }
5165 }
5166 impl Clone for CResult_NoneSemanticErrorZ {
5167         fn clone(&self) -> Self {
5168                 if self.result_ok {
5169                         Self { result_ok: true, contents: CResult_NoneSemanticErrorZPtr {
5170                                 result: std::ptr::null_mut()
5171                         } }
5172                 } else {
5173                         Self { result_ok: false, contents: CResult_NoneSemanticErrorZPtr {
5174                                 err: Box::into_raw(Box::new(<crate::lightning_invoice::SemanticError>::clone(unsafe { &*self.contents.err })))
5175                         } }
5176                 }
5177         }
5178 }
5179 #[no_mangle]
5180 /// Creates a new CResult_NoneSemanticErrorZ which has the same data as `orig`
5181 /// but with all dynamically-allocated buffers duplicated in new buffers.
5182 pub extern "C" fn CResult_NoneSemanticErrorZ_clone(orig: &CResult_NoneSemanticErrorZ) -> CResult_NoneSemanticErrorZ { orig.clone() }
5183 #[repr(C)]
5184 /// The contents of CResult_InvoiceSemanticErrorZ
5185 pub union CResult_InvoiceSemanticErrorZPtr {
5186         /// A pointer to the contents in the success state.
5187         /// Reading from this pointer when `result_ok` is not set is undefined.
5188         pub result: *mut crate::lightning_invoice::Invoice,
5189         /// A pointer to the contents in the error state.
5190         /// Reading from this pointer when `result_ok` is set is undefined.
5191         pub err: *mut crate::lightning_invoice::SemanticError,
5192 }
5193 #[repr(C)]
5194 /// A CResult_InvoiceSemanticErrorZ represents the result of a fallible operation,
5195 /// containing a crate::lightning_invoice::Invoice on success and a crate::lightning_invoice::SemanticError on failure.
5196 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5197 pub struct CResult_InvoiceSemanticErrorZ {
5198         /// The contents of this CResult_InvoiceSemanticErrorZ, accessible via either
5199         /// `err` or `result` depending on the state of `result_ok`.
5200         pub contents: CResult_InvoiceSemanticErrorZPtr,
5201         /// Whether this CResult_InvoiceSemanticErrorZ represents a success state.
5202         pub result_ok: bool,
5203 }
5204 #[no_mangle]
5205 /// Creates a new CResult_InvoiceSemanticErrorZ in the success state.
5206 pub extern "C" fn CResult_InvoiceSemanticErrorZ_ok(o: crate::lightning_invoice::Invoice) -> CResult_InvoiceSemanticErrorZ {
5207         CResult_InvoiceSemanticErrorZ {
5208                 contents: CResult_InvoiceSemanticErrorZPtr {
5209                         result: Box::into_raw(Box::new(o)),
5210                 },
5211                 result_ok: true,
5212         }
5213 }
5214 #[no_mangle]
5215 /// Creates a new CResult_InvoiceSemanticErrorZ in the error state.
5216 pub extern "C" fn CResult_InvoiceSemanticErrorZ_err(e: crate::lightning_invoice::SemanticError) -> CResult_InvoiceSemanticErrorZ {
5217         CResult_InvoiceSemanticErrorZ {
5218                 contents: CResult_InvoiceSemanticErrorZPtr {
5219                         err: Box::into_raw(Box::new(e)),
5220                 },
5221                 result_ok: false,
5222         }
5223 }
5224 #[no_mangle]
5225 /// Frees any resources used by the CResult_InvoiceSemanticErrorZ.
5226 pub extern "C" fn CResult_InvoiceSemanticErrorZ_free(_res: CResult_InvoiceSemanticErrorZ) { }
5227 impl Drop for CResult_InvoiceSemanticErrorZ {
5228         fn drop(&mut self) {
5229                 if self.result_ok {
5230                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
5231                                 let _ = unsafe { Box::from_raw(self.contents.result) };
5232                         }
5233                 } else {
5234                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
5235                                 let _ = unsafe { Box::from_raw(self.contents.err) };
5236                         }
5237                 }
5238         }
5239 }
5240 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::Invoice, crate::lightning_invoice::SemanticError>> for CResult_InvoiceSemanticErrorZ {
5241         fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::Invoice, crate::lightning_invoice::SemanticError>) -> Self {
5242                 let contents = if o.result_ok {
5243                         let result = unsafe { o.contents.result };
5244                         unsafe { o.contents.result = std::ptr::null_mut() };
5245                         CResult_InvoiceSemanticErrorZPtr { result }
5246                 } else {
5247                         let err = unsafe { o.contents.err };
5248                         unsafe { o.contents.err = std::ptr::null_mut(); }
5249                         CResult_InvoiceSemanticErrorZPtr { err }
5250                 };
5251                 Self {
5252                         contents,
5253                         result_ok: o.result_ok,
5254                 }
5255         }
5256 }
5257 impl Clone for CResult_InvoiceSemanticErrorZ {
5258         fn clone(&self) -> Self {
5259                 if self.result_ok {
5260                         Self { result_ok: true, contents: CResult_InvoiceSemanticErrorZPtr {
5261                                 result: Box::into_raw(Box::new(<crate::lightning_invoice::Invoice>::clone(unsafe { &*self.contents.result })))
5262                         } }
5263                 } else {
5264                         Self { result_ok: false, contents: CResult_InvoiceSemanticErrorZPtr {
5265                                 err: Box::into_raw(Box::new(<crate::lightning_invoice::SemanticError>::clone(unsafe { &*self.contents.err })))
5266                         } }
5267                 }
5268         }
5269 }
5270 #[no_mangle]
5271 /// Creates a new CResult_InvoiceSemanticErrorZ which has the same data as `orig`
5272 /// but with all dynamically-allocated buffers duplicated in new buffers.
5273 pub extern "C" fn CResult_InvoiceSemanticErrorZ_clone(orig: &CResult_InvoiceSemanticErrorZ) -> CResult_InvoiceSemanticErrorZ { orig.clone() }
5274 #[repr(C)]
5275 /// The contents of CResult_DescriptionCreationErrorZ
5276 pub union CResult_DescriptionCreationErrorZPtr {
5277         /// A pointer to the contents in the success state.
5278         /// Reading from this pointer when `result_ok` is not set is undefined.
5279         pub result: *mut crate::lightning_invoice::Description,
5280         /// A pointer to the contents in the error state.
5281         /// Reading from this pointer when `result_ok` is set is undefined.
5282         pub err: *mut crate::lightning_invoice::CreationError,
5283 }
5284 #[repr(C)]
5285 /// A CResult_DescriptionCreationErrorZ represents the result of a fallible operation,
5286 /// containing a crate::lightning_invoice::Description on success and a crate::lightning_invoice::CreationError on failure.
5287 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5288 pub struct CResult_DescriptionCreationErrorZ {
5289         /// The contents of this CResult_DescriptionCreationErrorZ, accessible via either
5290         /// `err` or `result` depending on the state of `result_ok`.
5291         pub contents: CResult_DescriptionCreationErrorZPtr,
5292         /// Whether this CResult_DescriptionCreationErrorZ represents a success state.
5293         pub result_ok: bool,
5294 }
5295 #[no_mangle]
5296 /// Creates a new CResult_DescriptionCreationErrorZ in the success state.
5297 pub extern "C" fn CResult_DescriptionCreationErrorZ_ok(o: crate::lightning_invoice::Description) -> CResult_DescriptionCreationErrorZ {
5298         CResult_DescriptionCreationErrorZ {
5299                 contents: CResult_DescriptionCreationErrorZPtr {
5300                         result: Box::into_raw(Box::new(o)),
5301                 },
5302                 result_ok: true,
5303         }
5304 }
5305 #[no_mangle]
5306 /// Creates a new CResult_DescriptionCreationErrorZ in the error state.
5307 pub extern "C" fn CResult_DescriptionCreationErrorZ_err(e: crate::lightning_invoice::CreationError) -> CResult_DescriptionCreationErrorZ {
5308         CResult_DescriptionCreationErrorZ {
5309                 contents: CResult_DescriptionCreationErrorZPtr {
5310                         err: Box::into_raw(Box::new(e)),
5311                 },
5312                 result_ok: false,
5313         }
5314 }
5315 #[no_mangle]
5316 /// Frees any resources used by the CResult_DescriptionCreationErrorZ.
5317 pub extern "C" fn CResult_DescriptionCreationErrorZ_free(_res: CResult_DescriptionCreationErrorZ) { }
5318 impl Drop for CResult_DescriptionCreationErrorZ {
5319         fn drop(&mut self) {
5320                 if self.result_ok {
5321                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
5322                                 let _ = unsafe { Box::from_raw(self.contents.result) };
5323                         }
5324                 } else {
5325                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
5326                                 let _ = unsafe { Box::from_raw(self.contents.err) };
5327                         }
5328                 }
5329         }
5330 }
5331 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::Description, crate::lightning_invoice::CreationError>> for CResult_DescriptionCreationErrorZ {
5332         fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::Description, crate::lightning_invoice::CreationError>) -> Self {
5333                 let contents = if o.result_ok {
5334                         let result = unsafe { o.contents.result };
5335                         unsafe { o.contents.result = std::ptr::null_mut() };
5336                         CResult_DescriptionCreationErrorZPtr { result }
5337                 } else {
5338                         let err = unsafe { o.contents.err };
5339                         unsafe { o.contents.err = std::ptr::null_mut(); }
5340                         CResult_DescriptionCreationErrorZPtr { err }
5341                 };
5342                 Self {
5343                         contents,
5344                         result_ok: o.result_ok,
5345                 }
5346         }
5347 }
5348 impl Clone for CResult_DescriptionCreationErrorZ {
5349         fn clone(&self) -> Self {
5350                 if self.result_ok {
5351                         Self { result_ok: true, contents: CResult_DescriptionCreationErrorZPtr {
5352                                 result: Box::into_raw(Box::new(<crate::lightning_invoice::Description>::clone(unsafe { &*self.contents.result })))
5353                         } }
5354                 } else {
5355                         Self { result_ok: false, contents: CResult_DescriptionCreationErrorZPtr {
5356                                 err: Box::into_raw(Box::new(<crate::lightning_invoice::CreationError>::clone(unsafe { &*self.contents.err })))
5357                         } }
5358                 }
5359         }
5360 }
5361 #[no_mangle]
5362 /// Creates a new CResult_DescriptionCreationErrorZ which has the same data as `orig`
5363 /// but with all dynamically-allocated buffers duplicated in new buffers.
5364 pub extern "C" fn CResult_DescriptionCreationErrorZ_clone(orig: &CResult_DescriptionCreationErrorZ) -> CResult_DescriptionCreationErrorZ { orig.clone() }
5365 #[repr(C)]
5366 /// The contents of CResult_ExpiryTimeCreationErrorZ
5367 pub union CResult_ExpiryTimeCreationErrorZPtr {
5368         /// A pointer to the contents in the success state.
5369         /// Reading from this pointer when `result_ok` is not set is undefined.
5370         pub result: *mut crate::lightning_invoice::ExpiryTime,
5371         /// A pointer to the contents in the error state.
5372         /// Reading from this pointer when `result_ok` is set is undefined.
5373         pub err: *mut crate::lightning_invoice::CreationError,
5374 }
5375 #[repr(C)]
5376 /// A CResult_ExpiryTimeCreationErrorZ represents the result of a fallible operation,
5377 /// containing a crate::lightning_invoice::ExpiryTime on success and a crate::lightning_invoice::CreationError on failure.
5378 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5379 pub struct CResult_ExpiryTimeCreationErrorZ {
5380         /// The contents of this CResult_ExpiryTimeCreationErrorZ, accessible via either
5381         /// `err` or `result` depending on the state of `result_ok`.
5382         pub contents: CResult_ExpiryTimeCreationErrorZPtr,
5383         /// Whether this CResult_ExpiryTimeCreationErrorZ represents a success state.
5384         pub result_ok: bool,
5385 }
5386 #[no_mangle]
5387 /// Creates a new CResult_ExpiryTimeCreationErrorZ in the success state.
5388 pub extern "C" fn CResult_ExpiryTimeCreationErrorZ_ok(o: crate::lightning_invoice::ExpiryTime) -> CResult_ExpiryTimeCreationErrorZ {
5389         CResult_ExpiryTimeCreationErrorZ {
5390                 contents: CResult_ExpiryTimeCreationErrorZPtr {
5391                         result: Box::into_raw(Box::new(o)),
5392                 },
5393                 result_ok: true,
5394         }
5395 }
5396 #[no_mangle]
5397 /// Creates a new CResult_ExpiryTimeCreationErrorZ in the error state.
5398 pub extern "C" fn CResult_ExpiryTimeCreationErrorZ_err(e: crate::lightning_invoice::CreationError) -> CResult_ExpiryTimeCreationErrorZ {
5399         CResult_ExpiryTimeCreationErrorZ {
5400                 contents: CResult_ExpiryTimeCreationErrorZPtr {
5401                         err: Box::into_raw(Box::new(e)),
5402                 },
5403                 result_ok: false,
5404         }
5405 }
5406 #[no_mangle]
5407 /// Frees any resources used by the CResult_ExpiryTimeCreationErrorZ.
5408 pub extern "C" fn CResult_ExpiryTimeCreationErrorZ_free(_res: CResult_ExpiryTimeCreationErrorZ) { }
5409 impl Drop for CResult_ExpiryTimeCreationErrorZ {
5410         fn drop(&mut self) {
5411                 if self.result_ok {
5412                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
5413                                 let _ = unsafe { Box::from_raw(self.contents.result) };
5414                         }
5415                 } else {
5416                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
5417                                 let _ = unsafe { Box::from_raw(self.contents.err) };
5418                         }
5419                 }
5420         }
5421 }
5422 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::ExpiryTime, crate::lightning_invoice::CreationError>> for CResult_ExpiryTimeCreationErrorZ {
5423         fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::ExpiryTime, crate::lightning_invoice::CreationError>) -> Self {
5424                 let contents = if o.result_ok {
5425                         let result = unsafe { o.contents.result };
5426                         unsafe { o.contents.result = std::ptr::null_mut() };
5427                         CResult_ExpiryTimeCreationErrorZPtr { result }
5428                 } else {
5429                         let err = unsafe { o.contents.err };
5430                         unsafe { o.contents.err = std::ptr::null_mut(); }
5431                         CResult_ExpiryTimeCreationErrorZPtr { err }
5432                 };
5433                 Self {
5434                         contents,
5435                         result_ok: o.result_ok,
5436                 }
5437         }
5438 }
5439 impl Clone for CResult_ExpiryTimeCreationErrorZ {
5440         fn clone(&self) -> Self {
5441                 if self.result_ok {
5442                         Self { result_ok: true, contents: CResult_ExpiryTimeCreationErrorZPtr {
5443                                 result: Box::into_raw(Box::new(<crate::lightning_invoice::ExpiryTime>::clone(unsafe { &*self.contents.result })))
5444                         } }
5445                 } else {
5446                         Self { result_ok: false, contents: CResult_ExpiryTimeCreationErrorZPtr {
5447                                 err: Box::into_raw(Box::new(<crate::lightning_invoice::CreationError>::clone(unsafe { &*self.contents.err })))
5448                         } }
5449                 }
5450         }
5451 }
5452 #[no_mangle]
5453 /// Creates a new CResult_ExpiryTimeCreationErrorZ which has the same data as `orig`
5454 /// but with all dynamically-allocated buffers duplicated in new buffers.
5455 pub extern "C" fn CResult_ExpiryTimeCreationErrorZ_clone(orig: &CResult_ExpiryTimeCreationErrorZ) -> CResult_ExpiryTimeCreationErrorZ { orig.clone() }
5456 #[repr(C)]
5457 /// The contents of CResult_RouteHintCreationErrorZ
5458 pub union CResult_RouteHintCreationErrorZPtr {
5459         /// A pointer to the contents in the success state.
5460         /// Reading from this pointer when `result_ok` is not set is undefined.
5461         pub result: *mut crate::lightning_invoice::RouteHint,
5462         /// A pointer to the contents in the error state.
5463         /// Reading from this pointer when `result_ok` is set is undefined.
5464         pub err: *mut crate::lightning_invoice::CreationError,
5465 }
5466 #[repr(C)]
5467 /// A CResult_RouteHintCreationErrorZ represents the result of a fallible operation,
5468 /// containing a crate::lightning_invoice::RouteHint on success and a crate::lightning_invoice::CreationError on failure.
5469 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5470 pub struct CResult_RouteHintCreationErrorZ {
5471         /// The contents of this CResult_RouteHintCreationErrorZ, accessible via either
5472         /// `err` or `result` depending on the state of `result_ok`.
5473         pub contents: CResult_RouteHintCreationErrorZPtr,
5474         /// Whether this CResult_RouteHintCreationErrorZ represents a success state.
5475         pub result_ok: bool,
5476 }
5477 #[no_mangle]
5478 /// Creates a new CResult_RouteHintCreationErrorZ in the success state.
5479 pub extern "C" fn CResult_RouteHintCreationErrorZ_ok(o: crate::lightning_invoice::RouteHint) -> CResult_RouteHintCreationErrorZ {
5480         CResult_RouteHintCreationErrorZ {
5481                 contents: CResult_RouteHintCreationErrorZPtr {
5482                         result: Box::into_raw(Box::new(o)),
5483                 },
5484                 result_ok: true,
5485         }
5486 }
5487 #[no_mangle]
5488 /// Creates a new CResult_RouteHintCreationErrorZ in the error state.
5489 pub extern "C" fn CResult_RouteHintCreationErrorZ_err(e: crate::lightning_invoice::CreationError) -> CResult_RouteHintCreationErrorZ {
5490         CResult_RouteHintCreationErrorZ {
5491                 contents: CResult_RouteHintCreationErrorZPtr {
5492                         err: Box::into_raw(Box::new(e)),
5493                 },
5494                 result_ok: false,
5495         }
5496 }
5497 #[no_mangle]
5498 /// Frees any resources used by the CResult_RouteHintCreationErrorZ.
5499 pub extern "C" fn CResult_RouteHintCreationErrorZ_free(_res: CResult_RouteHintCreationErrorZ) { }
5500 impl Drop for CResult_RouteHintCreationErrorZ {
5501         fn drop(&mut self) {
5502                 if self.result_ok {
5503                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
5504                                 let _ = unsafe { Box::from_raw(self.contents.result) };
5505                         }
5506                 } else {
5507                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
5508                                 let _ = unsafe { Box::from_raw(self.contents.err) };
5509                         }
5510                 }
5511         }
5512 }
5513 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::RouteHint, crate::lightning_invoice::CreationError>> for CResult_RouteHintCreationErrorZ {
5514         fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::RouteHint, crate::lightning_invoice::CreationError>) -> Self {
5515                 let contents = if o.result_ok {
5516                         let result = unsafe { o.contents.result };
5517                         unsafe { o.contents.result = std::ptr::null_mut() };
5518                         CResult_RouteHintCreationErrorZPtr { result }
5519                 } else {
5520                         let err = unsafe { o.contents.err };
5521                         unsafe { o.contents.err = std::ptr::null_mut(); }
5522                         CResult_RouteHintCreationErrorZPtr { err }
5523                 };
5524                 Self {
5525                         contents,
5526                         result_ok: o.result_ok,
5527                 }
5528         }
5529 }
5530 impl Clone for CResult_RouteHintCreationErrorZ {
5531         fn clone(&self) -> Self {
5532                 if self.result_ok {
5533                         Self { result_ok: true, contents: CResult_RouteHintCreationErrorZPtr {
5534                                 result: Box::into_raw(Box::new(<crate::lightning_invoice::RouteHint>::clone(unsafe { &*self.contents.result })))
5535                         } }
5536                 } else {
5537                         Self { result_ok: false, contents: CResult_RouteHintCreationErrorZPtr {
5538                                 err: Box::into_raw(Box::new(<crate::lightning_invoice::CreationError>::clone(unsafe { &*self.contents.err })))
5539                         } }
5540                 }
5541         }
5542 }
5543 #[no_mangle]
5544 /// Creates a new CResult_RouteHintCreationErrorZ which has the same data as `orig`
5545 /// but with all dynamically-allocated buffers duplicated in new buffers.
5546 pub extern "C" fn CResult_RouteHintCreationErrorZ_clone(orig: &CResult_RouteHintCreationErrorZ) -> CResult_RouteHintCreationErrorZ { orig.clone() }
5547 #[repr(C)]
5548 /// The contents of CResult_StringErrorZ
5549 pub union CResult_StringErrorZPtr {
5550         /// A pointer to the contents in the success state.
5551         /// Reading from this pointer when `result_ok` is not set is undefined.
5552         pub result: *mut crate::c_types::Str,
5553         /// A pointer to the contents in the error state.
5554         /// Reading from this pointer when `result_ok` is set is undefined.
5555         pub err: *mut crate::c_types::Secp256k1Error,
5556 }
5557 #[repr(C)]
5558 /// A CResult_StringErrorZ represents the result of a fallible operation,
5559 /// containing a crate::c_types::Str on success and a crate::c_types::Secp256k1Error on failure.
5560 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5561 pub struct CResult_StringErrorZ {
5562         /// The contents of this CResult_StringErrorZ, accessible via either
5563         /// `err` or `result` depending on the state of `result_ok`.
5564         pub contents: CResult_StringErrorZPtr,
5565         /// Whether this CResult_StringErrorZ represents a success state.
5566         pub result_ok: bool,
5567 }
5568 #[no_mangle]
5569 /// Creates a new CResult_StringErrorZ in the success state.
5570 pub extern "C" fn CResult_StringErrorZ_ok(o: crate::c_types::Str) -> CResult_StringErrorZ {
5571         CResult_StringErrorZ {
5572                 contents: CResult_StringErrorZPtr {
5573                         result: Box::into_raw(Box::new(o)),
5574                 },
5575                 result_ok: true,
5576         }
5577 }
5578 #[no_mangle]
5579 /// Creates a new CResult_StringErrorZ in the error state.
5580 pub extern "C" fn CResult_StringErrorZ_err(e: crate::c_types::Secp256k1Error) -> CResult_StringErrorZ {
5581         CResult_StringErrorZ {
5582                 contents: CResult_StringErrorZPtr {
5583                         err: Box::into_raw(Box::new(e)),
5584                 },
5585                 result_ok: false,
5586         }
5587 }
5588 #[no_mangle]
5589 /// Frees any resources used by the CResult_StringErrorZ.
5590 pub extern "C" fn CResult_StringErrorZ_free(_res: CResult_StringErrorZ) { }
5591 impl Drop for CResult_StringErrorZ {
5592         fn drop(&mut self) {
5593                 if self.result_ok {
5594                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
5595                                 let _ = unsafe { Box::from_raw(self.contents.result) };
5596                         }
5597                 } else {
5598                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
5599                                 let _ = unsafe { Box::from_raw(self.contents.err) };
5600                         }
5601                 }
5602         }
5603 }
5604 impl From<crate::c_types::CResultTempl<crate::c_types::Str, crate::c_types::Secp256k1Error>> for CResult_StringErrorZ {
5605         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::Str, crate::c_types::Secp256k1Error>) -> Self {
5606                 let contents = if o.result_ok {
5607                         let result = unsafe { o.contents.result };
5608                         unsafe { o.contents.result = std::ptr::null_mut() };
5609                         CResult_StringErrorZPtr { result }
5610                 } else {
5611                         let err = unsafe { o.contents.err };
5612                         unsafe { o.contents.err = std::ptr::null_mut(); }
5613                         CResult_StringErrorZPtr { err }
5614                 };
5615                 Self {
5616                         contents,
5617                         result_ok: o.result_ok,
5618                 }
5619         }
5620 }
5621 #[repr(C)]
5622 /// The contents of CResult_ChannelMonitorUpdateDecodeErrorZ
5623 pub union CResult_ChannelMonitorUpdateDecodeErrorZPtr {
5624         /// A pointer to the contents in the success state.
5625         /// Reading from this pointer when `result_ok` is not set is undefined.
5626         pub result: *mut crate::lightning::chain::channelmonitor::ChannelMonitorUpdate,
5627         /// A pointer to the contents in the error state.
5628         /// Reading from this pointer when `result_ok` is set is undefined.
5629         pub err: *mut crate::lightning::ln::msgs::DecodeError,
5630 }
5631 #[repr(C)]
5632 /// A CResult_ChannelMonitorUpdateDecodeErrorZ represents the result of a fallible operation,
5633 /// containing a crate::lightning::chain::channelmonitor::ChannelMonitorUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
5634 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5635 pub struct CResult_ChannelMonitorUpdateDecodeErrorZ {
5636         /// The contents of this CResult_ChannelMonitorUpdateDecodeErrorZ, accessible via either
5637         /// `err` or `result` depending on the state of `result_ok`.
5638         pub contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr,
5639         /// Whether this CResult_ChannelMonitorUpdateDecodeErrorZ represents a success state.
5640         pub result_ok: bool,
5641 }
5642 #[no_mangle]
5643 /// Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ in the success state.
5644 pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_ok(o: crate::lightning::chain::channelmonitor::ChannelMonitorUpdate) -> CResult_ChannelMonitorUpdateDecodeErrorZ {
5645         CResult_ChannelMonitorUpdateDecodeErrorZ {
5646                 contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr {
5647                         result: Box::into_raw(Box::new(o)),
5648                 },
5649                 result_ok: true,
5650         }
5651 }
5652 #[no_mangle]
5653 /// Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ in the error state.
5654 pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelMonitorUpdateDecodeErrorZ {
5655         CResult_ChannelMonitorUpdateDecodeErrorZ {
5656                 contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr {
5657                         err: Box::into_raw(Box::new(e)),
5658                 },
5659                 result_ok: false,
5660         }
5661 }
5662 #[no_mangle]
5663 /// Frees any resources used by the CResult_ChannelMonitorUpdateDecodeErrorZ.
5664 pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_free(_res: CResult_ChannelMonitorUpdateDecodeErrorZ) { }
5665 impl Drop for CResult_ChannelMonitorUpdateDecodeErrorZ {
5666         fn drop(&mut self) {
5667                 if self.result_ok {
5668                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
5669                                 let _ = unsafe { Box::from_raw(self.contents.result) };
5670                         }
5671                 } else {
5672                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
5673                                 let _ = unsafe { Box::from_raw(self.contents.err) };
5674                         }
5675                 }
5676         }
5677 }
5678 impl From<crate::c_types::CResultTempl<crate::lightning::chain::channelmonitor::ChannelMonitorUpdate, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelMonitorUpdateDecodeErrorZ {
5679         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::channelmonitor::ChannelMonitorUpdate, crate::lightning::ln::msgs::DecodeError>) -> Self {
5680                 let contents = if o.result_ok {
5681                         let result = unsafe { o.contents.result };
5682                         unsafe { o.contents.result = std::ptr::null_mut() };
5683                         CResult_ChannelMonitorUpdateDecodeErrorZPtr { result }
5684                 } else {
5685                         let err = unsafe { o.contents.err };
5686                         unsafe { o.contents.err = std::ptr::null_mut(); }
5687                         CResult_ChannelMonitorUpdateDecodeErrorZPtr { err }
5688                 };
5689                 Self {
5690                         contents,
5691                         result_ok: o.result_ok,
5692                 }
5693         }
5694 }
5695 impl Clone for CResult_ChannelMonitorUpdateDecodeErrorZ {
5696         fn clone(&self) -> Self {
5697                 if self.result_ok {
5698                         Self { result_ok: true, contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr {
5699                                 result: Box::into_raw(Box::new(<crate::lightning::chain::channelmonitor::ChannelMonitorUpdate>::clone(unsafe { &*self.contents.result })))
5700                         } }
5701                 } else {
5702                         Self { result_ok: false, contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr {
5703                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
5704                         } }
5705                 }
5706         }
5707 }
5708 #[no_mangle]
5709 /// Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ which has the same data as `orig`
5710 /// but with all dynamically-allocated buffers duplicated in new buffers.
5711 pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_clone(orig: &CResult_ChannelMonitorUpdateDecodeErrorZ) -> CResult_ChannelMonitorUpdateDecodeErrorZ { orig.clone() }
5712 #[repr(C)]
5713 /// The contents of CResult_HTLCUpdateDecodeErrorZ
5714 pub union CResult_HTLCUpdateDecodeErrorZPtr {
5715         /// A pointer to the contents in the success state.
5716         /// Reading from this pointer when `result_ok` is not set is undefined.
5717         pub result: *mut crate::lightning::chain::channelmonitor::HTLCUpdate,
5718         /// A pointer to the contents in the error state.
5719         /// Reading from this pointer when `result_ok` is set is undefined.
5720         pub err: *mut crate::lightning::ln::msgs::DecodeError,
5721 }
5722 #[repr(C)]
5723 /// A CResult_HTLCUpdateDecodeErrorZ represents the result of a fallible operation,
5724 /// containing a crate::lightning::chain::channelmonitor::HTLCUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
5725 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5726 pub struct CResult_HTLCUpdateDecodeErrorZ {
5727         /// The contents of this CResult_HTLCUpdateDecodeErrorZ, accessible via either
5728         /// `err` or `result` depending on the state of `result_ok`.
5729         pub contents: CResult_HTLCUpdateDecodeErrorZPtr,
5730         /// Whether this CResult_HTLCUpdateDecodeErrorZ represents a success state.
5731         pub result_ok: bool,
5732 }
5733 #[no_mangle]
5734 /// Creates a new CResult_HTLCUpdateDecodeErrorZ in the success state.
5735 pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_ok(o: crate::lightning::chain::channelmonitor::HTLCUpdate) -> CResult_HTLCUpdateDecodeErrorZ {
5736         CResult_HTLCUpdateDecodeErrorZ {
5737                 contents: CResult_HTLCUpdateDecodeErrorZPtr {
5738                         result: Box::into_raw(Box::new(o)),
5739                 },
5740                 result_ok: true,
5741         }
5742 }
5743 #[no_mangle]
5744 /// Creates a new CResult_HTLCUpdateDecodeErrorZ in the error state.
5745 pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_HTLCUpdateDecodeErrorZ {
5746         CResult_HTLCUpdateDecodeErrorZ {
5747                 contents: CResult_HTLCUpdateDecodeErrorZPtr {
5748                         err: Box::into_raw(Box::new(e)),
5749                 },
5750                 result_ok: false,
5751         }
5752 }
5753 #[no_mangle]
5754 /// Frees any resources used by the CResult_HTLCUpdateDecodeErrorZ.
5755 pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_free(_res: CResult_HTLCUpdateDecodeErrorZ) { }
5756 impl Drop for CResult_HTLCUpdateDecodeErrorZ {
5757         fn drop(&mut self) {
5758                 if self.result_ok {
5759                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
5760                                 let _ = unsafe { Box::from_raw(self.contents.result) };
5761                         }
5762                 } else {
5763                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
5764                                 let _ = unsafe { Box::from_raw(self.contents.err) };
5765                         }
5766                 }
5767         }
5768 }
5769 impl From<crate::c_types::CResultTempl<crate::lightning::chain::channelmonitor::HTLCUpdate, crate::lightning::ln::msgs::DecodeError>> for CResult_HTLCUpdateDecodeErrorZ {
5770         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::channelmonitor::HTLCUpdate, crate::lightning::ln::msgs::DecodeError>) -> Self {
5771                 let contents = if o.result_ok {
5772                         let result = unsafe { o.contents.result };
5773                         unsafe { o.contents.result = std::ptr::null_mut() };
5774                         CResult_HTLCUpdateDecodeErrorZPtr { result }
5775                 } else {
5776                         let err = unsafe { o.contents.err };
5777                         unsafe { o.contents.err = std::ptr::null_mut(); }
5778                         CResult_HTLCUpdateDecodeErrorZPtr { err }
5779                 };
5780                 Self {
5781                         contents,
5782                         result_ok: o.result_ok,
5783                 }
5784         }
5785 }
5786 impl Clone for CResult_HTLCUpdateDecodeErrorZ {
5787         fn clone(&self) -> Self {
5788                 if self.result_ok {
5789                         Self { result_ok: true, contents: CResult_HTLCUpdateDecodeErrorZPtr {
5790                                 result: Box::into_raw(Box::new(<crate::lightning::chain::channelmonitor::HTLCUpdate>::clone(unsafe { &*self.contents.result })))
5791                         } }
5792                 } else {
5793                         Self { result_ok: false, contents: CResult_HTLCUpdateDecodeErrorZPtr {
5794                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
5795                         } }
5796                 }
5797         }
5798 }
5799 #[no_mangle]
5800 /// Creates a new CResult_HTLCUpdateDecodeErrorZ which has the same data as `orig`
5801 /// but with all dynamically-allocated buffers duplicated in new buffers.
5802 pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_clone(orig: &CResult_HTLCUpdateDecodeErrorZ) -> CResult_HTLCUpdateDecodeErrorZ { orig.clone() }
5803 #[repr(C)]
5804 /// The contents of CResult_NoneMonitorUpdateErrorZ
5805 pub union CResult_NoneMonitorUpdateErrorZPtr {
5806         /// Note that this value is always NULL, as there are no contents in the OK variant
5807         pub result: *mut std::ffi::c_void,
5808         /// A pointer to the contents in the error state.
5809         /// Reading from this pointer when `result_ok` is set is undefined.
5810         pub err: *mut crate::lightning::chain::channelmonitor::MonitorUpdateError,
5811 }
5812 #[repr(C)]
5813 /// A CResult_NoneMonitorUpdateErrorZ represents the result of a fallible operation,
5814 /// containing a () on success and a crate::lightning::chain::channelmonitor::MonitorUpdateError on failure.
5815 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5816 pub struct CResult_NoneMonitorUpdateErrorZ {
5817         /// The contents of this CResult_NoneMonitorUpdateErrorZ, accessible via either
5818         /// `err` or `result` depending on the state of `result_ok`.
5819         pub contents: CResult_NoneMonitorUpdateErrorZPtr,
5820         /// Whether this CResult_NoneMonitorUpdateErrorZ represents a success state.
5821         pub result_ok: bool,
5822 }
5823 #[no_mangle]
5824 /// Creates a new CResult_NoneMonitorUpdateErrorZ in the success state.
5825 pub extern "C" fn CResult_NoneMonitorUpdateErrorZ_ok() -> CResult_NoneMonitorUpdateErrorZ {
5826         CResult_NoneMonitorUpdateErrorZ {
5827                 contents: CResult_NoneMonitorUpdateErrorZPtr {
5828                         result: std::ptr::null_mut(),
5829                 },
5830                 result_ok: true,
5831         }
5832 }
5833 #[no_mangle]
5834 /// Creates a new CResult_NoneMonitorUpdateErrorZ in the error state.
5835 pub extern "C" fn CResult_NoneMonitorUpdateErrorZ_err(e: crate::lightning::chain::channelmonitor::MonitorUpdateError) -> CResult_NoneMonitorUpdateErrorZ {
5836         CResult_NoneMonitorUpdateErrorZ {
5837                 contents: CResult_NoneMonitorUpdateErrorZPtr {
5838                         err: Box::into_raw(Box::new(e)),
5839                 },
5840                 result_ok: false,
5841         }
5842 }
5843 #[no_mangle]
5844 /// Frees any resources used by the CResult_NoneMonitorUpdateErrorZ.
5845 pub extern "C" fn CResult_NoneMonitorUpdateErrorZ_free(_res: CResult_NoneMonitorUpdateErrorZ) { }
5846 impl Drop for CResult_NoneMonitorUpdateErrorZ {
5847         fn drop(&mut self) {
5848                 if self.result_ok {
5849                 } else {
5850                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
5851                                 let _ = unsafe { Box::from_raw(self.contents.err) };
5852                         }
5853                 }
5854         }
5855 }
5856 impl From<crate::c_types::CResultTempl<(), crate::lightning::chain::channelmonitor::MonitorUpdateError>> for CResult_NoneMonitorUpdateErrorZ {
5857         fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::chain::channelmonitor::MonitorUpdateError>) -> Self {
5858                 let contents = if o.result_ok {
5859                         let _ = unsafe { Box::from_raw(o.contents.result) };
5860                         o.contents.result = std::ptr::null_mut();
5861                         CResult_NoneMonitorUpdateErrorZPtr { result: std::ptr::null_mut() }
5862                 } else {
5863                         let err = unsafe { o.contents.err };
5864                         unsafe { o.contents.err = std::ptr::null_mut(); }
5865                         CResult_NoneMonitorUpdateErrorZPtr { err }
5866                 };
5867                 Self {
5868                         contents,
5869                         result_ok: o.result_ok,
5870                 }
5871         }
5872 }
5873 impl Clone for CResult_NoneMonitorUpdateErrorZ {
5874         fn clone(&self) -> Self {
5875                 if self.result_ok {
5876                         Self { result_ok: true, contents: CResult_NoneMonitorUpdateErrorZPtr {
5877                                 result: std::ptr::null_mut()
5878                         } }
5879                 } else {
5880                         Self { result_ok: false, contents: CResult_NoneMonitorUpdateErrorZPtr {
5881                                 err: Box::into_raw(Box::new(<crate::lightning::chain::channelmonitor::MonitorUpdateError>::clone(unsafe { &*self.contents.err })))
5882                         } }
5883                 }
5884         }
5885 }
5886 #[no_mangle]
5887 /// Creates a new CResult_NoneMonitorUpdateErrorZ which has the same data as `orig`
5888 /// but with all dynamically-allocated buffers duplicated in new buffers.
5889 pub extern "C" fn CResult_NoneMonitorUpdateErrorZ_clone(orig: &CResult_NoneMonitorUpdateErrorZ) -> CResult_NoneMonitorUpdateErrorZ { orig.clone() }
5890 #[repr(C)]
5891 /// A tuple of 2 elements. See the individual fields for the types contained.
5892 pub struct C2Tuple_OutPointScriptZ {
5893         /// The element at position 0
5894         pub a: crate::lightning::chain::transaction::OutPoint,
5895         /// The element at position 1
5896         pub b: crate::c_types::derived::CVec_u8Z,
5897 }
5898 impl From<(crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_u8Z)> for C2Tuple_OutPointScriptZ {
5899         fn from (tup: (crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_u8Z)) -> Self {
5900                 Self {
5901                         a: tup.0,
5902                         b: tup.1,
5903                 }
5904         }
5905 }
5906 impl C2Tuple_OutPointScriptZ {
5907         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_u8Z) {
5908                 (self.a, self.b)
5909         }
5910 }
5911 impl Clone for C2Tuple_OutPointScriptZ {
5912         fn clone(&self) -> Self {
5913                 Self {
5914                         a: self.a.clone(),
5915                         b: self.b.clone(),
5916                 }
5917         }
5918 }
5919 #[no_mangle]
5920 /// Creates a new tuple which has the same data as `orig`
5921 /// but with all dynamically-allocated buffers duplicated in new buffers.
5922 pub extern "C" fn C2Tuple_OutPointScriptZ_clone(orig: &C2Tuple_OutPointScriptZ) -> C2Tuple_OutPointScriptZ { orig.clone() }
5923 /// Creates a new C2Tuple_OutPointScriptZ from the contained elements.
5924 #[no_mangle]
5925 pub extern "C" fn C2Tuple_OutPointScriptZ_new(a: crate::lightning::chain::transaction::OutPoint, b: crate::c_types::derived::CVec_u8Z) -> C2Tuple_OutPointScriptZ {
5926         C2Tuple_OutPointScriptZ { a, b, }
5927 }
5928
5929 #[no_mangle]
5930 /// Frees any resources used by the C2Tuple_OutPointScriptZ.
5931 pub extern "C" fn C2Tuple_OutPointScriptZ_free(_res: C2Tuple_OutPointScriptZ) { }
5932 #[repr(C)]
5933 /// A tuple of 2 elements. See the individual fields for the types contained.
5934 pub struct C2Tuple_u32ScriptZ {
5935         /// The element at position 0
5936         pub a: u32,
5937         /// The element at position 1
5938         pub b: crate::c_types::derived::CVec_u8Z,
5939 }
5940 impl From<(u32, crate::c_types::derived::CVec_u8Z)> for C2Tuple_u32ScriptZ {
5941         fn from (tup: (u32, crate::c_types::derived::CVec_u8Z)) -> Self {
5942                 Self {
5943                         a: tup.0,
5944                         b: tup.1,
5945                 }
5946         }
5947 }
5948 impl C2Tuple_u32ScriptZ {
5949         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (u32, crate::c_types::derived::CVec_u8Z) {
5950                 (self.a, self.b)
5951         }
5952 }
5953 impl Clone for C2Tuple_u32ScriptZ {
5954         fn clone(&self) -> Self {
5955                 Self {
5956                         a: self.a.clone(),
5957                         b: self.b.clone(),
5958                 }
5959         }
5960 }
5961 #[no_mangle]
5962 /// Creates a new tuple which has the same data as `orig`
5963 /// but with all dynamically-allocated buffers duplicated in new buffers.
5964 pub extern "C" fn C2Tuple_u32ScriptZ_clone(orig: &C2Tuple_u32ScriptZ) -> C2Tuple_u32ScriptZ { orig.clone() }
5965 /// Creates a new C2Tuple_u32ScriptZ from the contained elements.
5966 #[no_mangle]
5967 pub extern "C" fn C2Tuple_u32ScriptZ_new(a: u32, b: crate::c_types::derived::CVec_u8Z) -> C2Tuple_u32ScriptZ {
5968         C2Tuple_u32ScriptZ { a, b, }
5969 }
5970
5971 #[no_mangle]
5972 /// Frees any resources used by the C2Tuple_u32ScriptZ.
5973 pub extern "C" fn C2Tuple_u32ScriptZ_free(_res: C2Tuple_u32ScriptZ) { }
5974 #[repr(C)]
5975 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_u32ScriptZs of arbitrary size.
5976 /// This corresponds to std::vector in C++
5977 pub struct CVec_C2Tuple_u32ScriptZZ {
5978         /// The elements in the array.
5979         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
5980         pub data: *mut crate::c_types::derived::C2Tuple_u32ScriptZ,
5981         /// The number of elements pointed to by `data`.
5982         pub datalen: usize
5983 }
5984 impl CVec_C2Tuple_u32ScriptZZ {
5985         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_u32ScriptZ> {
5986                 if self.datalen == 0 { return Vec::new(); }
5987                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
5988                 self.data = std::ptr::null_mut();
5989                 self.datalen = 0;
5990                 ret
5991         }
5992         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_u32ScriptZ] {
5993                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
5994         }
5995 }
5996 impl From<Vec<crate::c_types::derived::C2Tuple_u32ScriptZ>> for CVec_C2Tuple_u32ScriptZZ {
5997         fn from(v: Vec<crate::c_types::derived::C2Tuple_u32ScriptZ>) -> Self {
5998                 let datalen = v.len();
5999                 let data = Box::into_raw(v.into_boxed_slice());
6000                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
6001         }
6002 }
6003 #[no_mangle]
6004 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
6005 pub extern "C" fn CVec_C2Tuple_u32ScriptZZ_free(_res: CVec_C2Tuple_u32ScriptZZ) { }
6006 impl Drop for CVec_C2Tuple_u32ScriptZZ {
6007         fn drop(&mut self) {
6008                 if self.datalen == 0 { return; }
6009                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
6010         }
6011 }
6012 impl Clone for CVec_C2Tuple_u32ScriptZZ {
6013         fn clone(&self) -> Self {
6014                 let mut res = Vec::new();
6015                 if self.datalen == 0 { return Self::from(res); }
6016                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
6017                 Self::from(res)
6018         }
6019 }
6020 #[repr(C)]
6021 /// A tuple of 2 elements. See the individual fields for the types contained.
6022 pub struct C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ {
6023         /// The element at position 0
6024         pub a: crate::c_types::ThirtyTwoBytes,
6025         /// The element at position 1
6026         pub b: crate::c_types::derived::CVec_C2Tuple_u32ScriptZZ,
6027 }
6028 impl From<(crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32ScriptZZ)> for C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ {
6029         fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32ScriptZZ)) -> Self {
6030                 Self {
6031                         a: tup.0,
6032                         b: tup.1,
6033                 }
6034         }
6035 }
6036 impl C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ {
6037         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32ScriptZZ) {
6038                 (self.a, self.b)
6039         }
6040 }
6041 impl Clone for C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ {
6042         fn clone(&self) -> Self {
6043                 Self {
6044                         a: self.a.clone(),
6045                         b: self.b.clone(),
6046                 }
6047         }
6048 }
6049 #[no_mangle]
6050 /// Creates a new tuple which has the same data as `orig`
6051 /// but with all dynamically-allocated buffers duplicated in new buffers.
6052 pub extern "C" fn C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone(orig: &C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ) -> C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ { orig.clone() }
6053 /// Creates a new C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ from the contained elements.
6054 #[no_mangle]
6055 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 {
6056         C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ { a, b, }
6057 }
6058
6059 #[no_mangle]
6060 /// Frees any resources used by the C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ.
6061 pub extern "C" fn C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_free(_res: C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ) { }
6062 #[repr(C)]
6063 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZs of arbitrary size.
6064 /// This corresponds to std::vector in C++
6065 pub struct CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ {
6066         /// The elements in the array.
6067         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
6068         pub data: *mut crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ,
6069         /// The number of elements pointed to by `data`.
6070         pub datalen: usize
6071 }
6072 impl CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ {
6073         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ> {
6074                 if self.datalen == 0 { return Vec::new(); }
6075                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
6076                 self.data = std::ptr::null_mut();
6077                 self.datalen = 0;
6078                 ret
6079         }
6080         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ] {
6081                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
6082         }
6083 }
6084 impl From<Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ>> for CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ {
6085         fn from(v: Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ>) -> Self {
6086                 let datalen = v.len();
6087                 let data = Box::into_raw(v.into_boxed_slice());
6088                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
6089         }
6090 }
6091 #[no_mangle]
6092 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
6093 pub extern "C" fn CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ_free(_res: CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ) { }
6094 impl Drop for CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ {
6095         fn drop(&mut self) {
6096                 if self.datalen == 0 { return; }
6097                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
6098         }
6099 }
6100 impl Clone for CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ {
6101         fn clone(&self) -> Self {
6102                 let mut res = Vec::new();
6103                 if self.datalen == 0 { return Self::from(res); }
6104                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
6105                 Self::from(res)
6106         }
6107 }
6108 #[repr(C)]
6109 /// A dynamically-allocated array of crate::lightning::util::events::Events of arbitrary size.
6110 /// This corresponds to std::vector in C++
6111 pub struct CVec_EventZ {
6112         /// The elements in the array.
6113         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
6114         pub data: *mut crate::lightning::util::events::Event,
6115         /// The number of elements pointed to by `data`.
6116         pub datalen: usize
6117 }
6118 impl CVec_EventZ {
6119         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::util::events::Event> {
6120                 if self.datalen == 0 { return Vec::new(); }
6121                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
6122                 self.data = std::ptr::null_mut();
6123                 self.datalen = 0;
6124                 ret
6125         }
6126         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::util::events::Event] {
6127                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
6128         }
6129 }
6130 impl From<Vec<crate::lightning::util::events::Event>> for CVec_EventZ {
6131         fn from(v: Vec<crate::lightning::util::events::Event>) -> Self {
6132                 let datalen = v.len();
6133                 let data = Box::into_raw(v.into_boxed_slice());
6134                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
6135         }
6136 }
6137 #[no_mangle]
6138 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
6139 pub extern "C" fn CVec_EventZ_free(_res: CVec_EventZ) { }
6140 impl Drop for CVec_EventZ {
6141         fn drop(&mut self) {
6142                 if self.datalen == 0 { return; }
6143                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
6144         }
6145 }
6146 impl Clone for CVec_EventZ {
6147         fn clone(&self) -> Self {
6148                 let mut res = Vec::new();
6149                 if self.datalen == 0 { return Self::from(res); }
6150                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
6151                 Self::from(res)
6152         }
6153 }
6154 #[repr(C)]
6155 /// A dynamically-allocated array of crate::c_types::Transactions of arbitrary size.
6156 /// This corresponds to std::vector in C++
6157 pub struct CVec_TransactionZ {
6158         /// The elements in the array.
6159         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
6160         pub data: *mut crate::c_types::Transaction,
6161         /// The number of elements pointed to by `data`.
6162         pub datalen: usize
6163 }
6164 impl CVec_TransactionZ {
6165         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::Transaction> {
6166                 if self.datalen == 0 { return Vec::new(); }
6167                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
6168                 self.data = std::ptr::null_mut();
6169                 self.datalen = 0;
6170                 ret
6171         }
6172         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::Transaction] {
6173                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
6174         }
6175 }
6176 impl From<Vec<crate::c_types::Transaction>> for CVec_TransactionZ {
6177         fn from(v: Vec<crate::c_types::Transaction>) -> Self {
6178                 let datalen = v.len();
6179                 let data = Box::into_raw(v.into_boxed_slice());
6180                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
6181         }
6182 }
6183 #[no_mangle]
6184 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
6185 pub extern "C" fn CVec_TransactionZ_free(_res: CVec_TransactionZ) { }
6186 impl Drop for CVec_TransactionZ {
6187         fn drop(&mut self) {
6188                 if self.datalen == 0 { return; }
6189                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
6190         }
6191 }
6192 impl Clone for CVec_TransactionZ {
6193         fn clone(&self) -> Self {
6194                 let mut res = Vec::new();
6195                 if self.datalen == 0 { return Self::from(res); }
6196                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
6197                 Self::from(res)
6198         }
6199 }
6200 #[repr(C)]
6201 /// A tuple of 2 elements. See the individual fields for the types contained.
6202 pub struct C2Tuple_u32TxOutZ {
6203         /// The element at position 0
6204         pub a: u32,
6205         /// The element at position 1
6206         pub b: crate::c_types::TxOut,
6207 }
6208 impl From<(u32, crate::c_types::TxOut)> for C2Tuple_u32TxOutZ {
6209         fn from (tup: (u32, crate::c_types::TxOut)) -> Self {
6210                 Self {
6211                         a: tup.0,
6212                         b: tup.1,
6213                 }
6214         }
6215 }
6216 impl C2Tuple_u32TxOutZ {
6217         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (u32, crate::c_types::TxOut) {
6218                 (self.a, self.b)
6219         }
6220 }
6221 impl Clone for C2Tuple_u32TxOutZ {
6222         fn clone(&self) -> Self {
6223                 Self {
6224                         a: self.a.clone(),
6225                         b: self.b.clone(),
6226                 }
6227         }
6228 }
6229 #[no_mangle]
6230 /// Creates a new tuple which has the same data as `orig`
6231 /// but with all dynamically-allocated buffers duplicated in new buffers.
6232 pub extern "C" fn C2Tuple_u32TxOutZ_clone(orig: &C2Tuple_u32TxOutZ) -> C2Tuple_u32TxOutZ { orig.clone() }
6233 /// Creates a new C2Tuple_u32TxOutZ from the contained elements.
6234 #[no_mangle]
6235 pub extern "C" fn C2Tuple_u32TxOutZ_new(a: u32, b: crate::c_types::TxOut) -> C2Tuple_u32TxOutZ {
6236         C2Tuple_u32TxOutZ { a, b, }
6237 }
6238
6239 #[no_mangle]
6240 /// Frees any resources used by the C2Tuple_u32TxOutZ.
6241 pub extern "C" fn C2Tuple_u32TxOutZ_free(_res: C2Tuple_u32TxOutZ) { }
6242 #[repr(C)]
6243 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_u32TxOutZs of arbitrary size.
6244 /// This corresponds to std::vector in C++
6245 pub struct CVec_C2Tuple_u32TxOutZZ {
6246         /// The elements in the array.
6247         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
6248         pub data: *mut crate::c_types::derived::C2Tuple_u32TxOutZ,
6249         /// The number of elements pointed to by `data`.
6250         pub datalen: usize
6251 }
6252 impl CVec_C2Tuple_u32TxOutZZ {
6253         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_u32TxOutZ> {
6254                 if self.datalen == 0 { return Vec::new(); }
6255                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
6256                 self.data = std::ptr::null_mut();
6257                 self.datalen = 0;
6258                 ret
6259         }
6260         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_u32TxOutZ] {
6261                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
6262         }
6263 }
6264 impl From<Vec<crate::c_types::derived::C2Tuple_u32TxOutZ>> for CVec_C2Tuple_u32TxOutZZ {
6265         fn from(v: Vec<crate::c_types::derived::C2Tuple_u32TxOutZ>) -> Self {
6266                 let datalen = v.len();
6267                 let data = Box::into_raw(v.into_boxed_slice());
6268                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
6269         }
6270 }
6271 #[no_mangle]
6272 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
6273 pub extern "C" fn CVec_C2Tuple_u32TxOutZZ_free(_res: CVec_C2Tuple_u32TxOutZZ) { }
6274 impl Drop for CVec_C2Tuple_u32TxOutZZ {
6275         fn drop(&mut self) {
6276                 if self.datalen == 0 { return; }
6277                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
6278         }
6279 }
6280 impl Clone for CVec_C2Tuple_u32TxOutZZ {
6281         fn clone(&self) -> Self {
6282                 let mut res = Vec::new();
6283                 if self.datalen == 0 { return Self::from(res); }
6284                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
6285                 Self::from(res)
6286         }
6287 }
6288 #[repr(C)]
6289 /// A tuple of 2 elements. See the individual fields for the types contained.
6290 pub struct C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ {
6291         /// The element at position 0
6292         pub a: crate::c_types::ThirtyTwoBytes,
6293         /// The element at position 1
6294         pub b: crate::c_types::derived::CVec_C2Tuple_u32TxOutZZ,
6295 }
6296 impl From<(crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32TxOutZZ)> for C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ {
6297         fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32TxOutZZ)) -> Self {
6298                 Self {
6299                         a: tup.0,
6300                         b: tup.1,
6301                 }
6302         }
6303 }
6304 impl C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ {
6305         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32TxOutZZ) {
6306                 (self.a, self.b)
6307         }
6308 }
6309 impl Clone for C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ {
6310         fn clone(&self) -> Self {
6311                 Self {
6312                         a: self.a.clone(),
6313                         b: self.b.clone(),
6314                 }
6315         }
6316 }
6317 #[no_mangle]
6318 /// Creates a new tuple which has the same data as `orig`
6319 /// but with all dynamically-allocated buffers duplicated in new buffers.
6320 pub extern "C" fn C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone(orig: &C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ) -> C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ { orig.clone() }
6321 /// Creates a new C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ from the contained elements.
6322 #[no_mangle]
6323 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 {
6324         C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ { a, b, }
6325 }
6326
6327 #[no_mangle]
6328 /// Frees any resources used by the C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ.
6329 pub extern "C" fn C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_free(_res: C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ) { }
6330 #[repr(C)]
6331 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZs of arbitrary size.
6332 /// This corresponds to std::vector in C++
6333 pub struct CVec_TransactionOutputsZ {
6334         /// The elements in the array.
6335         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
6336         pub data: *mut crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ,
6337         /// The number of elements pointed to by `data`.
6338         pub datalen: usize
6339 }
6340 impl CVec_TransactionOutputsZ {
6341         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ> {
6342                 if self.datalen == 0 { return Vec::new(); }
6343                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
6344                 self.data = std::ptr::null_mut();
6345                 self.datalen = 0;
6346                 ret
6347         }
6348         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ] {
6349                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
6350         }
6351 }
6352 impl From<Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ>> for CVec_TransactionOutputsZ {
6353         fn from(v: Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ>) -> Self {
6354                 let datalen = v.len();
6355                 let data = Box::into_raw(v.into_boxed_slice());
6356                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
6357         }
6358 }
6359 #[no_mangle]
6360 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
6361 pub extern "C" fn CVec_TransactionOutputsZ_free(_res: CVec_TransactionOutputsZ) { }
6362 impl Drop for CVec_TransactionOutputsZ {
6363         fn drop(&mut self) {
6364                 if self.datalen == 0 { return; }
6365                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
6366         }
6367 }
6368 impl Clone for CVec_TransactionOutputsZ {
6369         fn clone(&self) -> Self {
6370                 let mut res = Vec::new();
6371                 if self.datalen == 0 { return Self::from(res); }
6372                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
6373                 Self::from(res)
6374         }
6375 }
6376 #[repr(C)]
6377 /// The contents of CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ
6378 pub union CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr {
6379         /// A pointer to the contents in the success state.
6380         /// Reading from this pointer when `result_ok` is not set is undefined.
6381         pub result: *mut crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ,
6382         /// A pointer to the contents in the error state.
6383         /// Reading from this pointer when `result_ok` is set is undefined.
6384         pub err: *mut crate::lightning::ln::msgs::DecodeError,
6385 }
6386 #[repr(C)]
6387 /// A CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ represents the result of a fallible operation,
6388 /// containing a crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
6389 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6390 pub struct CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
6391         /// The contents of this CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ, accessible via either
6392         /// `err` or `result` depending on the state of `result_ok`.
6393         pub contents: CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr,
6394         /// Whether this CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ represents a success state.
6395         pub result_ok: bool,
6396 }
6397 #[no_mangle]
6398 /// Creates a new CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ in the success state.
6399 pub extern "C" fn CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_ok(o: crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ) -> CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
6400         CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
6401                 contents: CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr {
6402                         result: Box::into_raw(Box::new(o)),
6403                 },
6404                 result_ok: true,
6405         }
6406 }
6407 #[no_mangle]
6408 /// Creates a new CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ in the error state.
6409 pub extern "C" fn CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
6410         CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
6411                 contents: CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr {
6412                         err: Box::into_raw(Box::new(e)),
6413                 },
6414                 result_ok: false,
6415         }
6416 }
6417 #[no_mangle]
6418 /// Frees any resources used by the CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ.
6419 pub extern "C" fn CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_free(_res: CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ) { }
6420 impl Drop for CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
6421         fn drop(&mut self) {
6422                 if self.result_ok {
6423                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
6424                                 let _ = unsafe { Box::from_raw(self.contents.result) };
6425                         }
6426                 } else {
6427                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
6428                                 let _ = unsafe { Box::from_raw(self.contents.err) };
6429                         }
6430                 }
6431         }
6432 }
6433 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ, crate::lightning::ln::msgs::DecodeError>> for CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
6434         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
6435                 let contents = if o.result_ok {
6436                         let result = unsafe { o.contents.result };
6437                         unsafe { o.contents.result = std::ptr::null_mut() };
6438                         CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr { result }
6439                 } else {
6440                         let err = unsafe { o.contents.err };
6441                         unsafe { o.contents.err = std::ptr::null_mut(); }
6442                         CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr { err }
6443                 };
6444                 Self {
6445                         contents,
6446                         result_ok: o.result_ok,
6447                 }
6448         }
6449 }
6450 #[repr(C)]
6451 /// The contents of CResult_boolLightningErrorZ
6452 pub union CResult_boolLightningErrorZPtr {
6453         /// A pointer to the contents in the success state.
6454         /// Reading from this pointer when `result_ok` is not set is undefined.
6455         pub result: *mut bool,
6456         /// A pointer to the contents in the error state.
6457         /// Reading from this pointer when `result_ok` is set is undefined.
6458         pub err: *mut crate::lightning::ln::msgs::LightningError,
6459 }
6460 #[repr(C)]
6461 /// A CResult_boolLightningErrorZ represents the result of a fallible operation,
6462 /// containing a bool on success and a crate::lightning::ln::msgs::LightningError on failure.
6463 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6464 pub struct CResult_boolLightningErrorZ {
6465         /// The contents of this CResult_boolLightningErrorZ, accessible via either
6466         /// `err` or `result` depending on the state of `result_ok`.
6467         pub contents: CResult_boolLightningErrorZPtr,
6468         /// Whether this CResult_boolLightningErrorZ represents a success state.
6469         pub result_ok: bool,
6470 }
6471 #[no_mangle]
6472 /// Creates a new CResult_boolLightningErrorZ in the success state.
6473 pub extern "C" fn CResult_boolLightningErrorZ_ok(o: bool) -> CResult_boolLightningErrorZ {
6474         CResult_boolLightningErrorZ {
6475                 contents: CResult_boolLightningErrorZPtr {
6476                         result: Box::into_raw(Box::new(o)),
6477                 },
6478                 result_ok: true,
6479         }
6480 }
6481 #[no_mangle]
6482 /// Creates a new CResult_boolLightningErrorZ in the error state.
6483 pub extern "C" fn CResult_boolLightningErrorZ_err(e: crate::lightning::ln::msgs::LightningError) -> CResult_boolLightningErrorZ {
6484         CResult_boolLightningErrorZ {
6485                 contents: CResult_boolLightningErrorZPtr {
6486                         err: Box::into_raw(Box::new(e)),
6487                 },
6488                 result_ok: false,
6489         }
6490 }
6491 #[no_mangle]
6492 /// Frees any resources used by the CResult_boolLightningErrorZ.
6493 pub extern "C" fn CResult_boolLightningErrorZ_free(_res: CResult_boolLightningErrorZ) { }
6494 impl Drop for CResult_boolLightningErrorZ {
6495         fn drop(&mut self) {
6496                 if self.result_ok {
6497                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
6498                                 let _ = unsafe { Box::from_raw(self.contents.result) };
6499                         }
6500                 } else {
6501                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
6502                                 let _ = unsafe { Box::from_raw(self.contents.err) };
6503                         }
6504                 }
6505         }
6506 }
6507 impl From<crate::c_types::CResultTempl<bool, crate::lightning::ln::msgs::LightningError>> for CResult_boolLightningErrorZ {
6508         fn from(mut o: crate::c_types::CResultTempl<bool, crate::lightning::ln::msgs::LightningError>) -> Self {
6509                 let contents = if o.result_ok {
6510                         let result = unsafe { o.contents.result };
6511                         unsafe { o.contents.result = std::ptr::null_mut() };
6512                         CResult_boolLightningErrorZPtr { result }
6513                 } else {
6514                         let err = unsafe { o.contents.err };
6515                         unsafe { o.contents.err = std::ptr::null_mut(); }
6516                         CResult_boolLightningErrorZPtr { err }
6517                 };
6518                 Self {
6519                         contents,
6520                         result_ok: o.result_ok,
6521                 }
6522         }
6523 }
6524 impl Clone for CResult_boolLightningErrorZ {
6525         fn clone(&self) -> Self {
6526                 if self.result_ok {
6527                         Self { result_ok: true, contents: CResult_boolLightningErrorZPtr {
6528                                 result: Box::into_raw(Box::new(<bool>::clone(unsafe { &*self.contents.result })))
6529                         } }
6530                 } else {
6531                         Self { result_ok: false, contents: CResult_boolLightningErrorZPtr {
6532                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::LightningError>::clone(unsafe { &*self.contents.err })))
6533                         } }
6534                 }
6535         }
6536 }
6537 #[no_mangle]
6538 /// Creates a new CResult_boolLightningErrorZ which has the same data as `orig`
6539 /// but with all dynamically-allocated buffers duplicated in new buffers.
6540 pub extern "C" fn CResult_boolLightningErrorZ_clone(orig: &CResult_boolLightningErrorZ) -> CResult_boolLightningErrorZ { orig.clone() }
6541 #[repr(C)]
6542 /// A tuple of 3 elements. See the individual fields for the types contained.
6543 pub struct C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
6544         /// The element at position 0
6545         pub a: crate::lightning::ln::msgs::ChannelAnnouncement,
6546         /// The element at position 1
6547         pub b: crate::lightning::ln::msgs::ChannelUpdate,
6548         /// The element at position 2
6549         pub c: crate::lightning::ln::msgs::ChannelUpdate,
6550 }
6551 impl From<(crate::lightning::ln::msgs::ChannelAnnouncement, crate::lightning::ln::msgs::ChannelUpdate, crate::lightning::ln::msgs::ChannelUpdate)> for C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
6552         fn from (tup: (crate::lightning::ln::msgs::ChannelAnnouncement, crate::lightning::ln::msgs::ChannelUpdate, crate::lightning::ln::msgs::ChannelUpdate)) -> Self {
6553                 Self {
6554                         a: tup.0,
6555                         b: tup.1,
6556                         c: tup.2,
6557                 }
6558         }
6559 }
6560 impl C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
6561         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::lightning::ln::msgs::ChannelAnnouncement, crate::lightning::ln::msgs::ChannelUpdate, crate::lightning::ln::msgs::ChannelUpdate) {
6562                 (self.a, self.b, self.c)
6563         }
6564 }
6565 impl Clone for C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
6566         fn clone(&self) -> Self {
6567                 Self {
6568                         a: self.a.clone(),
6569                         b: self.b.clone(),
6570                         c: self.c.clone(),
6571                 }
6572         }
6573 }
6574 #[no_mangle]
6575 /// Creates a new tuple which has the same data as `orig`
6576 /// but with all dynamically-allocated buffers duplicated in new buffers.
6577 pub extern "C" fn C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(orig: &C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ) -> C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ { orig.clone() }
6578 /// Creates a new C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ from the contained elements.
6579 #[no_mangle]
6580 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 {
6581         C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ { a, b, c, }
6582 }
6583
6584 #[no_mangle]
6585 /// Frees any resources used by the C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ.
6586 pub extern "C" fn C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free(_res: C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ) { }
6587 #[repr(C)]
6588 /// A dynamically-allocated array of crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZs of arbitrary size.
6589 /// This corresponds to std::vector in C++
6590 pub struct CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
6591         /// The elements in the array.
6592         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
6593         pub data: *mut crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ,
6594         /// The number of elements pointed to by `data`.
6595         pub datalen: usize
6596 }
6597 impl CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
6598         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ> {
6599                 if self.datalen == 0 { return Vec::new(); }
6600                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
6601                 self.data = std::ptr::null_mut();
6602                 self.datalen = 0;
6603                 ret
6604         }
6605         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ] {
6606                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
6607         }
6608 }
6609 impl From<Vec<crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ>> for CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
6610         fn from(v: Vec<crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ>) -> Self {
6611                 let datalen = v.len();
6612                 let data = Box::into_raw(v.into_boxed_slice());
6613                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
6614         }
6615 }
6616 #[no_mangle]
6617 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
6618 pub extern "C" fn CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free(_res: CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ) { }
6619 impl Drop for CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
6620         fn drop(&mut self) {
6621                 if self.datalen == 0 { return; }
6622                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
6623         }
6624 }
6625 impl Clone for CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
6626         fn clone(&self) -> Self {
6627                 let mut res = Vec::new();
6628                 if self.datalen == 0 { return Self::from(res); }
6629                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
6630                 Self::from(res)
6631         }
6632 }
6633 #[repr(C)]
6634 /// A dynamically-allocated array of crate::lightning::ln::msgs::NodeAnnouncements of arbitrary size.
6635 /// This corresponds to std::vector in C++
6636 pub struct CVec_NodeAnnouncementZ {
6637         /// The elements in the array.
6638         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
6639         pub data: *mut crate::lightning::ln::msgs::NodeAnnouncement,
6640         /// The number of elements pointed to by `data`.
6641         pub datalen: usize
6642 }
6643 impl CVec_NodeAnnouncementZ {
6644         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::NodeAnnouncement> {
6645                 if self.datalen == 0 { return Vec::new(); }
6646                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
6647                 self.data = std::ptr::null_mut();
6648                 self.datalen = 0;
6649                 ret
6650         }
6651         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::NodeAnnouncement] {
6652                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
6653         }
6654 }
6655 impl From<Vec<crate::lightning::ln::msgs::NodeAnnouncement>> for CVec_NodeAnnouncementZ {
6656         fn from(v: Vec<crate::lightning::ln::msgs::NodeAnnouncement>) -> Self {
6657                 let datalen = v.len();
6658                 let data = Box::into_raw(v.into_boxed_slice());
6659                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
6660         }
6661 }
6662 #[no_mangle]
6663 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
6664 pub extern "C" fn CVec_NodeAnnouncementZ_free(_res: CVec_NodeAnnouncementZ) { }
6665 impl Drop for CVec_NodeAnnouncementZ {
6666         fn drop(&mut self) {
6667                 if self.datalen == 0 { return; }
6668                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
6669         }
6670 }
6671 impl Clone for CVec_NodeAnnouncementZ {
6672         fn clone(&self) -> Self {
6673                 let mut res = Vec::new();
6674                 if self.datalen == 0 { return Self::from(res); }
6675                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
6676                 Self::from(res)
6677         }
6678 }
6679 #[repr(C)]
6680 /// The contents of CResult_NoneLightningErrorZ
6681 pub union CResult_NoneLightningErrorZPtr {
6682         /// Note that this value is always NULL, as there are no contents in the OK variant
6683         pub result: *mut std::ffi::c_void,
6684         /// A pointer to the contents in the error state.
6685         /// Reading from this pointer when `result_ok` is set is undefined.
6686         pub err: *mut crate::lightning::ln::msgs::LightningError,
6687 }
6688 #[repr(C)]
6689 /// A CResult_NoneLightningErrorZ represents the result of a fallible operation,
6690 /// containing a () on success and a crate::lightning::ln::msgs::LightningError on failure.
6691 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6692 pub struct CResult_NoneLightningErrorZ {
6693         /// The contents of this CResult_NoneLightningErrorZ, accessible via either
6694         /// `err` or `result` depending on the state of `result_ok`.
6695         pub contents: CResult_NoneLightningErrorZPtr,
6696         /// Whether this CResult_NoneLightningErrorZ represents a success state.
6697         pub result_ok: bool,
6698 }
6699 #[no_mangle]
6700 /// Creates a new CResult_NoneLightningErrorZ in the success state.
6701 pub extern "C" fn CResult_NoneLightningErrorZ_ok() -> CResult_NoneLightningErrorZ {
6702         CResult_NoneLightningErrorZ {
6703                 contents: CResult_NoneLightningErrorZPtr {
6704                         result: std::ptr::null_mut(),
6705                 },
6706                 result_ok: true,
6707         }
6708 }
6709 #[no_mangle]
6710 /// Creates a new CResult_NoneLightningErrorZ in the error state.
6711 pub extern "C" fn CResult_NoneLightningErrorZ_err(e: crate::lightning::ln::msgs::LightningError) -> CResult_NoneLightningErrorZ {
6712         CResult_NoneLightningErrorZ {
6713                 contents: CResult_NoneLightningErrorZPtr {
6714                         err: Box::into_raw(Box::new(e)),
6715                 },
6716                 result_ok: false,
6717         }
6718 }
6719 #[no_mangle]
6720 /// Frees any resources used by the CResult_NoneLightningErrorZ.
6721 pub extern "C" fn CResult_NoneLightningErrorZ_free(_res: CResult_NoneLightningErrorZ) { }
6722 impl Drop for CResult_NoneLightningErrorZ {
6723         fn drop(&mut self) {
6724                 if self.result_ok {
6725                 } else {
6726                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
6727                                 let _ = unsafe { Box::from_raw(self.contents.err) };
6728                         }
6729                 }
6730         }
6731 }
6732 impl From<crate::c_types::CResultTempl<(), crate::lightning::ln::msgs::LightningError>> for CResult_NoneLightningErrorZ {
6733         fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::ln::msgs::LightningError>) -> Self {
6734                 let contents = if o.result_ok {
6735                         let _ = unsafe { Box::from_raw(o.contents.result) };
6736                         o.contents.result = std::ptr::null_mut();
6737                         CResult_NoneLightningErrorZPtr { result: std::ptr::null_mut() }
6738                 } else {
6739                         let err = unsafe { o.contents.err };
6740                         unsafe { o.contents.err = std::ptr::null_mut(); }
6741                         CResult_NoneLightningErrorZPtr { err }
6742                 };
6743                 Self {
6744                         contents,
6745                         result_ok: o.result_ok,
6746                 }
6747         }
6748 }
6749 impl Clone for CResult_NoneLightningErrorZ {
6750         fn clone(&self) -> Self {
6751                 if self.result_ok {
6752                         Self { result_ok: true, contents: CResult_NoneLightningErrorZPtr {
6753                                 result: std::ptr::null_mut()
6754                         } }
6755                 } else {
6756                         Self { result_ok: false, contents: CResult_NoneLightningErrorZPtr {
6757                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::LightningError>::clone(unsafe { &*self.contents.err })))
6758                         } }
6759                 }
6760         }
6761 }
6762 #[no_mangle]
6763 /// Creates a new CResult_NoneLightningErrorZ which has the same data as `orig`
6764 /// but with all dynamically-allocated buffers duplicated in new buffers.
6765 pub extern "C" fn CResult_NoneLightningErrorZ_clone(orig: &CResult_NoneLightningErrorZ) -> CResult_NoneLightningErrorZ { orig.clone() }
6766 #[repr(C)]
6767 /// A dynamically-allocated array of crate::c_types::PublicKeys of arbitrary size.
6768 /// This corresponds to std::vector in C++
6769 pub struct CVec_PublicKeyZ {
6770         /// The elements in the array.
6771         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
6772         pub data: *mut crate::c_types::PublicKey,
6773         /// The number of elements pointed to by `data`.
6774         pub datalen: usize
6775 }
6776 impl CVec_PublicKeyZ {
6777         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::PublicKey> {
6778                 if self.datalen == 0 { return Vec::new(); }
6779                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
6780                 self.data = std::ptr::null_mut();
6781                 self.datalen = 0;
6782                 ret
6783         }
6784         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::PublicKey] {
6785                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
6786         }
6787 }
6788 impl From<Vec<crate::c_types::PublicKey>> for CVec_PublicKeyZ {
6789         fn from(v: Vec<crate::c_types::PublicKey>) -> Self {
6790                 let datalen = v.len();
6791                 let data = Box::into_raw(v.into_boxed_slice());
6792                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
6793         }
6794 }
6795 #[no_mangle]
6796 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
6797 pub extern "C" fn CVec_PublicKeyZ_free(_res: CVec_PublicKeyZ) { }
6798 impl Drop for CVec_PublicKeyZ {
6799         fn drop(&mut self) {
6800                 if self.datalen == 0 { return; }
6801                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
6802         }
6803 }
6804 impl Clone for CVec_PublicKeyZ {
6805         fn clone(&self) -> Self {
6806                 let mut res = Vec::new();
6807                 if self.datalen == 0 { return Self::from(res); }
6808                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
6809                 Self::from(res)
6810         }
6811 }
6812 #[repr(C)]
6813 /// The contents of CResult_CVec_u8ZPeerHandleErrorZ
6814 pub union CResult_CVec_u8ZPeerHandleErrorZPtr {
6815         /// A pointer to the contents in the success state.
6816         /// Reading from this pointer when `result_ok` is not set is undefined.
6817         pub result: *mut crate::c_types::derived::CVec_u8Z,
6818         /// A pointer to the contents in the error state.
6819         /// Reading from this pointer when `result_ok` is set is undefined.
6820         pub err: *mut crate::lightning::ln::peer_handler::PeerHandleError,
6821 }
6822 #[repr(C)]
6823 /// A CResult_CVec_u8ZPeerHandleErrorZ represents the result of a fallible operation,
6824 /// containing a crate::c_types::derived::CVec_u8Z on success and a crate::lightning::ln::peer_handler::PeerHandleError on failure.
6825 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6826 pub struct CResult_CVec_u8ZPeerHandleErrorZ {
6827         /// The contents of this CResult_CVec_u8ZPeerHandleErrorZ, accessible via either
6828         /// `err` or `result` depending on the state of `result_ok`.
6829         pub contents: CResult_CVec_u8ZPeerHandleErrorZPtr,
6830         /// Whether this CResult_CVec_u8ZPeerHandleErrorZ represents a success state.
6831         pub result_ok: bool,
6832 }
6833 #[no_mangle]
6834 /// Creates a new CResult_CVec_u8ZPeerHandleErrorZ in the success state.
6835 pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_ok(o: crate::c_types::derived::CVec_u8Z) -> CResult_CVec_u8ZPeerHandleErrorZ {
6836         CResult_CVec_u8ZPeerHandleErrorZ {
6837                 contents: CResult_CVec_u8ZPeerHandleErrorZPtr {
6838                         result: Box::into_raw(Box::new(o)),
6839                 },
6840                 result_ok: true,
6841         }
6842 }
6843 #[no_mangle]
6844 /// Creates a new CResult_CVec_u8ZPeerHandleErrorZ in the error state.
6845 pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_err(e: crate::lightning::ln::peer_handler::PeerHandleError) -> CResult_CVec_u8ZPeerHandleErrorZ {
6846         CResult_CVec_u8ZPeerHandleErrorZ {
6847                 contents: CResult_CVec_u8ZPeerHandleErrorZPtr {
6848                         err: Box::into_raw(Box::new(e)),
6849                 },
6850                 result_ok: false,
6851         }
6852 }
6853 #[no_mangle]
6854 /// Frees any resources used by the CResult_CVec_u8ZPeerHandleErrorZ.
6855 pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_free(_res: CResult_CVec_u8ZPeerHandleErrorZ) { }
6856 impl Drop for CResult_CVec_u8ZPeerHandleErrorZ {
6857         fn drop(&mut self) {
6858                 if self.result_ok {
6859                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
6860                                 let _ = unsafe { Box::from_raw(self.contents.result) };
6861                         }
6862                 } else {
6863                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
6864                                 let _ = unsafe { Box::from_raw(self.contents.err) };
6865                         }
6866                 }
6867         }
6868 }
6869 impl From<crate::c_types::CResultTempl<crate::c_types::derived::CVec_u8Z, crate::lightning::ln::peer_handler::PeerHandleError>> for CResult_CVec_u8ZPeerHandleErrorZ {
6870         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CVec_u8Z, crate::lightning::ln::peer_handler::PeerHandleError>) -> Self {
6871                 let contents = if o.result_ok {
6872                         let result = unsafe { o.contents.result };
6873                         unsafe { o.contents.result = std::ptr::null_mut() };
6874                         CResult_CVec_u8ZPeerHandleErrorZPtr { result }
6875                 } else {
6876                         let err = unsafe { o.contents.err };
6877                         unsafe { o.contents.err = std::ptr::null_mut(); }
6878                         CResult_CVec_u8ZPeerHandleErrorZPtr { err }
6879                 };
6880                 Self {
6881                         contents,
6882                         result_ok: o.result_ok,
6883                 }
6884         }
6885 }
6886 impl Clone for CResult_CVec_u8ZPeerHandleErrorZ {
6887         fn clone(&self) -> Self {
6888                 if self.result_ok {
6889                         Self { result_ok: true, contents: CResult_CVec_u8ZPeerHandleErrorZPtr {
6890                                 result: Box::into_raw(Box::new(<crate::c_types::derived::CVec_u8Z>::clone(unsafe { &*self.contents.result })))
6891                         } }
6892                 } else {
6893                         Self { result_ok: false, contents: CResult_CVec_u8ZPeerHandleErrorZPtr {
6894                                 err: Box::into_raw(Box::new(<crate::lightning::ln::peer_handler::PeerHandleError>::clone(unsafe { &*self.contents.err })))
6895                         } }
6896                 }
6897         }
6898 }
6899 #[no_mangle]
6900 /// Creates a new CResult_CVec_u8ZPeerHandleErrorZ which has the same data as `orig`
6901 /// but with all dynamically-allocated buffers duplicated in new buffers.
6902 pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_clone(orig: &CResult_CVec_u8ZPeerHandleErrorZ) -> CResult_CVec_u8ZPeerHandleErrorZ { orig.clone() }
6903 #[repr(C)]
6904 /// The contents of CResult_NonePeerHandleErrorZ
6905 pub union CResult_NonePeerHandleErrorZPtr {
6906         /// Note that this value is always NULL, as there are no contents in the OK variant
6907         pub result: *mut std::ffi::c_void,
6908         /// A pointer to the contents in the error state.
6909         /// Reading from this pointer when `result_ok` is set is undefined.
6910         pub err: *mut crate::lightning::ln::peer_handler::PeerHandleError,
6911 }
6912 #[repr(C)]
6913 /// A CResult_NonePeerHandleErrorZ represents the result of a fallible operation,
6914 /// containing a () on success and a crate::lightning::ln::peer_handler::PeerHandleError on failure.
6915 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6916 pub struct CResult_NonePeerHandleErrorZ {
6917         /// The contents of this CResult_NonePeerHandleErrorZ, accessible via either
6918         /// `err` or `result` depending on the state of `result_ok`.
6919         pub contents: CResult_NonePeerHandleErrorZPtr,
6920         /// Whether this CResult_NonePeerHandleErrorZ represents a success state.
6921         pub result_ok: bool,
6922 }
6923 #[no_mangle]
6924 /// Creates a new CResult_NonePeerHandleErrorZ in the success state.
6925 pub extern "C" fn CResult_NonePeerHandleErrorZ_ok() -> CResult_NonePeerHandleErrorZ {
6926         CResult_NonePeerHandleErrorZ {
6927                 contents: CResult_NonePeerHandleErrorZPtr {
6928                         result: std::ptr::null_mut(),
6929                 },
6930                 result_ok: true,
6931         }
6932 }
6933 #[no_mangle]
6934 /// Creates a new CResult_NonePeerHandleErrorZ in the error state.
6935 pub extern "C" fn CResult_NonePeerHandleErrorZ_err(e: crate::lightning::ln::peer_handler::PeerHandleError) -> CResult_NonePeerHandleErrorZ {
6936         CResult_NonePeerHandleErrorZ {
6937                 contents: CResult_NonePeerHandleErrorZPtr {
6938                         err: Box::into_raw(Box::new(e)),
6939                 },
6940                 result_ok: false,
6941         }
6942 }
6943 #[no_mangle]
6944 /// Frees any resources used by the CResult_NonePeerHandleErrorZ.
6945 pub extern "C" fn CResult_NonePeerHandleErrorZ_free(_res: CResult_NonePeerHandleErrorZ) { }
6946 impl Drop for CResult_NonePeerHandleErrorZ {
6947         fn drop(&mut self) {
6948                 if self.result_ok {
6949                 } else {
6950                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
6951                                 let _ = unsafe { Box::from_raw(self.contents.err) };
6952                         }
6953                 }
6954         }
6955 }
6956 impl From<crate::c_types::CResultTempl<(), crate::lightning::ln::peer_handler::PeerHandleError>> for CResult_NonePeerHandleErrorZ {
6957         fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::ln::peer_handler::PeerHandleError>) -> Self {
6958                 let contents = if o.result_ok {
6959                         let _ = unsafe { Box::from_raw(o.contents.result) };
6960                         o.contents.result = std::ptr::null_mut();
6961                         CResult_NonePeerHandleErrorZPtr { result: std::ptr::null_mut() }
6962                 } else {
6963                         let err = unsafe { o.contents.err };
6964                         unsafe { o.contents.err = std::ptr::null_mut(); }
6965                         CResult_NonePeerHandleErrorZPtr { err }
6966                 };
6967                 Self {
6968                         contents,
6969                         result_ok: o.result_ok,
6970                 }
6971         }
6972 }
6973 impl Clone for CResult_NonePeerHandleErrorZ {
6974         fn clone(&self) -> Self {
6975                 if self.result_ok {
6976                         Self { result_ok: true, contents: CResult_NonePeerHandleErrorZPtr {
6977                                 result: std::ptr::null_mut()
6978                         } }
6979                 } else {
6980                         Self { result_ok: false, contents: CResult_NonePeerHandleErrorZPtr {
6981                                 err: Box::into_raw(Box::new(<crate::lightning::ln::peer_handler::PeerHandleError>::clone(unsafe { &*self.contents.err })))
6982                         } }
6983                 }
6984         }
6985 }
6986 #[no_mangle]
6987 /// Creates a new CResult_NonePeerHandleErrorZ which has the same data as `orig`
6988 /// but with all dynamically-allocated buffers duplicated in new buffers.
6989 pub extern "C" fn CResult_NonePeerHandleErrorZ_clone(orig: &CResult_NonePeerHandleErrorZ) -> CResult_NonePeerHandleErrorZ { orig.clone() }
6990 #[repr(C)]
6991 /// The contents of CResult_boolPeerHandleErrorZ
6992 pub union CResult_boolPeerHandleErrorZPtr {
6993         /// A pointer to the contents in the success state.
6994         /// Reading from this pointer when `result_ok` is not set is undefined.
6995         pub result: *mut bool,
6996         /// A pointer to the contents in the error state.
6997         /// Reading from this pointer when `result_ok` is set is undefined.
6998         pub err: *mut crate::lightning::ln::peer_handler::PeerHandleError,
6999 }
7000 #[repr(C)]
7001 /// A CResult_boolPeerHandleErrorZ represents the result of a fallible operation,
7002 /// containing a bool on success and a crate::lightning::ln::peer_handler::PeerHandleError on failure.
7003 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7004 pub struct CResult_boolPeerHandleErrorZ {
7005         /// The contents of this CResult_boolPeerHandleErrorZ, accessible via either
7006         /// `err` or `result` depending on the state of `result_ok`.
7007         pub contents: CResult_boolPeerHandleErrorZPtr,
7008         /// Whether this CResult_boolPeerHandleErrorZ represents a success state.
7009         pub result_ok: bool,
7010 }
7011 #[no_mangle]
7012 /// Creates a new CResult_boolPeerHandleErrorZ in the success state.
7013 pub extern "C" fn CResult_boolPeerHandleErrorZ_ok(o: bool) -> CResult_boolPeerHandleErrorZ {
7014         CResult_boolPeerHandleErrorZ {
7015                 contents: CResult_boolPeerHandleErrorZPtr {
7016                         result: Box::into_raw(Box::new(o)),
7017                 },
7018                 result_ok: true,
7019         }
7020 }
7021 #[no_mangle]
7022 /// Creates a new CResult_boolPeerHandleErrorZ in the error state.
7023 pub extern "C" fn CResult_boolPeerHandleErrorZ_err(e: crate::lightning::ln::peer_handler::PeerHandleError) -> CResult_boolPeerHandleErrorZ {
7024         CResult_boolPeerHandleErrorZ {
7025                 contents: CResult_boolPeerHandleErrorZPtr {
7026                         err: Box::into_raw(Box::new(e)),
7027                 },
7028                 result_ok: false,
7029         }
7030 }
7031 #[no_mangle]
7032 /// Frees any resources used by the CResult_boolPeerHandleErrorZ.
7033 pub extern "C" fn CResult_boolPeerHandleErrorZ_free(_res: CResult_boolPeerHandleErrorZ) { }
7034 impl Drop for CResult_boolPeerHandleErrorZ {
7035         fn drop(&mut self) {
7036                 if self.result_ok {
7037                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
7038                                 let _ = unsafe { Box::from_raw(self.contents.result) };
7039                         }
7040                 } else {
7041                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
7042                                 let _ = unsafe { Box::from_raw(self.contents.err) };
7043                         }
7044                 }
7045         }
7046 }
7047 impl From<crate::c_types::CResultTempl<bool, crate::lightning::ln::peer_handler::PeerHandleError>> for CResult_boolPeerHandleErrorZ {
7048         fn from(mut o: crate::c_types::CResultTempl<bool, crate::lightning::ln::peer_handler::PeerHandleError>) -> Self {
7049                 let contents = if o.result_ok {
7050                         let result = unsafe { o.contents.result };
7051                         unsafe { o.contents.result = std::ptr::null_mut() };
7052                         CResult_boolPeerHandleErrorZPtr { result }
7053                 } else {
7054                         let err = unsafe { o.contents.err };
7055                         unsafe { o.contents.err = std::ptr::null_mut(); }
7056                         CResult_boolPeerHandleErrorZPtr { err }
7057                 };
7058                 Self {
7059                         contents,
7060                         result_ok: o.result_ok,
7061                 }
7062         }
7063 }
7064 impl Clone for CResult_boolPeerHandleErrorZ {
7065         fn clone(&self) -> Self {
7066                 if self.result_ok {
7067                         Self { result_ok: true, contents: CResult_boolPeerHandleErrorZPtr {
7068                                 result: Box::into_raw(Box::new(<bool>::clone(unsafe { &*self.contents.result })))
7069                         } }
7070                 } else {
7071                         Self { result_ok: false, contents: CResult_boolPeerHandleErrorZPtr {
7072                                 err: Box::into_raw(Box::new(<crate::lightning::ln::peer_handler::PeerHandleError>::clone(unsafe { &*self.contents.err })))
7073                         } }
7074                 }
7075         }
7076 }
7077 #[no_mangle]
7078 /// Creates a new CResult_boolPeerHandleErrorZ which has the same data as `orig`
7079 /// but with all dynamically-allocated buffers duplicated in new buffers.
7080 pub extern "C" fn CResult_boolPeerHandleErrorZ_clone(orig: &CResult_boolPeerHandleErrorZ) -> CResult_boolPeerHandleErrorZ { orig.clone() }
7081 #[repr(C)]
7082 /// The contents of CResult_DirectionalChannelInfoDecodeErrorZ
7083 pub union CResult_DirectionalChannelInfoDecodeErrorZPtr {
7084         /// A pointer to the contents in the success state.
7085         /// Reading from this pointer when `result_ok` is not set is undefined.
7086         pub result: *mut crate::lightning::routing::network_graph::DirectionalChannelInfo,
7087         /// A pointer to the contents in the error state.
7088         /// Reading from this pointer when `result_ok` is set is undefined.
7089         pub err: *mut crate::lightning::ln::msgs::DecodeError,
7090 }
7091 #[repr(C)]
7092 /// A CResult_DirectionalChannelInfoDecodeErrorZ represents the result of a fallible operation,
7093 /// containing a crate::lightning::routing::network_graph::DirectionalChannelInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
7094 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7095 pub struct CResult_DirectionalChannelInfoDecodeErrorZ {
7096         /// The contents of this CResult_DirectionalChannelInfoDecodeErrorZ, accessible via either
7097         /// `err` or `result` depending on the state of `result_ok`.
7098         pub contents: CResult_DirectionalChannelInfoDecodeErrorZPtr,
7099         /// Whether this CResult_DirectionalChannelInfoDecodeErrorZ represents a success state.
7100         pub result_ok: bool,
7101 }
7102 #[no_mangle]
7103 /// Creates a new CResult_DirectionalChannelInfoDecodeErrorZ in the success state.
7104 pub extern "C" fn CResult_DirectionalChannelInfoDecodeErrorZ_ok(o: crate::lightning::routing::network_graph::DirectionalChannelInfo) -> CResult_DirectionalChannelInfoDecodeErrorZ {
7105         CResult_DirectionalChannelInfoDecodeErrorZ {
7106                 contents: CResult_DirectionalChannelInfoDecodeErrorZPtr {
7107                         result: Box::into_raw(Box::new(o)),
7108                 },
7109                 result_ok: true,
7110         }
7111 }
7112 #[no_mangle]
7113 /// Creates a new CResult_DirectionalChannelInfoDecodeErrorZ in the error state.
7114 pub extern "C" fn CResult_DirectionalChannelInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_DirectionalChannelInfoDecodeErrorZ {
7115         CResult_DirectionalChannelInfoDecodeErrorZ {
7116                 contents: CResult_DirectionalChannelInfoDecodeErrorZPtr {
7117                         err: Box::into_raw(Box::new(e)),
7118                 },
7119                 result_ok: false,
7120         }
7121 }
7122 #[no_mangle]
7123 /// Frees any resources used by the CResult_DirectionalChannelInfoDecodeErrorZ.
7124 pub extern "C" fn CResult_DirectionalChannelInfoDecodeErrorZ_free(_res: CResult_DirectionalChannelInfoDecodeErrorZ) { }
7125 impl Drop for CResult_DirectionalChannelInfoDecodeErrorZ {
7126         fn drop(&mut self) {
7127                 if self.result_ok {
7128                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
7129                                 let _ = unsafe { Box::from_raw(self.contents.result) };
7130                         }
7131                 } else {
7132                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
7133                                 let _ = unsafe { Box::from_raw(self.contents.err) };
7134                         }
7135                 }
7136         }
7137 }
7138 impl From<crate::c_types::CResultTempl<crate::lightning::routing::network_graph::DirectionalChannelInfo, crate::lightning::ln::msgs::DecodeError>> for CResult_DirectionalChannelInfoDecodeErrorZ {
7139         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::network_graph::DirectionalChannelInfo, crate::lightning::ln::msgs::DecodeError>) -> Self {
7140                 let contents = if o.result_ok {
7141                         let result = unsafe { o.contents.result };
7142                         unsafe { o.contents.result = std::ptr::null_mut() };
7143                         CResult_DirectionalChannelInfoDecodeErrorZPtr { result }
7144                 } else {
7145                         let err = unsafe { o.contents.err };
7146                         unsafe { o.contents.err = std::ptr::null_mut(); }
7147                         CResult_DirectionalChannelInfoDecodeErrorZPtr { err }
7148                 };
7149                 Self {
7150                         contents,
7151                         result_ok: o.result_ok,
7152                 }
7153         }
7154 }
7155 impl Clone for CResult_DirectionalChannelInfoDecodeErrorZ {
7156         fn clone(&self) -> Self {
7157                 if self.result_ok {
7158                         Self { result_ok: true, contents: CResult_DirectionalChannelInfoDecodeErrorZPtr {
7159                                 result: Box::into_raw(Box::new(<crate::lightning::routing::network_graph::DirectionalChannelInfo>::clone(unsafe { &*self.contents.result })))
7160                         } }
7161                 } else {
7162                         Self { result_ok: false, contents: CResult_DirectionalChannelInfoDecodeErrorZPtr {
7163                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
7164                         } }
7165                 }
7166         }
7167 }
7168 #[no_mangle]
7169 /// Creates a new CResult_DirectionalChannelInfoDecodeErrorZ which has the same data as `orig`
7170 /// but with all dynamically-allocated buffers duplicated in new buffers.
7171 pub extern "C" fn CResult_DirectionalChannelInfoDecodeErrorZ_clone(orig: &CResult_DirectionalChannelInfoDecodeErrorZ) -> CResult_DirectionalChannelInfoDecodeErrorZ { orig.clone() }
7172 #[repr(C)]
7173 /// The contents of CResult_ChannelInfoDecodeErrorZ
7174 pub union CResult_ChannelInfoDecodeErrorZPtr {
7175         /// A pointer to the contents in the success state.
7176         /// Reading from this pointer when `result_ok` is not set is undefined.
7177         pub result: *mut crate::lightning::routing::network_graph::ChannelInfo,
7178         /// A pointer to the contents in the error state.
7179         /// Reading from this pointer when `result_ok` is set is undefined.
7180         pub err: *mut crate::lightning::ln::msgs::DecodeError,
7181 }
7182 #[repr(C)]
7183 /// A CResult_ChannelInfoDecodeErrorZ represents the result of a fallible operation,
7184 /// containing a crate::lightning::routing::network_graph::ChannelInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
7185 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7186 pub struct CResult_ChannelInfoDecodeErrorZ {
7187         /// The contents of this CResult_ChannelInfoDecodeErrorZ, accessible via either
7188         /// `err` or `result` depending on the state of `result_ok`.
7189         pub contents: CResult_ChannelInfoDecodeErrorZPtr,
7190         /// Whether this CResult_ChannelInfoDecodeErrorZ represents a success state.
7191         pub result_ok: bool,
7192 }
7193 #[no_mangle]
7194 /// Creates a new CResult_ChannelInfoDecodeErrorZ in the success state.
7195 pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_ok(o: crate::lightning::routing::network_graph::ChannelInfo) -> CResult_ChannelInfoDecodeErrorZ {
7196         CResult_ChannelInfoDecodeErrorZ {
7197                 contents: CResult_ChannelInfoDecodeErrorZPtr {
7198                         result: Box::into_raw(Box::new(o)),
7199                 },
7200                 result_ok: true,
7201         }
7202 }
7203 #[no_mangle]
7204 /// Creates a new CResult_ChannelInfoDecodeErrorZ in the error state.
7205 pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelInfoDecodeErrorZ {
7206         CResult_ChannelInfoDecodeErrorZ {
7207                 contents: CResult_ChannelInfoDecodeErrorZPtr {
7208                         err: Box::into_raw(Box::new(e)),
7209                 },
7210                 result_ok: false,
7211         }
7212 }
7213 #[no_mangle]
7214 /// Frees any resources used by the CResult_ChannelInfoDecodeErrorZ.
7215 pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_free(_res: CResult_ChannelInfoDecodeErrorZ) { }
7216 impl Drop for CResult_ChannelInfoDecodeErrorZ {
7217         fn drop(&mut self) {
7218                 if self.result_ok {
7219                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
7220                                 let _ = unsafe { Box::from_raw(self.contents.result) };
7221                         }
7222                 } else {
7223                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
7224                                 let _ = unsafe { Box::from_raw(self.contents.err) };
7225                         }
7226                 }
7227         }
7228 }
7229 impl From<crate::c_types::CResultTempl<crate::lightning::routing::network_graph::ChannelInfo, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelInfoDecodeErrorZ {
7230         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::network_graph::ChannelInfo, crate::lightning::ln::msgs::DecodeError>) -> Self {
7231                 let contents = if o.result_ok {
7232                         let result = unsafe { o.contents.result };
7233                         unsafe { o.contents.result = std::ptr::null_mut() };
7234                         CResult_ChannelInfoDecodeErrorZPtr { result }
7235                 } else {
7236                         let err = unsafe { o.contents.err };
7237                         unsafe { o.contents.err = std::ptr::null_mut(); }
7238                         CResult_ChannelInfoDecodeErrorZPtr { err }
7239                 };
7240                 Self {
7241                         contents,
7242                         result_ok: o.result_ok,
7243                 }
7244         }
7245 }
7246 impl Clone for CResult_ChannelInfoDecodeErrorZ {
7247         fn clone(&self) -> Self {
7248                 if self.result_ok {
7249                         Self { result_ok: true, contents: CResult_ChannelInfoDecodeErrorZPtr {
7250                                 result: Box::into_raw(Box::new(<crate::lightning::routing::network_graph::ChannelInfo>::clone(unsafe { &*self.contents.result })))
7251                         } }
7252                 } else {
7253                         Self { result_ok: false, contents: CResult_ChannelInfoDecodeErrorZPtr {
7254                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
7255                         } }
7256                 }
7257         }
7258 }
7259 #[no_mangle]
7260 /// Creates a new CResult_ChannelInfoDecodeErrorZ which has the same data as `orig`
7261 /// but with all dynamically-allocated buffers duplicated in new buffers.
7262 pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_clone(orig: &CResult_ChannelInfoDecodeErrorZ) -> CResult_ChannelInfoDecodeErrorZ { orig.clone() }
7263 #[repr(C)]
7264 /// The contents of CResult_RoutingFeesDecodeErrorZ
7265 pub union CResult_RoutingFeesDecodeErrorZPtr {
7266         /// A pointer to the contents in the success state.
7267         /// Reading from this pointer when `result_ok` is not set is undefined.
7268         pub result: *mut crate::lightning::routing::network_graph::RoutingFees,
7269         /// A pointer to the contents in the error state.
7270         /// Reading from this pointer when `result_ok` is set is undefined.
7271         pub err: *mut crate::lightning::ln::msgs::DecodeError,
7272 }
7273 #[repr(C)]
7274 /// A CResult_RoutingFeesDecodeErrorZ represents the result of a fallible operation,
7275 /// containing a crate::lightning::routing::network_graph::RoutingFees on success and a crate::lightning::ln::msgs::DecodeError on failure.
7276 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7277 pub struct CResult_RoutingFeesDecodeErrorZ {
7278         /// The contents of this CResult_RoutingFeesDecodeErrorZ, accessible via either
7279         /// `err` or `result` depending on the state of `result_ok`.
7280         pub contents: CResult_RoutingFeesDecodeErrorZPtr,
7281         /// Whether this CResult_RoutingFeesDecodeErrorZ represents a success state.
7282         pub result_ok: bool,
7283 }
7284 #[no_mangle]
7285 /// Creates a new CResult_RoutingFeesDecodeErrorZ in the success state.
7286 pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_ok(o: crate::lightning::routing::network_graph::RoutingFees) -> CResult_RoutingFeesDecodeErrorZ {
7287         CResult_RoutingFeesDecodeErrorZ {
7288                 contents: CResult_RoutingFeesDecodeErrorZPtr {
7289                         result: Box::into_raw(Box::new(o)),
7290                 },
7291                 result_ok: true,
7292         }
7293 }
7294 #[no_mangle]
7295 /// Creates a new CResult_RoutingFeesDecodeErrorZ in the error state.
7296 pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RoutingFeesDecodeErrorZ {
7297         CResult_RoutingFeesDecodeErrorZ {
7298                 contents: CResult_RoutingFeesDecodeErrorZPtr {
7299                         err: Box::into_raw(Box::new(e)),
7300                 },
7301                 result_ok: false,
7302         }
7303 }
7304 #[no_mangle]
7305 /// Frees any resources used by the CResult_RoutingFeesDecodeErrorZ.
7306 pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_free(_res: CResult_RoutingFeesDecodeErrorZ) { }
7307 impl Drop for CResult_RoutingFeesDecodeErrorZ {
7308         fn drop(&mut self) {
7309                 if self.result_ok {
7310                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
7311                                 let _ = unsafe { Box::from_raw(self.contents.result) };
7312                         }
7313                 } else {
7314                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
7315                                 let _ = unsafe { Box::from_raw(self.contents.err) };
7316                         }
7317                 }
7318         }
7319 }
7320 impl From<crate::c_types::CResultTempl<crate::lightning::routing::network_graph::RoutingFees, crate::lightning::ln::msgs::DecodeError>> for CResult_RoutingFeesDecodeErrorZ {
7321         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::network_graph::RoutingFees, crate::lightning::ln::msgs::DecodeError>) -> Self {
7322                 let contents = if o.result_ok {
7323                         let result = unsafe { o.contents.result };
7324                         unsafe { o.contents.result = std::ptr::null_mut() };
7325                         CResult_RoutingFeesDecodeErrorZPtr { result }
7326                 } else {
7327                         let err = unsafe { o.contents.err };
7328                         unsafe { o.contents.err = std::ptr::null_mut(); }
7329                         CResult_RoutingFeesDecodeErrorZPtr { err }
7330                 };
7331                 Self {
7332                         contents,
7333                         result_ok: o.result_ok,
7334                 }
7335         }
7336 }
7337 impl Clone for CResult_RoutingFeesDecodeErrorZ {
7338         fn clone(&self) -> Self {
7339                 if self.result_ok {
7340                         Self { result_ok: true, contents: CResult_RoutingFeesDecodeErrorZPtr {
7341                                 result: Box::into_raw(Box::new(<crate::lightning::routing::network_graph::RoutingFees>::clone(unsafe { &*self.contents.result })))
7342                         } }
7343                 } else {
7344                         Self { result_ok: false, contents: CResult_RoutingFeesDecodeErrorZPtr {
7345                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
7346                         } }
7347                 }
7348         }
7349 }
7350 #[no_mangle]
7351 /// Creates a new CResult_RoutingFeesDecodeErrorZ which has the same data as `orig`
7352 /// but with all dynamically-allocated buffers duplicated in new buffers.
7353 pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_clone(orig: &CResult_RoutingFeesDecodeErrorZ) -> CResult_RoutingFeesDecodeErrorZ { orig.clone() }
7354 #[repr(C)]
7355 /// The contents of CResult_NodeAnnouncementInfoDecodeErrorZ
7356 pub union CResult_NodeAnnouncementInfoDecodeErrorZPtr {
7357         /// A pointer to the contents in the success state.
7358         /// Reading from this pointer when `result_ok` is not set is undefined.
7359         pub result: *mut crate::lightning::routing::network_graph::NodeAnnouncementInfo,
7360         /// A pointer to the contents in the error state.
7361         /// Reading from this pointer when `result_ok` is set is undefined.
7362         pub err: *mut crate::lightning::ln::msgs::DecodeError,
7363 }
7364 #[repr(C)]
7365 /// A CResult_NodeAnnouncementInfoDecodeErrorZ represents the result of a fallible operation,
7366 /// containing a crate::lightning::routing::network_graph::NodeAnnouncementInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
7367 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7368 pub struct CResult_NodeAnnouncementInfoDecodeErrorZ {
7369         /// The contents of this CResult_NodeAnnouncementInfoDecodeErrorZ, accessible via either
7370         /// `err` or `result` depending on the state of `result_ok`.
7371         pub contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr,
7372         /// Whether this CResult_NodeAnnouncementInfoDecodeErrorZ represents a success state.
7373         pub result_ok: bool,
7374 }
7375 #[no_mangle]
7376 /// Creates a new CResult_NodeAnnouncementInfoDecodeErrorZ in the success state.
7377 pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_ok(o: crate::lightning::routing::network_graph::NodeAnnouncementInfo) -> CResult_NodeAnnouncementInfoDecodeErrorZ {
7378         CResult_NodeAnnouncementInfoDecodeErrorZ {
7379                 contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr {
7380                         result: Box::into_raw(Box::new(o)),
7381                 },
7382                 result_ok: true,
7383         }
7384 }
7385 #[no_mangle]
7386 /// Creates a new CResult_NodeAnnouncementInfoDecodeErrorZ in the error state.
7387 pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeAnnouncementInfoDecodeErrorZ {
7388         CResult_NodeAnnouncementInfoDecodeErrorZ {
7389                 contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr {
7390                         err: Box::into_raw(Box::new(e)),
7391                 },
7392                 result_ok: false,
7393         }
7394 }
7395 #[no_mangle]
7396 /// Frees any resources used by the CResult_NodeAnnouncementInfoDecodeErrorZ.
7397 pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_free(_res: CResult_NodeAnnouncementInfoDecodeErrorZ) { }
7398 impl Drop for CResult_NodeAnnouncementInfoDecodeErrorZ {
7399         fn drop(&mut self) {
7400                 if self.result_ok {
7401                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
7402                                 let _ = unsafe { Box::from_raw(self.contents.result) };
7403                         }
7404                 } else {
7405                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
7406                                 let _ = unsafe { Box::from_raw(self.contents.err) };
7407                         }
7408                 }
7409         }
7410 }
7411 impl From<crate::c_types::CResultTempl<crate::lightning::routing::network_graph::NodeAnnouncementInfo, crate::lightning::ln::msgs::DecodeError>> for CResult_NodeAnnouncementInfoDecodeErrorZ {
7412         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::network_graph::NodeAnnouncementInfo, crate::lightning::ln::msgs::DecodeError>) -> Self {
7413                 let contents = if o.result_ok {
7414                         let result = unsafe { o.contents.result };
7415                         unsafe { o.contents.result = std::ptr::null_mut() };
7416                         CResult_NodeAnnouncementInfoDecodeErrorZPtr { result }
7417                 } else {
7418                         let err = unsafe { o.contents.err };
7419                         unsafe { o.contents.err = std::ptr::null_mut(); }
7420                         CResult_NodeAnnouncementInfoDecodeErrorZPtr { err }
7421                 };
7422                 Self {
7423                         contents,
7424                         result_ok: o.result_ok,
7425                 }
7426         }
7427 }
7428 impl Clone for CResult_NodeAnnouncementInfoDecodeErrorZ {
7429         fn clone(&self) -> Self {
7430                 if self.result_ok {
7431                         Self { result_ok: true, contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr {
7432                                 result: Box::into_raw(Box::new(<crate::lightning::routing::network_graph::NodeAnnouncementInfo>::clone(unsafe { &*self.contents.result })))
7433                         } }
7434                 } else {
7435                         Self { result_ok: false, contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr {
7436                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
7437                         } }
7438                 }
7439         }
7440 }
7441 #[no_mangle]
7442 /// Creates a new CResult_NodeAnnouncementInfoDecodeErrorZ which has the same data as `orig`
7443 /// but with all dynamically-allocated buffers duplicated in new buffers.
7444 pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_clone(orig: &CResult_NodeAnnouncementInfoDecodeErrorZ) -> CResult_NodeAnnouncementInfoDecodeErrorZ { orig.clone() }
7445 #[repr(C)]
7446 /// A dynamically-allocated array of u64s of arbitrary size.
7447 /// This corresponds to std::vector in C++
7448 pub struct CVec_u64Z {
7449         /// The elements in the array.
7450         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
7451         pub data: *mut u64,
7452         /// The number of elements pointed to by `data`.
7453         pub datalen: usize
7454 }
7455 impl CVec_u64Z {
7456         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<u64> {
7457                 if self.datalen == 0 { return Vec::new(); }
7458                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
7459                 self.data = std::ptr::null_mut();
7460                 self.datalen = 0;
7461                 ret
7462         }
7463         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[u64] {
7464                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
7465         }
7466 }
7467 impl From<Vec<u64>> for CVec_u64Z {
7468         fn from(v: Vec<u64>) -> Self {
7469                 let datalen = v.len();
7470                 let data = Box::into_raw(v.into_boxed_slice());
7471                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
7472         }
7473 }
7474 #[no_mangle]
7475 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
7476 pub extern "C" fn CVec_u64Z_free(_res: CVec_u64Z) { }
7477 impl Drop for CVec_u64Z {
7478         fn drop(&mut self) {
7479                 if self.datalen == 0 { return; }
7480                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
7481         }
7482 }
7483 impl Clone for CVec_u64Z {
7484         fn clone(&self) -> Self {
7485                 let mut res = Vec::new();
7486                 if self.datalen == 0 { return Self::from(res); }
7487                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
7488                 Self::from(res)
7489         }
7490 }
7491 #[repr(C)]
7492 /// The contents of CResult_NodeInfoDecodeErrorZ
7493 pub union CResult_NodeInfoDecodeErrorZPtr {
7494         /// A pointer to the contents in the success state.
7495         /// Reading from this pointer when `result_ok` is not set is undefined.
7496         pub result: *mut crate::lightning::routing::network_graph::NodeInfo,
7497         /// A pointer to the contents in the error state.
7498         /// Reading from this pointer when `result_ok` is set is undefined.
7499         pub err: *mut crate::lightning::ln::msgs::DecodeError,
7500 }
7501 #[repr(C)]
7502 /// A CResult_NodeInfoDecodeErrorZ represents the result of a fallible operation,
7503 /// containing a crate::lightning::routing::network_graph::NodeInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
7504 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7505 pub struct CResult_NodeInfoDecodeErrorZ {
7506         /// The contents of this CResult_NodeInfoDecodeErrorZ, accessible via either
7507         /// `err` or `result` depending on the state of `result_ok`.
7508         pub contents: CResult_NodeInfoDecodeErrorZPtr,
7509         /// Whether this CResult_NodeInfoDecodeErrorZ represents a success state.
7510         pub result_ok: bool,
7511 }
7512 #[no_mangle]
7513 /// Creates a new CResult_NodeInfoDecodeErrorZ in the success state.
7514 pub extern "C" fn CResult_NodeInfoDecodeErrorZ_ok(o: crate::lightning::routing::network_graph::NodeInfo) -> CResult_NodeInfoDecodeErrorZ {
7515         CResult_NodeInfoDecodeErrorZ {
7516                 contents: CResult_NodeInfoDecodeErrorZPtr {
7517                         result: Box::into_raw(Box::new(o)),
7518                 },
7519                 result_ok: true,
7520         }
7521 }
7522 #[no_mangle]
7523 /// Creates a new CResult_NodeInfoDecodeErrorZ in the error state.
7524 pub extern "C" fn CResult_NodeInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeInfoDecodeErrorZ {
7525         CResult_NodeInfoDecodeErrorZ {
7526                 contents: CResult_NodeInfoDecodeErrorZPtr {
7527                         err: Box::into_raw(Box::new(e)),
7528                 },
7529                 result_ok: false,
7530         }
7531 }
7532 #[no_mangle]
7533 /// Frees any resources used by the CResult_NodeInfoDecodeErrorZ.
7534 pub extern "C" fn CResult_NodeInfoDecodeErrorZ_free(_res: CResult_NodeInfoDecodeErrorZ) { }
7535 impl Drop for CResult_NodeInfoDecodeErrorZ {
7536         fn drop(&mut self) {
7537                 if self.result_ok {
7538                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
7539                                 let _ = unsafe { Box::from_raw(self.contents.result) };
7540                         }
7541                 } else {
7542                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
7543                                 let _ = unsafe { Box::from_raw(self.contents.err) };
7544                         }
7545                 }
7546         }
7547 }
7548 impl From<crate::c_types::CResultTempl<crate::lightning::routing::network_graph::NodeInfo, crate::lightning::ln::msgs::DecodeError>> for CResult_NodeInfoDecodeErrorZ {
7549         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::network_graph::NodeInfo, crate::lightning::ln::msgs::DecodeError>) -> Self {
7550                 let contents = if o.result_ok {
7551                         let result = unsafe { o.contents.result };
7552                         unsafe { o.contents.result = std::ptr::null_mut() };
7553                         CResult_NodeInfoDecodeErrorZPtr { result }
7554                 } else {
7555                         let err = unsafe { o.contents.err };
7556                         unsafe { o.contents.err = std::ptr::null_mut(); }
7557                         CResult_NodeInfoDecodeErrorZPtr { err }
7558                 };
7559                 Self {
7560                         contents,
7561                         result_ok: o.result_ok,
7562                 }
7563         }
7564 }
7565 impl Clone for CResult_NodeInfoDecodeErrorZ {
7566         fn clone(&self) -> Self {
7567                 if self.result_ok {
7568                         Self { result_ok: true, contents: CResult_NodeInfoDecodeErrorZPtr {
7569                                 result: Box::into_raw(Box::new(<crate::lightning::routing::network_graph::NodeInfo>::clone(unsafe { &*self.contents.result })))
7570                         } }
7571                 } else {
7572                         Self { result_ok: false, contents: CResult_NodeInfoDecodeErrorZPtr {
7573                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
7574                         } }
7575                 }
7576         }
7577 }
7578 #[no_mangle]
7579 /// Creates a new CResult_NodeInfoDecodeErrorZ which has the same data as `orig`
7580 /// but with all dynamically-allocated buffers duplicated in new buffers.
7581 pub extern "C" fn CResult_NodeInfoDecodeErrorZ_clone(orig: &CResult_NodeInfoDecodeErrorZ) -> CResult_NodeInfoDecodeErrorZ { orig.clone() }
7582 #[repr(C)]
7583 /// The contents of CResult_NetworkGraphDecodeErrorZ
7584 pub union CResult_NetworkGraphDecodeErrorZPtr {
7585         /// A pointer to the contents in the success state.
7586         /// Reading from this pointer when `result_ok` is not set is undefined.
7587         pub result: *mut crate::lightning::routing::network_graph::NetworkGraph,
7588         /// A pointer to the contents in the error state.
7589         /// Reading from this pointer when `result_ok` is set is undefined.
7590         pub err: *mut crate::lightning::ln::msgs::DecodeError,
7591 }
7592 #[repr(C)]
7593 /// A CResult_NetworkGraphDecodeErrorZ represents the result of a fallible operation,
7594 /// containing a crate::lightning::routing::network_graph::NetworkGraph on success and a crate::lightning::ln::msgs::DecodeError on failure.
7595 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7596 pub struct CResult_NetworkGraphDecodeErrorZ {
7597         /// The contents of this CResult_NetworkGraphDecodeErrorZ, accessible via either
7598         /// `err` or `result` depending on the state of `result_ok`.
7599         pub contents: CResult_NetworkGraphDecodeErrorZPtr,
7600         /// Whether this CResult_NetworkGraphDecodeErrorZ represents a success state.
7601         pub result_ok: bool,
7602 }
7603 #[no_mangle]
7604 /// Creates a new CResult_NetworkGraphDecodeErrorZ in the success state.
7605 pub extern "C" fn CResult_NetworkGraphDecodeErrorZ_ok(o: crate::lightning::routing::network_graph::NetworkGraph) -> CResult_NetworkGraphDecodeErrorZ {
7606         CResult_NetworkGraphDecodeErrorZ {
7607                 contents: CResult_NetworkGraphDecodeErrorZPtr {
7608                         result: Box::into_raw(Box::new(o)),
7609                 },
7610                 result_ok: true,
7611         }
7612 }
7613 #[no_mangle]
7614 /// Creates a new CResult_NetworkGraphDecodeErrorZ in the error state.
7615 pub extern "C" fn CResult_NetworkGraphDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NetworkGraphDecodeErrorZ {
7616         CResult_NetworkGraphDecodeErrorZ {
7617                 contents: CResult_NetworkGraphDecodeErrorZPtr {
7618                         err: Box::into_raw(Box::new(e)),
7619                 },
7620                 result_ok: false,
7621         }
7622 }
7623 #[no_mangle]
7624 /// Frees any resources used by the CResult_NetworkGraphDecodeErrorZ.
7625 pub extern "C" fn CResult_NetworkGraphDecodeErrorZ_free(_res: CResult_NetworkGraphDecodeErrorZ) { }
7626 impl Drop for CResult_NetworkGraphDecodeErrorZ {
7627         fn drop(&mut self) {
7628                 if self.result_ok {
7629                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
7630                                 let _ = unsafe { Box::from_raw(self.contents.result) };
7631                         }
7632                 } else {
7633                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
7634                                 let _ = unsafe { Box::from_raw(self.contents.err) };
7635                         }
7636                 }
7637         }
7638 }
7639 impl From<crate::c_types::CResultTempl<crate::lightning::routing::network_graph::NetworkGraph, crate::lightning::ln::msgs::DecodeError>> for CResult_NetworkGraphDecodeErrorZ {
7640         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::network_graph::NetworkGraph, crate::lightning::ln::msgs::DecodeError>) -> Self {
7641                 let contents = if o.result_ok {
7642                         let result = unsafe { o.contents.result };
7643                         unsafe { o.contents.result = std::ptr::null_mut() };
7644                         CResult_NetworkGraphDecodeErrorZPtr { result }
7645                 } else {
7646                         let err = unsafe { o.contents.err };
7647                         unsafe { o.contents.err = std::ptr::null_mut(); }
7648                         CResult_NetworkGraphDecodeErrorZPtr { err }
7649                 };
7650                 Self {
7651                         contents,
7652                         result_ok: o.result_ok,
7653                 }
7654         }
7655 }
7656 impl Clone for CResult_NetworkGraphDecodeErrorZ {
7657         fn clone(&self) -> Self {
7658                 if self.result_ok {
7659                         Self { result_ok: true, contents: CResult_NetworkGraphDecodeErrorZPtr {
7660                                 result: Box::into_raw(Box::new(<crate::lightning::routing::network_graph::NetworkGraph>::clone(unsafe { &*self.contents.result })))
7661                         } }
7662                 } else {
7663                         Self { result_ok: false, contents: CResult_NetworkGraphDecodeErrorZPtr {
7664                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
7665                         } }
7666                 }
7667         }
7668 }
7669 #[no_mangle]
7670 /// Creates a new CResult_NetworkGraphDecodeErrorZ which has the same data as `orig`
7671 /// but with all dynamically-allocated buffers duplicated in new buffers.
7672 pub extern "C" fn CResult_NetworkGraphDecodeErrorZ_clone(orig: &CResult_NetworkGraphDecodeErrorZ) -> CResult_NetworkGraphDecodeErrorZ { orig.clone() }
7673 #[repr(C)]
7674 /// The contents of CResult_NetAddressu8Z
7675 pub union CResult_NetAddressu8ZPtr {
7676         /// A pointer to the contents in the success state.
7677         /// Reading from this pointer when `result_ok` is not set is undefined.
7678         pub result: *mut crate::lightning::ln::msgs::NetAddress,
7679         /// A pointer to the contents in the error state.
7680         /// Reading from this pointer when `result_ok` is set is undefined.
7681         pub err: *mut u8,
7682 }
7683 #[repr(C)]
7684 /// A CResult_NetAddressu8Z represents the result of a fallible operation,
7685 /// containing a crate::lightning::ln::msgs::NetAddress on success and a u8 on failure.
7686 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7687 pub struct CResult_NetAddressu8Z {
7688         /// The contents of this CResult_NetAddressu8Z, accessible via either
7689         /// `err` or `result` depending on the state of `result_ok`.
7690         pub contents: CResult_NetAddressu8ZPtr,
7691         /// Whether this CResult_NetAddressu8Z represents a success state.
7692         pub result_ok: bool,
7693 }
7694 #[no_mangle]
7695 /// Creates a new CResult_NetAddressu8Z in the success state.
7696 pub extern "C" fn CResult_NetAddressu8Z_ok(o: crate::lightning::ln::msgs::NetAddress) -> CResult_NetAddressu8Z {
7697         CResult_NetAddressu8Z {
7698                 contents: CResult_NetAddressu8ZPtr {
7699                         result: Box::into_raw(Box::new(o)),
7700                 },
7701                 result_ok: true,
7702         }
7703 }
7704 #[no_mangle]
7705 /// Creates a new CResult_NetAddressu8Z in the error state.
7706 pub extern "C" fn CResult_NetAddressu8Z_err(e: u8) -> CResult_NetAddressu8Z {
7707         CResult_NetAddressu8Z {
7708                 contents: CResult_NetAddressu8ZPtr {
7709                         err: Box::into_raw(Box::new(e)),
7710                 },
7711                 result_ok: false,
7712         }
7713 }
7714 #[no_mangle]
7715 /// Frees any resources used by the CResult_NetAddressu8Z.
7716 pub extern "C" fn CResult_NetAddressu8Z_free(_res: CResult_NetAddressu8Z) { }
7717 impl Drop for CResult_NetAddressu8Z {
7718         fn drop(&mut self) {
7719                 if self.result_ok {
7720                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
7721                                 let _ = unsafe { Box::from_raw(self.contents.result) };
7722                         }
7723                 } else {
7724                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
7725                                 let _ = unsafe { Box::from_raw(self.contents.err) };
7726                         }
7727                 }
7728         }
7729 }
7730 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::NetAddress, u8>> for CResult_NetAddressu8Z {
7731         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::NetAddress, u8>) -> Self {
7732                 let contents = if o.result_ok {
7733                         let result = unsafe { o.contents.result };
7734                         unsafe { o.contents.result = std::ptr::null_mut() };
7735                         CResult_NetAddressu8ZPtr { result }
7736                 } else {
7737                         let err = unsafe { o.contents.err };
7738                         unsafe { o.contents.err = std::ptr::null_mut(); }
7739                         CResult_NetAddressu8ZPtr { err }
7740                 };
7741                 Self {
7742                         contents,
7743                         result_ok: o.result_ok,
7744                 }
7745         }
7746 }
7747 impl Clone for CResult_NetAddressu8Z {
7748         fn clone(&self) -> Self {
7749                 if self.result_ok {
7750                         Self { result_ok: true, contents: CResult_NetAddressu8ZPtr {
7751                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::NetAddress>::clone(unsafe { &*self.contents.result })))
7752                         } }
7753                 } else {
7754                         Self { result_ok: false, contents: CResult_NetAddressu8ZPtr {
7755                                 err: Box::into_raw(Box::new(<u8>::clone(unsafe { &*self.contents.err })))
7756                         } }
7757                 }
7758         }
7759 }
7760 #[no_mangle]
7761 /// Creates a new CResult_NetAddressu8Z which has the same data as `orig`
7762 /// but with all dynamically-allocated buffers duplicated in new buffers.
7763 pub extern "C" fn CResult_NetAddressu8Z_clone(orig: &CResult_NetAddressu8Z) -> CResult_NetAddressu8Z { orig.clone() }
7764 #[repr(C)]
7765 /// The contents of CResult_CResult_NetAddressu8ZDecodeErrorZ
7766 pub union CResult_CResult_NetAddressu8ZDecodeErrorZPtr {
7767         /// A pointer to the contents in the success state.
7768         /// Reading from this pointer when `result_ok` is not set is undefined.
7769         pub result: *mut crate::c_types::derived::CResult_NetAddressu8Z,
7770         /// A pointer to the contents in the error state.
7771         /// Reading from this pointer when `result_ok` is set is undefined.
7772         pub err: *mut crate::lightning::ln::msgs::DecodeError,
7773 }
7774 #[repr(C)]
7775 /// A CResult_CResult_NetAddressu8ZDecodeErrorZ represents the result of a fallible operation,
7776 /// containing a crate::c_types::derived::CResult_NetAddressu8Z on success and a crate::lightning::ln::msgs::DecodeError on failure.
7777 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7778 pub struct CResult_CResult_NetAddressu8ZDecodeErrorZ {
7779         /// The contents of this CResult_CResult_NetAddressu8ZDecodeErrorZ, accessible via either
7780         /// `err` or `result` depending on the state of `result_ok`.
7781         pub contents: CResult_CResult_NetAddressu8ZDecodeErrorZPtr,
7782         /// Whether this CResult_CResult_NetAddressu8ZDecodeErrorZ represents a success state.
7783         pub result_ok: bool,
7784 }
7785 #[no_mangle]
7786 /// Creates a new CResult_CResult_NetAddressu8ZDecodeErrorZ in the success state.
7787 pub extern "C" fn CResult_CResult_NetAddressu8ZDecodeErrorZ_ok(o: crate::c_types::derived::CResult_NetAddressu8Z) -> CResult_CResult_NetAddressu8ZDecodeErrorZ {
7788         CResult_CResult_NetAddressu8ZDecodeErrorZ {
7789                 contents: CResult_CResult_NetAddressu8ZDecodeErrorZPtr {
7790                         result: Box::into_raw(Box::new(o)),
7791                 },
7792                 result_ok: true,
7793         }
7794 }
7795 #[no_mangle]
7796 /// Creates a new CResult_CResult_NetAddressu8ZDecodeErrorZ in the error state.
7797 pub extern "C" fn CResult_CResult_NetAddressu8ZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_CResult_NetAddressu8ZDecodeErrorZ {
7798         CResult_CResult_NetAddressu8ZDecodeErrorZ {
7799                 contents: CResult_CResult_NetAddressu8ZDecodeErrorZPtr {
7800                         err: Box::into_raw(Box::new(e)),
7801                 },
7802                 result_ok: false,
7803         }
7804 }
7805 #[no_mangle]
7806 /// Frees any resources used by the CResult_CResult_NetAddressu8ZDecodeErrorZ.
7807 pub extern "C" fn CResult_CResult_NetAddressu8ZDecodeErrorZ_free(_res: CResult_CResult_NetAddressu8ZDecodeErrorZ) { }
7808 impl Drop for CResult_CResult_NetAddressu8ZDecodeErrorZ {
7809         fn drop(&mut self) {
7810                 if self.result_ok {
7811                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
7812                                 let _ = unsafe { Box::from_raw(self.contents.result) };
7813                         }
7814                 } else {
7815                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
7816                                 let _ = unsafe { Box::from_raw(self.contents.err) };
7817                         }
7818                 }
7819         }
7820 }
7821 impl From<crate::c_types::CResultTempl<crate::c_types::derived::CResult_NetAddressu8Z, crate::lightning::ln::msgs::DecodeError>> for CResult_CResult_NetAddressu8ZDecodeErrorZ {
7822         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CResult_NetAddressu8Z, crate::lightning::ln::msgs::DecodeError>) -> Self {
7823                 let contents = if o.result_ok {
7824                         let result = unsafe { o.contents.result };
7825                         unsafe { o.contents.result = std::ptr::null_mut() };
7826                         CResult_CResult_NetAddressu8ZDecodeErrorZPtr { result }
7827                 } else {
7828                         let err = unsafe { o.contents.err };
7829                         unsafe { o.contents.err = std::ptr::null_mut(); }
7830                         CResult_CResult_NetAddressu8ZDecodeErrorZPtr { err }
7831                 };
7832                 Self {
7833                         contents,
7834                         result_ok: o.result_ok,
7835                 }
7836         }
7837 }
7838 impl Clone for CResult_CResult_NetAddressu8ZDecodeErrorZ {
7839         fn clone(&self) -> Self {
7840                 if self.result_ok {
7841                         Self { result_ok: true, contents: CResult_CResult_NetAddressu8ZDecodeErrorZPtr {
7842                                 result: Box::into_raw(Box::new(<crate::c_types::derived::CResult_NetAddressu8Z>::clone(unsafe { &*self.contents.result })))
7843                         } }
7844                 } else {
7845                         Self { result_ok: false, contents: CResult_CResult_NetAddressu8ZDecodeErrorZPtr {
7846                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
7847                         } }
7848                 }
7849         }
7850 }
7851 #[no_mangle]
7852 /// Creates a new CResult_CResult_NetAddressu8ZDecodeErrorZ which has the same data as `orig`
7853 /// but with all dynamically-allocated buffers duplicated in new buffers.
7854 pub extern "C" fn CResult_CResult_NetAddressu8ZDecodeErrorZ_clone(orig: &CResult_CResult_NetAddressu8ZDecodeErrorZ) -> CResult_CResult_NetAddressu8ZDecodeErrorZ { orig.clone() }
7855 #[repr(C)]
7856 /// The contents of CResult_NetAddressDecodeErrorZ
7857 pub union CResult_NetAddressDecodeErrorZPtr {
7858         /// A pointer to the contents in the success state.
7859         /// Reading from this pointer when `result_ok` is not set is undefined.
7860         pub result: *mut crate::lightning::ln::msgs::NetAddress,
7861         /// A pointer to the contents in the error state.
7862         /// Reading from this pointer when `result_ok` is set is undefined.
7863         pub err: *mut crate::lightning::ln::msgs::DecodeError,
7864 }
7865 #[repr(C)]
7866 /// A CResult_NetAddressDecodeErrorZ represents the result of a fallible operation,
7867 /// containing a crate::lightning::ln::msgs::NetAddress on success and a crate::lightning::ln::msgs::DecodeError on failure.
7868 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7869 pub struct CResult_NetAddressDecodeErrorZ {
7870         /// The contents of this CResult_NetAddressDecodeErrorZ, accessible via either
7871         /// `err` or `result` depending on the state of `result_ok`.
7872         pub contents: CResult_NetAddressDecodeErrorZPtr,
7873         /// Whether this CResult_NetAddressDecodeErrorZ represents a success state.
7874         pub result_ok: bool,
7875 }
7876 #[no_mangle]
7877 /// Creates a new CResult_NetAddressDecodeErrorZ in the success state.
7878 pub extern "C" fn CResult_NetAddressDecodeErrorZ_ok(o: crate::lightning::ln::msgs::NetAddress) -> CResult_NetAddressDecodeErrorZ {
7879         CResult_NetAddressDecodeErrorZ {
7880                 contents: CResult_NetAddressDecodeErrorZPtr {
7881                         result: Box::into_raw(Box::new(o)),
7882                 },
7883                 result_ok: true,
7884         }
7885 }
7886 #[no_mangle]
7887 /// Creates a new CResult_NetAddressDecodeErrorZ in the error state.
7888 pub extern "C" fn CResult_NetAddressDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NetAddressDecodeErrorZ {
7889         CResult_NetAddressDecodeErrorZ {
7890                 contents: CResult_NetAddressDecodeErrorZPtr {
7891                         err: Box::into_raw(Box::new(e)),
7892                 },
7893                 result_ok: false,
7894         }
7895 }
7896 #[no_mangle]
7897 /// Frees any resources used by the CResult_NetAddressDecodeErrorZ.
7898 pub extern "C" fn CResult_NetAddressDecodeErrorZ_free(_res: CResult_NetAddressDecodeErrorZ) { }
7899 impl Drop for CResult_NetAddressDecodeErrorZ {
7900         fn drop(&mut self) {
7901                 if self.result_ok {
7902                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
7903                                 let _ = unsafe { Box::from_raw(self.contents.result) };
7904                         }
7905                 } else {
7906                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
7907                                 let _ = unsafe { Box::from_raw(self.contents.err) };
7908                         }
7909                 }
7910         }
7911 }
7912 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::NetAddress, crate::lightning::ln::msgs::DecodeError>> for CResult_NetAddressDecodeErrorZ {
7913         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::NetAddress, crate::lightning::ln::msgs::DecodeError>) -> Self {
7914                 let contents = if o.result_ok {
7915                         let result = unsafe { o.contents.result };
7916                         unsafe { o.contents.result = std::ptr::null_mut() };
7917                         CResult_NetAddressDecodeErrorZPtr { result }
7918                 } else {
7919                         let err = unsafe { o.contents.err };
7920                         unsafe { o.contents.err = std::ptr::null_mut(); }
7921                         CResult_NetAddressDecodeErrorZPtr { err }
7922                 };
7923                 Self {
7924                         contents,
7925                         result_ok: o.result_ok,
7926                 }
7927         }
7928 }
7929 impl Clone for CResult_NetAddressDecodeErrorZ {
7930         fn clone(&self) -> Self {
7931                 if self.result_ok {
7932                         Self { result_ok: true, contents: CResult_NetAddressDecodeErrorZPtr {
7933                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::NetAddress>::clone(unsafe { &*self.contents.result })))
7934                         } }
7935                 } else {
7936                         Self { result_ok: false, contents: CResult_NetAddressDecodeErrorZPtr {
7937                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
7938                         } }
7939                 }
7940         }
7941 }
7942 #[no_mangle]
7943 /// Creates a new CResult_NetAddressDecodeErrorZ which has the same data as `orig`
7944 /// but with all dynamically-allocated buffers duplicated in new buffers.
7945 pub extern "C" fn CResult_NetAddressDecodeErrorZ_clone(orig: &CResult_NetAddressDecodeErrorZ) -> CResult_NetAddressDecodeErrorZ { orig.clone() }
7946 #[repr(C)]
7947 /// A dynamically-allocated array of crate::lightning::ln::msgs::UpdateAddHTLCs of arbitrary size.
7948 /// This corresponds to std::vector in C++
7949 pub struct CVec_UpdateAddHTLCZ {
7950         /// The elements in the array.
7951         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
7952         pub data: *mut crate::lightning::ln::msgs::UpdateAddHTLC,
7953         /// The number of elements pointed to by `data`.
7954         pub datalen: usize
7955 }
7956 impl CVec_UpdateAddHTLCZ {
7957         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::UpdateAddHTLC> {
7958                 if self.datalen == 0 { return Vec::new(); }
7959                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
7960                 self.data = std::ptr::null_mut();
7961                 self.datalen = 0;
7962                 ret
7963         }
7964         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::UpdateAddHTLC] {
7965                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
7966         }
7967 }
7968 impl From<Vec<crate::lightning::ln::msgs::UpdateAddHTLC>> for CVec_UpdateAddHTLCZ {
7969         fn from(v: Vec<crate::lightning::ln::msgs::UpdateAddHTLC>) -> Self {
7970                 let datalen = v.len();
7971                 let data = Box::into_raw(v.into_boxed_slice());
7972                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
7973         }
7974 }
7975 #[no_mangle]
7976 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
7977 pub extern "C" fn CVec_UpdateAddHTLCZ_free(_res: CVec_UpdateAddHTLCZ) { }
7978 impl Drop for CVec_UpdateAddHTLCZ {
7979         fn drop(&mut self) {
7980                 if self.datalen == 0 { return; }
7981                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
7982         }
7983 }
7984 impl Clone for CVec_UpdateAddHTLCZ {
7985         fn clone(&self) -> Self {
7986                 let mut res = Vec::new();
7987                 if self.datalen == 0 { return Self::from(res); }
7988                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
7989                 Self::from(res)
7990         }
7991 }
7992 #[repr(C)]
7993 /// A dynamically-allocated array of crate::lightning::ln::msgs::UpdateFulfillHTLCs of arbitrary size.
7994 /// This corresponds to std::vector in C++
7995 pub struct CVec_UpdateFulfillHTLCZ {
7996         /// The elements in the array.
7997         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
7998         pub data: *mut crate::lightning::ln::msgs::UpdateFulfillHTLC,
7999         /// The number of elements pointed to by `data`.
8000         pub datalen: usize
8001 }
8002 impl CVec_UpdateFulfillHTLCZ {
8003         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::UpdateFulfillHTLC> {
8004                 if self.datalen == 0 { return Vec::new(); }
8005                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
8006                 self.data = std::ptr::null_mut();
8007                 self.datalen = 0;
8008                 ret
8009         }
8010         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::UpdateFulfillHTLC] {
8011                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
8012         }
8013 }
8014 impl From<Vec<crate::lightning::ln::msgs::UpdateFulfillHTLC>> for CVec_UpdateFulfillHTLCZ {
8015         fn from(v: Vec<crate::lightning::ln::msgs::UpdateFulfillHTLC>) -> Self {
8016                 let datalen = v.len();
8017                 let data = Box::into_raw(v.into_boxed_slice());
8018                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
8019         }
8020 }
8021 #[no_mangle]
8022 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
8023 pub extern "C" fn CVec_UpdateFulfillHTLCZ_free(_res: CVec_UpdateFulfillHTLCZ) { }
8024 impl Drop for CVec_UpdateFulfillHTLCZ {
8025         fn drop(&mut self) {
8026                 if self.datalen == 0 { return; }
8027                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
8028         }
8029 }
8030 impl Clone for CVec_UpdateFulfillHTLCZ {
8031         fn clone(&self) -> Self {
8032                 let mut res = Vec::new();
8033                 if self.datalen == 0 { return Self::from(res); }
8034                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
8035                 Self::from(res)
8036         }
8037 }
8038 #[repr(C)]
8039 /// A dynamically-allocated array of crate::lightning::ln::msgs::UpdateFailHTLCs of arbitrary size.
8040 /// This corresponds to std::vector in C++
8041 pub struct CVec_UpdateFailHTLCZ {
8042         /// The elements in the array.
8043         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
8044         pub data: *mut crate::lightning::ln::msgs::UpdateFailHTLC,
8045         /// The number of elements pointed to by `data`.
8046         pub datalen: usize
8047 }
8048 impl CVec_UpdateFailHTLCZ {
8049         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::UpdateFailHTLC> {
8050                 if self.datalen == 0 { return Vec::new(); }
8051                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
8052                 self.data = std::ptr::null_mut();
8053                 self.datalen = 0;
8054                 ret
8055         }
8056         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::UpdateFailHTLC] {
8057                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
8058         }
8059 }
8060 impl From<Vec<crate::lightning::ln::msgs::UpdateFailHTLC>> for CVec_UpdateFailHTLCZ {
8061         fn from(v: Vec<crate::lightning::ln::msgs::UpdateFailHTLC>) -> Self {
8062                 let datalen = v.len();
8063                 let data = Box::into_raw(v.into_boxed_slice());
8064                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
8065         }
8066 }
8067 #[no_mangle]
8068 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
8069 pub extern "C" fn CVec_UpdateFailHTLCZ_free(_res: CVec_UpdateFailHTLCZ) { }
8070 impl Drop for CVec_UpdateFailHTLCZ {
8071         fn drop(&mut self) {
8072                 if self.datalen == 0 { return; }
8073                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
8074         }
8075 }
8076 impl Clone for CVec_UpdateFailHTLCZ {
8077         fn clone(&self) -> Self {
8078                 let mut res = Vec::new();
8079                 if self.datalen == 0 { return Self::from(res); }
8080                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
8081                 Self::from(res)
8082         }
8083 }
8084 #[repr(C)]
8085 /// A dynamically-allocated array of crate::lightning::ln::msgs::UpdateFailMalformedHTLCs of arbitrary size.
8086 /// This corresponds to std::vector in C++
8087 pub struct CVec_UpdateFailMalformedHTLCZ {
8088         /// The elements in the array.
8089         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
8090         pub data: *mut crate::lightning::ln::msgs::UpdateFailMalformedHTLC,
8091         /// The number of elements pointed to by `data`.
8092         pub datalen: usize
8093 }
8094 impl CVec_UpdateFailMalformedHTLCZ {
8095         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::UpdateFailMalformedHTLC> {
8096                 if self.datalen == 0 { return Vec::new(); }
8097                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
8098                 self.data = std::ptr::null_mut();
8099                 self.datalen = 0;
8100                 ret
8101         }
8102         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::UpdateFailMalformedHTLC] {
8103                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
8104         }
8105 }
8106 impl From<Vec<crate::lightning::ln::msgs::UpdateFailMalformedHTLC>> for CVec_UpdateFailMalformedHTLCZ {
8107         fn from(v: Vec<crate::lightning::ln::msgs::UpdateFailMalformedHTLC>) -> Self {
8108                 let datalen = v.len();
8109                 let data = Box::into_raw(v.into_boxed_slice());
8110                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
8111         }
8112 }
8113 #[no_mangle]
8114 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
8115 pub extern "C" fn CVec_UpdateFailMalformedHTLCZ_free(_res: CVec_UpdateFailMalformedHTLCZ) { }
8116 impl Drop for CVec_UpdateFailMalformedHTLCZ {
8117         fn drop(&mut self) {
8118                 if self.datalen == 0 { return; }
8119                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
8120         }
8121 }
8122 impl Clone for CVec_UpdateFailMalformedHTLCZ {
8123         fn clone(&self) -> Self {
8124                 let mut res = Vec::new();
8125                 if self.datalen == 0 { return Self::from(res); }
8126                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
8127                 Self::from(res)
8128         }
8129 }
8130 #[repr(C)]
8131 /// The contents of CResult_AcceptChannelDecodeErrorZ
8132 pub union CResult_AcceptChannelDecodeErrorZPtr {
8133         /// A pointer to the contents in the success state.
8134         /// Reading from this pointer when `result_ok` is not set is undefined.
8135         pub result: *mut crate::lightning::ln::msgs::AcceptChannel,
8136         /// A pointer to the contents in the error state.
8137         /// Reading from this pointer when `result_ok` is set is undefined.
8138         pub err: *mut crate::lightning::ln::msgs::DecodeError,
8139 }
8140 #[repr(C)]
8141 /// A CResult_AcceptChannelDecodeErrorZ represents the result of a fallible operation,
8142 /// containing a crate::lightning::ln::msgs::AcceptChannel on success and a crate::lightning::ln::msgs::DecodeError on failure.
8143 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8144 pub struct CResult_AcceptChannelDecodeErrorZ {
8145         /// The contents of this CResult_AcceptChannelDecodeErrorZ, accessible via either
8146         /// `err` or `result` depending on the state of `result_ok`.
8147         pub contents: CResult_AcceptChannelDecodeErrorZPtr,
8148         /// Whether this CResult_AcceptChannelDecodeErrorZ represents a success state.
8149         pub result_ok: bool,
8150 }
8151 #[no_mangle]
8152 /// Creates a new CResult_AcceptChannelDecodeErrorZ in the success state.
8153 pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_ok(o: crate::lightning::ln::msgs::AcceptChannel) -> CResult_AcceptChannelDecodeErrorZ {
8154         CResult_AcceptChannelDecodeErrorZ {
8155                 contents: CResult_AcceptChannelDecodeErrorZPtr {
8156                         result: Box::into_raw(Box::new(o)),
8157                 },
8158                 result_ok: true,
8159         }
8160 }
8161 #[no_mangle]
8162 /// Creates a new CResult_AcceptChannelDecodeErrorZ in the error state.
8163 pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_AcceptChannelDecodeErrorZ {
8164         CResult_AcceptChannelDecodeErrorZ {
8165                 contents: CResult_AcceptChannelDecodeErrorZPtr {
8166                         err: Box::into_raw(Box::new(e)),
8167                 },
8168                 result_ok: false,
8169         }
8170 }
8171 #[no_mangle]
8172 /// Frees any resources used by the CResult_AcceptChannelDecodeErrorZ.
8173 pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_free(_res: CResult_AcceptChannelDecodeErrorZ) { }
8174 impl Drop for CResult_AcceptChannelDecodeErrorZ {
8175         fn drop(&mut self) {
8176                 if self.result_ok {
8177                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
8178                                 let _ = unsafe { Box::from_raw(self.contents.result) };
8179                         }
8180                 } else {
8181                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
8182                                 let _ = unsafe { Box::from_raw(self.contents.err) };
8183                         }
8184                 }
8185         }
8186 }
8187 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::AcceptChannel, crate::lightning::ln::msgs::DecodeError>> for CResult_AcceptChannelDecodeErrorZ {
8188         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::AcceptChannel, crate::lightning::ln::msgs::DecodeError>) -> Self {
8189                 let contents = if o.result_ok {
8190                         let result = unsafe { o.contents.result };
8191                         unsafe { o.contents.result = std::ptr::null_mut() };
8192                         CResult_AcceptChannelDecodeErrorZPtr { result }
8193                 } else {
8194                         let err = unsafe { o.contents.err };
8195                         unsafe { o.contents.err = std::ptr::null_mut(); }
8196                         CResult_AcceptChannelDecodeErrorZPtr { err }
8197                 };
8198                 Self {
8199                         contents,
8200                         result_ok: o.result_ok,
8201                 }
8202         }
8203 }
8204 impl Clone for CResult_AcceptChannelDecodeErrorZ {
8205         fn clone(&self) -> Self {
8206                 if self.result_ok {
8207                         Self { result_ok: true, contents: CResult_AcceptChannelDecodeErrorZPtr {
8208                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::AcceptChannel>::clone(unsafe { &*self.contents.result })))
8209                         } }
8210                 } else {
8211                         Self { result_ok: false, contents: CResult_AcceptChannelDecodeErrorZPtr {
8212                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
8213                         } }
8214                 }
8215         }
8216 }
8217 #[no_mangle]
8218 /// Creates a new CResult_AcceptChannelDecodeErrorZ which has the same data as `orig`
8219 /// but with all dynamically-allocated buffers duplicated in new buffers.
8220 pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_clone(orig: &CResult_AcceptChannelDecodeErrorZ) -> CResult_AcceptChannelDecodeErrorZ { orig.clone() }
8221 #[repr(C)]
8222 /// The contents of CResult_AnnouncementSignaturesDecodeErrorZ
8223 pub union CResult_AnnouncementSignaturesDecodeErrorZPtr {
8224         /// A pointer to the contents in the success state.
8225         /// Reading from this pointer when `result_ok` is not set is undefined.
8226         pub result: *mut crate::lightning::ln::msgs::AnnouncementSignatures,
8227         /// A pointer to the contents in the error state.
8228         /// Reading from this pointer when `result_ok` is set is undefined.
8229         pub err: *mut crate::lightning::ln::msgs::DecodeError,
8230 }
8231 #[repr(C)]
8232 /// A CResult_AnnouncementSignaturesDecodeErrorZ represents the result of a fallible operation,
8233 /// containing a crate::lightning::ln::msgs::AnnouncementSignatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
8234 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8235 pub struct CResult_AnnouncementSignaturesDecodeErrorZ {
8236         /// The contents of this CResult_AnnouncementSignaturesDecodeErrorZ, accessible via either
8237         /// `err` or `result` depending on the state of `result_ok`.
8238         pub contents: CResult_AnnouncementSignaturesDecodeErrorZPtr,
8239         /// Whether this CResult_AnnouncementSignaturesDecodeErrorZ represents a success state.
8240         pub result_ok: bool,
8241 }
8242 #[no_mangle]
8243 /// Creates a new CResult_AnnouncementSignaturesDecodeErrorZ in the success state.
8244 pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_ok(o: crate::lightning::ln::msgs::AnnouncementSignatures) -> CResult_AnnouncementSignaturesDecodeErrorZ {
8245         CResult_AnnouncementSignaturesDecodeErrorZ {
8246                 contents: CResult_AnnouncementSignaturesDecodeErrorZPtr {
8247                         result: Box::into_raw(Box::new(o)),
8248                 },
8249                 result_ok: true,
8250         }
8251 }
8252 #[no_mangle]
8253 /// Creates a new CResult_AnnouncementSignaturesDecodeErrorZ in the error state.
8254 pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_AnnouncementSignaturesDecodeErrorZ {
8255         CResult_AnnouncementSignaturesDecodeErrorZ {
8256                 contents: CResult_AnnouncementSignaturesDecodeErrorZPtr {
8257                         err: Box::into_raw(Box::new(e)),
8258                 },
8259                 result_ok: false,
8260         }
8261 }
8262 #[no_mangle]
8263 /// Frees any resources used by the CResult_AnnouncementSignaturesDecodeErrorZ.
8264 pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_free(_res: CResult_AnnouncementSignaturesDecodeErrorZ) { }
8265 impl Drop for CResult_AnnouncementSignaturesDecodeErrorZ {
8266         fn drop(&mut self) {
8267                 if self.result_ok {
8268                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
8269                                 let _ = unsafe { Box::from_raw(self.contents.result) };
8270                         }
8271                 } else {
8272                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
8273                                 let _ = unsafe { Box::from_raw(self.contents.err) };
8274                         }
8275                 }
8276         }
8277 }
8278 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::AnnouncementSignatures, crate::lightning::ln::msgs::DecodeError>> for CResult_AnnouncementSignaturesDecodeErrorZ {
8279         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::AnnouncementSignatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
8280                 let contents = if o.result_ok {
8281                         let result = unsafe { o.contents.result };
8282                         unsafe { o.contents.result = std::ptr::null_mut() };
8283                         CResult_AnnouncementSignaturesDecodeErrorZPtr { result }
8284                 } else {
8285                         let err = unsafe { o.contents.err };
8286                         unsafe { o.contents.err = std::ptr::null_mut(); }
8287                         CResult_AnnouncementSignaturesDecodeErrorZPtr { err }
8288                 };
8289                 Self {
8290                         contents,
8291                         result_ok: o.result_ok,
8292                 }
8293         }
8294 }
8295 impl Clone for CResult_AnnouncementSignaturesDecodeErrorZ {
8296         fn clone(&self) -> Self {
8297                 if self.result_ok {
8298                         Self { result_ok: true, contents: CResult_AnnouncementSignaturesDecodeErrorZPtr {
8299                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::AnnouncementSignatures>::clone(unsafe { &*self.contents.result })))
8300                         } }
8301                 } else {
8302                         Self { result_ok: false, contents: CResult_AnnouncementSignaturesDecodeErrorZPtr {
8303                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
8304                         } }
8305                 }
8306         }
8307 }
8308 #[no_mangle]
8309 /// Creates a new CResult_AnnouncementSignaturesDecodeErrorZ which has the same data as `orig`
8310 /// but with all dynamically-allocated buffers duplicated in new buffers.
8311 pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_clone(orig: &CResult_AnnouncementSignaturesDecodeErrorZ) -> CResult_AnnouncementSignaturesDecodeErrorZ { orig.clone() }
8312 #[repr(C)]
8313 /// The contents of CResult_ChannelReestablishDecodeErrorZ
8314 pub union CResult_ChannelReestablishDecodeErrorZPtr {
8315         /// A pointer to the contents in the success state.
8316         /// Reading from this pointer when `result_ok` is not set is undefined.
8317         pub result: *mut crate::lightning::ln::msgs::ChannelReestablish,
8318         /// A pointer to the contents in the error state.
8319         /// Reading from this pointer when `result_ok` is set is undefined.
8320         pub err: *mut crate::lightning::ln::msgs::DecodeError,
8321 }
8322 #[repr(C)]
8323 /// A CResult_ChannelReestablishDecodeErrorZ represents the result of a fallible operation,
8324 /// containing a crate::lightning::ln::msgs::ChannelReestablish on success and a crate::lightning::ln::msgs::DecodeError on failure.
8325 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8326 pub struct CResult_ChannelReestablishDecodeErrorZ {
8327         /// The contents of this CResult_ChannelReestablishDecodeErrorZ, accessible via either
8328         /// `err` or `result` depending on the state of `result_ok`.
8329         pub contents: CResult_ChannelReestablishDecodeErrorZPtr,
8330         /// Whether this CResult_ChannelReestablishDecodeErrorZ represents a success state.
8331         pub result_ok: bool,
8332 }
8333 #[no_mangle]
8334 /// Creates a new CResult_ChannelReestablishDecodeErrorZ in the success state.
8335 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ChannelReestablish) -> CResult_ChannelReestablishDecodeErrorZ {
8336         CResult_ChannelReestablishDecodeErrorZ {
8337                 contents: CResult_ChannelReestablishDecodeErrorZPtr {
8338                         result: Box::into_raw(Box::new(o)),
8339                 },
8340                 result_ok: true,
8341         }
8342 }
8343 #[no_mangle]
8344 /// Creates a new CResult_ChannelReestablishDecodeErrorZ in the error state.
8345 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelReestablishDecodeErrorZ {
8346         CResult_ChannelReestablishDecodeErrorZ {
8347                 contents: CResult_ChannelReestablishDecodeErrorZPtr {
8348                         err: Box::into_raw(Box::new(e)),
8349                 },
8350                 result_ok: false,
8351         }
8352 }
8353 #[no_mangle]
8354 /// Frees any resources used by the CResult_ChannelReestablishDecodeErrorZ.
8355 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_free(_res: CResult_ChannelReestablishDecodeErrorZ) { }
8356 impl Drop for CResult_ChannelReestablishDecodeErrorZ {
8357         fn drop(&mut self) {
8358                 if self.result_ok {
8359                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
8360                                 let _ = unsafe { Box::from_raw(self.contents.result) };
8361                         }
8362                 } else {
8363                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
8364                                 let _ = unsafe { Box::from_raw(self.contents.err) };
8365                         }
8366                 }
8367         }
8368 }
8369 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelReestablish, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelReestablishDecodeErrorZ {
8370         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelReestablish, crate::lightning::ln::msgs::DecodeError>) -> Self {
8371                 let contents = if o.result_ok {
8372                         let result = unsafe { o.contents.result };
8373                         unsafe { o.contents.result = std::ptr::null_mut() };
8374                         CResult_ChannelReestablishDecodeErrorZPtr { result }
8375                 } else {
8376                         let err = unsafe { o.contents.err };
8377                         unsafe { o.contents.err = std::ptr::null_mut(); }
8378                         CResult_ChannelReestablishDecodeErrorZPtr { err }
8379                 };
8380                 Self {
8381                         contents,
8382                         result_ok: o.result_ok,
8383                 }
8384         }
8385 }
8386 impl Clone for CResult_ChannelReestablishDecodeErrorZ {
8387         fn clone(&self) -> Self {
8388                 if self.result_ok {
8389                         Self { result_ok: true, contents: CResult_ChannelReestablishDecodeErrorZPtr {
8390                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ChannelReestablish>::clone(unsafe { &*self.contents.result })))
8391                         } }
8392                 } else {
8393                         Self { result_ok: false, contents: CResult_ChannelReestablishDecodeErrorZPtr {
8394                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
8395                         } }
8396                 }
8397         }
8398 }
8399 #[no_mangle]
8400 /// Creates a new CResult_ChannelReestablishDecodeErrorZ which has the same data as `orig`
8401 /// but with all dynamically-allocated buffers duplicated in new buffers.
8402 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_clone(orig: &CResult_ChannelReestablishDecodeErrorZ) -> CResult_ChannelReestablishDecodeErrorZ { orig.clone() }
8403 #[repr(C)]
8404 /// The contents of CResult_ClosingSignedDecodeErrorZ
8405 pub union CResult_ClosingSignedDecodeErrorZPtr {
8406         /// A pointer to the contents in the success state.
8407         /// Reading from this pointer when `result_ok` is not set is undefined.
8408         pub result: *mut crate::lightning::ln::msgs::ClosingSigned,
8409         /// A pointer to the contents in the error state.
8410         /// Reading from this pointer when `result_ok` is set is undefined.
8411         pub err: *mut crate::lightning::ln::msgs::DecodeError,
8412 }
8413 #[repr(C)]
8414 /// A CResult_ClosingSignedDecodeErrorZ represents the result of a fallible operation,
8415 /// containing a crate::lightning::ln::msgs::ClosingSigned on success and a crate::lightning::ln::msgs::DecodeError on failure.
8416 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8417 pub struct CResult_ClosingSignedDecodeErrorZ {
8418         /// The contents of this CResult_ClosingSignedDecodeErrorZ, accessible via either
8419         /// `err` or `result` depending on the state of `result_ok`.
8420         pub contents: CResult_ClosingSignedDecodeErrorZPtr,
8421         /// Whether this CResult_ClosingSignedDecodeErrorZ represents a success state.
8422         pub result_ok: bool,
8423 }
8424 #[no_mangle]
8425 /// Creates a new CResult_ClosingSignedDecodeErrorZ in the success state.
8426 pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ClosingSigned) -> CResult_ClosingSignedDecodeErrorZ {
8427         CResult_ClosingSignedDecodeErrorZ {
8428                 contents: CResult_ClosingSignedDecodeErrorZPtr {
8429                         result: Box::into_raw(Box::new(o)),
8430                 },
8431                 result_ok: true,
8432         }
8433 }
8434 #[no_mangle]
8435 /// Creates a new CResult_ClosingSignedDecodeErrorZ in the error state.
8436 pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ClosingSignedDecodeErrorZ {
8437         CResult_ClosingSignedDecodeErrorZ {
8438                 contents: CResult_ClosingSignedDecodeErrorZPtr {
8439                         err: Box::into_raw(Box::new(e)),
8440                 },
8441                 result_ok: false,
8442         }
8443 }
8444 #[no_mangle]
8445 /// Frees any resources used by the CResult_ClosingSignedDecodeErrorZ.
8446 pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_free(_res: CResult_ClosingSignedDecodeErrorZ) { }
8447 impl Drop for CResult_ClosingSignedDecodeErrorZ {
8448         fn drop(&mut self) {
8449                 if self.result_ok {
8450                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
8451                                 let _ = unsafe { Box::from_raw(self.contents.result) };
8452                         }
8453                 } else {
8454                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
8455                                 let _ = unsafe { Box::from_raw(self.contents.err) };
8456                         }
8457                 }
8458         }
8459 }
8460 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ClosingSigned, crate::lightning::ln::msgs::DecodeError>> for CResult_ClosingSignedDecodeErrorZ {
8461         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ClosingSigned, crate::lightning::ln::msgs::DecodeError>) -> Self {
8462                 let contents = if o.result_ok {
8463                         let result = unsafe { o.contents.result };
8464                         unsafe { o.contents.result = std::ptr::null_mut() };
8465                         CResult_ClosingSignedDecodeErrorZPtr { result }
8466                 } else {
8467                         let err = unsafe { o.contents.err };
8468                         unsafe { o.contents.err = std::ptr::null_mut(); }
8469                         CResult_ClosingSignedDecodeErrorZPtr { err }
8470                 };
8471                 Self {
8472                         contents,
8473                         result_ok: o.result_ok,
8474                 }
8475         }
8476 }
8477 impl Clone for CResult_ClosingSignedDecodeErrorZ {
8478         fn clone(&self) -> Self {
8479                 if self.result_ok {
8480                         Self { result_ok: true, contents: CResult_ClosingSignedDecodeErrorZPtr {
8481                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ClosingSigned>::clone(unsafe { &*self.contents.result })))
8482                         } }
8483                 } else {
8484                         Self { result_ok: false, contents: CResult_ClosingSignedDecodeErrorZPtr {
8485                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
8486                         } }
8487                 }
8488         }
8489 }
8490 #[no_mangle]
8491 /// Creates a new CResult_ClosingSignedDecodeErrorZ which has the same data as `orig`
8492 /// but with all dynamically-allocated buffers duplicated in new buffers.
8493 pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_clone(orig: &CResult_ClosingSignedDecodeErrorZ) -> CResult_ClosingSignedDecodeErrorZ { orig.clone() }
8494 #[repr(C)]
8495 /// The contents of CResult_CommitmentSignedDecodeErrorZ
8496 pub union CResult_CommitmentSignedDecodeErrorZPtr {
8497         /// A pointer to the contents in the success state.
8498         /// Reading from this pointer when `result_ok` is not set is undefined.
8499         pub result: *mut crate::lightning::ln::msgs::CommitmentSigned,
8500         /// A pointer to the contents in the error state.
8501         /// Reading from this pointer when `result_ok` is set is undefined.
8502         pub err: *mut crate::lightning::ln::msgs::DecodeError,
8503 }
8504 #[repr(C)]
8505 /// A CResult_CommitmentSignedDecodeErrorZ represents the result of a fallible operation,
8506 /// containing a crate::lightning::ln::msgs::CommitmentSigned on success and a crate::lightning::ln::msgs::DecodeError on failure.
8507 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8508 pub struct CResult_CommitmentSignedDecodeErrorZ {
8509         /// The contents of this CResult_CommitmentSignedDecodeErrorZ, accessible via either
8510         /// `err` or `result` depending on the state of `result_ok`.
8511         pub contents: CResult_CommitmentSignedDecodeErrorZPtr,
8512         /// Whether this CResult_CommitmentSignedDecodeErrorZ represents a success state.
8513         pub result_ok: bool,
8514 }
8515 #[no_mangle]
8516 /// Creates a new CResult_CommitmentSignedDecodeErrorZ in the success state.
8517 pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_ok(o: crate::lightning::ln::msgs::CommitmentSigned) -> CResult_CommitmentSignedDecodeErrorZ {
8518         CResult_CommitmentSignedDecodeErrorZ {
8519                 contents: CResult_CommitmentSignedDecodeErrorZPtr {
8520                         result: Box::into_raw(Box::new(o)),
8521                 },
8522                 result_ok: true,
8523         }
8524 }
8525 #[no_mangle]
8526 /// Creates a new CResult_CommitmentSignedDecodeErrorZ in the error state.
8527 pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_CommitmentSignedDecodeErrorZ {
8528         CResult_CommitmentSignedDecodeErrorZ {
8529                 contents: CResult_CommitmentSignedDecodeErrorZPtr {
8530                         err: Box::into_raw(Box::new(e)),
8531                 },
8532                 result_ok: false,
8533         }
8534 }
8535 #[no_mangle]
8536 /// Frees any resources used by the CResult_CommitmentSignedDecodeErrorZ.
8537 pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_free(_res: CResult_CommitmentSignedDecodeErrorZ) { }
8538 impl Drop for CResult_CommitmentSignedDecodeErrorZ {
8539         fn drop(&mut self) {
8540                 if self.result_ok {
8541                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
8542                                 let _ = unsafe { Box::from_raw(self.contents.result) };
8543                         }
8544                 } else {
8545                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
8546                                 let _ = unsafe { Box::from_raw(self.contents.err) };
8547                         }
8548                 }
8549         }
8550 }
8551 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::CommitmentSigned, crate::lightning::ln::msgs::DecodeError>> for CResult_CommitmentSignedDecodeErrorZ {
8552         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::CommitmentSigned, crate::lightning::ln::msgs::DecodeError>) -> Self {
8553                 let contents = if o.result_ok {
8554                         let result = unsafe { o.contents.result };
8555                         unsafe { o.contents.result = std::ptr::null_mut() };
8556                         CResult_CommitmentSignedDecodeErrorZPtr { result }
8557                 } else {
8558                         let err = unsafe { o.contents.err };
8559                         unsafe { o.contents.err = std::ptr::null_mut(); }
8560                         CResult_CommitmentSignedDecodeErrorZPtr { err }
8561                 };
8562                 Self {
8563                         contents,
8564                         result_ok: o.result_ok,
8565                 }
8566         }
8567 }
8568 impl Clone for CResult_CommitmentSignedDecodeErrorZ {
8569         fn clone(&self) -> Self {
8570                 if self.result_ok {
8571                         Self { result_ok: true, contents: CResult_CommitmentSignedDecodeErrorZPtr {
8572                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::CommitmentSigned>::clone(unsafe { &*self.contents.result })))
8573                         } }
8574                 } else {
8575                         Self { result_ok: false, contents: CResult_CommitmentSignedDecodeErrorZPtr {
8576                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
8577                         } }
8578                 }
8579         }
8580 }
8581 #[no_mangle]
8582 /// Creates a new CResult_CommitmentSignedDecodeErrorZ which has the same data as `orig`
8583 /// but with all dynamically-allocated buffers duplicated in new buffers.
8584 pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_clone(orig: &CResult_CommitmentSignedDecodeErrorZ) -> CResult_CommitmentSignedDecodeErrorZ { orig.clone() }
8585 #[repr(C)]
8586 /// The contents of CResult_FundingCreatedDecodeErrorZ
8587 pub union CResult_FundingCreatedDecodeErrorZPtr {
8588         /// A pointer to the contents in the success state.
8589         /// Reading from this pointer when `result_ok` is not set is undefined.
8590         pub result: *mut crate::lightning::ln::msgs::FundingCreated,
8591         /// A pointer to the contents in the error state.
8592         /// Reading from this pointer when `result_ok` is set is undefined.
8593         pub err: *mut crate::lightning::ln::msgs::DecodeError,
8594 }
8595 #[repr(C)]
8596 /// A CResult_FundingCreatedDecodeErrorZ represents the result of a fallible operation,
8597 /// containing a crate::lightning::ln::msgs::FundingCreated on success and a crate::lightning::ln::msgs::DecodeError on failure.
8598 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8599 pub struct CResult_FundingCreatedDecodeErrorZ {
8600         /// The contents of this CResult_FundingCreatedDecodeErrorZ, accessible via either
8601         /// `err` or `result` depending on the state of `result_ok`.
8602         pub contents: CResult_FundingCreatedDecodeErrorZPtr,
8603         /// Whether this CResult_FundingCreatedDecodeErrorZ represents a success state.
8604         pub result_ok: bool,
8605 }
8606 #[no_mangle]
8607 /// Creates a new CResult_FundingCreatedDecodeErrorZ in the success state.
8608 pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_ok(o: crate::lightning::ln::msgs::FundingCreated) -> CResult_FundingCreatedDecodeErrorZ {
8609         CResult_FundingCreatedDecodeErrorZ {
8610                 contents: CResult_FundingCreatedDecodeErrorZPtr {
8611                         result: Box::into_raw(Box::new(o)),
8612                 },
8613                 result_ok: true,
8614         }
8615 }
8616 #[no_mangle]
8617 /// Creates a new CResult_FundingCreatedDecodeErrorZ in the error state.
8618 pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_FundingCreatedDecodeErrorZ {
8619         CResult_FundingCreatedDecodeErrorZ {
8620                 contents: CResult_FundingCreatedDecodeErrorZPtr {
8621                         err: Box::into_raw(Box::new(e)),
8622                 },
8623                 result_ok: false,
8624         }
8625 }
8626 #[no_mangle]
8627 /// Frees any resources used by the CResult_FundingCreatedDecodeErrorZ.
8628 pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_free(_res: CResult_FundingCreatedDecodeErrorZ) { }
8629 impl Drop for CResult_FundingCreatedDecodeErrorZ {
8630         fn drop(&mut self) {
8631                 if self.result_ok {
8632                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
8633                                 let _ = unsafe { Box::from_raw(self.contents.result) };
8634                         }
8635                 } else {
8636                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
8637                                 let _ = unsafe { Box::from_raw(self.contents.err) };
8638                         }
8639                 }
8640         }
8641 }
8642 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::FundingCreated, crate::lightning::ln::msgs::DecodeError>> for CResult_FundingCreatedDecodeErrorZ {
8643         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::FundingCreated, crate::lightning::ln::msgs::DecodeError>) -> Self {
8644                 let contents = if o.result_ok {
8645                         let result = unsafe { o.contents.result };
8646                         unsafe { o.contents.result = std::ptr::null_mut() };
8647                         CResult_FundingCreatedDecodeErrorZPtr { result }
8648                 } else {
8649                         let err = unsafe { o.contents.err };
8650                         unsafe { o.contents.err = std::ptr::null_mut(); }
8651                         CResult_FundingCreatedDecodeErrorZPtr { err }
8652                 };
8653                 Self {
8654                         contents,
8655                         result_ok: o.result_ok,
8656                 }
8657         }
8658 }
8659 impl Clone for CResult_FundingCreatedDecodeErrorZ {
8660         fn clone(&self) -> Self {
8661                 if self.result_ok {
8662                         Self { result_ok: true, contents: CResult_FundingCreatedDecodeErrorZPtr {
8663                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::FundingCreated>::clone(unsafe { &*self.contents.result })))
8664                         } }
8665                 } else {
8666                         Self { result_ok: false, contents: CResult_FundingCreatedDecodeErrorZPtr {
8667                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
8668                         } }
8669                 }
8670         }
8671 }
8672 #[no_mangle]
8673 /// Creates a new CResult_FundingCreatedDecodeErrorZ which has the same data as `orig`
8674 /// but with all dynamically-allocated buffers duplicated in new buffers.
8675 pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_clone(orig: &CResult_FundingCreatedDecodeErrorZ) -> CResult_FundingCreatedDecodeErrorZ { orig.clone() }
8676 #[repr(C)]
8677 /// The contents of CResult_FundingSignedDecodeErrorZ
8678 pub union CResult_FundingSignedDecodeErrorZPtr {
8679         /// A pointer to the contents in the success state.
8680         /// Reading from this pointer when `result_ok` is not set is undefined.
8681         pub result: *mut crate::lightning::ln::msgs::FundingSigned,
8682         /// A pointer to the contents in the error state.
8683         /// Reading from this pointer when `result_ok` is set is undefined.
8684         pub err: *mut crate::lightning::ln::msgs::DecodeError,
8685 }
8686 #[repr(C)]
8687 /// A CResult_FundingSignedDecodeErrorZ represents the result of a fallible operation,
8688 /// containing a crate::lightning::ln::msgs::FundingSigned on success and a crate::lightning::ln::msgs::DecodeError on failure.
8689 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8690 pub struct CResult_FundingSignedDecodeErrorZ {
8691         /// The contents of this CResult_FundingSignedDecodeErrorZ, accessible via either
8692         /// `err` or `result` depending on the state of `result_ok`.
8693         pub contents: CResult_FundingSignedDecodeErrorZPtr,
8694         /// Whether this CResult_FundingSignedDecodeErrorZ represents a success state.
8695         pub result_ok: bool,
8696 }
8697 #[no_mangle]
8698 /// Creates a new CResult_FundingSignedDecodeErrorZ in the success state.
8699 pub extern "C" fn CResult_FundingSignedDecodeErrorZ_ok(o: crate::lightning::ln::msgs::FundingSigned) -> CResult_FundingSignedDecodeErrorZ {
8700         CResult_FundingSignedDecodeErrorZ {
8701                 contents: CResult_FundingSignedDecodeErrorZPtr {
8702                         result: Box::into_raw(Box::new(o)),
8703                 },
8704                 result_ok: true,
8705         }
8706 }
8707 #[no_mangle]
8708 /// Creates a new CResult_FundingSignedDecodeErrorZ in the error state.
8709 pub extern "C" fn CResult_FundingSignedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_FundingSignedDecodeErrorZ {
8710         CResult_FundingSignedDecodeErrorZ {
8711                 contents: CResult_FundingSignedDecodeErrorZPtr {
8712                         err: Box::into_raw(Box::new(e)),
8713                 },
8714                 result_ok: false,
8715         }
8716 }
8717 #[no_mangle]
8718 /// Frees any resources used by the CResult_FundingSignedDecodeErrorZ.
8719 pub extern "C" fn CResult_FundingSignedDecodeErrorZ_free(_res: CResult_FundingSignedDecodeErrorZ) { }
8720 impl Drop for CResult_FundingSignedDecodeErrorZ {
8721         fn drop(&mut self) {
8722                 if self.result_ok {
8723                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
8724                                 let _ = unsafe { Box::from_raw(self.contents.result) };
8725                         }
8726                 } else {
8727                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
8728                                 let _ = unsafe { Box::from_raw(self.contents.err) };
8729                         }
8730                 }
8731         }
8732 }
8733 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::FundingSigned, crate::lightning::ln::msgs::DecodeError>> for CResult_FundingSignedDecodeErrorZ {
8734         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::FundingSigned, crate::lightning::ln::msgs::DecodeError>) -> Self {
8735                 let contents = if o.result_ok {
8736                         let result = unsafe { o.contents.result };
8737                         unsafe { o.contents.result = std::ptr::null_mut() };
8738                         CResult_FundingSignedDecodeErrorZPtr { result }
8739                 } else {
8740                         let err = unsafe { o.contents.err };
8741                         unsafe { o.contents.err = std::ptr::null_mut(); }
8742                         CResult_FundingSignedDecodeErrorZPtr { err }
8743                 };
8744                 Self {
8745                         contents,
8746                         result_ok: o.result_ok,
8747                 }
8748         }
8749 }
8750 impl Clone for CResult_FundingSignedDecodeErrorZ {
8751         fn clone(&self) -> Self {
8752                 if self.result_ok {
8753                         Self { result_ok: true, contents: CResult_FundingSignedDecodeErrorZPtr {
8754                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::FundingSigned>::clone(unsafe { &*self.contents.result })))
8755                         } }
8756                 } else {
8757                         Self { result_ok: false, contents: CResult_FundingSignedDecodeErrorZPtr {
8758                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
8759                         } }
8760                 }
8761         }
8762 }
8763 #[no_mangle]
8764 /// Creates a new CResult_FundingSignedDecodeErrorZ which has the same data as `orig`
8765 /// but with all dynamically-allocated buffers duplicated in new buffers.
8766 pub extern "C" fn CResult_FundingSignedDecodeErrorZ_clone(orig: &CResult_FundingSignedDecodeErrorZ) -> CResult_FundingSignedDecodeErrorZ { orig.clone() }
8767 #[repr(C)]
8768 /// The contents of CResult_FundingLockedDecodeErrorZ
8769 pub union CResult_FundingLockedDecodeErrorZPtr {
8770         /// A pointer to the contents in the success state.
8771         /// Reading from this pointer when `result_ok` is not set is undefined.
8772         pub result: *mut crate::lightning::ln::msgs::FundingLocked,
8773         /// A pointer to the contents in the error state.
8774         /// Reading from this pointer when `result_ok` is set is undefined.
8775         pub err: *mut crate::lightning::ln::msgs::DecodeError,
8776 }
8777 #[repr(C)]
8778 /// A CResult_FundingLockedDecodeErrorZ represents the result of a fallible operation,
8779 /// containing a crate::lightning::ln::msgs::FundingLocked on success and a crate::lightning::ln::msgs::DecodeError on failure.
8780 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8781 pub struct CResult_FundingLockedDecodeErrorZ {
8782         /// The contents of this CResult_FundingLockedDecodeErrorZ, accessible via either
8783         /// `err` or `result` depending on the state of `result_ok`.
8784         pub contents: CResult_FundingLockedDecodeErrorZPtr,
8785         /// Whether this CResult_FundingLockedDecodeErrorZ represents a success state.
8786         pub result_ok: bool,
8787 }
8788 #[no_mangle]
8789 /// Creates a new CResult_FundingLockedDecodeErrorZ in the success state.
8790 pub extern "C" fn CResult_FundingLockedDecodeErrorZ_ok(o: crate::lightning::ln::msgs::FundingLocked) -> CResult_FundingLockedDecodeErrorZ {
8791         CResult_FundingLockedDecodeErrorZ {
8792                 contents: CResult_FundingLockedDecodeErrorZPtr {
8793                         result: Box::into_raw(Box::new(o)),
8794                 },
8795                 result_ok: true,
8796         }
8797 }
8798 #[no_mangle]
8799 /// Creates a new CResult_FundingLockedDecodeErrorZ in the error state.
8800 pub extern "C" fn CResult_FundingLockedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_FundingLockedDecodeErrorZ {
8801         CResult_FundingLockedDecodeErrorZ {
8802                 contents: CResult_FundingLockedDecodeErrorZPtr {
8803                         err: Box::into_raw(Box::new(e)),
8804                 },
8805                 result_ok: false,
8806         }
8807 }
8808 #[no_mangle]
8809 /// Frees any resources used by the CResult_FundingLockedDecodeErrorZ.
8810 pub extern "C" fn CResult_FundingLockedDecodeErrorZ_free(_res: CResult_FundingLockedDecodeErrorZ) { }
8811 impl Drop for CResult_FundingLockedDecodeErrorZ {
8812         fn drop(&mut self) {
8813                 if self.result_ok {
8814                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
8815                                 let _ = unsafe { Box::from_raw(self.contents.result) };
8816                         }
8817                 } else {
8818                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
8819                                 let _ = unsafe { Box::from_raw(self.contents.err) };
8820                         }
8821                 }
8822         }
8823 }
8824 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::FundingLocked, crate::lightning::ln::msgs::DecodeError>> for CResult_FundingLockedDecodeErrorZ {
8825         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::FundingLocked, crate::lightning::ln::msgs::DecodeError>) -> Self {
8826                 let contents = if o.result_ok {
8827                         let result = unsafe { o.contents.result };
8828                         unsafe { o.contents.result = std::ptr::null_mut() };
8829                         CResult_FundingLockedDecodeErrorZPtr { result }
8830                 } else {
8831                         let err = unsafe { o.contents.err };
8832                         unsafe { o.contents.err = std::ptr::null_mut(); }
8833                         CResult_FundingLockedDecodeErrorZPtr { err }
8834                 };
8835                 Self {
8836                         contents,
8837                         result_ok: o.result_ok,
8838                 }
8839         }
8840 }
8841 impl Clone for CResult_FundingLockedDecodeErrorZ {
8842         fn clone(&self) -> Self {
8843                 if self.result_ok {
8844                         Self { result_ok: true, contents: CResult_FundingLockedDecodeErrorZPtr {
8845                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::FundingLocked>::clone(unsafe { &*self.contents.result })))
8846                         } }
8847                 } else {
8848                         Self { result_ok: false, contents: CResult_FundingLockedDecodeErrorZPtr {
8849                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
8850                         } }
8851                 }
8852         }
8853 }
8854 #[no_mangle]
8855 /// Creates a new CResult_FundingLockedDecodeErrorZ which has the same data as `orig`
8856 /// but with all dynamically-allocated buffers duplicated in new buffers.
8857 pub extern "C" fn CResult_FundingLockedDecodeErrorZ_clone(orig: &CResult_FundingLockedDecodeErrorZ) -> CResult_FundingLockedDecodeErrorZ { orig.clone() }
8858 #[repr(C)]
8859 /// The contents of CResult_InitDecodeErrorZ
8860 pub union CResult_InitDecodeErrorZPtr {
8861         /// A pointer to the contents in the success state.
8862         /// Reading from this pointer when `result_ok` is not set is undefined.
8863         pub result: *mut crate::lightning::ln::msgs::Init,
8864         /// A pointer to the contents in the error state.
8865         /// Reading from this pointer when `result_ok` is set is undefined.
8866         pub err: *mut crate::lightning::ln::msgs::DecodeError,
8867 }
8868 #[repr(C)]
8869 /// A CResult_InitDecodeErrorZ represents the result of a fallible operation,
8870 /// containing a crate::lightning::ln::msgs::Init on success and a crate::lightning::ln::msgs::DecodeError on failure.
8871 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8872 pub struct CResult_InitDecodeErrorZ {
8873         /// The contents of this CResult_InitDecodeErrorZ, accessible via either
8874         /// `err` or `result` depending on the state of `result_ok`.
8875         pub contents: CResult_InitDecodeErrorZPtr,
8876         /// Whether this CResult_InitDecodeErrorZ represents a success state.
8877         pub result_ok: bool,
8878 }
8879 #[no_mangle]
8880 /// Creates a new CResult_InitDecodeErrorZ in the success state.
8881 pub extern "C" fn CResult_InitDecodeErrorZ_ok(o: crate::lightning::ln::msgs::Init) -> CResult_InitDecodeErrorZ {
8882         CResult_InitDecodeErrorZ {
8883                 contents: CResult_InitDecodeErrorZPtr {
8884                         result: Box::into_raw(Box::new(o)),
8885                 },
8886                 result_ok: true,
8887         }
8888 }
8889 #[no_mangle]
8890 /// Creates a new CResult_InitDecodeErrorZ in the error state.
8891 pub extern "C" fn CResult_InitDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_InitDecodeErrorZ {
8892         CResult_InitDecodeErrorZ {
8893                 contents: CResult_InitDecodeErrorZPtr {
8894                         err: Box::into_raw(Box::new(e)),
8895                 },
8896                 result_ok: false,
8897         }
8898 }
8899 #[no_mangle]
8900 /// Frees any resources used by the CResult_InitDecodeErrorZ.
8901 pub extern "C" fn CResult_InitDecodeErrorZ_free(_res: CResult_InitDecodeErrorZ) { }
8902 impl Drop for CResult_InitDecodeErrorZ {
8903         fn drop(&mut self) {
8904                 if self.result_ok {
8905                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
8906                                 let _ = unsafe { Box::from_raw(self.contents.result) };
8907                         }
8908                 } else {
8909                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
8910                                 let _ = unsafe { Box::from_raw(self.contents.err) };
8911                         }
8912                 }
8913         }
8914 }
8915 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::Init, crate::lightning::ln::msgs::DecodeError>> for CResult_InitDecodeErrorZ {
8916         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::Init, crate::lightning::ln::msgs::DecodeError>) -> Self {
8917                 let contents = if o.result_ok {
8918                         let result = unsafe { o.contents.result };
8919                         unsafe { o.contents.result = std::ptr::null_mut() };
8920                         CResult_InitDecodeErrorZPtr { result }
8921                 } else {
8922                         let err = unsafe { o.contents.err };
8923                         unsafe { o.contents.err = std::ptr::null_mut(); }
8924                         CResult_InitDecodeErrorZPtr { err }
8925                 };
8926                 Self {
8927                         contents,
8928                         result_ok: o.result_ok,
8929                 }
8930         }
8931 }
8932 impl Clone for CResult_InitDecodeErrorZ {
8933         fn clone(&self) -> Self {
8934                 if self.result_ok {
8935                         Self { result_ok: true, contents: CResult_InitDecodeErrorZPtr {
8936                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::Init>::clone(unsafe { &*self.contents.result })))
8937                         } }
8938                 } else {
8939                         Self { result_ok: false, contents: CResult_InitDecodeErrorZPtr {
8940                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
8941                         } }
8942                 }
8943         }
8944 }
8945 #[no_mangle]
8946 /// Creates a new CResult_InitDecodeErrorZ which has the same data as `orig`
8947 /// but with all dynamically-allocated buffers duplicated in new buffers.
8948 pub extern "C" fn CResult_InitDecodeErrorZ_clone(orig: &CResult_InitDecodeErrorZ) -> CResult_InitDecodeErrorZ { orig.clone() }
8949 #[repr(C)]
8950 /// The contents of CResult_OpenChannelDecodeErrorZ
8951 pub union CResult_OpenChannelDecodeErrorZPtr {
8952         /// A pointer to the contents in the success state.
8953         /// Reading from this pointer when `result_ok` is not set is undefined.
8954         pub result: *mut crate::lightning::ln::msgs::OpenChannel,
8955         /// A pointer to the contents in the error state.
8956         /// Reading from this pointer when `result_ok` is set is undefined.
8957         pub err: *mut crate::lightning::ln::msgs::DecodeError,
8958 }
8959 #[repr(C)]
8960 /// A CResult_OpenChannelDecodeErrorZ represents the result of a fallible operation,
8961 /// containing a crate::lightning::ln::msgs::OpenChannel on success and a crate::lightning::ln::msgs::DecodeError on failure.
8962 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8963 pub struct CResult_OpenChannelDecodeErrorZ {
8964         /// The contents of this CResult_OpenChannelDecodeErrorZ, accessible via either
8965         /// `err` or `result` depending on the state of `result_ok`.
8966         pub contents: CResult_OpenChannelDecodeErrorZPtr,
8967         /// Whether this CResult_OpenChannelDecodeErrorZ represents a success state.
8968         pub result_ok: bool,
8969 }
8970 #[no_mangle]
8971 /// Creates a new CResult_OpenChannelDecodeErrorZ in the success state.
8972 pub extern "C" fn CResult_OpenChannelDecodeErrorZ_ok(o: crate::lightning::ln::msgs::OpenChannel) -> CResult_OpenChannelDecodeErrorZ {
8973         CResult_OpenChannelDecodeErrorZ {
8974                 contents: CResult_OpenChannelDecodeErrorZPtr {
8975                         result: Box::into_raw(Box::new(o)),
8976                 },
8977                 result_ok: true,
8978         }
8979 }
8980 #[no_mangle]
8981 /// Creates a new CResult_OpenChannelDecodeErrorZ in the error state.
8982 pub extern "C" fn CResult_OpenChannelDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_OpenChannelDecodeErrorZ {
8983         CResult_OpenChannelDecodeErrorZ {
8984                 contents: CResult_OpenChannelDecodeErrorZPtr {
8985                         err: Box::into_raw(Box::new(e)),
8986                 },
8987                 result_ok: false,
8988         }
8989 }
8990 #[no_mangle]
8991 /// Frees any resources used by the CResult_OpenChannelDecodeErrorZ.
8992 pub extern "C" fn CResult_OpenChannelDecodeErrorZ_free(_res: CResult_OpenChannelDecodeErrorZ) { }
8993 impl Drop for CResult_OpenChannelDecodeErrorZ {
8994         fn drop(&mut self) {
8995                 if self.result_ok {
8996                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
8997                                 let _ = unsafe { Box::from_raw(self.contents.result) };
8998                         }
8999                 } else {
9000                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
9001                                 let _ = unsafe { Box::from_raw(self.contents.err) };
9002                         }
9003                 }
9004         }
9005 }
9006 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::OpenChannel, crate::lightning::ln::msgs::DecodeError>> for CResult_OpenChannelDecodeErrorZ {
9007         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::OpenChannel, crate::lightning::ln::msgs::DecodeError>) -> Self {
9008                 let contents = if o.result_ok {
9009                         let result = unsafe { o.contents.result };
9010                         unsafe { o.contents.result = std::ptr::null_mut() };
9011                         CResult_OpenChannelDecodeErrorZPtr { result }
9012                 } else {
9013                         let err = unsafe { o.contents.err };
9014                         unsafe { o.contents.err = std::ptr::null_mut(); }
9015                         CResult_OpenChannelDecodeErrorZPtr { err }
9016                 };
9017                 Self {
9018                         contents,
9019                         result_ok: o.result_ok,
9020                 }
9021         }
9022 }
9023 impl Clone for CResult_OpenChannelDecodeErrorZ {
9024         fn clone(&self) -> Self {
9025                 if self.result_ok {
9026                         Self { result_ok: true, contents: CResult_OpenChannelDecodeErrorZPtr {
9027                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::OpenChannel>::clone(unsafe { &*self.contents.result })))
9028                         } }
9029                 } else {
9030                         Self { result_ok: false, contents: CResult_OpenChannelDecodeErrorZPtr {
9031                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
9032                         } }
9033                 }
9034         }
9035 }
9036 #[no_mangle]
9037 /// Creates a new CResult_OpenChannelDecodeErrorZ which has the same data as `orig`
9038 /// but with all dynamically-allocated buffers duplicated in new buffers.
9039 pub extern "C" fn CResult_OpenChannelDecodeErrorZ_clone(orig: &CResult_OpenChannelDecodeErrorZ) -> CResult_OpenChannelDecodeErrorZ { orig.clone() }
9040 #[repr(C)]
9041 /// The contents of CResult_RevokeAndACKDecodeErrorZ
9042 pub union CResult_RevokeAndACKDecodeErrorZPtr {
9043         /// A pointer to the contents in the success state.
9044         /// Reading from this pointer when `result_ok` is not set is undefined.
9045         pub result: *mut crate::lightning::ln::msgs::RevokeAndACK,
9046         /// A pointer to the contents in the error state.
9047         /// Reading from this pointer when `result_ok` is set is undefined.
9048         pub err: *mut crate::lightning::ln::msgs::DecodeError,
9049 }
9050 #[repr(C)]
9051 /// A CResult_RevokeAndACKDecodeErrorZ represents the result of a fallible operation,
9052 /// containing a crate::lightning::ln::msgs::RevokeAndACK on success and a crate::lightning::ln::msgs::DecodeError on failure.
9053 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9054 pub struct CResult_RevokeAndACKDecodeErrorZ {
9055         /// The contents of this CResult_RevokeAndACKDecodeErrorZ, accessible via either
9056         /// `err` or `result` depending on the state of `result_ok`.
9057         pub contents: CResult_RevokeAndACKDecodeErrorZPtr,
9058         /// Whether this CResult_RevokeAndACKDecodeErrorZ represents a success state.
9059         pub result_ok: bool,
9060 }
9061 #[no_mangle]
9062 /// Creates a new CResult_RevokeAndACKDecodeErrorZ in the success state.
9063 pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_ok(o: crate::lightning::ln::msgs::RevokeAndACK) -> CResult_RevokeAndACKDecodeErrorZ {
9064         CResult_RevokeAndACKDecodeErrorZ {
9065                 contents: CResult_RevokeAndACKDecodeErrorZPtr {
9066                         result: Box::into_raw(Box::new(o)),
9067                 },
9068                 result_ok: true,
9069         }
9070 }
9071 #[no_mangle]
9072 /// Creates a new CResult_RevokeAndACKDecodeErrorZ in the error state.
9073 pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RevokeAndACKDecodeErrorZ {
9074         CResult_RevokeAndACKDecodeErrorZ {
9075                 contents: CResult_RevokeAndACKDecodeErrorZPtr {
9076                         err: Box::into_raw(Box::new(e)),
9077                 },
9078                 result_ok: false,
9079         }
9080 }
9081 #[no_mangle]
9082 /// Frees any resources used by the CResult_RevokeAndACKDecodeErrorZ.
9083 pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_free(_res: CResult_RevokeAndACKDecodeErrorZ) { }
9084 impl Drop for CResult_RevokeAndACKDecodeErrorZ {
9085         fn drop(&mut self) {
9086                 if self.result_ok {
9087                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
9088                                 let _ = unsafe { Box::from_raw(self.contents.result) };
9089                         }
9090                 } else {
9091                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
9092                                 let _ = unsafe { Box::from_raw(self.contents.err) };
9093                         }
9094                 }
9095         }
9096 }
9097 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::RevokeAndACK, crate::lightning::ln::msgs::DecodeError>> for CResult_RevokeAndACKDecodeErrorZ {
9098         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::RevokeAndACK, crate::lightning::ln::msgs::DecodeError>) -> Self {
9099                 let contents = if o.result_ok {
9100                         let result = unsafe { o.contents.result };
9101                         unsafe { o.contents.result = std::ptr::null_mut() };
9102                         CResult_RevokeAndACKDecodeErrorZPtr { result }
9103                 } else {
9104                         let err = unsafe { o.contents.err };
9105                         unsafe { o.contents.err = std::ptr::null_mut(); }
9106                         CResult_RevokeAndACKDecodeErrorZPtr { err }
9107                 };
9108                 Self {
9109                         contents,
9110                         result_ok: o.result_ok,
9111                 }
9112         }
9113 }
9114 impl Clone for CResult_RevokeAndACKDecodeErrorZ {
9115         fn clone(&self) -> Self {
9116                 if self.result_ok {
9117                         Self { result_ok: true, contents: CResult_RevokeAndACKDecodeErrorZPtr {
9118                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::RevokeAndACK>::clone(unsafe { &*self.contents.result })))
9119                         } }
9120                 } else {
9121                         Self { result_ok: false, contents: CResult_RevokeAndACKDecodeErrorZPtr {
9122                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
9123                         } }
9124                 }
9125         }
9126 }
9127 #[no_mangle]
9128 /// Creates a new CResult_RevokeAndACKDecodeErrorZ which has the same data as `orig`
9129 /// but with all dynamically-allocated buffers duplicated in new buffers.
9130 pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_clone(orig: &CResult_RevokeAndACKDecodeErrorZ) -> CResult_RevokeAndACKDecodeErrorZ { orig.clone() }
9131 #[repr(C)]
9132 /// The contents of CResult_ShutdownDecodeErrorZ
9133 pub union CResult_ShutdownDecodeErrorZPtr {
9134         /// A pointer to the contents in the success state.
9135         /// Reading from this pointer when `result_ok` is not set is undefined.
9136         pub result: *mut crate::lightning::ln::msgs::Shutdown,
9137         /// A pointer to the contents in the error state.
9138         /// Reading from this pointer when `result_ok` is set is undefined.
9139         pub err: *mut crate::lightning::ln::msgs::DecodeError,
9140 }
9141 #[repr(C)]
9142 /// A CResult_ShutdownDecodeErrorZ represents the result of a fallible operation,
9143 /// containing a crate::lightning::ln::msgs::Shutdown on success and a crate::lightning::ln::msgs::DecodeError on failure.
9144 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9145 pub struct CResult_ShutdownDecodeErrorZ {
9146         /// The contents of this CResult_ShutdownDecodeErrorZ, accessible via either
9147         /// `err` or `result` depending on the state of `result_ok`.
9148         pub contents: CResult_ShutdownDecodeErrorZPtr,
9149         /// Whether this CResult_ShutdownDecodeErrorZ represents a success state.
9150         pub result_ok: bool,
9151 }
9152 #[no_mangle]
9153 /// Creates a new CResult_ShutdownDecodeErrorZ in the success state.
9154 pub extern "C" fn CResult_ShutdownDecodeErrorZ_ok(o: crate::lightning::ln::msgs::Shutdown) -> CResult_ShutdownDecodeErrorZ {
9155         CResult_ShutdownDecodeErrorZ {
9156                 contents: CResult_ShutdownDecodeErrorZPtr {
9157                         result: Box::into_raw(Box::new(o)),
9158                 },
9159                 result_ok: true,
9160         }
9161 }
9162 #[no_mangle]
9163 /// Creates a new CResult_ShutdownDecodeErrorZ in the error state.
9164 pub extern "C" fn CResult_ShutdownDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ShutdownDecodeErrorZ {
9165         CResult_ShutdownDecodeErrorZ {
9166                 contents: CResult_ShutdownDecodeErrorZPtr {
9167                         err: Box::into_raw(Box::new(e)),
9168                 },
9169                 result_ok: false,
9170         }
9171 }
9172 #[no_mangle]
9173 /// Frees any resources used by the CResult_ShutdownDecodeErrorZ.
9174 pub extern "C" fn CResult_ShutdownDecodeErrorZ_free(_res: CResult_ShutdownDecodeErrorZ) { }
9175 impl Drop for CResult_ShutdownDecodeErrorZ {
9176         fn drop(&mut self) {
9177                 if self.result_ok {
9178                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
9179                                 let _ = unsafe { Box::from_raw(self.contents.result) };
9180                         }
9181                 } else {
9182                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
9183                                 let _ = unsafe { Box::from_raw(self.contents.err) };
9184                         }
9185                 }
9186         }
9187 }
9188 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::Shutdown, crate::lightning::ln::msgs::DecodeError>> for CResult_ShutdownDecodeErrorZ {
9189         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::Shutdown, crate::lightning::ln::msgs::DecodeError>) -> Self {
9190                 let contents = if o.result_ok {
9191                         let result = unsafe { o.contents.result };
9192                         unsafe { o.contents.result = std::ptr::null_mut() };
9193                         CResult_ShutdownDecodeErrorZPtr { result }
9194                 } else {
9195                         let err = unsafe { o.contents.err };
9196                         unsafe { o.contents.err = std::ptr::null_mut(); }
9197                         CResult_ShutdownDecodeErrorZPtr { err }
9198                 };
9199                 Self {
9200                         contents,
9201                         result_ok: o.result_ok,
9202                 }
9203         }
9204 }
9205 impl Clone for CResult_ShutdownDecodeErrorZ {
9206         fn clone(&self) -> Self {
9207                 if self.result_ok {
9208                         Self { result_ok: true, contents: CResult_ShutdownDecodeErrorZPtr {
9209                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::Shutdown>::clone(unsafe { &*self.contents.result })))
9210                         } }
9211                 } else {
9212                         Self { result_ok: false, contents: CResult_ShutdownDecodeErrorZPtr {
9213                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
9214                         } }
9215                 }
9216         }
9217 }
9218 #[no_mangle]
9219 /// Creates a new CResult_ShutdownDecodeErrorZ which has the same data as `orig`
9220 /// but with all dynamically-allocated buffers duplicated in new buffers.
9221 pub extern "C" fn CResult_ShutdownDecodeErrorZ_clone(orig: &CResult_ShutdownDecodeErrorZ) -> CResult_ShutdownDecodeErrorZ { orig.clone() }
9222 #[repr(C)]
9223 /// The contents of CResult_UpdateFailHTLCDecodeErrorZ
9224 pub union CResult_UpdateFailHTLCDecodeErrorZPtr {
9225         /// A pointer to the contents in the success state.
9226         /// Reading from this pointer when `result_ok` is not set is undefined.
9227         pub result: *mut crate::lightning::ln::msgs::UpdateFailHTLC,
9228         /// A pointer to the contents in the error state.
9229         /// Reading from this pointer when `result_ok` is set is undefined.
9230         pub err: *mut crate::lightning::ln::msgs::DecodeError,
9231 }
9232 #[repr(C)]
9233 /// A CResult_UpdateFailHTLCDecodeErrorZ represents the result of a fallible operation,
9234 /// containing a crate::lightning::ln::msgs::UpdateFailHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
9235 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9236 pub struct CResult_UpdateFailHTLCDecodeErrorZ {
9237         /// The contents of this CResult_UpdateFailHTLCDecodeErrorZ, accessible via either
9238         /// `err` or `result` depending on the state of `result_ok`.
9239         pub contents: CResult_UpdateFailHTLCDecodeErrorZPtr,
9240         /// Whether this CResult_UpdateFailHTLCDecodeErrorZ represents a success state.
9241         pub result_ok: bool,
9242 }
9243 #[no_mangle]
9244 /// Creates a new CResult_UpdateFailHTLCDecodeErrorZ in the success state.
9245 pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateFailHTLC) -> CResult_UpdateFailHTLCDecodeErrorZ {
9246         CResult_UpdateFailHTLCDecodeErrorZ {
9247                 contents: CResult_UpdateFailHTLCDecodeErrorZPtr {
9248                         result: Box::into_raw(Box::new(o)),
9249                 },
9250                 result_ok: true,
9251         }
9252 }
9253 #[no_mangle]
9254 /// Creates a new CResult_UpdateFailHTLCDecodeErrorZ in the error state.
9255 pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateFailHTLCDecodeErrorZ {
9256         CResult_UpdateFailHTLCDecodeErrorZ {
9257                 contents: CResult_UpdateFailHTLCDecodeErrorZPtr {
9258                         err: Box::into_raw(Box::new(e)),
9259                 },
9260                 result_ok: false,
9261         }
9262 }
9263 #[no_mangle]
9264 /// Frees any resources used by the CResult_UpdateFailHTLCDecodeErrorZ.
9265 pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_free(_res: CResult_UpdateFailHTLCDecodeErrorZ) { }
9266 impl Drop for CResult_UpdateFailHTLCDecodeErrorZ {
9267         fn drop(&mut self) {
9268                 if self.result_ok {
9269                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
9270                                 let _ = unsafe { Box::from_raw(self.contents.result) };
9271                         }
9272                 } else {
9273                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
9274                                 let _ = unsafe { Box::from_raw(self.contents.err) };
9275                         }
9276                 }
9277         }
9278 }
9279 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFailHTLC, crate::lightning::ln::msgs::DecodeError>> for CResult_UpdateFailHTLCDecodeErrorZ {
9280         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFailHTLC, crate::lightning::ln::msgs::DecodeError>) -> Self {
9281                 let contents = if o.result_ok {
9282                         let result = unsafe { o.contents.result };
9283                         unsafe { o.contents.result = std::ptr::null_mut() };
9284                         CResult_UpdateFailHTLCDecodeErrorZPtr { result }
9285                 } else {
9286                         let err = unsafe { o.contents.err };
9287                         unsafe { o.contents.err = std::ptr::null_mut(); }
9288                         CResult_UpdateFailHTLCDecodeErrorZPtr { err }
9289                 };
9290                 Self {
9291                         contents,
9292                         result_ok: o.result_ok,
9293                 }
9294         }
9295 }
9296 impl Clone for CResult_UpdateFailHTLCDecodeErrorZ {
9297         fn clone(&self) -> Self {
9298                 if self.result_ok {
9299                         Self { result_ok: true, contents: CResult_UpdateFailHTLCDecodeErrorZPtr {
9300                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UpdateFailHTLC>::clone(unsafe { &*self.contents.result })))
9301                         } }
9302                 } else {
9303                         Self { result_ok: false, contents: CResult_UpdateFailHTLCDecodeErrorZPtr {
9304                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
9305                         } }
9306                 }
9307         }
9308 }
9309 #[no_mangle]
9310 /// Creates a new CResult_UpdateFailHTLCDecodeErrorZ which has the same data as `orig`
9311 /// but with all dynamically-allocated buffers duplicated in new buffers.
9312 pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_clone(orig: &CResult_UpdateFailHTLCDecodeErrorZ) -> CResult_UpdateFailHTLCDecodeErrorZ { orig.clone() }
9313 #[repr(C)]
9314 /// The contents of CResult_UpdateFailMalformedHTLCDecodeErrorZ
9315 pub union CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
9316         /// A pointer to the contents in the success state.
9317         /// Reading from this pointer when `result_ok` is not set is undefined.
9318         pub result: *mut crate::lightning::ln::msgs::UpdateFailMalformedHTLC,
9319         /// A pointer to the contents in the error state.
9320         /// Reading from this pointer when `result_ok` is set is undefined.
9321         pub err: *mut crate::lightning::ln::msgs::DecodeError,
9322 }
9323 #[repr(C)]
9324 /// A CResult_UpdateFailMalformedHTLCDecodeErrorZ represents the result of a fallible operation,
9325 /// containing a crate::lightning::ln::msgs::UpdateFailMalformedHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
9326 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9327 pub struct CResult_UpdateFailMalformedHTLCDecodeErrorZ {
9328         /// The contents of this CResult_UpdateFailMalformedHTLCDecodeErrorZ, accessible via either
9329         /// `err` or `result` depending on the state of `result_ok`.
9330         pub contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr,
9331         /// Whether this CResult_UpdateFailMalformedHTLCDecodeErrorZ represents a success state.
9332         pub result_ok: bool,
9333 }
9334 #[no_mangle]
9335 /// Creates a new CResult_UpdateFailMalformedHTLCDecodeErrorZ in the success state.
9336 pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateFailMalformedHTLC) -> CResult_UpdateFailMalformedHTLCDecodeErrorZ {
9337         CResult_UpdateFailMalformedHTLCDecodeErrorZ {
9338                 contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
9339                         result: Box::into_raw(Box::new(o)),
9340                 },
9341                 result_ok: true,
9342         }
9343 }
9344 #[no_mangle]
9345 /// Creates a new CResult_UpdateFailMalformedHTLCDecodeErrorZ in the error state.
9346 pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateFailMalformedHTLCDecodeErrorZ {
9347         CResult_UpdateFailMalformedHTLCDecodeErrorZ {
9348                 contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
9349                         err: Box::into_raw(Box::new(e)),
9350                 },
9351                 result_ok: false,
9352         }
9353 }
9354 #[no_mangle]
9355 /// Frees any resources used by the CResult_UpdateFailMalformedHTLCDecodeErrorZ.
9356 pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_free(_res: CResult_UpdateFailMalformedHTLCDecodeErrorZ) { }
9357 impl Drop for CResult_UpdateFailMalformedHTLCDecodeErrorZ {
9358         fn drop(&mut self) {
9359                 if self.result_ok {
9360                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
9361                                 let _ = unsafe { Box::from_raw(self.contents.result) };
9362                         }
9363                 } else {
9364                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
9365                                 let _ = unsafe { Box::from_raw(self.contents.err) };
9366                         }
9367                 }
9368         }
9369 }
9370 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFailMalformedHTLC, crate::lightning::ln::msgs::DecodeError>> for CResult_UpdateFailMalformedHTLCDecodeErrorZ {
9371         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFailMalformedHTLC, crate::lightning::ln::msgs::DecodeError>) -> Self {
9372                 let contents = if o.result_ok {
9373                         let result = unsafe { o.contents.result };
9374                         unsafe { o.contents.result = std::ptr::null_mut() };
9375                         CResult_UpdateFailMalformedHTLCDecodeErrorZPtr { result }
9376                 } else {
9377                         let err = unsafe { o.contents.err };
9378                         unsafe { o.contents.err = std::ptr::null_mut(); }
9379                         CResult_UpdateFailMalformedHTLCDecodeErrorZPtr { err }
9380                 };
9381                 Self {
9382                         contents,
9383                         result_ok: o.result_ok,
9384                 }
9385         }
9386 }
9387 impl Clone for CResult_UpdateFailMalformedHTLCDecodeErrorZ {
9388         fn clone(&self) -> Self {
9389                 if self.result_ok {
9390                         Self { result_ok: true, contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
9391                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UpdateFailMalformedHTLC>::clone(unsafe { &*self.contents.result })))
9392                         } }
9393                 } else {
9394                         Self { result_ok: false, contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
9395                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
9396                         } }
9397                 }
9398         }
9399 }
9400 #[no_mangle]
9401 /// Creates a new CResult_UpdateFailMalformedHTLCDecodeErrorZ which has the same data as `orig`
9402 /// but with all dynamically-allocated buffers duplicated in new buffers.
9403 pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone(orig: &CResult_UpdateFailMalformedHTLCDecodeErrorZ) -> CResult_UpdateFailMalformedHTLCDecodeErrorZ { orig.clone() }
9404 #[repr(C)]
9405 /// The contents of CResult_UpdateFeeDecodeErrorZ
9406 pub union CResult_UpdateFeeDecodeErrorZPtr {
9407         /// A pointer to the contents in the success state.
9408         /// Reading from this pointer when `result_ok` is not set is undefined.
9409         pub result: *mut crate::lightning::ln::msgs::UpdateFee,
9410         /// A pointer to the contents in the error state.
9411         /// Reading from this pointer when `result_ok` is set is undefined.
9412         pub err: *mut crate::lightning::ln::msgs::DecodeError,
9413 }
9414 #[repr(C)]
9415 /// A CResult_UpdateFeeDecodeErrorZ represents the result of a fallible operation,
9416 /// containing a crate::lightning::ln::msgs::UpdateFee on success and a crate::lightning::ln::msgs::DecodeError on failure.
9417 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9418 pub struct CResult_UpdateFeeDecodeErrorZ {
9419         /// The contents of this CResult_UpdateFeeDecodeErrorZ, accessible via either
9420         /// `err` or `result` depending on the state of `result_ok`.
9421         pub contents: CResult_UpdateFeeDecodeErrorZPtr,
9422         /// Whether this CResult_UpdateFeeDecodeErrorZ represents a success state.
9423         pub result_ok: bool,
9424 }
9425 #[no_mangle]
9426 /// Creates a new CResult_UpdateFeeDecodeErrorZ in the success state.
9427 pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateFee) -> CResult_UpdateFeeDecodeErrorZ {
9428         CResult_UpdateFeeDecodeErrorZ {
9429                 contents: CResult_UpdateFeeDecodeErrorZPtr {
9430                         result: Box::into_raw(Box::new(o)),
9431                 },
9432                 result_ok: true,
9433         }
9434 }
9435 #[no_mangle]
9436 /// Creates a new CResult_UpdateFeeDecodeErrorZ in the error state.
9437 pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateFeeDecodeErrorZ {
9438         CResult_UpdateFeeDecodeErrorZ {
9439                 contents: CResult_UpdateFeeDecodeErrorZPtr {
9440                         err: Box::into_raw(Box::new(e)),
9441                 },
9442                 result_ok: false,
9443         }
9444 }
9445 #[no_mangle]
9446 /// Frees any resources used by the CResult_UpdateFeeDecodeErrorZ.
9447 pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_free(_res: CResult_UpdateFeeDecodeErrorZ) { }
9448 impl Drop for CResult_UpdateFeeDecodeErrorZ {
9449         fn drop(&mut self) {
9450                 if self.result_ok {
9451                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
9452                                 let _ = unsafe { Box::from_raw(self.contents.result) };
9453                         }
9454                 } else {
9455                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
9456                                 let _ = unsafe { Box::from_raw(self.contents.err) };
9457                         }
9458                 }
9459         }
9460 }
9461 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFee, crate::lightning::ln::msgs::DecodeError>> for CResult_UpdateFeeDecodeErrorZ {
9462         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFee, crate::lightning::ln::msgs::DecodeError>) -> Self {
9463                 let contents = if o.result_ok {
9464                         let result = unsafe { o.contents.result };
9465                         unsafe { o.contents.result = std::ptr::null_mut() };
9466                         CResult_UpdateFeeDecodeErrorZPtr { result }
9467                 } else {
9468                         let err = unsafe { o.contents.err };
9469                         unsafe { o.contents.err = std::ptr::null_mut(); }
9470                         CResult_UpdateFeeDecodeErrorZPtr { err }
9471                 };
9472                 Self {
9473                         contents,
9474                         result_ok: o.result_ok,
9475                 }
9476         }
9477 }
9478 impl Clone for CResult_UpdateFeeDecodeErrorZ {
9479         fn clone(&self) -> Self {
9480                 if self.result_ok {
9481                         Self { result_ok: true, contents: CResult_UpdateFeeDecodeErrorZPtr {
9482                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UpdateFee>::clone(unsafe { &*self.contents.result })))
9483                         } }
9484                 } else {
9485                         Self { result_ok: false, contents: CResult_UpdateFeeDecodeErrorZPtr {
9486                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
9487                         } }
9488                 }
9489         }
9490 }
9491 #[no_mangle]
9492 /// Creates a new CResult_UpdateFeeDecodeErrorZ which has the same data as `orig`
9493 /// but with all dynamically-allocated buffers duplicated in new buffers.
9494 pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_clone(orig: &CResult_UpdateFeeDecodeErrorZ) -> CResult_UpdateFeeDecodeErrorZ { orig.clone() }
9495 #[repr(C)]
9496 /// The contents of CResult_UpdateFulfillHTLCDecodeErrorZ
9497 pub union CResult_UpdateFulfillHTLCDecodeErrorZPtr {
9498         /// A pointer to the contents in the success state.
9499         /// Reading from this pointer when `result_ok` is not set is undefined.
9500         pub result: *mut crate::lightning::ln::msgs::UpdateFulfillHTLC,
9501         /// A pointer to the contents in the error state.
9502         /// Reading from this pointer when `result_ok` is set is undefined.
9503         pub err: *mut crate::lightning::ln::msgs::DecodeError,
9504 }
9505 #[repr(C)]
9506 /// A CResult_UpdateFulfillHTLCDecodeErrorZ represents the result of a fallible operation,
9507 /// containing a crate::lightning::ln::msgs::UpdateFulfillHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
9508 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9509 pub struct CResult_UpdateFulfillHTLCDecodeErrorZ {
9510         /// The contents of this CResult_UpdateFulfillHTLCDecodeErrorZ, accessible via either
9511         /// `err` or `result` depending on the state of `result_ok`.
9512         pub contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr,
9513         /// Whether this CResult_UpdateFulfillHTLCDecodeErrorZ represents a success state.
9514         pub result_ok: bool,
9515 }
9516 #[no_mangle]
9517 /// Creates a new CResult_UpdateFulfillHTLCDecodeErrorZ in the success state.
9518 pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateFulfillHTLC) -> CResult_UpdateFulfillHTLCDecodeErrorZ {
9519         CResult_UpdateFulfillHTLCDecodeErrorZ {
9520                 contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr {
9521                         result: Box::into_raw(Box::new(o)),
9522                 },
9523                 result_ok: true,
9524         }
9525 }
9526 #[no_mangle]
9527 /// Creates a new CResult_UpdateFulfillHTLCDecodeErrorZ in the error state.
9528 pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateFulfillHTLCDecodeErrorZ {
9529         CResult_UpdateFulfillHTLCDecodeErrorZ {
9530                 contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr {
9531                         err: Box::into_raw(Box::new(e)),
9532                 },
9533                 result_ok: false,
9534         }
9535 }
9536 #[no_mangle]
9537 /// Frees any resources used by the CResult_UpdateFulfillHTLCDecodeErrorZ.
9538 pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_free(_res: CResult_UpdateFulfillHTLCDecodeErrorZ) { }
9539 impl Drop for CResult_UpdateFulfillHTLCDecodeErrorZ {
9540         fn drop(&mut self) {
9541                 if self.result_ok {
9542                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
9543                                 let _ = unsafe { Box::from_raw(self.contents.result) };
9544                         }
9545                 } else {
9546                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
9547                                 let _ = unsafe { Box::from_raw(self.contents.err) };
9548                         }
9549                 }
9550         }
9551 }
9552 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFulfillHTLC, crate::lightning::ln::msgs::DecodeError>> for CResult_UpdateFulfillHTLCDecodeErrorZ {
9553         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFulfillHTLC, crate::lightning::ln::msgs::DecodeError>) -> Self {
9554                 let contents = if o.result_ok {
9555                         let result = unsafe { o.contents.result };
9556                         unsafe { o.contents.result = std::ptr::null_mut() };
9557                         CResult_UpdateFulfillHTLCDecodeErrorZPtr { result }
9558                 } else {
9559                         let err = unsafe { o.contents.err };
9560                         unsafe { o.contents.err = std::ptr::null_mut(); }
9561                         CResult_UpdateFulfillHTLCDecodeErrorZPtr { err }
9562                 };
9563                 Self {
9564                         contents,
9565                         result_ok: o.result_ok,
9566                 }
9567         }
9568 }
9569 impl Clone for CResult_UpdateFulfillHTLCDecodeErrorZ {
9570         fn clone(&self) -> Self {
9571                 if self.result_ok {
9572                         Self { result_ok: true, contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr {
9573                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UpdateFulfillHTLC>::clone(unsafe { &*self.contents.result })))
9574                         } }
9575                 } else {
9576                         Self { result_ok: false, contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr {
9577                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
9578                         } }
9579                 }
9580         }
9581 }
9582 #[no_mangle]
9583 /// Creates a new CResult_UpdateFulfillHTLCDecodeErrorZ which has the same data as `orig`
9584 /// but with all dynamically-allocated buffers duplicated in new buffers.
9585 pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_clone(orig: &CResult_UpdateFulfillHTLCDecodeErrorZ) -> CResult_UpdateFulfillHTLCDecodeErrorZ { orig.clone() }
9586 #[repr(C)]
9587 /// The contents of CResult_UpdateAddHTLCDecodeErrorZ
9588 pub union CResult_UpdateAddHTLCDecodeErrorZPtr {
9589         /// A pointer to the contents in the success state.
9590         /// Reading from this pointer when `result_ok` is not set is undefined.
9591         pub result: *mut crate::lightning::ln::msgs::UpdateAddHTLC,
9592         /// A pointer to the contents in the error state.
9593         /// Reading from this pointer when `result_ok` is set is undefined.
9594         pub err: *mut crate::lightning::ln::msgs::DecodeError,
9595 }
9596 #[repr(C)]
9597 /// A CResult_UpdateAddHTLCDecodeErrorZ represents the result of a fallible operation,
9598 /// containing a crate::lightning::ln::msgs::UpdateAddHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
9599 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9600 pub struct CResult_UpdateAddHTLCDecodeErrorZ {
9601         /// The contents of this CResult_UpdateAddHTLCDecodeErrorZ, accessible via either
9602         /// `err` or `result` depending on the state of `result_ok`.
9603         pub contents: CResult_UpdateAddHTLCDecodeErrorZPtr,
9604         /// Whether this CResult_UpdateAddHTLCDecodeErrorZ represents a success state.
9605         pub result_ok: bool,
9606 }
9607 #[no_mangle]
9608 /// Creates a new CResult_UpdateAddHTLCDecodeErrorZ in the success state.
9609 pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateAddHTLC) -> CResult_UpdateAddHTLCDecodeErrorZ {
9610         CResult_UpdateAddHTLCDecodeErrorZ {
9611                 contents: CResult_UpdateAddHTLCDecodeErrorZPtr {
9612                         result: Box::into_raw(Box::new(o)),
9613                 },
9614                 result_ok: true,
9615         }
9616 }
9617 #[no_mangle]
9618 /// Creates a new CResult_UpdateAddHTLCDecodeErrorZ in the error state.
9619 pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateAddHTLCDecodeErrorZ {
9620         CResult_UpdateAddHTLCDecodeErrorZ {
9621                 contents: CResult_UpdateAddHTLCDecodeErrorZPtr {
9622                         err: Box::into_raw(Box::new(e)),
9623                 },
9624                 result_ok: false,
9625         }
9626 }
9627 #[no_mangle]
9628 /// Frees any resources used by the CResult_UpdateAddHTLCDecodeErrorZ.
9629 pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_free(_res: CResult_UpdateAddHTLCDecodeErrorZ) { }
9630 impl Drop for CResult_UpdateAddHTLCDecodeErrorZ {
9631         fn drop(&mut self) {
9632                 if self.result_ok {
9633                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
9634                                 let _ = unsafe { Box::from_raw(self.contents.result) };
9635                         }
9636                 } else {
9637                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
9638                                 let _ = unsafe { Box::from_raw(self.contents.err) };
9639                         }
9640                 }
9641         }
9642 }
9643 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateAddHTLC, crate::lightning::ln::msgs::DecodeError>> for CResult_UpdateAddHTLCDecodeErrorZ {
9644         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateAddHTLC, crate::lightning::ln::msgs::DecodeError>) -> Self {
9645                 let contents = if o.result_ok {
9646                         let result = unsafe { o.contents.result };
9647                         unsafe { o.contents.result = std::ptr::null_mut() };
9648                         CResult_UpdateAddHTLCDecodeErrorZPtr { result }
9649                 } else {
9650                         let err = unsafe { o.contents.err };
9651                         unsafe { o.contents.err = std::ptr::null_mut(); }
9652                         CResult_UpdateAddHTLCDecodeErrorZPtr { err }
9653                 };
9654                 Self {
9655                         contents,
9656                         result_ok: o.result_ok,
9657                 }
9658         }
9659 }
9660 impl Clone for CResult_UpdateAddHTLCDecodeErrorZ {
9661         fn clone(&self) -> Self {
9662                 if self.result_ok {
9663                         Self { result_ok: true, contents: CResult_UpdateAddHTLCDecodeErrorZPtr {
9664                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UpdateAddHTLC>::clone(unsafe { &*self.contents.result })))
9665                         } }
9666                 } else {
9667                         Self { result_ok: false, contents: CResult_UpdateAddHTLCDecodeErrorZPtr {
9668                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
9669                         } }
9670                 }
9671         }
9672 }
9673 #[no_mangle]
9674 /// Creates a new CResult_UpdateAddHTLCDecodeErrorZ which has the same data as `orig`
9675 /// but with all dynamically-allocated buffers duplicated in new buffers.
9676 pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_clone(orig: &CResult_UpdateAddHTLCDecodeErrorZ) -> CResult_UpdateAddHTLCDecodeErrorZ { orig.clone() }
9677 #[repr(C)]
9678 /// The contents of CResult_PingDecodeErrorZ
9679 pub union CResult_PingDecodeErrorZPtr {
9680         /// A pointer to the contents in the success state.
9681         /// Reading from this pointer when `result_ok` is not set is undefined.
9682         pub result: *mut crate::lightning::ln::msgs::Ping,
9683         /// A pointer to the contents in the error state.
9684         /// Reading from this pointer when `result_ok` is set is undefined.
9685         pub err: *mut crate::lightning::ln::msgs::DecodeError,
9686 }
9687 #[repr(C)]
9688 /// A CResult_PingDecodeErrorZ represents the result of a fallible operation,
9689 /// containing a crate::lightning::ln::msgs::Ping on success and a crate::lightning::ln::msgs::DecodeError on failure.
9690 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9691 pub struct CResult_PingDecodeErrorZ {
9692         /// The contents of this CResult_PingDecodeErrorZ, accessible via either
9693         /// `err` or `result` depending on the state of `result_ok`.
9694         pub contents: CResult_PingDecodeErrorZPtr,
9695         /// Whether this CResult_PingDecodeErrorZ represents a success state.
9696         pub result_ok: bool,
9697 }
9698 #[no_mangle]
9699 /// Creates a new CResult_PingDecodeErrorZ in the success state.
9700 pub extern "C" fn CResult_PingDecodeErrorZ_ok(o: crate::lightning::ln::msgs::Ping) -> CResult_PingDecodeErrorZ {
9701         CResult_PingDecodeErrorZ {
9702                 contents: CResult_PingDecodeErrorZPtr {
9703                         result: Box::into_raw(Box::new(o)),
9704                 },
9705                 result_ok: true,
9706         }
9707 }
9708 #[no_mangle]
9709 /// Creates a new CResult_PingDecodeErrorZ in the error state.
9710 pub extern "C" fn CResult_PingDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_PingDecodeErrorZ {
9711         CResult_PingDecodeErrorZ {
9712                 contents: CResult_PingDecodeErrorZPtr {
9713                         err: Box::into_raw(Box::new(e)),
9714                 },
9715                 result_ok: false,
9716         }
9717 }
9718 #[no_mangle]
9719 /// Frees any resources used by the CResult_PingDecodeErrorZ.
9720 pub extern "C" fn CResult_PingDecodeErrorZ_free(_res: CResult_PingDecodeErrorZ) { }
9721 impl Drop for CResult_PingDecodeErrorZ {
9722         fn drop(&mut self) {
9723                 if self.result_ok {
9724                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
9725                                 let _ = unsafe { Box::from_raw(self.contents.result) };
9726                         }
9727                 } else {
9728                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
9729                                 let _ = unsafe { Box::from_raw(self.contents.err) };
9730                         }
9731                 }
9732         }
9733 }
9734 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::Ping, crate::lightning::ln::msgs::DecodeError>> for CResult_PingDecodeErrorZ {
9735         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::Ping, crate::lightning::ln::msgs::DecodeError>) -> Self {
9736                 let contents = if o.result_ok {
9737                         let result = unsafe { o.contents.result };
9738                         unsafe { o.contents.result = std::ptr::null_mut() };
9739                         CResult_PingDecodeErrorZPtr { result }
9740                 } else {
9741                         let err = unsafe { o.contents.err };
9742                         unsafe { o.contents.err = std::ptr::null_mut(); }
9743                         CResult_PingDecodeErrorZPtr { err }
9744                 };
9745                 Self {
9746                         contents,
9747                         result_ok: o.result_ok,
9748                 }
9749         }
9750 }
9751 impl Clone for CResult_PingDecodeErrorZ {
9752         fn clone(&self) -> Self {
9753                 if self.result_ok {
9754                         Self { result_ok: true, contents: CResult_PingDecodeErrorZPtr {
9755                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::Ping>::clone(unsafe { &*self.contents.result })))
9756                         } }
9757                 } else {
9758                         Self { result_ok: false, contents: CResult_PingDecodeErrorZPtr {
9759                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
9760                         } }
9761                 }
9762         }
9763 }
9764 #[no_mangle]
9765 /// Creates a new CResult_PingDecodeErrorZ which has the same data as `orig`
9766 /// but with all dynamically-allocated buffers duplicated in new buffers.
9767 pub extern "C" fn CResult_PingDecodeErrorZ_clone(orig: &CResult_PingDecodeErrorZ) -> CResult_PingDecodeErrorZ { orig.clone() }
9768 #[repr(C)]
9769 /// The contents of CResult_PongDecodeErrorZ
9770 pub union CResult_PongDecodeErrorZPtr {
9771         /// A pointer to the contents in the success state.
9772         /// Reading from this pointer when `result_ok` is not set is undefined.
9773         pub result: *mut crate::lightning::ln::msgs::Pong,
9774         /// A pointer to the contents in the error state.
9775         /// Reading from this pointer when `result_ok` is set is undefined.
9776         pub err: *mut crate::lightning::ln::msgs::DecodeError,
9777 }
9778 #[repr(C)]
9779 /// A CResult_PongDecodeErrorZ represents the result of a fallible operation,
9780 /// containing a crate::lightning::ln::msgs::Pong on success and a crate::lightning::ln::msgs::DecodeError on failure.
9781 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9782 pub struct CResult_PongDecodeErrorZ {
9783         /// The contents of this CResult_PongDecodeErrorZ, accessible via either
9784         /// `err` or `result` depending on the state of `result_ok`.
9785         pub contents: CResult_PongDecodeErrorZPtr,
9786         /// Whether this CResult_PongDecodeErrorZ represents a success state.
9787         pub result_ok: bool,
9788 }
9789 #[no_mangle]
9790 /// Creates a new CResult_PongDecodeErrorZ in the success state.
9791 pub extern "C" fn CResult_PongDecodeErrorZ_ok(o: crate::lightning::ln::msgs::Pong) -> CResult_PongDecodeErrorZ {
9792         CResult_PongDecodeErrorZ {
9793                 contents: CResult_PongDecodeErrorZPtr {
9794                         result: Box::into_raw(Box::new(o)),
9795                 },
9796                 result_ok: true,
9797         }
9798 }
9799 #[no_mangle]
9800 /// Creates a new CResult_PongDecodeErrorZ in the error state.
9801 pub extern "C" fn CResult_PongDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_PongDecodeErrorZ {
9802         CResult_PongDecodeErrorZ {
9803                 contents: CResult_PongDecodeErrorZPtr {
9804                         err: Box::into_raw(Box::new(e)),
9805                 },
9806                 result_ok: false,
9807         }
9808 }
9809 #[no_mangle]
9810 /// Frees any resources used by the CResult_PongDecodeErrorZ.
9811 pub extern "C" fn CResult_PongDecodeErrorZ_free(_res: CResult_PongDecodeErrorZ) { }
9812 impl Drop for CResult_PongDecodeErrorZ {
9813         fn drop(&mut self) {
9814                 if self.result_ok {
9815                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
9816                                 let _ = unsafe { Box::from_raw(self.contents.result) };
9817                         }
9818                 } else {
9819                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
9820                                 let _ = unsafe { Box::from_raw(self.contents.err) };
9821                         }
9822                 }
9823         }
9824 }
9825 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::Pong, crate::lightning::ln::msgs::DecodeError>> for CResult_PongDecodeErrorZ {
9826         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::Pong, crate::lightning::ln::msgs::DecodeError>) -> Self {
9827                 let contents = if o.result_ok {
9828                         let result = unsafe { o.contents.result };
9829                         unsafe { o.contents.result = std::ptr::null_mut() };
9830                         CResult_PongDecodeErrorZPtr { result }
9831                 } else {
9832                         let err = unsafe { o.contents.err };
9833                         unsafe { o.contents.err = std::ptr::null_mut(); }
9834                         CResult_PongDecodeErrorZPtr { err }
9835                 };
9836                 Self {
9837                         contents,
9838                         result_ok: o.result_ok,
9839                 }
9840         }
9841 }
9842 impl Clone for CResult_PongDecodeErrorZ {
9843         fn clone(&self) -> Self {
9844                 if self.result_ok {
9845                         Self { result_ok: true, contents: CResult_PongDecodeErrorZPtr {
9846                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::Pong>::clone(unsafe { &*self.contents.result })))
9847                         } }
9848                 } else {
9849                         Self { result_ok: false, contents: CResult_PongDecodeErrorZPtr {
9850                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
9851                         } }
9852                 }
9853         }
9854 }
9855 #[no_mangle]
9856 /// Creates a new CResult_PongDecodeErrorZ which has the same data as `orig`
9857 /// but with all dynamically-allocated buffers duplicated in new buffers.
9858 pub extern "C" fn CResult_PongDecodeErrorZ_clone(orig: &CResult_PongDecodeErrorZ) -> CResult_PongDecodeErrorZ { orig.clone() }
9859 #[repr(C)]
9860 /// The contents of CResult_UnsignedChannelAnnouncementDecodeErrorZ
9861 pub union CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
9862         /// A pointer to the contents in the success state.
9863         /// Reading from this pointer when `result_ok` is not set is undefined.
9864         pub result: *mut crate::lightning::ln::msgs::UnsignedChannelAnnouncement,
9865         /// A pointer to the contents in the error state.
9866         /// Reading from this pointer when `result_ok` is set is undefined.
9867         pub err: *mut crate::lightning::ln::msgs::DecodeError,
9868 }
9869 #[repr(C)]
9870 /// A CResult_UnsignedChannelAnnouncementDecodeErrorZ represents the result of a fallible operation,
9871 /// containing a crate::lightning::ln::msgs::UnsignedChannelAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
9872 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9873 pub struct CResult_UnsignedChannelAnnouncementDecodeErrorZ {
9874         /// The contents of this CResult_UnsignedChannelAnnouncementDecodeErrorZ, accessible via either
9875         /// `err` or `result` depending on the state of `result_ok`.
9876         pub contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr,
9877         /// Whether this CResult_UnsignedChannelAnnouncementDecodeErrorZ represents a success state.
9878         pub result_ok: bool,
9879 }
9880 #[no_mangle]
9881 /// Creates a new CResult_UnsignedChannelAnnouncementDecodeErrorZ in the success state.
9882 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UnsignedChannelAnnouncement) -> CResult_UnsignedChannelAnnouncementDecodeErrorZ {
9883         CResult_UnsignedChannelAnnouncementDecodeErrorZ {
9884                 contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
9885                         result: Box::into_raw(Box::new(o)),
9886                 },
9887                 result_ok: true,
9888         }
9889 }
9890 #[no_mangle]
9891 /// Creates a new CResult_UnsignedChannelAnnouncementDecodeErrorZ in the error state.
9892 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UnsignedChannelAnnouncementDecodeErrorZ {
9893         CResult_UnsignedChannelAnnouncementDecodeErrorZ {
9894                 contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
9895                         err: Box::into_raw(Box::new(e)),
9896                 },
9897                 result_ok: false,
9898         }
9899 }
9900 #[no_mangle]
9901 /// Frees any resources used by the CResult_UnsignedChannelAnnouncementDecodeErrorZ.
9902 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_free(_res: CResult_UnsignedChannelAnnouncementDecodeErrorZ) { }
9903 impl Drop for CResult_UnsignedChannelAnnouncementDecodeErrorZ {
9904         fn drop(&mut self) {
9905                 if self.result_ok {
9906                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
9907                                 let _ = unsafe { Box::from_raw(self.contents.result) };
9908                         }
9909                 } else {
9910                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
9911                                 let _ = unsafe { Box::from_raw(self.contents.err) };
9912                         }
9913                 }
9914         }
9915 }
9916 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedChannelAnnouncement, crate::lightning::ln::msgs::DecodeError>> for CResult_UnsignedChannelAnnouncementDecodeErrorZ {
9917         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedChannelAnnouncement, crate::lightning::ln::msgs::DecodeError>) -> Self {
9918                 let contents = if o.result_ok {
9919                         let result = unsafe { o.contents.result };
9920                         unsafe { o.contents.result = std::ptr::null_mut() };
9921                         CResult_UnsignedChannelAnnouncementDecodeErrorZPtr { result }
9922                 } else {
9923                         let err = unsafe { o.contents.err };
9924                         unsafe { o.contents.err = std::ptr::null_mut(); }
9925                         CResult_UnsignedChannelAnnouncementDecodeErrorZPtr { err }
9926                 };
9927                 Self {
9928                         contents,
9929                         result_ok: o.result_ok,
9930                 }
9931         }
9932 }
9933 impl Clone for CResult_UnsignedChannelAnnouncementDecodeErrorZ {
9934         fn clone(&self) -> Self {
9935                 if self.result_ok {
9936                         Self { result_ok: true, contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
9937                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UnsignedChannelAnnouncement>::clone(unsafe { &*self.contents.result })))
9938                         } }
9939                 } else {
9940                         Self { result_ok: false, contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
9941                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
9942                         } }
9943                 }
9944         }
9945 }
9946 #[no_mangle]
9947 /// Creates a new CResult_UnsignedChannelAnnouncementDecodeErrorZ which has the same data as `orig`
9948 /// but with all dynamically-allocated buffers duplicated in new buffers.
9949 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone(orig: &CResult_UnsignedChannelAnnouncementDecodeErrorZ) -> CResult_UnsignedChannelAnnouncementDecodeErrorZ { orig.clone() }
9950 #[repr(C)]
9951 /// The contents of CResult_ChannelAnnouncementDecodeErrorZ
9952 pub union CResult_ChannelAnnouncementDecodeErrorZPtr {
9953         /// A pointer to the contents in the success state.
9954         /// Reading from this pointer when `result_ok` is not set is undefined.
9955         pub result: *mut crate::lightning::ln::msgs::ChannelAnnouncement,
9956         /// A pointer to the contents in the error state.
9957         /// Reading from this pointer when `result_ok` is set is undefined.
9958         pub err: *mut crate::lightning::ln::msgs::DecodeError,
9959 }
9960 #[repr(C)]
9961 /// A CResult_ChannelAnnouncementDecodeErrorZ represents the result of a fallible operation,
9962 /// containing a crate::lightning::ln::msgs::ChannelAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
9963 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9964 pub struct CResult_ChannelAnnouncementDecodeErrorZ {
9965         /// The contents of this CResult_ChannelAnnouncementDecodeErrorZ, accessible via either
9966         /// `err` or `result` depending on the state of `result_ok`.
9967         pub contents: CResult_ChannelAnnouncementDecodeErrorZPtr,
9968         /// Whether this CResult_ChannelAnnouncementDecodeErrorZ represents a success state.
9969         pub result_ok: bool,
9970 }
9971 #[no_mangle]
9972 /// Creates a new CResult_ChannelAnnouncementDecodeErrorZ in the success state.
9973 pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ChannelAnnouncement) -> CResult_ChannelAnnouncementDecodeErrorZ {
9974         CResult_ChannelAnnouncementDecodeErrorZ {
9975                 contents: CResult_ChannelAnnouncementDecodeErrorZPtr {
9976                         result: Box::into_raw(Box::new(o)),
9977                 },
9978                 result_ok: true,
9979         }
9980 }
9981 #[no_mangle]
9982 /// Creates a new CResult_ChannelAnnouncementDecodeErrorZ in the error state.
9983 pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelAnnouncementDecodeErrorZ {
9984         CResult_ChannelAnnouncementDecodeErrorZ {
9985                 contents: CResult_ChannelAnnouncementDecodeErrorZPtr {
9986                         err: Box::into_raw(Box::new(e)),
9987                 },
9988                 result_ok: false,
9989         }
9990 }
9991 #[no_mangle]
9992 /// Frees any resources used by the CResult_ChannelAnnouncementDecodeErrorZ.
9993 pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_free(_res: CResult_ChannelAnnouncementDecodeErrorZ) { }
9994 impl Drop for CResult_ChannelAnnouncementDecodeErrorZ {
9995         fn drop(&mut self) {
9996                 if self.result_ok {
9997                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
9998                                 let _ = unsafe { Box::from_raw(self.contents.result) };
9999                         }
10000                 } else {
10001                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
10002                                 let _ = unsafe { Box::from_raw(self.contents.err) };
10003                         }
10004                 }
10005         }
10006 }
10007 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelAnnouncement, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelAnnouncementDecodeErrorZ {
10008         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelAnnouncement, crate::lightning::ln::msgs::DecodeError>) -> Self {
10009                 let contents = if o.result_ok {
10010                         let result = unsafe { o.contents.result };
10011                         unsafe { o.contents.result = std::ptr::null_mut() };
10012                         CResult_ChannelAnnouncementDecodeErrorZPtr { result }
10013                 } else {
10014                         let err = unsafe { o.contents.err };
10015                         unsafe { o.contents.err = std::ptr::null_mut(); }
10016                         CResult_ChannelAnnouncementDecodeErrorZPtr { err }
10017                 };
10018                 Self {
10019                         contents,
10020                         result_ok: o.result_ok,
10021                 }
10022         }
10023 }
10024 impl Clone for CResult_ChannelAnnouncementDecodeErrorZ {
10025         fn clone(&self) -> Self {
10026                 if self.result_ok {
10027                         Self { result_ok: true, contents: CResult_ChannelAnnouncementDecodeErrorZPtr {
10028                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ChannelAnnouncement>::clone(unsafe { &*self.contents.result })))
10029                         } }
10030                 } else {
10031                         Self { result_ok: false, contents: CResult_ChannelAnnouncementDecodeErrorZPtr {
10032                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
10033                         } }
10034                 }
10035         }
10036 }
10037 #[no_mangle]
10038 /// Creates a new CResult_ChannelAnnouncementDecodeErrorZ which has the same data as `orig`
10039 /// but with all dynamically-allocated buffers duplicated in new buffers.
10040 pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_clone(orig: &CResult_ChannelAnnouncementDecodeErrorZ) -> CResult_ChannelAnnouncementDecodeErrorZ { orig.clone() }
10041 #[repr(C)]
10042 /// The contents of CResult_UnsignedChannelUpdateDecodeErrorZ
10043 pub union CResult_UnsignedChannelUpdateDecodeErrorZPtr {
10044         /// A pointer to the contents in the success state.
10045         /// Reading from this pointer when `result_ok` is not set is undefined.
10046         pub result: *mut crate::lightning::ln::msgs::UnsignedChannelUpdate,
10047         /// A pointer to the contents in the error state.
10048         /// Reading from this pointer when `result_ok` is set is undefined.
10049         pub err: *mut crate::lightning::ln::msgs::DecodeError,
10050 }
10051 #[repr(C)]
10052 /// A CResult_UnsignedChannelUpdateDecodeErrorZ represents the result of a fallible operation,
10053 /// containing a crate::lightning::ln::msgs::UnsignedChannelUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
10054 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10055 pub struct CResult_UnsignedChannelUpdateDecodeErrorZ {
10056         /// The contents of this CResult_UnsignedChannelUpdateDecodeErrorZ, accessible via either
10057         /// `err` or `result` depending on the state of `result_ok`.
10058         pub contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr,
10059         /// Whether this CResult_UnsignedChannelUpdateDecodeErrorZ represents a success state.
10060         pub result_ok: bool,
10061 }
10062 #[no_mangle]
10063 /// Creates a new CResult_UnsignedChannelUpdateDecodeErrorZ in the success state.
10064 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UnsignedChannelUpdate) -> CResult_UnsignedChannelUpdateDecodeErrorZ {
10065         CResult_UnsignedChannelUpdateDecodeErrorZ {
10066                 contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr {
10067                         result: Box::into_raw(Box::new(o)),
10068                 },
10069                 result_ok: true,
10070         }
10071 }
10072 #[no_mangle]
10073 /// Creates a new CResult_UnsignedChannelUpdateDecodeErrorZ in the error state.
10074 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UnsignedChannelUpdateDecodeErrorZ {
10075         CResult_UnsignedChannelUpdateDecodeErrorZ {
10076                 contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr {
10077                         err: Box::into_raw(Box::new(e)),
10078                 },
10079                 result_ok: false,
10080         }
10081 }
10082 #[no_mangle]
10083 /// Frees any resources used by the CResult_UnsignedChannelUpdateDecodeErrorZ.
10084 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_free(_res: CResult_UnsignedChannelUpdateDecodeErrorZ) { }
10085 impl Drop for CResult_UnsignedChannelUpdateDecodeErrorZ {
10086         fn drop(&mut self) {
10087                 if self.result_ok {
10088                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
10089                                 let _ = unsafe { Box::from_raw(self.contents.result) };
10090                         }
10091                 } else {
10092                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
10093                                 let _ = unsafe { Box::from_raw(self.contents.err) };
10094                         }
10095                 }
10096         }
10097 }
10098 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedChannelUpdate, crate::lightning::ln::msgs::DecodeError>> for CResult_UnsignedChannelUpdateDecodeErrorZ {
10099         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedChannelUpdate, crate::lightning::ln::msgs::DecodeError>) -> Self {
10100                 let contents = if o.result_ok {
10101                         let result = unsafe { o.contents.result };
10102                         unsafe { o.contents.result = std::ptr::null_mut() };
10103                         CResult_UnsignedChannelUpdateDecodeErrorZPtr { result }
10104                 } else {
10105                         let err = unsafe { o.contents.err };
10106                         unsafe { o.contents.err = std::ptr::null_mut(); }
10107                         CResult_UnsignedChannelUpdateDecodeErrorZPtr { err }
10108                 };
10109                 Self {
10110                         contents,
10111                         result_ok: o.result_ok,
10112                 }
10113         }
10114 }
10115 impl Clone for CResult_UnsignedChannelUpdateDecodeErrorZ {
10116         fn clone(&self) -> Self {
10117                 if self.result_ok {
10118                         Self { result_ok: true, contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr {
10119                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UnsignedChannelUpdate>::clone(unsafe { &*self.contents.result })))
10120                         } }
10121                 } else {
10122                         Self { result_ok: false, contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr {
10123                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
10124                         } }
10125                 }
10126         }
10127 }
10128 #[no_mangle]
10129 /// Creates a new CResult_UnsignedChannelUpdateDecodeErrorZ which has the same data as `orig`
10130 /// but with all dynamically-allocated buffers duplicated in new buffers.
10131 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_clone(orig: &CResult_UnsignedChannelUpdateDecodeErrorZ) -> CResult_UnsignedChannelUpdateDecodeErrorZ { orig.clone() }
10132 #[repr(C)]
10133 /// The contents of CResult_ChannelUpdateDecodeErrorZ
10134 pub union CResult_ChannelUpdateDecodeErrorZPtr {
10135         /// A pointer to the contents in the success state.
10136         /// Reading from this pointer when `result_ok` is not set is undefined.
10137         pub result: *mut crate::lightning::ln::msgs::ChannelUpdate,
10138         /// A pointer to the contents in the error state.
10139         /// Reading from this pointer when `result_ok` is set is undefined.
10140         pub err: *mut crate::lightning::ln::msgs::DecodeError,
10141 }
10142 #[repr(C)]
10143 /// A CResult_ChannelUpdateDecodeErrorZ represents the result of a fallible operation,
10144 /// containing a crate::lightning::ln::msgs::ChannelUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
10145 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10146 pub struct CResult_ChannelUpdateDecodeErrorZ {
10147         /// The contents of this CResult_ChannelUpdateDecodeErrorZ, accessible via either
10148         /// `err` or `result` depending on the state of `result_ok`.
10149         pub contents: CResult_ChannelUpdateDecodeErrorZPtr,
10150         /// Whether this CResult_ChannelUpdateDecodeErrorZ represents a success state.
10151         pub result_ok: bool,
10152 }
10153 #[no_mangle]
10154 /// Creates a new CResult_ChannelUpdateDecodeErrorZ in the success state.
10155 pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ChannelUpdate) -> CResult_ChannelUpdateDecodeErrorZ {
10156         CResult_ChannelUpdateDecodeErrorZ {
10157                 contents: CResult_ChannelUpdateDecodeErrorZPtr {
10158                         result: Box::into_raw(Box::new(o)),
10159                 },
10160                 result_ok: true,
10161         }
10162 }
10163 #[no_mangle]
10164 /// Creates a new CResult_ChannelUpdateDecodeErrorZ in the error state.
10165 pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelUpdateDecodeErrorZ {
10166         CResult_ChannelUpdateDecodeErrorZ {
10167                 contents: CResult_ChannelUpdateDecodeErrorZPtr {
10168                         err: Box::into_raw(Box::new(e)),
10169                 },
10170                 result_ok: false,
10171         }
10172 }
10173 #[no_mangle]
10174 /// Frees any resources used by the CResult_ChannelUpdateDecodeErrorZ.
10175 pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_free(_res: CResult_ChannelUpdateDecodeErrorZ) { }
10176 impl Drop for CResult_ChannelUpdateDecodeErrorZ {
10177         fn drop(&mut self) {
10178                 if self.result_ok {
10179                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
10180                                 let _ = unsafe { Box::from_raw(self.contents.result) };
10181                         }
10182                 } else {
10183                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
10184                                 let _ = unsafe { Box::from_raw(self.contents.err) };
10185                         }
10186                 }
10187         }
10188 }
10189 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelUpdate, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelUpdateDecodeErrorZ {
10190         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelUpdate, crate::lightning::ln::msgs::DecodeError>) -> Self {
10191                 let contents = if o.result_ok {
10192                         let result = unsafe { o.contents.result };
10193                         unsafe { o.contents.result = std::ptr::null_mut() };
10194                         CResult_ChannelUpdateDecodeErrorZPtr { result }
10195                 } else {
10196                         let err = unsafe { o.contents.err };
10197                         unsafe { o.contents.err = std::ptr::null_mut(); }
10198                         CResult_ChannelUpdateDecodeErrorZPtr { err }
10199                 };
10200                 Self {
10201                         contents,
10202                         result_ok: o.result_ok,
10203                 }
10204         }
10205 }
10206 impl Clone for CResult_ChannelUpdateDecodeErrorZ {
10207         fn clone(&self) -> Self {
10208                 if self.result_ok {
10209                         Self { result_ok: true, contents: CResult_ChannelUpdateDecodeErrorZPtr {
10210                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ChannelUpdate>::clone(unsafe { &*self.contents.result })))
10211                         } }
10212                 } else {
10213                         Self { result_ok: false, contents: CResult_ChannelUpdateDecodeErrorZPtr {
10214                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
10215                         } }
10216                 }
10217         }
10218 }
10219 #[no_mangle]
10220 /// Creates a new CResult_ChannelUpdateDecodeErrorZ which has the same data as `orig`
10221 /// but with all dynamically-allocated buffers duplicated in new buffers.
10222 pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_clone(orig: &CResult_ChannelUpdateDecodeErrorZ) -> CResult_ChannelUpdateDecodeErrorZ { orig.clone() }
10223 #[repr(C)]
10224 /// The contents of CResult_ErrorMessageDecodeErrorZ
10225 pub union CResult_ErrorMessageDecodeErrorZPtr {
10226         /// A pointer to the contents in the success state.
10227         /// Reading from this pointer when `result_ok` is not set is undefined.
10228         pub result: *mut crate::lightning::ln::msgs::ErrorMessage,
10229         /// A pointer to the contents in the error state.
10230         /// Reading from this pointer when `result_ok` is set is undefined.
10231         pub err: *mut crate::lightning::ln::msgs::DecodeError,
10232 }
10233 #[repr(C)]
10234 /// A CResult_ErrorMessageDecodeErrorZ represents the result of a fallible operation,
10235 /// containing a crate::lightning::ln::msgs::ErrorMessage on success and a crate::lightning::ln::msgs::DecodeError on failure.
10236 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10237 pub struct CResult_ErrorMessageDecodeErrorZ {
10238         /// The contents of this CResult_ErrorMessageDecodeErrorZ, accessible via either
10239         /// `err` or `result` depending on the state of `result_ok`.
10240         pub contents: CResult_ErrorMessageDecodeErrorZPtr,
10241         /// Whether this CResult_ErrorMessageDecodeErrorZ represents a success state.
10242         pub result_ok: bool,
10243 }
10244 #[no_mangle]
10245 /// Creates a new CResult_ErrorMessageDecodeErrorZ in the success state.
10246 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ErrorMessage) -> CResult_ErrorMessageDecodeErrorZ {
10247         CResult_ErrorMessageDecodeErrorZ {
10248                 contents: CResult_ErrorMessageDecodeErrorZPtr {
10249                         result: Box::into_raw(Box::new(o)),
10250                 },
10251                 result_ok: true,
10252         }
10253 }
10254 #[no_mangle]
10255 /// Creates a new CResult_ErrorMessageDecodeErrorZ in the error state.
10256 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ErrorMessageDecodeErrorZ {
10257         CResult_ErrorMessageDecodeErrorZ {
10258                 contents: CResult_ErrorMessageDecodeErrorZPtr {
10259                         err: Box::into_raw(Box::new(e)),
10260                 },
10261                 result_ok: false,
10262         }
10263 }
10264 #[no_mangle]
10265 /// Frees any resources used by the CResult_ErrorMessageDecodeErrorZ.
10266 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_free(_res: CResult_ErrorMessageDecodeErrorZ) { }
10267 impl Drop for CResult_ErrorMessageDecodeErrorZ {
10268         fn drop(&mut self) {
10269                 if self.result_ok {
10270                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
10271                                 let _ = unsafe { Box::from_raw(self.contents.result) };
10272                         }
10273                 } else {
10274                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
10275                                 let _ = unsafe { Box::from_raw(self.contents.err) };
10276                         }
10277                 }
10278         }
10279 }
10280 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ErrorMessage, crate::lightning::ln::msgs::DecodeError>> for CResult_ErrorMessageDecodeErrorZ {
10281         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ErrorMessage, crate::lightning::ln::msgs::DecodeError>) -> Self {
10282                 let contents = if o.result_ok {
10283                         let result = unsafe { o.contents.result };
10284                         unsafe { o.contents.result = std::ptr::null_mut() };
10285                         CResult_ErrorMessageDecodeErrorZPtr { result }
10286                 } else {
10287                         let err = unsafe { o.contents.err };
10288                         unsafe { o.contents.err = std::ptr::null_mut(); }
10289                         CResult_ErrorMessageDecodeErrorZPtr { err }
10290                 };
10291                 Self {
10292                         contents,
10293                         result_ok: o.result_ok,
10294                 }
10295         }
10296 }
10297 impl Clone for CResult_ErrorMessageDecodeErrorZ {
10298         fn clone(&self) -> Self {
10299                 if self.result_ok {
10300                         Self { result_ok: true, contents: CResult_ErrorMessageDecodeErrorZPtr {
10301                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ErrorMessage>::clone(unsafe { &*self.contents.result })))
10302                         } }
10303                 } else {
10304                         Self { result_ok: false, contents: CResult_ErrorMessageDecodeErrorZPtr {
10305                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
10306                         } }
10307                 }
10308         }
10309 }
10310 #[no_mangle]
10311 /// Creates a new CResult_ErrorMessageDecodeErrorZ which has the same data as `orig`
10312 /// but with all dynamically-allocated buffers duplicated in new buffers.
10313 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_clone(orig: &CResult_ErrorMessageDecodeErrorZ) -> CResult_ErrorMessageDecodeErrorZ { orig.clone() }
10314 #[repr(C)]
10315 /// The contents of CResult_UnsignedNodeAnnouncementDecodeErrorZ
10316 pub union CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
10317         /// A pointer to the contents in the success state.
10318         /// Reading from this pointer when `result_ok` is not set is undefined.
10319         pub result: *mut crate::lightning::ln::msgs::UnsignedNodeAnnouncement,
10320         /// A pointer to the contents in the error state.
10321         /// Reading from this pointer when `result_ok` is set is undefined.
10322         pub err: *mut crate::lightning::ln::msgs::DecodeError,
10323 }
10324 #[repr(C)]
10325 /// A CResult_UnsignedNodeAnnouncementDecodeErrorZ represents the result of a fallible operation,
10326 /// containing a crate::lightning::ln::msgs::UnsignedNodeAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
10327 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10328 pub struct CResult_UnsignedNodeAnnouncementDecodeErrorZ {
10329         /// The contents of this CResult_UnsignedNodeAnnouncementDecodeErrorZ, accessible via either
10330         /// `err` or `result` depending on the state of `result_ok`.
10331         pub contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr,
10332         /// Whether this CResult_UnsignedNodeAnnouncementDecodeErrorZ represents a success state.
10333         pub result_ok: bool,
10334 }
10335 #[no_mangle]
10336 /// Creates a new CResult_UnsignedNodeAnnouncementDecodeErrorZ in the success state.
10337 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UnsignedNodeAnnouncement) -> CResult_UnsignedNodeAnnouncementDecodeErrorZ {
10338         CResult_UnsignedNodeAnnouncementDecodeErrorZ {
10339                 contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
10340                         result: Box::into_raw(Box::new(o)),
10341                 },
10342                 result_ok: true,
10343         }
10344 }
10345 #[no_mangle]
10346 /// Creates a new CResult_UnsignedNodeAnnouncementDecodeErrorZ in the error state.
10347 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UnsignedNodeAnnouncementDecodeErrorZ {
10348         CResult_UnsignedNodeAnnouncementDecodeErrorZ {
10349                 contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
10350                         err: Box::into_raw(Box::new(e)),
10351                 },
10352                 result_ok: false,
10353         }
10354 }
10355 #[no_mangle]
10356 /// Frees any resources used by the CResult_UnsignedNodeAnnouncementDecodeErrorZ.
10357 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_free(_res: CResult_UnsignedNodeAnnouncementDecodeErrorZ) { }
10358 impl Drop for CResult_UnsignedNodeAnnouncementDecodeErrorZ {
10359         fn drop(&mut self) {
10360                 if self.result_ok {
10361                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
10362                                 let _ = unsafe { Box::from_raw(self.contents.result) };
10363                         }
10364                 } else {
10365                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
10366                                 let _ = unsafe { Box::from_raw(self.contents.err) };
10367                         }
10368                 }
10369         }
10370 }
10371 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedNodeAnnouncement, crate::lightning::ln::msgs::DecodeError>> for CResult_UnsignedNodeAnnouncementDecodeErrorZ {
10372         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedNodeAnnouncement, crate::lightning::ln::msgs::DecodeError>) -> Self {
10373                 let contents = if o.result_ok {
10374                         let result = unsafe { o.contents.result };
10375                         unsafe { o.contents.result = std::ptr::null_mut() };
10376                         CResult_UnsignedNodeAnnouncementDecodeErrorZPtr { result }
10377                 } else {
10378                         let err = unsafe { o.contents.err };
10379                         unsafe { o.contents.err = std::ptr::null_mut(); }
10380                         CResult_UnsignedNodeAnnouncementDecodeErrorZPtr { err }
10381                 };
10382                 Self {
10383                         contents,
10384                         result_ok: o.result_ok,
10385                 }
10386         }
10387 }
10388 impl Clone for CResult_UnsignedNodeAnnouncementDecodeErrorZ {
10389         fn clone(&self) -> Self {
10390                 if self.result_ok {
10391                         Self { result_ok: true, contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
10392                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UnsignedNodeAnnouncement>::clone(unsafe { &*self.contents.result })))
10393                         } }
10394                 } else {
10395                         Self { result_ok: false, contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
10396                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
10397                         } }
10398                 }
10399         }
10400 }
10401 #[no_mangle]
10402 /// Creates a new CResult_UnsignedNodeAnnouncementDecodeErrorZ which has the same data as `orig`
10403 /// but with all dynamically-allocated buffers duplicated in new buffers.
10404 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone(orig: &CResult_UnsignedNodeAnnouncementDecodeErrorZ) -> CResult_UnsignedNodeAnnouncementDecodeErrorZ { orig.clone() }
10405 #[repr(C)]
10406 /// The contents of CResult_NodeAnnouncementDecodeErrorZ
10407 pub union CResult_NodeAnnouncementDecodeErrorZPtr {
10408         /// A pointer to the contents in the success state.
10409         /// Reading from this pointer when `result_ok` is not set is undefined.
10410         pub result: *mut crate::lightning::ln::msgs::NodeAnnouncement,
10411         /// A pointer to the contents in the error state.
10412         /// Reading from this pointer when `result_ok` is set is undefined.
10413         pub err: *mut crate::lightning::ln::msgs::DecodeError,
10414 }
10415 #[repr(C)]
10416 /// A CResult_NodeAnnouncementDecodeErrorZ represents the result of a fallible operation,
10417 /// containing a crate::lightning::ln::msgs::NodeAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
10418 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10419 pub struct CResult_NodeAnnouncementDecodeErrorZ {
10420         /// The contents of this CResult_NodeAnnouncementDecodeErrorZ, accessible via either
10421         /// `err` or `result` depending on the state of `result_ok`.
10422         pub contents: CResult_NodeAnnouncementDecodeErrorZPtr,
10423         /// Whether this CResult_NodeAnnouncementDecodeErrorZ represents a success state.
10424         pub result_ok: bool,
10425 }
10426 #[no_mangle]
10427 /// Creates a new CResult_NodeAnnouncementDecodeErrorZ in the success state.
10428 pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_ok(o: crate::lightning::ln::msgs::NodeAnnouncement) -> CResult_NodeAnnouncementDecodeErrorZ {
10429         CResult_NodeAnnouncementDecodeErrorZ {
10430                 contents: CResult_NodeAnnouncementDecodeErrorZPtr {
10431                         result: Box::into_raw(Box::new(o)),
10432                 },
10433                 result_ok: true,
10434         }
10435 }
10436 #[no_mangle]
10437 /// Creates a new CResult_NodeAnnouncementDecodeErrorZ in the error state.
10438 pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeAnnouncementDecodeErrorZ {
10439         CResult_NodeAnnouncementDecodeErrorZ {
10440                 contents: CResult_NodeAnnouncementDecodeErrorZPtr {
10441                         err: Box::into_raw(Box::new(e)),
10442                 },
10443                 result_ok: false,
10444         }
10445 }
10446 #[no_mangle]
10447 /// Frees any resources used by the CResult_NodeAnnouncementDecodeErrorZ.
10448 pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_free(_res: CResult_NodeAnnouncementDecodeErrorZ) { }
10449 impl Drop for CResult_NodeAnnouncementDecodeErrorZ {
10450         fn drop(&mut self) {
10451                 if self.result_ok {
10452                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
10453                                 let _ = unsafe { Box::from_raw(self.contents.result) };
10454                         }
10455                 } else {
10456                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
10457                                 let _ = unsafe { Box::from_raw(self.contents.err) };
10458                         }
10459                 }
10460         }
10461 }
10462 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::NodeAnnouncement, crate::lightning::ln::msgs::DecodeError>> for CResult_NodeAnnouncementDecodeErrorZ {
10463         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::NodeAnnouncement, crate::lightning::ln::msgs::DecodeError>) -> Self {
10464                 let contents = if o.result_ok {
10465                         let result = unsafe { o.contents.result };
10466                         unsafe { o.contents.result = std::ptr::null_mut() };
10467                         CResult_NodeAnnouncementDecodeErrorZPtr { result }
10468                 } else {
10469                         let err = unsafe { o.contents.err };
10470                         unsafe { o.contents.err = std::ptr::null_mut(); }
10471                         CResult_NodeAnnouncementDecodeErrorZPtr { err }
10472                 };
10473                 Self {
10474                         contents,
10475                         result_ok: o.result_ok,
10476                 }
10477         }
10478 }
10479 impl Clone for CResult_NodeAnnouncementDecodeErrorZ {
10480         fn clone(&self) -> Self {
10481                 if self.result_ok {
10482                         Self { result_ok: true, contents: CResult_NodeAnnouncementDecodeErrorZPtr {
10483                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::NodeAnnouncement>::clone(unsafe { &*self.contents.result })))
10484                         } }
10485                 } else {
10486                         Self { result_ok: false, contents: CResult_NodeAnnouncementDecodeErrorZPtr {
10487                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
10488                         } }
10489                 }
10490         }
10491 }
10492 #[no_mangle]
10493 /// Creates a new CResult_NodeAnnouncementDecodeErrorZ which has the same data as `orig`
10494 /// but with all dynamically-allocated buffers duplicated in new buffers.
10495 pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_clone(orig: &CResult_NodeAnnouncementDecodeErrorZ) -> CResult_NodeAnnouncementDecodeErrorZ { orig.clone() }
10496 #[repr(C)]
10497 /// The contents of CResult_QueryShortChannelIdsDecodeErrorZ
10498 pub union CResult_QueryShortChannelIdsDecodeErrorZPtr {
10499         /// A pointer to the contents in the success state.
10500         /// Reading from this pointer when `result_ok` is not set is undefined.
10501         pub result: *mut crate::lightning::ln::msgs::QueryShortChannelIds,
10502         /// A pointer to the contents in the error state.
10503         /// Reading from this pointer when `result_ok` is set is undefined.
10504         pub err: *mut crate::lightning::ln::msgs::DecodeError,
10505 }
10506 #[repr(C)]
10507 /// A CResult_QueryShortChannelIdsDecodeErrorZ represents the result of a fallible operation,
10508 /// containing a crate::lightning::ln::msgs::QueryShortChannelIds on success and a crate::lightning::ln::msgs::DecodeError on failure.
10509 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10510 pub struct CResult_QueryShortChannelIdsDecodeErrorZ {
10511         /// The contents of this CResult_QueryShortChannelIdsDecodeErrorZ, accessible via either
10512         /// `err` or `result` depending on the state of `result_ok`.
10513         pub contents: CResult_QueryShortChannelIdsDecodeErrorZPtr,
10514         /// Whether this CResult_QueryShortChannelIdsDecodeErrorZ represents a success state.
10515         pub result_ok: bool,
10516 }
10517 #[no_mangle]
10518 /// Creates a new CResult_QueryShortChannelIdsDecodeErrorZ in the success state.
10519 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_ok(o: crate::lightning::ln::msgs::QueryShortChannelIds) -> CResult_QueryShortChannelIdsDecodeErrorZ {
10520         CResult_QueryShortChannelIdsDecodeErrorZ {
10521                 contents: CResult_QueryShortChannelIdsDecodeErrorZPtr {
10522                         result: Box::into_raw(Box::new(o)),
10523                 },
10524                 result_ok: true,
10525         }
10526 }
10527 #[no_mangle]
10528 /// Creates a new CResult_QueryShortChannelIdsDecodeErrorZ in the error state.
10529 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_QueryShortChannelIdsDecodeErrorZ {
10530         CResult_QueryShortChannelIdsDecodeErrorZ {
10531                 contents: CResult_QueryShortChannelIdsDecodeErrorZPtr {
10532                         err: Box::into_raw(Box::new(e)),
10533                 },
10534                 result_ok: false,
10535         }
10536 }
10537 #[no_mangle]
10538 /// Frees any resources used by the CResult_QueryShortChannelIdsDecodeErrorZ.
10539 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_free(_res: CResult_QueryShortChannelIdsDecodeErrorZ) { }
10540 impl Drop for CResult_QueryShortChannelIdsDecodeErrorZ {
10541         fn drop(&mut self) {
10542                 if self.result_ok {
10543                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
10544                                 let _ = unsafe { Box::from_raw(self.contents.result) };
10545                         }
10546                 } else {
10547                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
10548                                 let _ = unsafe { Box::from_raw(self.contents.err) };
10549                         }
10550                 }
10551         }
10552 }
10553 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::QueryShortChannelIds, crate::lightning::ln::msgs::DecodeError>> for CResult_QueryShortChannelIdsDecodeErrorZ {
10554         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::QueryShortChannelIds, crate::lightning::ln::msgs::DecodeError>) -> Self {
10555                 let contents = if o.result_ok {
10556                         let result = unsafe { o.contents.result };
10557                         unsafe { o.contents.result = std::ptr::null_mut() };
10558                         CResult_QueryShortChannelIdsDecodeErrorZPtr { result }
10559                 } else {
10560                         let err = unsafe { o.contents.err };
10561                         unsafe { o.contents.err = std::ptr::null_mut(); }
10562                         CResult_QueryShortChannelIdsDecodeErrorZPtr { err }
10563                 };
10564                 Self {
10565                         contents,
10566                         result_ok: o.result_ok,
10567                 }
10568         }
10569 }
10570 impl Clone for CResult_QueryShortChannelIdsDecodeErrorZ {
10571         fn clone(&self) -> Self {
10572                 if self.result_ok {
10573                         Self { result_ok: true, contents: CResult_QueryShortChannelIdsDecodeErrorZPtr {
10574                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::QueryShortChannelIds>::clone(unsafe { &*self.contents.result })))
10575                         } }
10576                 } else {
10577                         Self { result_ok: false, contents: CResult_QueryShortChannelIdsDecodeErrorZPtr {
10578                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
10579                         } }
10580                 }
10581         }
10582 }
10583 #[no_mangle]
10584 /// Creates a new CResult_QueryShortChannelIdsDecodeErrorZ which has the same data as `orig`
10585 /// but with all dynamically-allocated buffers duplicated in new buffers.
10586 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_clone(orig: &CResult_QueryShortChannelIdsDecodeErrorZ) -> CResult_QueryShortChannelIdsDecodeErrorZ { orig.clone() }
10587 #[repr(C)]
10588 /// The contents of CResult_ReplyShortChannelIdsEndDecodeErrorZ
10589 pub union CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
10590         /// A pointer to the contents in the success state.
10591         /// Reading from this pointer when `result_ok` is not set is undefined.
10592         pub result: *mut crate::lightning::ln::msgs::ReplyShortChannelIdsEnd,
10593         /// A pointer to the contents in the error state.
10594         /// Reading from this pointer when `result_ok` is set is undefined.
10595         pub err: *mut crate::lightning::ln::msgs::DecodeError,
10596 }
10597 #[repr(C)]
10598 /// A CResult_ReplyShortChannelIdsEndDecodeErrorZ represents the result of a fallible operation,
10599 /// containing a crate::lightning::ln::msgs::ReplyShortChannelIdsEnd on success and a crate::lightning::ln::msgs::DecodeError on failure.
10600 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10601 pub struct CResult_ReplyShortChannelIdsEndDecodeErrorZ {
10602         /// The contents of this CResult_ReplyShortChannelIdsEndDecodeErrorZ, accessible via either
10603         /// `err` or `result` depending on the state of `result_ok`.
10604         pub contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr,
10605         /// Whether this CResult_ReplyShortChannelIdsEndDecodeErrorZ represents a success state.
10606         pub result_ok: bool,
10607 }
10608 #[no_mangle]
10609 /// Creates a new CResult_ReplyShortChannelIdsEndDecodeErrorZ in the success state.
10610 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ReplyShortChannelIdsEnd) -> CResult_ReplyShortChannelIdsEndDecodeErrorZ {
10611         CResult_ReplyShortChannelIdsEndDecodeErrorZ {
10612                 contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
10613                         result: Box::into_raw(Box::new(o)),
10614                 },
10615                 result_ok: true,
10616         }
10617 }
10618 #[no_mangle]
10619 /// Creates a new CResult_ReplyShortChannelIdsEndDecodeErrorZ in the error state.
10620 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ReplyShortChannelIdsEndDecodeErrorZ {
10621         CResult_ReplyShortChannelIdsEndDecodeErrorZ {
10622                 contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
10623                         err: Box::into_raw(Box::new(e)),
10624                 },
10625                 result_ok: false,
10626         }
10627 }
10628 #[no_mangle]
10629 /// Frees any resources used by the CResult_ReplyShortChannelIdsEndDecodeErrorZ.
10630 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_free(_res: CResult_ReplyShortChannelIdsEndDecodeErrorZ) { }
10631 impl Drop for CResult_ReplyShortChannelIdsEndDecodeErrorZ {
10632         fn drop(&mut self) {
10633                 if self.result_ok {
10634                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
10635                                 let _ = unsafe { Box::from_raw(self.contents.result) };
10636                         }
10637                 } else {
10638                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
10639                                 let _ = unsafe { Box::from_raw(self.contents.err) };
10640                         }
10641                 }
10642         }
10643 }
10644 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ReplyShortChannelIdsEnd, crate::lightning::ln::msgs::DecodeError>> for CResult_ReplyShortChannelIdsEndDecodeErrorZ {
10645         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ReplyShortChannelIdsEnd, crate::lightning::ln::msgs::DecodeError>) -> Self {
10646                 let contents = if o.result_ok {
10647                         let result = unsafe { o.contents.result };
10648                         unsafe { o.contents.result = std::ptr::null_mut() };
10649                         CResult_ReplyShortChannelIdsEndDecodeErrorZPtr { result }
10650                 } else {
10651                         let err = unsafe { o.contents.err };
10652                         unsafe { o.contents.err = std::ptr::null_mut(); }
10653                         CResult_ReplyShortChannelIdsEndDecodeErrorZPtr { err }
10654                 };
10655                 Self {
10656                         contents,
10657                         result_ok: o.result_ok,
10658                 }
10659         }
10660 }
10661 impl Clone for CResult_ReplyShortChannelIdsEndDecodeErrorZ {
10662         fn clone(&self) -> Self {
10663                 if self.result_ok {
10664                         Self { result_ok: true, contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
10665                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ReplyShortChannelIdsEnd>::clone(unsafe { &*self.contents.result })))
10666                         } }
10667                 } else {
10668                         Self { result_ok: false, contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
10669                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
10670                         } }
10671                 }
10672         }
10673 }
10674 #[no_mangle]
10675 /// Creates a new CResult_ReplyShortChannelIdsEndDecodeErrorZ which has the same data as `orig`
10676 /// but with all dynamically-allocated buffers duplicated in new buffers.
10677 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone(orig: &CResult_ReplyShortChannelIdsEndDecodeErrorZ) -> CResult_ReplyShortChannelIdsEndDecodeErrorZ { orig.clone() }
10678 #[repr(C)]
10679 /// The contents of CResult_QueryChannelRangeDecodeErrorZ
10680 pub union CResult_QueryChannelRangeDecodeErrorZPtr {
10681         /// A pointer to the contents in the success state.
10682         /// Reading from this pointer when `result_ok` is not set is undefined.
10683         pub result: *mut crate::lightning::ln::msgs::QueryChannelRange,
10684         /// A pointer to the contents in the error state.
10685         /// Reading from this pointer when `result_ok` is set is undefined.
10686         pub err: *mut crate::lightning::ln::msgs::DecodeError,
10687 }
10688 #[repr(C)]
10689 /// A CResult_QueryChannelRangeDecodeErrorZ represents the result of a fallible operation,
10690 /// containing a crate::lightning::ln::msgs::QueryChannelRange on success and a crate::lightning::ln::msgs::DecodeError on failure.
10691 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10692 pub struct CResult_QueryChannelRangeDecodeErrorZ {
10693         /// The contents of this CResult_QueryChannelRangeDecodeErrorZ, accessible via either
10694         /// `err` or `result` depending on the state of `result_ok`.
10695         pub contents: CResult_QueryChannelRangeDecodeErrorZPtr,
10696         /// Whether this CResult_QueryChannelRangeDecodeErrorZ represents a success state.
10697         pub result_ok: bool,
10698 }
10699 #[no_mangle]
10700 /// Creates a new CResult_QueryChannelRangeDecodeErrorZ in the success state.
10701 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_ok(o: crate::lightning::ln::msgs::QueryChannelRange) -> CResult_QueryChannelRangeDecodeErrorZ {
10702         CResult_QueryChannelRangeDecodeErrorZ {
10703                 contents: CResult_QueryChannelRangeDecodeErrorZPtr {
10704                         result: Box::into_raw(Box::new(o)),
10705                 },
10706                 result_ok: true,
10707         }
10708 }
10709 #[no_mangle]
10710 /// Creates a new CResult_QueryChannelRangeDecodeErrorZ in the error state.
10711 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_QueryChannelRangeDecodeErrorZ {
10712         CResult_QueryChannelRangeDecodeErrorZ {
10713                 contents: CResult_QueryChannelRangeDecodeErrorZPtr {
10714                         err: Box::into_raw(Box::new(e)),
10715                 },
10716                 result_ok: false,
10717         }
10718 }
10719 #[no_mangle]
10720 /// Frees any resources used by the CResult_QueryChannelRangeDecodeErrorZ.
10721 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_free(_res: CResult_QueryChannelRangeDecodeErrorZ) { }
10722 impl Drop for CResult_QueryChannelRangeDecodeErrorZ {
10723         fn drop(&mut self) {
10724                 if self.result_ok {
10725                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
10726                                 let _ = unsafe { Box::from_raw(self.contents.result) };
10727                         }
10728                 } else {
10729                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
10730                                 let _ = unsafe { Box::from_raw(self.contents.err) };
10731                         }
10732                 }
10733         }
10734 }
10735 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::QueryChannelRange, crate::lightning::ln::msgs::DecodeError>> for CResult_QueryChannelRangeDecodeErrorZ {
10736         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::QueryChannelRange, crate::lightning::ln::msgs::DecodeError>) -> Self {
10737                 let contents = if o.result_ok {
10738                         let result = unsafe { o.contents.result };
10739                         unsafe { o.contents.result = std::ptr::null_mut() };
10740                         CResult_QueryChannelRangeDecodeErrorZPtr { result }
10741                 } else {
10742                         let err = unsafe { o.contents.err };
10743                         unsafe { o.contents.err = std::ptr::null_mut(); }
10744                         CResult_QueryChannelRangeDecodeErrorZPtr { err }
10745                 };
10746                 Self {
10747                         contents,
10748                         result_ok: o.result_ok,
10749                 }
10750         }
10751 }
10752 impl Clone for CResult_QueryChannelRangeDecodeErrorZ {
10753         fn clone(&self) -> Self {
10754                 if self.result_ok {
10755                         Self { result_ok: true, contents: CResult_QueryChannelRangeDecodeErrorZPtr {
10756                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::QueryChannelRange>::clone(unsafe { &*self.contents.result })))
10757                         } }
10758                 } else {
10759                         Self { result_ok: false, contents: CResult_QueryChannelRangeDecodeErrorZPtr {
10760                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
10761                         } }
10762                 }
10763         }
10764 }
10765 #[no_mangle]
10766 /// Creates a new CResult_QueryChannelRangeDecodeErrorZ which has the same data as `orig`
10767 /// but with all dynamically-allocated buffers duplicated in new buffers.
10768 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_clone(orig: &CResult_QueryChannelRangeDecodeErrorZ) -> CResult_QueryChannelRangeDecodeErrorZ { orig.clone() }
10769 #[repr(C)]
10770 /// The contents of CResult_ReplyChannelRangeDecodeErrorZ
10771 pub union CResult_ReplyChannelRangeDecodeErrorZPtr {
10772         /// A pointer to the contents in the success state.
10773         /// Reading from this pointer when `result_ok` is not set is undefined.
10774         pub result: *mut crate::lightning::ln::msgs::ReplyChannelRange,
10775         /// A pointer to the contents in the error state.
10776         /// Reading from this pointer when `result_ok` is set is undefined.
10777         pub err: *mut crate::lightning::ln::msgs::DecodeError,
10778 }
10779 #[repr(C)]
10780 /// A CResult_ReplyChannelRangeDecodeErrorZ represents the result of a fallible operation,
10781 /// containing a crate::lightning::ln::msgs::ReplyChannelRange on success and a crate::lightning::ln::msgs::DecodeError on failure.
10782 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10783 pub struct CResult_ReplyChannelRangeDecodeErrorZ {
10784         /// The contents of this CResult_ReplyChannelRangeDecodeErrorZ, accessible via either
10785         /// `err` or `result` depending on the state of `result_ok`.
10786         pub contents: CResult_ReplyChannelRangeDecodeErrorZPtr,
10787         /// Whether this CResult_ReplyChannelRangeDecodeErrorZ represents a success state.
10788         pub result_ok: bool,
10789 }
10790 #[no_mangle]
10791 /// Creates a new CResult_ReplyChannelRangeDecodeErrorZ in the success state.
10792 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ReplyChannelRange) -> CResult_ReplyChannelRangeDecodeErrorZ {
10793         CResult_ReplyChannelRangeDecodeErrorZ {
10794                 contents: CResult_ReplyChannelRangeDecodeErrorZPtr {
10795                         result: Box::into_raw(Box::new(o)),
10796                 },
10797                 result_ok: true,
10798         }
10799 }
10800 #[no_mangle]
10801 /// Creates a new CResult_ReplyChannelRangeDecodeErrorZ in the error state.
10802 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ReplyChannelRangeDecodeErrorZ {
10803         CResult_ReplyChannelRangeDecodeErrorZ {
10804                 contents: CResult_ReplyChannelRangeDecodeErrorZPtr {
10805                         err: Box::into_raw(Box::new(e)),
10806                 },
10807                 result_ok: false,
10808         }
10809 }
10810 #[no_mangle]
10811 /// Frees any resources used by the CResult_ReplyChannelRangeDecodeErrorZ.
10812 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_free(_res: CResult_ReplyChannelRangeDecodeErrorZ) { }
10813 impl Drop for CResult_ReplyChannelRangeDecodeErrorZ {
10814         fn drop(&mut self) {
10815                 if self.result_ok {
10816                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
10817                                 let _ = unsafe { Box::from_raw(self.contents.result) };
10818                         }
10819                 } else {
10820                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
10821                                 let _ = unsafe { Box::from_raw(self.contents.err) };
10822                         }
10823                 }
10824         }
10825 }
10826 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ReplyChannelRange, crate::lightning::ln::msgs::DecodeError>> for CResult_ReplyChannelRangeDecodeErrorZ {
10827         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ReplyChannelRange, crate::lightning::ln::msgs::DecodeError>) -> Self {
10828                 let contents = if o.result_ok {
10829                         let result = unsafe { o.contents.result };
10830                         unsafe { o.contents.result = std::ptr::null_mut() };
10831                         CResult_ReplyChannelRangeDecodeErrorZPtr { result }
10832                 } else {
10833                         let err = unsafe { o.contents.err };
10834                         unsafe { o.contents.err = std::ptr::null_mut(); }
10835                         CResult_ReplyChannelRangeDecodeErrorZPtr { err }
10836                 };
10837                 Self {
10838                         contents,
10839                         result_ok: o.result_ok,
10840                 }
10841         }
10842 }
10843 impl Clone for CResult_ReplyChannelRangeDecodeErrorZ {
10844         fn clone(&self) -> Self {
10845                 if self.result_ok {
10846                         Self { result_ok: true, contents: CResult_ReplyChannelRangeDecodeErrorZPtr {
10847                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ReplyChannelRange>::clone(unsafe { &*self.contents.result })))
10848                         } }
10849                 } else {
10850                         Self { result_ok: false, contents: CResult_ReplyChannelRangeDecodeErrorZPtr {
10851                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
10852                         } }
10853                 }
10854         }
10855 }
10856 #[no_mangle]
10857 /// Creates a new CResult_ReplyChannelRangeDecodeErrorZ which has the same data as `orig`
10858 /// but with all dynamically-allocated buffers duplicated in new buffers.
10859 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_clone(orig: &CResult_ReplyChannelRangeDecodeErrorZ) -> CResult_ReplyChannelRangeDecodeErrorZ { orig.clone() }
10860 #[repr(C)]
10861 /// The contents of CResult_GossipTimestampFilterDecodeErrorZ
10862 pub union CResult_GossipTimestampFilterDecodeErrorZPtr {
10863         /// A pointer to the contents in the success state.
10864         /// Reading from this pointer when `result_ok` is not set is undefined.
10865         pub result: *mut crate::lightning::ln::msgs::GossipTimestampFilter,
10866         /// A pointer to the contents in the error state.
10867         /// Reading from this pointer when `result_ok` is set is undefined.
10868         pub err: *mut crate::lightning::ln::msgs::DecodeError,
10869 }
10870 #[repr(C)]
10871 /// A CResult_GossipTimestampFilterDecodeErrorZ represents the result of a fallible operation,
10872 /// containing a crate::lightning::ln::msgs::GossipTimestampFilter on success and a crate::lightning::ln::msgs::DecodeError on failure.
10873 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10874 pub struct CResult_GossipTimestampFilterDecodeErrorZ {
10875         /// The contents of this CResult_GossipTimestampFilterDecodeErrorZ, accessible via either
10876         /// `err` or `result` depending on the state of `result_ok`.
10877         pub contents: CResult_GossipTimestampFilterDecodeErrorZPtr,
10878         /// Whether this CResult_GossipTimestampFilterDecodeErrorZ represents a success state.
10879         pub result_ok: bool,
10880 }
10881 #[no_mangle]
10882 /// Creates a new CResult_GossipTimestampFilterDecodeErrorZ in the success state.
10883 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_ok(o: crate::lightning::ln::msgs::GossipTimestampFilter) -> CResult_GossipTimestampFilterDecodeErrorZ {
10884         CResult_GossipTimestampFilterDecodeErrorZ {
10885                 contents: CResult_GossipTimestampFilterDecodeErrorZPtr {
10886                         result: Box::into_raw(Box::new(o)),
10887                 },
10888                 result_ok: true,
10889         }
10890 }
10891 #[no_mangle]
10892 /// Creates a new CResult_GossipTimestampFilterDecodeErrorZ in the error state.
10893 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_GossipTimestampFilterDecodeErrorZ {
10894         CResult_GossipTimestampFilterDecodeErrorZ {
10895                 contents: CResult_GossipTimestampFilterDecodeErrorZPtr {
10896                         err: Box::into_raw(Box::new(e)),
10897                 },
10898                 result_ok: false,
10899         }
10900 }
10901 #[no_mangle]
10902 /// Frees any resources used by the CResult_GossipTimestampFilterDecodeErrorZ.
10903 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_free(_res: CResult_GossipTimestampFilterDecodeErrorZ) { }
10904 impl Drop for CResult_GossipTimestampFilterDecodeErrorZ {
10905         fn drop(&mut self) {
10906                 if self.result_ok {
10907                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
10908                                 let _ = unsafe { Box::from_raw(self.contents.result) };
10909                         }
10910                 } else {
10911                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
10912                                 let _ = unsafe { Box::from_raw(self.contents.err) };
10913                         }
10914                 }
10915         }
10916 }
10917 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::GossipTimestampFilter, crate::lightning::ln::msgs::DecodeError>> for CResult_GossipTimestampFilterDecodeErrorZ {
10918         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::GossipTimestampFilter, crate::lightning::ln::msgs::DecodeError>) -> Self {
10919                 let contents = if o.result_ok {
10920                         let result = unsafe { o.contents.result };
10921                         unsafe { o.contents.result = std::ptr::null_mut() };
10922                         CResult_GossipTimestampFilterDecodeErrorZPtr { result }
10923                 } else {
10924                         let err = unsafe { o.contents.err };
10925                         unsafe { o.contents.err = std::ptr::null_mut(); }
10926                         CResult_GossipTimestampFilterDecodeErrorZPtr { err }
10927                 };
10928                 Self {
10929                         contents,
10930                         result_ok: o.result_ok,
10931                 }
10932         }
10933 }
10934 impl Clone for CResult_GossipTimestampFilterDecodeErrorZ {
10935         fn clone(&self) -> Self {
10936                 if self.result_ok {
10937                         Self { result_ok: true, contents: CResult_GossipTimestampFilterDecodeErrorZPtr {
10938                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::GossipTimestampFilter>::clone(unsafe { &*self.contents.result })))
10939                         } }
10940                 } else {
10941                         Self { result_ok: false, contents: CResult_GossipTimestampFilterDecodeErrorZPtr {
10942                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
10943                         } }
10944                 }
10945         }
10946 }
10947 #[no_mangle]
10948 /// Creates a new CResult_GossipTimestampFilterDecodeErrorZ which has the same data as `orig`
10949 /// but with all dynamically-allocated buffers duplicated in new buffers.
10950 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_clone(orig: &CResult_GossipTimestampFilterDecodeErrorZ) -> CResult_GossipTimestampFilterDecodeErrorZ { orig.clone() }
10951 #[repr(C)]
10952 /// The contents of CResult_InvoiceSignOrCreationErrorZ
10953 pub union CResult_InvoiceSignOrCreationErrorZPtr {
10954         /// A pointer to the contents in the success state.
10955         /// Reading from this pointer when `result_ok` is not set is undefined.
10956         pub result: *mut crate::lightning_invoice::Invoice,
10957         /// A pointer to the contents in the error state.
10958         /// Reading from this pointer when `result_ok` is set is undefined.
10959         pub err: *mut crate::lightning_invoice::SignOrCreationError,
10960 }
10961 #[repr(C)]
10962 /// A CResult_InvoiceSignOrCreationErrorZ represents the result of a fallible operation,
10963 /// containing a crate::lightning_invoice::Invoice on success and a crate::lightning_invoice::SignOrCreationError on failure.
10964 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10965 pub struct CResult_InvoiceSignOrCreationErrorZ {
10966         /// The contents of this CResult_InvoiceSignOrCreationErrorZ, accessible via either
10967         /// `err` or `result` depending on the state of `result_ok`.
10968         pub contents: CResult_InvoiceSignOrCreationErrorZPtr,
10969         /// Whether this CResult_InvoiceSignOrCreationErrorZ represents a success state.
10970         pub result_ok: bool,
10971 }
10972 #[no_mangle]
10973 /// Creates a new CResult_InvoiceSignOrCreationErrorZ in the success state.
10974 pub extern "C" fn CResult_InvoiceSignOrCreationErrorZ_ok(o: crate::lightning_invoice::Invoice) -> CResult_InvoiceSignOrCreationErrorZ {
10975         CResult_InvoiceSignOrCreationErrorZ {
10976                 contents: CResult_InvoiceSignOrCreationErrorZPtr {
10977                         result: Box::into_raw(Box::new(o)),
10978                 },
10979                 result_ok: true,
10980         }
10981 }
10982 #[no_mangle]
10983 /// Creates a new CResult_InvoiceSignOrCreationErrorZ in the error state.
10984 pub extern "C" fn CResult_InvoiceSignOrCreationErrorZ_err(e: crate::lightning_invoice::SignOrCreationError) -> CResult_InvoiceSignOrCreationErrorZ {
10985         CResult_InvoiceSignOrCreationErrorZ {
10986                 contents: CResult_InvoiceSignOrCreationErrorZPtr {
10987                         err: Box::into_raw(Box::new(e)),
10988                 },
10989                 result_ok: false,
10990         }
10991 }
10992 #[no_mangle]
10993 /// Frees any resources used by the CResult_InvoiceSignOrCreationErrorZ.
10994 pub extern "C" fn CResult_InvoiceSignOrCreationErrorZ_free(_res: CResult_InvoiceSignOrCreationErrorZ) { }
10995 impl Drop for CResult_InvoiceSignOrCreationErrorZ {
10996         fn drop(&mut self) {
10997                 if self.result_ok {
10998                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
10999                                 let _ = unsafe { Box::from_raw(self.contents.result) };
11000                         }
11001                 } else {
11002                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
11003                                 let _ = unsafe { Box::from_raw(self.contents.err) };
11004                         }
11005                 }
11006         }
11007 }
11008 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::Invoice, crate::lightning_invoice::SignOrCreationError>> for CResult_InvoiceSignOrCreationErrorZ {
11009         fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::Invoice, crate::lightning_invoice::SignOrCreationError>) -> Self {
11010                 let contents = if o.result_ok {
11011                         let result = unsafe { o.contents.result };
11012                         unsafe { o.contents.result = std::ptr::null_mut() };
11013                         CResult_InvoiceSignOrCreationErrorZPtr { result }
11014                 } else {
11015                         let err = unsafe { o.contents.err };
11016                         unsafe { o.contents.err = std::ptr::null_mut(); }
11017                         CResult_InvoiceSignOrCreationErrorZPtr { err }
11018                 };
11019                 Self {
11020                         contents,
11021                         result_ok: o.result_ok,
11022                 }
11023         }
11024 }
11025 impl Clone for CResult_InvoiceSignOrCreationErrorZ {
11026         fn clone(&self) -> Self {
11027                 if self.result_ok {
11028                         Self { result_ok: true, contents: CResult_InvoiceSignOrCreationErrorZPtr {
11029                                 result: Box::into_raw(Box::new(<crate::lightning_invoice::Invoice>::clone(unsafe { &*self.contents.result })))
11030                         } }
11031                 } else {
11032                         Self { result_ok: false, contents: CResult_InvoiceSignOrCreationErrorZPtr {
11033                                 err: Box::into_raw(Box::new(<crate::lightning_invoice::SignOrCreationError>::clone(unsafe { &*self.contents.err })))
11034                         } }
11035                 }
11036         }
11037 }
11038 #[no_mangle]
11039 /// Creates a new CResult_InvoiceSignOrCreationErrorZ which has the same data as `orig`
11040 /// but with all dynamically-allocated buffers duplicated in new buffers.
11041 pub extern "C" fn CResult_InvoiceSignOrCreationErrorZ_clone(orig: &CResult_InvoiceSignOrCreationErrorZ) -> CResult_InvoiceSignOrCreationErrorZ { orig.clone() }