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