Merge pull request #36 from TheBlueMatt/main
[ldk-c-bindings] / lightning-c-bindings / src / c_types / derived.rs
1 #[repr(C)]
2 /// The contents of CResult_SecretKeyErrorZ
3 pub union CResult_SecretKeyErrorZPtr {
4         /// A pointer to the contents in the success state.
5         /// Reading from this pointer when `result_ok` is not set is undefined.
6         pub result: *mut crate::c_types::SecretKey,
7         /// A pointer to the contents in the error state.
8         /// Reading from this pointer when `result_ok` is set is undefined.
9         pub err: *mut crate::c_types::Secp256k1Error,
10 }
11 #[repr(C)]
12 /// A CResult_SecretKeyErrorZ represents the result of a fallible operation,
13 /// containing a crate::c_types::SecretKey on success and a crate::c_types::Secp256k1Error on failure.
14 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
15 pub struct CResult_SecretKeyErrorZ {
16         /// The contents of this CResult_SecretKeyErrorZ, accessible via either
17         /// `err` or `result` depending on the state of `result_ok`.
18         pub contents: CResult_SecretKeyErrorZPtr,
19         /// Whether this CResult_SecretKeyErrorZ represents a success state.
20         pub result_ok: bool,
21 }
22 #[no_mangle]
23 /// Creates a new CResult_SecretKeyErrorZ in the success state.
24 pub extern "C" fn CResult_SecretKeyErrorZ_ok(o: crate::c_types::SecretKey) -> CResult_SecretKeyErrorZ {
25         CResult_SecretKeyErrorZ {
26                 contents: CResult_SecretKeyErrorZPtr {
27                         result: Box::into_raw(Box::new(o)),
28                 },
29                 result_ok: true,
30         }
31 }
32 #[no_mangle]
33 /// Creates a new CResult_SecretKeyErrorZ in the error state.
34 pub extern "C" fn CResult_SecretKeyErrorZ_err(e: crate::c_types::Secp256k1Error) -> CResult_SecretKeyErrorZ {
35         CResult_SecretKeyErrorZ {
36                 contents: CResult_SecretKeyErrorZPtr {
37                         err: Box::into_raw(Box::new(e)),
38                 },
39                 result_ok: false,
40         }
41 }
42 #[no_mangle]
43 /// Frees any resources used by the CResult_SecretKeyErrorZ.
44 pub extern "C" fn CResult_SecretKeyErrorZ_free(_res: CResult_SecretKeyErrorZ) { }
45 impl Drop for CResult_SecretKeyErrorZ {
46         fn drop(&mut self) {
47                 if self.result_ok {
48                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
49                                 let _ = unsafe { Box::from_raw(self.contents.result) };
50                         }
51                 } else {
52                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
53                                 let _ = unsafe { Box::from_raw(self.contents.err) };
54                         }
55                 }
56         }
57 }
58 impl From<crate::c_types::CResultTempl<crate::c_types::SecretKey, crate::c_types::Secp256k1Error>> for CResult_SecretKeyErrorZ {
59         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::SecretKey, crate::c_types::Secp256k1Error>) -> Self {
60                 let contents = if o.result_ok {
61                         let result = unsafe { o.contents.result };
62                         unsafe { o.contents.result = std::ptr::null_mut() };
63                         CResult_SecretKeyErrorZPtr { result }
64                 } else {
65                         let err = unsafe { o.contents.err };
66                         unsafe { o.contents.err = std::ptr::null_mut(); }
67                         CResult_SecretKeyErrorZPtr { err }
68                 };
69                 Self {
70                         contents,
71                         result_ok: o.result_ok,
72                 }
73         }
74 }
75 #[repr(C)]
76 /// The contents of CResult_PublicKeyErrorZ
77 pub union CResult_PublicKeyErrorZPtr {
78         /// A pointer to the contents in the success state.
79         /// Reading from this pointer when `result_ok` is not set is undefined.
80         pub result: *mut crate::c_types::PublicKey,
81         /// A pointer to the contents in the error state.
82         /// Reading from this pointer when `result_ok` is set is undefined.
83         pub err: *mut crate::c_types::Secp256k1Error,
84 }
85 #[repr(C)]
86 /// A CResult_PublicKeyErrorZ represents the result of a fallible operation,
87 /// containing a crate::c_types::PublicKey on success and a crate::c_types::Secp256k1Error on failure.
88 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
89 pub struct CResult_PublicKeyErrorZ {
90         /// The contents of this CResult_PublicKeyErrorZ, accessible via either
91         /// `err` or `result` depending on the state of `result_ok`.
92         pub contents: CResult_PublicKeyErrorZPtr,
93         /// Whether this CResult_PublicKeyErrorZ represents a success state.
94         pub result_ok: bool,
95 }
96 #[no_mangle]
97 /// Creates a new CResult_PublicKeyErrorZ in the success state.
98 pub extern "C" fn CResult_PublicKeyErrorZ_ok(o: crate::c_types::PublicKey) -> CResult_PublicKeyErrorZ {
99         CResult_PublicKeyErrorZ {
100                 contents: CResult_PublicKeyErrorZPtr {
101                         result: Box::into_raw(Box::new(o)),
102                 },
103                 result_ok: true,
104         }
105 }
106 #[no_mangle]
107 /// Creates a new CResult_PublicKeyErrorZ in the error state.
108 pub extern "C" fn CResult_PublicKeyErrorZ_err(e: crate::c_types::Secp256k1Error) -> CResult_PublicKeyErrorZ {
109         CResult_PublicKeyErrorZ {
110                 contents: CResult_PublicKeyErrorZPtr {
111                         err: Box::into_raw(Box::new(e)),
112                 },
113                 result_ok: false,
114         }
115 }
116 #[no_mangle]
117 /// Frees any resources used by the CResult_PublicKeyErrorZ.
118 pub extern "C" fn CResult_PublicKeyErrorZ_free(_res: CResult_PublicKeyErrorZ) { }
119 impl Drop for CResult_PublicKeyErrorZ {
120         fn drop(&mut self) {
121                 if self.result_ok {
122                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
123                                 let _ = unsafe { Box::from_raw(self.contents.result) };
124                         }
125                 } else {
126                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
127                                 let _ = unsafe { Box::from_raw(self.contents.err) };
128                         }
129                 }
130         }
131 }
132 impl From<crate::c_types::CResultTempl<crate::c_types::PublicKey, crate::c_types::Secp256k1Error>> for CResult_PublicKeyErrorZ {
133         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::PublicKey, crate::c_types::Secp256k1Error>) -> Self {
134                 let contents = if o.result_ok {
135                         let result = unsafe { o.contents.result };
136                         unsafe { o.contents.result = std::ptr::null_mut() };
137                         CResult_PublicKeyErrorZPtr { result }
138                 } else {
139                         let err = unsafe { o.contents.err };
140                         unsafe { o.contents.err = std::ptr::null_mut(); }
141                         CResult_PublicKeyErrorZPtr { err }
142                 };
143                 Self {
144                         contents,
145                         result_ok: o.result_ok,
146                 }
147         }
148 }
149 impl Clone for CResult_PublicKeyErrorZ {
150         fn clone(&self) -> Self {
151                 if self.result_ok {
152                         Self { result_ok: true, contents: CResult_PublicKeyErrorZPtr {
153                                 result: Box::into_raw(Box::new(<crate::c_types::PublicKey>::clone(unsafe { &*self.contents.result })))
154                         } }
155                 } else {
156                         Self { result_ok: false, contents: CResult_PublicKeyErrorZPtr {
157                                 err: Box::into_raw(Box::new(<crate::c_types::Secp256k1Error>::clone(unsafe { &*self.contents.err })))
158                         } }
159                 }
160         }
161 }
162 #[no_mangle]
163 /// Creates a new CResult_PublicKeyErrorZ which has the same data as `orig`
164 /// but with all dynamically-allocated buffers duplicated in new buffers.
165 pub extern "C" fn CResult_PublicKeyErrorZ_clone(orig: &CResult_PublicKeyErrorZ) -> CResult_PublicKeyErrorZ { orig.clone() }
166 #[repr(C)]
167 /// The contents of CResult_TxCreationKeysDecodeErrorZ
168 pub union CResult_TxCreationKeysDecodeErrorZPtr {
169         /// A pointer to the contents in the success state.
170         /// Reading from this pointer when `result_ok` is not set is undefined.
171         pub result: *mut crate::lightning::ln::chan_utils::TxCreationKeys,
172         /// A pointer to the contents in the error state.
173         /// Reading from this pointer when `result_ok` is set is undefined.
174         pub err: *mut crate::lightning::ln::msgs::DecodeError,
175 }
176 #[repr(C)]
177 /// A CResult_TxCreationKeysDecodeErrorZ represents the result of a fallible operation,
178 /// containing a crate::lightning::ln::chan_utils::TxCreationKeys on success and a crate::lightning::ln::msgs::DecodeError on failure.
179 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
180 pub struct CResult_TxCreationKeysDecodeErrorZ {
181         /// The contents of this CResult_TxCreationKeysDecodeErrorZ, accessible via either
182         /// `err` or `result` depending on the state of `result_ok`.
183         pub contents: CResult_TxCreationKeysDecodeErrorZPtr,
184         /// Whether this CResult_TxCreationKeysDecodeErrorZ represents a success state.
185         pub result_ok: bool,
186 }
187 #[no_mangle]
188 /// Creates a new CResult_TxCreationKeysDecodeErrorZ in the success state.
189 pub extern "C" fn CResult_TxCreationKeysDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::TxCreationKeys) -> CResult_TxCreationKeysDecodeErrorZ {
190         CResult_TxCreationKeysDecodeErrorZ {
191                 contents: CResult_TxCreationKeysDecodeErrorZPtr {
192                         result: Box::into_raw(Box::new(o)),
193                 },
194                 result_ok: true,
195         }
196 }
197 #[no_mangle]
198 /// Creates a new CResult_TxCreationKeysDecodeErrorZ in the error state.
199 pub extern "C" fn CResult_TxCreationKeysDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_TxCreationKeysDecodeErrorZ {
200         CResult_TxCreationKeysDecodeErrorZ {
201                 contents: CResult_TxCreationKeysDecodeErrorZPtr {
202                         err: Box::into_raw(Box::new(e)),
203                 },
204                 result_ok: false,
205         }
206 }
207 #[no_mangle]
208 /// Frees any resources used by the CResult_TxCreationKeysDecodeErrorZ.
209 pub extern "C" fn CResult_TxCreationKeysDecodeErrorZ_free(_res: CResult_TxCreationKeysDecodeErrorZ) { }
210 impl Drop for CResult_TxCreationKeysDecodeErrorZ {
211         fn drop(&mut self) {
212                 if self.result_ok {
213                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
214                                 let _ = unsafe { Box::from_raw(self.contents.result) };
215                         }
216                 } else {
217                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
218                                 let _ = unsafe { Box::from_raw(self.contents.err) };
219                         }
220                 }
221         }
222 }
223 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::TxCreationKeys, crate::lightning::ln::msgs::DecodeError>> for CResult_TxCreationKeysDecodeErrorZ {
224         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::TxCreationKeys, crate::lightning::ln::msgs::DecodeError>) -> Self {
225                 let contents = if o.result_ok {
226                         let result = unsafe { o.contents.result };
227                         unsafe { o.contents.result = std::ptr::null_mut() };
228                         CResult_TxCreationKeysDecodeErrorZPtr { result }
229                 } else {
230                         let err = unsafe { o.contents.err };
231                         unsafe { o.contents.err = std::ptr::null_mut(); }
232                         CResult_TxCreationKeysDecodeErrorZPtr { err }
233                 };
234                 Self {
235                         contents,
236                         result_ok: o.result_ok,
237                 }
238         }
239 }
240 impl Clone for CResult_TxCreationKeysDecodeErrorZ {
241         fn clone(&self) -> Self {
242                 if self.result_ok {
243                         Self { result_ok: true, contents: CResult_TxCreationKeysDecodeErrorZPtr {
244                                 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::TxCreationKeys>::clone(unsafe { &*self.contents.result })))
245                         } }
246                 } else {
247                         Self { result_ok: false, contents: CResult_TxCreationKeysDecodeErrorZPtr {
248                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
249                         } }
250                 }
251         }
252 }
253 #[no_mangle]
254 /// Creates a new CResult_TxCreationKeysDecodeErrorZ which has the same data as `orig`
255 /// but with all dynamically-allocated buffers duplicated in new buffers.
256 pub extern "C" fn CResult_TxCreationKeysDecodeErrorZ_clone(orig: &CResult_TxCreationKeysDecodeErrorZ) -> CResult_TxCreationKeysDecodeErrorZ { orig.clone() }
257 #[repr(C)]
258 /// The contents of CResult_ChannelPublicKeysDecodeErrorZ
259 pub union CResult_ChannelPublicKeysDecodeErrorZPtr {
260         /// A pointer to the contents in the success state.
261         /// Reading from this pointer when `result_ok` is not set is undefined.
262         pub result: *mut crate::lightning::ln::chan_utils::ChannelPublicKeys,
263         /// A pointer to the contents in the error state.
264         /// Reading from this pointer when `result_ok` is set is undefined.
265         pub err: *mut crate::lightning::ln::msgs::DecodeError,
266 }
267 #[repr(C)]
268 /// A CResult_ChannelPublicKeysDecodeErrorZ represents the result of a fallible operation,
269 /// containing a crate::lightning::ln::chan_utils::ChannelPublicKeys on success and a crate::lightning::ln::msgs::DecodeError on failure.
270 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
271 pub struct CResult_ChannelPublicKeysDecodeErrorZ {
272         /// The contents of this CResult_ChannelPublicKeysDecodeErrorZ, accessible via either
273         /// `err` or `result` depending on the state of `result_ok`.
274         pub contents: CResult_ChannelPublicKeysDecodeErrorZPtr,
275         /// Whether this CResult_ChannelPublicKeysDecodeErrorZ represents a success state.
276         pub result_ok: bool,
277 }
278 #[no_mangle]
279 /// Creates a new CResult_ChannelPublicKeysDecodeErrorZ in the success state.
280 pub extern "C" fn CResult_ChannelPublicKeysDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::ChannelPublicKeys) -> CResult_ChannelPublicKeysDecodeErrorZ {
281         CResult_ChannelPublicKeysDecodeErrorZ {
282                 contents: CResult_ChannelPublicKeysDecodeErrorZPtr {
283                         result: Box::into_raw(Box::new(o)),
284                 },
285                 result_ok: true,
286         }
287 }
288 #[no_mangle]
289 /// Creates a new CResult_ChannelPublicKeysDecodeErrorZ in the error state.
290 pub extern "C" fn CResult_ChannelPublicKeysDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelPublicKeysDecodeErrorZ {
291         CResult_ChannelPublicKeysDecodeErrorZ {
292                 contents: CResult_ChannelPublicKeysDecodeErrorZPtr {
293                         err: Box::into_raw(Box::new(e)),
294                 },
295                 result_ok: false,
296         }
297 }
298 #[no_mangle]
299 /// Frees any resources used by the CResult_ChannelPublicKeysDecodeErrorZ.
300 pub extern "C" fn CResult_ChannelPublicKeysDecodeErrorZ_free(_res: CResult_ChannelPublicKeysDecodeErrorZ) { }
301 impl Drop for CResult_ChannelPublicKeysDecodeErrorZ {
302         fn drop(&mut self) {
303                 if self.result_ok {
304                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
305                                 let _ = unsafe { Box::from_raw(self.contents.result) };
306                         }
307                 } else {
308                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
309                                 let _ = unsafe { Box::from_raw(self.contents.err) };
310                         }
311                 }
312         }
313 }
314 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::ChannelPublicKeys, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelPublicKeysDecodeErrorZ {
315         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::ChannelPublicKeys, crate::lightning::ln::msgs::DecodeError>) -> Self {
316                 let contents = if o.result_ok {
317                         let result = unsafe { o.contents.result };
318                         unsafe { o.contents.result = std::ptr::null_mut() };
319                         CResult_ChannelPublicKeysDecodeErrorZPtr { result }
320                 } else {
321                         let err = unsafe { o.contents.err };
322                         unsafe { o.contents.err = std::ptr::null_mut(); }
323                         CResult_ChannelPublicKeysDecodeErrorZPtr { err }
324                 };
325                 Self {
326                         contents,
327                         result_ok: o.result_ok,
328                 }
329         }
330 }
331 impl Clone for CResult_ChannelPublicKeysDecodeErrorZ {
332         fn clone(&self) -> Self {
333                 if self.result_ok {
334                         Self { result_ok: true, contents: CResult_ChannelPublicKeysDecodeErrorZPtr {
335                                 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::ChannelPublicKeys>::clone(unsafe { &*self.contents.result })))
336                         } }
337                 } else {
338                         Self { result_ok: false, contents: CResult_ChannelPublicKeysDecodeErrorZPtr {
339                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
340                         } }
341                 }
342         }
343 }
344 #[no_mangle]
345 /// Creates a new CResult_ChannelPublicKeysDecodeErrorZ which has the same data as `orig`
346 /// but with all dynamically-allocated buffers duplicated in new buffers.
347 pub extern "C" fn CResult_ChannelPublicKeysDecodeErrorZ_clone(orig: &CResult_ChannelPublicKeysDecodeErrorZ) -> CResult_ChannelPublicKeysDecodeErrorZ { orig.clone() }
348 #[repr(C)]
349 /// The contents of CResult_TxCreationKeysErrorZ
350 pub union CResult_TxCreationKeysErrorZPtr {
351         /// A pointer to the contents in the success state.
352         /// Reading from this pointer when `result_ok` is not set is undefined.
353         pub result: *mut crate::lightning::ln::chan_utils::TxCreationKeys,
354         /// A pointer to the contents in the error state.
355         /// Reading from this pointer when `result_ok` is set is undefined.
356         pub err: *mut crate::c_types::Secp256k1Error,
357 }
358 #[repr(C)]
359 /// A CResult_TxCreationKeysErrorZ represents the result of a fallible operation,
360 /// containing a crate::lightning::ln::chan_utils::TxCreationKeys on success and a crate::c_types::Secp256k1Error on failure.
361 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
362 pub struct CResult_TxCreationKeysErrorZ {
363         /// The contents of this CResult_TxCreationKeysErrorZ, accessible via either
364         /// `err` or `result` depending on the state of `result_ok`.
365         pub contents: CResult_TxCreationKeysErrorZPtr,
366         /// Whether this CResult_TxCreationKeysErrorZ represents a success state.
367         pub result_ok: bool,
368 }
369 #[no_mangle]
370 /// Creates a new CResult_TxCreationKeysErrorZ in the success state.
371 pub extern "C" fn CResult_TxCreationKeysErrorZ_ok(o: crate::lightning::ln::chan_utils::TxCreationKeys) -> CResult_TxCreationKeysErrorZ {
372         CResult_TxCreationKeysErrorZ {
373                 contents: CResult_TxCreationKeysErrorZPtr {
374                         result: Box::into_raw(Box::new(o)),
375                 },
376                 result_ok: true,
377         }
378 }
379 #[no_mangle]
380 /// Creates a new CResult_TxCreationKeysErrorZ in the error state.
381 pub extern "C" fn CResult_TxCreationKeysErrorZ_err(e: crate::c_types::Secp256k1Error) -> CResult_TxCreationKeysErrorZ {
382         CResult_TxCreationKeysErrorZ {
383                 contents: CResult_TxCreationKeysErrorZPtr {
384                         err: Box::into_raw(Box::new(e)),
385                 },
386                 result_ok: false,
387         }
388 }
389 #[no_mangle]
390 /// Frees any resources used by the CResult_TxCreationKeysErrorZ.
391 pub extern "C" fn CResult_TxCreationKeysErrorZ_free(_res: CResult_TxCreationKeysErrorZ) { }
392 impl Drop for CResult_TxCreationKeysErrorZ {
393         fn drop(&mut self) {
394                 if self.result_ok {
395                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
396                                 let _ = unsafe { Box::from_raw(self.contents.result) };
397                         }
398                 } else {
399                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
400                                 let _ = unsafe { Box::from_raw(self.contents.err) };
401                         }
402                 }
403         }
404 }
405 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::TxCreationKeys, crate::c_types::Secp256k1Error>> for CResult_TxCreationKeysErrorZ {
406         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::TxCreationKeys, crate::c_types::Secp256k1Error>) -> Self {
407                 let contents = if o.result_ok {
408                         let result = unsafe { o.contents.result };
409                         unsafe { o.contents.result = std::ptr::null_mut() };
410                         CResult_TxCreationKeysErrorZPtr { result }
411                 } else {
412                         let err = unsafe { o.contents.err };
413                         unsafe { o.contents.err = std::ptr::null_mut(); }
414                         CResult_TxCreationKeysErrorZPtr { err }
415                 };
416                 Self {
417                         contents,
418                         result_ok: o.result_ok,
419                 }
420         }
421 }
422 impl Clone for CResult_TxCreationKeysErrorZ {
423         fn clone(&self) -> Self {
424                 if self.result_ok {
425                         Self { result_ok: true, contents: CResult_TxCreationKeysErrorZPtr {
426                                 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::TxCreationKeys>::clone(unsafe { &*self.contents.result })))
427                         } }
428                 } else {
429                         Self { result_ok: false, contents: CResult_TxCreationKeysErrorZPtr {
430                                 err: Box::into_raw(Box::new(<crate::c_types::Secp256k1Error>::clone(unsafe { &*self.contents.err })))
431                         } }
432                 }
433         }
434 }
435 #[no_mangle]
436 /// Creates a new CResult_TxCreationKeysErrorZ which has the same data as `orig`
437 /// but with all dynamically-allocated buffers duplicated in new buffers.
438 pub extern "C" fn CResult_TxCreationKeysErrorZ_clone(orig: &CResult_TxCreationKeysErrorZ) -> CResult_TxCreationKeysErrorZ { orig.clone() }
439 #[repr(C)]
440 #[derive(Clone)]
441 /// An enum which can either contain a u32 or not
442 pub enum COption_u32Z {
443         /// When we're in this state, this COption_u32Z contains a u32
444         Some(u32),
445         /// When we're in this state, this COption_u32Z contains nothing
446         None
447 }
448 impl COption_u32Z {
449         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
450                 if let Self::Some(_) = self { true } else { false }
451         }
452         #[allow(unused)] pub(crate) fn take(mut self) -> u32 {
453                 if let Self::Some(v) = self { v } else { unreachable!() }
454         }
455 }
456 #[no_mangle]
457 /// Constructs a new COption_u32Z containing a u32
458 pub extern "C" fn COption_u32Z_some(o: u32) -> COption_u32Z {
459         COption_u32Z::Some(o)
460 }
461 #[no_mangle]
462 /// Constructs a new COption_u32Z containing nothing
463 pub extern "C" fn COption_u32Z_none() -> COption_u32Z {
464         COption_u32Z::None
465 }
466 #[no_mangle]
467 /// Frees any resources associated with the u32, if we are in the Some state
468 pub extern "C" fn COption_u32Z_free(_res: COption_u32Z) { }
469 #[no_mangle]
470 /// Creates a new COption_u32Z which has the same data as `orig`
471 /// but with all dynamically-allocated buffers duplicated in new buffers.
472 pub extern "C" fn COption_u32Z_clone(orig: &COption_u32Z) -> COption_u32Z { orig.clone() }
473 #[repr(C)]
474 /// The contents of CResult_HTLCOutputInCommitmentDecodeErrorZ
475 pub union CResult_HTLCOutputInCommitmentDecodeErrorZPtr {
476         /// A pointer to the contents in the success state.
477         /// Reading from this pointer when `result_ok` is not set is undefined.
478         pub result: *mut crate::lightning::ln::chan_utils::HTLCOutputInCommitment,
479         /// A pointer to the contents in the error state.
480         /// Reading from this pointer when `result_ok` is set is undefined.
481         pub err: *mut crate::lightning::ln::msgs::DecodeError,
482 }
483 #[repr(C)]
484 /// A CResult_HTLCOutputInCommitmentDecodeErrorZ represents the result of a fallible operation,
485 /// containing a crate::lightning::ln::chan_utils::HTLCOutputInCommitment on success and a crate::lightning::ln::msgs::DecodeError on failure.
486 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
487 pub struct CResult_HTLCOutputInCommitmentDecodeErrorZ {
488         /// The contents of this CResult_HTLCOutputInCommitmentDecodeErrorZ, accessible via either
489         /// `err` or `result` depending on the state of `result_ok`.
490         pub contents: CResult_HTLCOutputInCommitmentDecodeErrorZPtr,
491         /// Whether this CResult_HTLCOutputInCommitmentDecodeErrorZ represents a success state.
492         pub result_ok: bool,
493 }
494 #[no_mangle]
495 /// Creates a new CResult_HTLCOutputInCommitmentDecodeErrorZ in the success state.
496 pub extern "C" fn CResult_HTLCOutputInCommitmentDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::HTLCOutputInCommitment) -> CResult_HTLCOutputInCommitmentDecodeErrorZ {
497         CResult_HTLCOutputInCommitmentDecodeErrorZ {
498                 contents: CResult_HTLCOutputInCommitmentDecodeErrorZPtr {
499                         result: Box::into_raw(Box::new(o)),
500                 },
501                 result_ok: true,
502         }
503 }
504 #[no_mangle]
505 /// Creates a new CResult_HTLCOutputInCommitmentDecodeErrorZ in the error state.
506 pub extern "C" fn CResult_HTLCOutputInCommitmentDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_HTLCOutputInCommitmentDecodeErrorZ {
507         CResult_HTLCOutputInCommitmentDecodeErrorZ {
508                 contents: CResult_HTLCOutputInCommitmentDecodeErrorZPtr {
509                         err: Box::into_raw(Box::new(e)),
510                 },
511                 result_ok: false,
512         }
513 }
514 #[no_mangle]
515 /// Frees any resources used by the CResult_HTLCOutputInCommitmentDecodeErrorZ.
516 pub extern "C" fn CResult_HTLCOutputInCommitmentDecodeErrorZ_free(_res: CResult_HTLCOutputInCommitmentDecodeErrorZ) { }
517 impl Drop for CResult_HTLCOutputInCommitmentDecodeErrorZ {
518         fn drop(&mut self) {
519                 if self.result_ok {
520                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
521                                 let _ = unsafe { Box::from_raw(self.contents.result) };
522                         }
523                 } else {
524                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
525                                 let _ = unsafe { Box::from_raw(self.contents.err) };
526                         }
527                 }
528         }
529 }
530 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::HTLCOutputInCommitment, crate::lightning::ln::msgs::DecodeError>> for CResult_HTLCOutputInCommitmentDecodeErrorZ {
531         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::HTLCOutputInCommitment, crate::lightning::ln::msgs::DecodeError>) -> Self {
532                 let contents = if o.result_ok {
533                         let result = unsafe { o.contents.result };
534                         unsafe { o.contents.result = std::ptr::null_mut() };
535                         CResult_HTLCOutputInCommitmentDecodeErrorZPtr { result }
536                 } else {
537                         let err = unsafe { o.contents.err };
538                         unsafe { o.contents.err = std::ptr::null_mut(); }
539                         CResult_HTLCOutputInCommitmentDecodeErrorZPtr { err }
540                 };
541                 Self {
542                         contents,
543                         result_ok: o.result_ok,
544                 }
545         }
546 }
547 impl Clone for CResult_HTLCOutputInCommitmentDecodeErrorZ {
548         fn clone(&self) -> Self {
549                 if self.result_ok {
550                         Self { result_ok: true, contents: CResult_HTLCOutputInCommitmentDecodeErrorZPtr {
551                                 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::HTLCOutputInCommitment>::clone(unsafe { &*self.contents.result })))
552                         } }
553                 } else {
554                         Self { result_ok: false, contents: CResult_HTLCOutputInCommitmentDecodeErrorZPtr {
555                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
556                         } }
557                 }
558         }
559 }
560 #[no_mangle]
561 /// Creates a new CResult_HTLCOutputInCommitmentDecodeErrorZ which has the same data as `orig`
562 /// but with all dynamically-allocated buffers duplicated in new buffers.
563 pub extern "C" fn CResult_HTLCOutputInCommitmentDecodeErrorZ_clone(orig: &CResult_HTLCOutputInCommitmentDecodeErrorZ) -> CResult_HTLCOutputInCommitmentDecodeErrorZ { orig.clone() }
564 #[repr(C)]
565 /// The contents of CResult_CounterpartyChannelTransactionParametersDecodeErrorZ
566 pub union CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr {
567         /// A pointer to the contents in the success state.
568         /// Reading from this pointer when `result_ok` is not set is undefined.
569         pub result: *mut crate::lightning::ln::chan_utils::CounterpartyChannelTransactionParameters,
570         /// A pointer to the contents in the error state.
571         /// Reading from this pointer when `result_ok` is set is undefined.
572         pub err: *mut crate::lightning::ln::msgs::DecodeError,
573 }
574 #[repr(C)]
575 /// A CResult_CounterpartyChannelTransactionParametersDecodeErrorZ represents the result of a fallible operation,
576 /// containing a crate::lightning::ln::chan_utils::CounterpartyChannelTransactionParameters on success and a crate::lightning::ln::msgs::DecodeError on failure.
577 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
578 pub struct CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
579         /// The contents of this CResult_CounterpartyChannelTransactionParametersDecodeErrorZ, accessible via either
580         /// `err` or `result` depending on the state of `result_ok`.
581         pub contents: CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr,
582         /// Whether this CResult_CounterpartyChannelTransactionParametersDecodeErrorZ represents a success state.
583         pub result_ok: bool,
584 }
585 #[no_mangle]
586 /// Creates a new CResult_CounterpartyChannelTransactionParametersDecodeErrorZ in the success state.
587 pub extern "C" fn CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::CounterpartyChannelTransactionParameters) -> CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
588         CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
589                 contents: CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr {
590                         result: Box::into_raw(Box::new(o)),
591                 },
592                 result_ok: true,
593         }
594 }
595 #[no_mangle]
596 /// Creates a new CResult_CounterpartyChannelTransactionParametersDecodeErrorZ in the error state.
597 pub extern "C" fn CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
598         CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
599                 contents: CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr {
600                         err: Box::into_raw(Box::new(e)),
601                 },
602                 result_ok: false,
603         }
604 }
605 #[no_mangle]
606 /// Frees any resources used by the CResult_CounterpartyChannelTransactionParametersDecodeErrorZ.
607 pub extern "C" fn CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_free(_res: CResult_CounterpartyChannelTransactionParametersDecodeErrorZ) { }
608 impl Drop for CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
609         fn drop(&mut self) {
610                 if self.result_ok {
611                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
612                                 let _ = unsafe { Box::from_raw(self.contents.result) };
613                         }
614                 } else {
615                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
616                                 let _ = unsafe { Box::from_raw(self.contents.err) };
617                         }
618                 }
619         }
620 }
621 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::CounterpartyChannelTransactionParameters, crate::lightning::ln::msgs::DecodeError>> for CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
622         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::CounterpartyChannelTransactionParameters, crate::lightning::ln::msgs::DecodeError>) -> Self {
623                 let contents = if o.result_ok {
624                         let result = unsafe { o.contents.result };
625                         unsafe { o.contents.result = std::ptr::null_mut() };
626                         CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr { result }
627                 } else {
628                         let err = unsafe { o.contents.err };
629                         unsafe { o.contents.err = std::ptr::null_mut(); }
630                         CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr { err }
631                 };
632                 Self {
633                         contents,
634                         result_ok: o.result_ok,
635                 }
636         }
637 }
638 impl Clone for CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
639         fn clone(&self) -> Self {
640                 if self.result_ok {
641                         Self { result_ok: true, contents: CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr {
642                                 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::CounterpartyChannelTransactionParameters>::clone(unsafe { &*self.contents.result })))
643                         } }
644                 } else {
645                         Self { result_ok: false, contents: CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr {
646                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
647                         } }
648                 }
649         }
650 }
651 #[no_mangle]
652 /// Creates a new CResult_CounterpartyChannelTransactionParametersDecodeErrorZ which has the same data as `orig`
653 /// but with all dynamically-allocated buffers duplicated in new buffers.
654 pub extern "C" fn CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone(orig: &CResult_CounterpartyChannelTransactionParametersDecodeErrorZ) -> CResult_CounterpartyChannelTransactionParametersDecodeErrorZ { orig.clone() }
655 #[repr(C)]
656 /// The contents of CResult_ChannelTransactionParametersDecodeErrorZ
657 pub union CResult_ChannelTransactionParametersDecodeErrorZPtr {
658         /// A pointer to the contents in the success state.
659         /// Reading from this pointer when `result_ok` is not set is undefined.
660         pub result: *mut crate::lightning::ln::chan_utils::ChannelTransactionParameters,
661         /// A pointer to the contents in the error state.
662         /// Reading from this pointer when `result_ok` is set is undefined.
663         pub err: *mut crate::lightning::ln::msgs::DecodeError,
664 }
665 #[repr(C)]
666 /// A CResult_ChannelTransactionParametersDecodeErrorZ represents the result of a fallible operation,
667 /// containing a crate::lightning::ln::chan_utils::ChannelTransactionParameters on success and a crate::lightning::ln::msgs::DecodeError on failure.
668 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
669 pub struct CResult_ChannelTransactionParametersDecodeErrorZ {
670         /// The contents of this CResult_ChannelTransactionParametersDecodeErrorZ, accessible via either
671         /// `err` or `result` depending on the state of `result_ok`.
672         pub contents: CResult_ChannelTransactionParametersDecodeErrorZPtr,
673         /// Whether this CResult_ChannelTransactionParametersDecodeErrorZ represents a success state.
674         pub result_ok: bool,
675 }
676 #[no_mangle]
677 /// Creates a new CResult_ChannelTransactionParametersDecodeErrorZ in the success state.
678 pub extern "C" fn CResult_ChannelTransactionParametersDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::ChannelTransactionParameters) -> CResult_ChannelTransactionParametersDecodeErrorZ {
679         CResult_ChannelTransactionParametersDecodeErrorZ {
680                 contents: CResult_ChannelTransactionParametersDecodeErrorZPtr {
681                         result: Box::into_raw(Box::new(o)),
682                 },
683                 result_ok: true,
684         }
685 }
686 #[no_mangle]
687 /// Creates a new CResult_ChannelTransactionParametersDecodeErrorZ in the error state.
688 pub extern "C" fn CResult_ChannelTransactionParametersDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelTransactionParametersDecodeErrorZ {
689         CResult_ChannelTransactionParametersDecodeErrorZ {
690                 contents: CResult_ChannelTransactionParametersDecodeErrorZPtr {
691                         err: Box::into_raw(Box::new(e)),
692                 },
693                 result_ok: false,
694         }
695 }
696 #[no_mangle]
697 /// Frees any resources used by the CResult_ChannelTransactionParametersDecodeErrorZ.
698 pub extern "C" fn CResult_ChannelTransactionParametersDecodeErrorZ_free(_res: CResult_ChannelTransactionParametersDecodeErrorZ) { }
699 impl Drop for CResult_ChannelTransactionParametersDecodeErrorZ {
700         fn drop(&mut self) {
701                 if self.result_ok {
702                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
703                                 let _ = unsafe { Box::from_raw(self.contents.result) };
704                         }
705                 } else {
706                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
707                                 let _ = unsafe { Box::from_raw(self.contents.err) };
708                         }
709                 }
710         }
711 }
712 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::ChannelTransactionParameters, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelTransactionParametersDecodeErrorZ {
713         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::ChannelTransactionParameters, crate::lightning::ln::msgs::DecodeError>) -> Self {
714                 let contents = if o.result_ok {
715                         let result = unsafe { o.contents.result };
716                         unsafe { o.contents.result = std::ptr::null_mut() };
717                         CResult_ChannelTransactionParametersDecodeErrorZPtr { result }
718                 } else {
719                         let err = unsafe { o.contents.err };
720                         unsafe { o.contents.err = std::ptr::null_mut(); }
721                         CResult_ChannelTransactionParametersDecodeErrorZPtr { err }
722                 };
723                 Self {
724                         contents,
725                         result_ok: o.result_ok,
726                 }
727         }
728 }
729 impl Clone for CResult_ChannelTransactionParametersDecodeErrorZ {
730         fn clone(&self) -> Self {
731                 if self.result_ok {
732                         Self { result_ok: true, contents: CResult_ChannelTransactionParametersDecodeErrorZPtr {
733                                 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::ChannelTransactionParameters>::clone(unsafe { &*self.contents.result })))
734                         } }
735                 } else {
736                         Self { result_ok: false, contents: CResult_ChannelTransactionParametersDecodeErrorZPtr {
737                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
738                         } }
739                 }
740         }
741 }
742 #[no_mangle]
743 /// Creates a new CResult_ChannelTransactionParametersDecodeErrorZ which has the same data as `orig`
744 /// but with all dynamically-allocated buffers duplicated in new buffers.
745 pub extern "C" fn CResult_ChannelTransactionParametersDecodeErrorZ_clone(orig: &CResult_ChannelTransactionParametersDecodeErrorZ) -> CResult_ChannelTransactionParametersDecodeErrorZ { orig.clone() }
746 #[repr(C)]
747 /// A dynamically-allocated array of crate::c_types::Signatures of arbitrary size.
748 /// This corresponds to std::vector in C++
749 pub struct CVec_SignatureZ {
750         /// The elements in the array.
751         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
752         pub data: *mut crate::c_types::Signature,
753         /// The number of elements pointed to by `data`.
754         pub datalen: usize
755 }
756 impl CVec_SignatureZ {
757         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::Signature> {
758                 if self.datalen == 0 { return Vec::new(); }
759                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
760                 self.data = std::ptr::null_mut();
761                 self.datalen = 0;
762                 ret
763         }
764         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::Signature] {
765                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
766         }
767 }
768 impl From<Vec<crate::c_types::Signature>> for CVec_SignatureZ {
769         fn from(v: Vec<crate::c_types::Signature>) -> Self {
770                 let datalen = v.len();
771                 let data = Box::into_raw(v.into_boxed_slice());
772                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
773         }
774 }
775 #[no_mangle]
776 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
777 pub extern "C" fn CVec_SignatureZ_free(_res: CVec_SignatureZ) { }
778 impl Drop for CVec_SignatureZ {
779         fn drop(&mut self) {
780                 if self.datalen == 0 { return; }
781                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
782         }
783 }
784 impl Clone for CVec_SignatureZ {
785         fn clone(&self) -> Self {
786                 let mut res = Vec::new();
787                 if self.datalen == 0 { return Self::from(res); }
788                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
789                 Self::from(res)
790         }
791 }
792 #[repr(C)]
793 /// The contents of CResult_HolderCommitmentTransactionDecodeErrorZ
794 pub union CResult_HolderCommitmentTransactionDecodeErrorZPtr {
795         /// A pointer to the contents in the success state.
796         /// Reading from this pointer when `result_ok` is not set is undefined.
797         pub result: *mut crate::lightning::ln::chan_utils::HolderCommitmentTransaction,
798         /// A pointer to the contents in the error state.
799         /// Reading from this pointer when `result_ok` is set is undefined.
800         pub err: *mut crate::lightning::ln::msgs::DecodeError,
801 }
802 #[repr(C)]
803 /// A CResult_HolderCommitmentTransactionDecodeErrorZ represents the result of a fallible operation,
804 /// containing a crate::lightning::ln::chan_utils::HolderCommitmentTransaction on success and a crate::lightning::ln::msgs::DecodeError on failure.
805 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
806 pub struct CResult_HolderCommitmentTransactionDecodeErrorZ {
807         /// The contents of this CResult_HolderCommitmentTransactionDecodeErrorZ, accessible via either
808         /// `err` or `result` depending on the state of `result_ok`.
809         pub contents: CResult_HolderCommitmentTransactionDecodeErrorZPtr,
810         /// Whether this CResult_HolderCommitmentTransactionDecodeErrorZ represents a success state.
811         pub result_ok: bool,
812 }
813 #[no_mangle]
814 /// Creates a new CResult_HolderCommitmentTransactionDecodeErrorZ in the success state.
815 pub extern "C" fn CResult_HolderCommitmentTransactionDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::HolderCommitmentTransaction) -> CResult_HolderCommitmentTransactionDecodeErrorZ {
816         CResult_HolderCommitmentTransactionDecodeErrorZ {
817                 contents: CResult_HolderCommitmentTransactionDecodeErrorZPtr {
818                         result: Box::into_raw(Box::new(o)),
819                 },
820                 result_ok: true,
821         }
822 }
823 #[no_mangle]
824 /// Creates a new CResult_HolderCommitmentTransactionDecodeErrorZ in the error state.
825 pub extern "C" fn CResult_HolderCommitmentTransactionDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_HolderCommitmentTransactionDecodeErrorZ {
826         CResult_HolderCommitmentTransactionDecodeErrorZ {
827                 contents: CResult_HolderCommitmentTransactionDecodeErrorZPtr {
828                         err: Box::into_raw(Box::new(e)),
829                 },
830                 result_ok: false,
831         }
832 }
833 #[no_mangle]
834 /// Frees any resources used by the CResult_HolderCommitmentTransactionDecodeErrorZ.
835 pub extern "C" fn CResult_HolderCommitmentTransactionDecodeErrorZ_free(_res: CResult_HolderCommitmentTransactionDecodeErrorZ) { }
836 impl Drop for CResult_HolderCommitmentTransactionDecodeErrorZ {
837         fn drop(&mut self) {
838                 if self.result_ok {
839                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
840                                 let _ = unsafe { Box::from_raw(self.contents.result) };
841                         }
842                 } else {
843                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
844                                 let _ = unsafe { Box::from_raw(self.contents.err) };
845                         }
846                 }
847         }
848 }
849 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::HolderCommitmentTransaction, crate::lightning::ln::msgs::DecodeError>> for CResult_HolderCommitmentTransactionDecodeErrorZ {
850         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::HolderCommitmentTransaction, crate::lightning::ln::msgs::DecodeError>) -> Self {
851                 let contents = if o.result_ok {
852                         let result = unsafe { o.contents.result };
853                         unsafe { o.contents.result = std::ptr::null_mut() };
854                         CResult_HolderCommitmentTransactionDecodeErrorZPtr { result }
855                 } else {
856                         let err = unsafe { o.contents.err };
857                         unsafe { o.contents.err = std::ptr::null_mut(); }
858                         CResult_HolderCommitmentTransactionDecodeErrorZPtr { err }
859                 };
860                 Self {
861                         contents,
862                         result_ok: o.result_ok,
863                 }
864         }
865 }
866 impl Clone for CResult_HolderCommitmentTransactionDecodeErrorZ {
867         fn clone(&self) -> Self {
868                 if self.result_ok {
869                         Self { result_ok: true, contents: CResult_HolderCommitmentTransactionDecodeErrorZPtr {
870                                 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::HolderCommitmentTransaction>::clone(unsafe { &*self.contents.result })))
871                         } }
872                 } else {
873                         Self { result_ok: false, contents: CResult_HolderCommitmentTransactionDecodeErrorZPtr {
874                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
875                         } }
876                 }
877         }
878 }
879 #[no_mangle]
880 /// Creates a new CResult_HolderCommitmentTransactionDecodeErrorZ which has the same data as `orig`
881 /// but with all dynamically-allocated buffers duplicated in new buffers.
882 pub extern "C" fn CResult_HolderCommitmentTransactionDecodeErrorZ_clone(orig: &CResult_HolderCommitmentTransactionDecodeErrorZ) -> CResult_HolderCommitmentTransactionDecodeErrorZ { orig.clone() }
883 #[repr(C)]
884 /// The contents of CResult_BuiltCommitmentTransactionDecodeErrorZ
885 pub union CResult_BuiltCommitmentTransactionDecodeErrorZPtr {
886         /// A pointer to the contents in the success state.
887         /// Reading from this pointer when `result_ok` is not set is undefined.
888         pub result: *mut crate::lightning::ln::chan_utils::BuiltCommitmentTransaction,
889         /// A pointer to the contents in the error state.
890         /// Reading from this pointer when `result_ok` is set is undefined.
891         pub err: *mut crate::lightning::ln::msgs::DecodeError,
892 }
893 #[repr(C)]
894 /// A CResult_BuiltCommitmentTransactionDecodeErrorZ represents the result of a fallible operation,
895 /// containing a crate::lightning::ln::chan_utils::BuiltCommitmentTransaction on success and a crate::lightning::ln::msgs::DecodeError on failure.
896 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
897 pub struct CResult_BuiltCommitmentTransactionDecodeErrorZ {
898         /// The contents of this CResult_BuiltCommitmentTransactionDecodeErrorZ, accessible via either
899         /// `err` or `result` depending on the state of `result_ok`.
900         pub contents: CResult_BuiltCommitmentTransactionDecodeErrorZPtr,
901         /// Whether this CResult_BuiltCommitmentTransactionDecodeErrorZ represents a success state.
902         pub result_ok: bool,
903 }
904 #[no_mangle]
905 /// Creates a new CResult_BuiltCommitmentTransactionDecodeErrorZ in the success state.
906 pub extern "C" fn CResult_BuiltCommitmentTransactionDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::BuiltCommitmentTransaction) -> CResult_BuiltCommitmentTransactionDecodeErrorZ {
907         CResult_BuiltCommitmentTransactionDecodeErrorZ {
908                 contents: CResult_BuiltCommitmentTransactionDecodeErrorZPtr {
909                         result: Box::into_raw(Box::new(o)),
910                 },
911                 result_ok: true,
912         }
913 }
914 #[no_mangle]
915 /// Creates a new CResult_BuiltCommitmentTransactionDecodeErrorZ in the error state.
916 pub extern "C" fn CResult_BuiltCommitmentTransactionDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_BuiltCommitmentTransactionDecodeErrorZ {
917         CResult_BuiltCommitmentTransactionDecodeErrorZ {
918                 contents: CResult_BuiltCommitmentTransactionDecodeErrorZPtr {
919                         err: Box::into_raw(Box::new(e)),
920                 },
921                 result_ok: false,
922         }
923 }
924 #[no_mangle]
925 /// Frees any resources used by the CResult_BuiltCommitmentTransactionDecodeErrorZ.
926 pub extern "C" fn CResult_BuiltCommitmentTransactionDecodeErrorZ_free(_res: CResult_BuiltCommitmentTransactionDecodeErrorZ) { }
927 impl Drop for CResult_BuiltCommitmentTransactionDecodeErrorZ {
928         fn drop(&mut self) {
929                 if self.result_ok {
930                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
931                                 let _ = unsafe { Box::from_raw(self.contents.result) };
932                         }
933                 } else {
934                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
935                                 let _ = unsafe { Box::from_raw(self.contents.err) };
936                         }
937                 }
938         }
939 }
940 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::BuiltCommitmentTransaction, crate::lightning::ln::msgs::DecodeError>> for CResult_BuiltCommitmentTransactionDecodeErrorZ {
941         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::BuiltCommitmentTransaction, crate::lightning::ln::msgs::DecodeError>) -> Self {
942                 let contents = if o.result_ok {
943                         let result = unsafe { o.contents.result };
944                         unsafe { o.contents.result = std::ptr::null_mut() };
945                         CResult_BuiltCommitmentTransactionDecodeErrorZPtr { result }
946                 } else {
947                         let err = unsafe { o.contents.err };
948                         unsafe { o.contents.err = std::ptr::null_mut(); }
949                         CResult_BuiltCommitmentTransactionDecodeErrorZPtr { err }
950                 };
951                 Self {
952                         contents,
953                         result_ok: o.result_ok,
954                 }
955         }
956 }
957 impl Clone for CResult_BuiltCommitmentTransactionDecodeErrorZ {
958         fn clone(&self) -> Self {
959                 if self.result_ok {
960                         Self { result_ok: true, contents: CResult_BuiltCommitmentTransactionDecodeErrorZPtr {
961                                 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::BuiltCommitmentTransaction>::clone(unsafe { &*self.contents.result })))
962                         } }
963                 } else {
964                         Self { result_ok: false, contents: CResult_BuiltCommitmentTransactionDecodeErrorZPtr {
965                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
966                         } }
967                 }
968         }
969 }
970 #[no_mangle]
971 /// Creates a new CResult_BuiltCommitmentTransactionDecodeErrorZ which has the same data as `orig`
972 /// but with all dynamically-allocated buffers duplicated in new buffers.
973 pub extern "C" fn CResult_BuiltCommitmentTransactionDecodeErrorZ_clone(orig: &CResult_BuiltCommitmentTransactionDecodeErrorZ) -> CResult_BuiltCommitmentTransactionDecodeErrorZ { orig.clone() }
974 #[repr(C)]
975 /// The contents of CResult_CommitmentTransactionDecodeErrorZ
976 pub union CResult_CommitmentTransactionDecodeErrorZPtr {
977         /// A pointer to the contents in the success state.
978         /// Reading from this pointer when `result_ok` is not set is undefined.
979         pub result: *mut crate::lightning::ln::chan_utils::CommitmentTransaction,
980         /// A pointer to the contents in the error state.
981         /// Reading from this pointer when `result_ok` is set is undefined.
982         pub err: *mut crate::lightning::ln::msgs::DecodeError,
983 }
984 #[repr(C)]
985 /// A CResult_CommitmentTransactionDecodeErrorZ represents the result of a fallible operation,
986 /// containing a crate::lightning::ln::chan_utils::CommitmentTransaction on success and a crate::lightning::ln::msgs::DecodeError on failure.
987 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
988 pub struct CResult_CommitmentTransactionDecodeErrorZ {
989         /// The contents of this CResult_CommitmentTransactionDecodeErrorZ, accessible via either
990         /// `err` or `result` depending on the state of `result_ok`.
991         pub contents: CResult_CommitmentTransactionDecodeErrorZPtr,
992         /// Whether this CResult_CommitmentTransactionDecodeErrorZ represents a success state.
993         pub result_ok: bool,
994 }
995 #[no_mangle]
996 /// Creates a new CResult_CommitmentTransactionDecodeErrorZ in the success state.
997 pub extern "C" fn CResult_CommitmentTransactionDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::CommitmentTransaction) -> CResult_CommitmentTransactionDecodeErrorZ {
998         CResult_CommitmentTransactionDecodeErrorZ {
999                 contents: CResult_CommitmentTransactionDecodeErrorZPtr {
1000                         result: Box::into_raw(Box::new(o)),
1001                 },
1002                 result_ok: true,
1003         }
1004 }
1005 #[no_mangle]
1006 /// Creates a new CResult_CommitmentTransactionDecodeErrorZ in the error state.
1007 pub extern "C" fn CResult_CommitmentTransactionDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_CommitmentTransactionDecodeErrorZ {
1008         CResult_CommitmentTransactionDecodeErrorZ {
1009                 contents: CResult_CommitmentTransactionDecodeErrorZPtr {
1010                         err: Box::into_raw(Box::new(e)),
1011                 },
1012                 result_ok: false,
1013         }
1014 }
1015 #[no_mangle]
1016 /// Frees any resources used by the CResult_CommitmentTransactionDecodeErrorZ.
1017 pub extern "C" fn CResult_CommitmentTransactionDecodeErrorZ_free(_res: CResult_CommitmentTransactionDecodeErrorZ) { }
1018 impl Drop for CResult_CommitmentTransactionDecodeErrorZ {
1019         fn drop(&mut self) {
1020                 if self.result_ok {
1021                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
1022                                 let _ = unsafe { Box::from_raw(self.contents.result) };
1023                         }
1024                 } else {
1025                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
1026                                 let _ = unsafe { Box::from_raw(self.contents.err) };
1027                         }
1028                 }
1029         }
1030 }
1031 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::CommitmentTransaction, crate::lightning::ln::msgs::DecodeError>> for CResult_CommitmentTransactionDecodeErrorZ {
1032         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::CommitmentTransaction, crate::lightning::ln::msgs::DecodeError>) -> Self {
1033                 let contents = if o.result_ok {
1034                         let result = unsafe { o.contents.result };
1035                         unsafe { o.contents.result = std::ptr::null_mut() };
1036                         CResult_CommitmentTransactionDecodeErrorZPtr { result }
1037                 } else {
1038                         let err = unsafe { o.contents.err };
1039                         unsafe { o.contents.err = std::ptr::null_mut(); }
1040                         CResult_CommitmentTransactionDecodeErrorZPtr { err }
1041                 };
1042                 Self {
1043                         contents,
1044                         result_ok: o.result_ok,
1045                 }
1046         }
1047 }
1048 impl Clone for CResult_CommitmentTransactionDecodeErrorZ {
1049         fn clone(&self) -> Self {
1050                 if self.result_ok {
1051                         Self { result_ok: true, contents: CResult_CommitmentTransactionDecodeErrorZPtr {
1052                                 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::CommitmentTransaction>::clone(unsafe { &*self.contents.result })))
1053                         } }
1054                 } else {
1055                         Self { result_ok: false, contents: CResult_CommitmentTransactionDecodeErrorZPtr {
1056                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
1057                         } }
1058                 }
1059         }
1060 }
1061 #[no_mangle]
1062 /// Creates a new CResult_CommitmentTransactionDecodeErrorZ which has the same data as `orig`
1063 /// but with all dynamically-allocated buffers duplicated in new buffers.
1064 pub extern "C" fn CResult_CommitmentTransactionDecodeErrorZ_clone(orig: &CResult_CommitmentTransactionDecodeErrorZ) -> CResult_CommitmentTransactionDecodeErrorZ { orig.clone() }
1065 #[repr(C)]
1066 /// The contents of CResult_TrustedCommitmentTransactionNoneZ
1067 pub union CResult_TrustedCommitmentTransactionNoneZPtr {
1068         /// A pointer to the contents in the success state.
1069         /// Reading from this pointer when `result_ok` is not set is undefined.
1070         pub result: *mut crate::lightning::ln::chan_utils::TrustedCommitmentTransaction,
1071         /// Note that this value is always NULL, as there are no contents in the Err variant
1072         pub err: *mut std::ffi::c_void,
1073 }
1074 #[repr(C)]
1075 /// A CResult_TrustedCommitmentTransactionNoneZ represents the result of a fallible operation,
1076 /// containing a crate::lightning::ln::chan_utils::TrustedCommitmentTransaction on success and a () on failure.
1077 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1078 pub struct CResult_TrustedCommitmentTransactionNoneZ {
1079         /// The contents of this CResult_TrustedCommitmentTransactionNoneZ, accessible via either
1080         /// `err` or `result` depending on the state of `result_ok`.
1081         pub contents: CResult_TrustedCommitmentTransactionNoneZPtr,
1082         /// Whether this CResult_TrustedCommitmentTransactionNoneZ represents a success state.
1083         pub result_ok: bool,
1084 }
1085 #[no_mangle]
1086 /// Creates a new CResult_TrustedCommitmentTransactionNoneZ in the success state.
1087 pub extern "C" fn CResult_TrustedCommitmentTransactionNoneZ_ok(o: crate::lightning::ln::chan_utils::TrustedCommitmentTransaction) -> CResult_TrustedCommitmentTransactionNoneZ {
1088         CResult_TrustedCommitmentTransactionNoneZ {
1089                 contents: CResult_TrustedCommitmentTransactionNoneZPtr {
1090                         result: Box::into_raw(Box::new(o)),
1091                 },
1092                 result_ok: true,
1093         }
1094 }
1095 #[no_mangle]
1096 /// Creates a new CResult_TrustedCommitmentTransactionNoneZ in the error state.
1097 pub extern "C" fn CResult_TrustedCommitmentTransactionNoneZ_err() -> CResult_TrustedCommitmentTransactionNoneZ {
1098         CResult_TrustedCommitmentTransactionNoneZ {
1099                 contents: CResult_TrustedCommitmentTransactionNoneZPtr {
1100                         err: std::ptr::null_mut(),
1101                 },
1102                 result_ok: false,
1103         }
1104 }
1105 #[no_mangle]
1106 /// Frees any resources used by the CResult_TrustedCommitmentTransactionNoneZ.
1107 pub extern "C" fn CResult_TrustedCommitmentTransactionNoneZ_free(_res: CResult_TrustedCommitmentTransactionNoneZ) { }
1108 impl Drop for CResult_TrustedCommitmentTransactionNoneZ {
1109         fn drop(&mut self) {
1110                 if self.result_ok {
1111                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
1112                                 let _ = unsafe { Box::from_raw(self.contents.result) };
1113                         }
1114                 } else {
1115                 }
1116         }
1117 }
1118 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::TrustedCommitmentTransaction, ()>> for CResult_TrustedCommitmentTransactionNoneZ {
1119         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::TrustedCommitmentTransaction, ()>) -> Self {
1120                 let contents = if o.result_ok {
1121                         let result = unsafe { o.contents.result };
1122                         unsafe { o.contents.result = std::ptr::null_mut() };
1123                         CResult_TrustedCommitmentTransactionNoneZPtr { result }
1124                 } else {
1125                         let _ = unsafe { Box::from_raw(o.contents.err) };
1126                         o.contents.err = std::ptr::null_mut();
1127                         CResult_TrustedCommitmentTransactionNoneZPtr { err: std::ptr::null_mut() }
1128                 };
1129                 Self {
1130                         contents,
1131                         result_ok: o.result_ok,
1132                 }
1133         }
1134 }
1135 #[repr(C)]
1136 /// The contents of CResult_CVec_SignatureZNoneZ
1137 pub union CResult_CVec_SignatureZNoneZPtr {
1138         /// A pointer to the contents in the success state.
1139         /// Reading from this pointer when `result_ok` is not set is undefined.
1140         pub result: *mut crate::c_types::derived::CVec_SignatureZ,
1141         /// Note that this value is always NULL, as there are no contents in the Err variant
1142         pub err: *mut std::ffi::c_void,
1143 }
1144 #[repr(C)]
1145 /// A CResult_CVec_SignatureZNoneZ represents the result of a fallible operation,
1146 /// containing a crate::c_types::derived::CVec_SignatureZ on success and a () on failure.
1147 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1148 pub struct CResult_CVec_SignatureZNoneZ {
1149         /// The contents of this CResult_CVec_SignatureZNoneZ, accessible via either
1150         /// `err` or `result` depending on the state of `result_ok`.
1151         pub contents: CResult_CVec_SignatureZNoneZPtr,
1152         /// Whether this CResult_CVec_SignatureZNoneZ represents a success state.
1153         pub result_ok: bool,
1154 }
1155 #[no_mangle]
1156 /// Creates a new CResult_CVec_SignatureZNoneZ in the success state.
1157 pub extern "C" fn CResult_CVec_SignatureZNoneZ_ok(o: crate::c_types::derived::CVec_SignatureZ) -> CResult_CVec_SignatureZNoneZ {
1158         CResult_CVec_SignatureZNoneZ {
1159                 contents: CResult_CVec_SignatureZNoneZPtr {
1160                         result: Box::into_raw(Box::new(o)),
1161                 },
1162                 result_ok: true,
1163         }
1164 }
1165 #[no_mangle]
1166 /// Creates a new CResult_CVec_SignatureZNoneZ in the error state.
1167 pub extern "C" fn CResult_CVec_SignatureZNoneZ_err() -> CResult_CVec_SignatureZNoneZ {
1168         CResult_CVec_SignatureZNoneZ {
1169                 contents: CResult_CVec_SignatureZNoneZPtr {
1170                         err: std::ptr::null_mut(),
1171                 },
1172                 result_ok: false,
1173         }
1174 }
1175 #[no_mangle]
1176 /// Frees any resources used by the CResult_CVec_SignatureZNoneZ.
1177 pub extern "C" fn CResult_CVec_SignatureZNoneZ_free(_res: CResult_CVec_SignatureZNoneZ) { }
1178 impl Drop for CResult_CVec_SignatureZNoneZ {
1179         fn drop(&mut self) {
1180                 if self.result_ok {
1181                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
1182                                 let _ = unsafe { Box::from_raw(self.contents.result) };
1183                         }
1184                 } else {
1185                 }
1186         }
1187 }
1188 impl From<crate::c_types::CResultTempl<crate::c_types::derived::CVec_SignatureZ, ()>> for CResult_CVec_SignatureZNoneZ {
1189         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CVec_SignatureZ, ()>) -> Self {
1190                 let contents = if o.result_ok {
1191                         let result = unsafe { o.contents.result };
1192                         unsafe { o.contents.result = std::ptr::null_mut() };
1193                         CResult_CVec_SignatureZNoneZPtr { result }
1194                 } else {
1195                         let _ = unsafe { Box::from_raw(o.contents.err) };
1196                         o.contents.err = std::ptr::null_mut();
1197                         CResult_CVec_SignatureZNoneZPtr { err: std::ptr::null_mut() }
1198                 };
1199                 Self {
1200                         contents,
1201                         result_ok: o.result_ok,
1202                 }
1203         }
1204 }
1205 impl Clone for CResult_CVec_SignatureZNoneZ {
1206         fn clone(&self) -> Self {
1207                 if self.result_ok {
1208                         Self { result_ok: true, contents: CResult_CVec_SignatureZNoneZPtr {
1209                                 result: Box::into_raw(Box::new(<crate::c_types::derived::CVec_SignatureZ>::clone(unsafe { &*self.contents.result })))
1210                         } }
1211                 } else {
1212                         Self { result_ok: false, contents: CResult_CVec_SignatureZNoneZPtr {
1213                                 err: std::ptr::null_mut()
1214                         } }
1215                 }
1216         }
1217 }
1218 #[no_mangle]
1219 /// Creates a new CResult_CVec_SignatureZNoneZ which has the same data as `orig`
1220 /// but with all dynamically-allocated buffers duplicated in new buffers.
1221 pub extern "C" fn CResult_CVec_SignatureZNoneZ_clone(orig: &CResult_CVec_SignatureZNoneZ) -> CResult_CVec_SignatureZNoneZ { orig.clone() }
1222 #[repr(C)]
1223 /// The contents of CResult_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 /// A dynamically-allocated array of crate::lightning::ln::msgs::NetAddresss of arbitrary size.
4094 /// This corresponds to std::vector in C++
4095 pub struct CVec_NetAddressZ {
4096         /// The elements in the array.
4097         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4098         pub data: *mut crate::lightning::ln::msgs::NetAddress,
4099         /// The number of elements pointed to by `data`.
4100         pub datalen: usize
4101 }
4102 impl CVec_NetAddressZ {
4103         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::NetAddress> {
4104                 if self.datalen == 0 { return Vec::new(); }
4105                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
4106                 self.data = std::ptr::null_mut();
4107                 self.datalen = 0;
4108                 ret
4109         }
4110         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::NetAddress] {
4111                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
4112         }
4113 }
4114 impl From<Vec<crate::lightning::ln::msgs::NetAddress>> for CVec_NetAddressZ {
4115         fn from(v: Vec<crate::lightning::ln::msgs::NetAddress>) -> Self {
4116                 let datalen = v.len();
4117                 let data = Box::into_raw(v.into_boxed_slice());
4118                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
4119         }
4120 }
4121 #[no_mangle]
4122 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
4123 pub extern "C" fn CVec_NetAddressZ_free(_res: CVec_NetAddressZ) { }
4124 impl Drop for CVec_NetAddressZ {
4125         fn drop(&mut self) {
4126                 if self.datalen == 0 { return; }
4127                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
4128         }
4129 }
4130 impl Clone for CVec_NetAddressZ {
4131         fn clone(&self) -> Self {
4132                 let mut res = Vec::new();
4133                 if self.datalen == 0 { return Self::from(res); }
4134                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
4135                 Self::from(res)
4136         }
4137 }
4138 #[repr(C)]
4139 /// A tuple of 2 elements. See the individual fields for the types contained.
4140 pub struct C2Tuple_PaymentHashPaymentSecretZ {
4141         /// The element at position 0
4142         pub a: crate::c_types::ThirtyTwoBytes,
4143         /// The element at position 1
4144         pub b: crate::c_types::ThirtyTwoBytes,
4145 }
4146 impl From<(crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes)> for C2Tuple_PaymentHashPaymentSecretZ {
4147         fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes)) -> Self {
4148                 Self {
4149                         a: tup.0,
4150                         b: tup.1,
4151                 }
4152         }
4153 }
4154 impl C2Tuple_PaymentHashPaymentSecretZ {
4155         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes) {
4156                 (self.a, self.b)
4157         }
4158 }
4159 impl Clone for C2Tuple_PaymentHashPaymentSecretZ {
4160         fn clone(&self) -> Self {
4161                 Self {
4162                         a: self.a.clone(),
4163                         b: self.b.clone(),
4164                 }
4165         }
4166 }
4167 #[no_mangle]
4168 /// Creates a new tuple which has the same data as `orig`
4169 /// but with all dynamically-allocated buffers duplicated in new buffers.
4170 pub extern "C" fn C2Tuple_PaymentHashPaymentSecretZ_clone(orig: &C2Tuple_PaymentHashPaymentSecretZ) -> C2Tuple_PaymentHashPaymentSecretZ { orig.clone() }
4171 /// Creates a new C2Tuple_PaymentHashPaymentSecretZ from the contained elements.
4172 #[no_mangle]
4173 pub extern "C" fn C2Tuple_PaymentHashPaymentSecretZ_new(a: crate::c_types::ThirtyTwoBytes, b: crate::c_types::ThirtyTwoBytes) -> C2Tuple_PaymentHashPaymentSecretZ {
4174         C2Tuple_PaymentHashPaymentSecretZ { a, b, }
4175 }
4176
4177 #[no_mangle]
4178 /// Frees any resources used by the C2Tuple_PaymentHashPaymentSecretZ.
4179 pub extern "C" fn C2Tuple_PaymentHashPaymentSecretZ_free(_res: C2Tuple_PaymentHashPaymentSecretZ) { }
4180 #[repr(C)]
4181 /// The contents of CResult_PaymentSecretAPIErrorZ
4182 pub union CResult_PaymentSecretAPIErrorZPtr {
4183         /// A pointer to the contents in the success state.
4184         /// Reading from this pointer when `result_ok` is not set is undefined.
4185         pub result: *mut crate::c_types::ThirtyTwoBytes,
4186         /// A pointer to the contents in the error state.
4187         /// Reading from this pointer when `result_ok` is set is undefined.
4188         pub err: *mut crate::lightning::util::errors::APIError,
4189 }
4190 #[repr(C)]
4191 /// A CResult_PaymentSecretAPIErrorZ represents the result of a fallible operation,
4192 /// containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning::util::errors::APIError on failure.
4193 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4194 pub struct CResult_PaymentSecretAPIErrorZ {
4195         /// The contents of this CResult_PaymentSecretAPIErrorZ, accessible via either
4196         /// `err` or `result` depending on the state of `result_ok`.
4197         pub contents: CResult_PaymentSecretAPIErrorZPtr,
4198         /// Whether this CResult_PaymentSecretAPIErrorZ represents a success state.
4199         pub result_ok: bool,
4200 }
4201 #[no_mangle]
4202 /// Creates a new CResult_PaymentSecretAPIErrorZ in the success state.
4203 pub extern "C" fn CResult_PaymentSecretAPIErrorZ_ok(o: crate::c_types::ThirtyTwoBytes) -> CResult_PaymentSecretAPIErrorZ {
4204         CResult_PaymentSecretAPIErrorZ {
4205                 contents: CResult_PaymentSecretAPIErrorZPtr {
4206                         result: Box::into_raw(Box::new(o)),
4207                 },
4208                 result_ok: true,
4209         }
4210 }
4211 #[no_mangle]
4212 /// Creates a new CResult_PaymentSecretAPIErrorZ in the error state.
4213 pub extern "C" fn CResult_PaymentSecretAPIErrorZ_err(e: crate::lightning::util::errors::APIError) -> CResult_PaymentSecretAPIErrorZ {
4214         CResult_PaymentSecretAPIErrorZ {
4215                 contents: CResult_PaymentSecretAPIErrorZPtr {
4216                         err: Box::into_raw(Box::new(e)),
4217                 },
4218                 result_ok: false,
4219         }
4220 }
4221 #[no_mangle]
4222 /// Frees any resources used by the CResult_PaymentSecretAPIErrorZ.
4223 pub extern "C" fn CResult_PaymentSecretAPIErrorZ_free(_res: CResult_PaymentSecretAPIErrorZ) { }
4224 impl Drop for CResult_PaymentSecretAPIErrorZ {
4225         fn drop(&mut self) {
4226                 if self.result_ok {
4227                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
4228                                 let _ = unsafe { Box::from_raw(self.contents.result) };
4229                         }
4230                 } else {
4231                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
4232                                 let _ = unsafe { Box::from_raw(self.contents.err) };
4233                         }
4234                 }
4235         }
4236 }
4237 impl From<crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::util::errors::APIError>> for CResult_PaymentSecretAPIErrorZ {
4238         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::util::errors::APIError>) -> Self {
4239                 let contents = if o.result_ok {
4240                         let result = unsafe { o.contents.result };
4241                         unsafe { o.contents.result = std::ptr::null_mut() };
4242                         CResult_PaymentSecretAPIErrorZPtr { result }
4243                 } else {
4244                         let err = unsafe { o.contents.err };
4245                         unsafe { o.contents.err = std::ptr::null_mut(); }
4246                         CResult_PaymentSecretAPIErrorZPtr { err }
4247                 };
4248                 Self {
4249                         contents,
4250                         result_ok: o.result_ok,
4251                 }
4252         }
4253 }
4254 impl Clone for CResult_PaymentSecretAPIErrorZ {
4255         fn clone(&self) -> Self {
4256                 if self.result_ok {
4257                         Self { result_ok: true, contents: CResult_PaymentSecretAPIErrorZPtr {
4258                                 result: Box::into_raw(Box::new(<crate::c_types::ThirtyTwoBytes>::clone(unsafe { &*self.contents.result })))
4259                         } }
4260                 } else {
4261                         Self { result_ok: false, contents: CResult_PaymentSecretAPIErrorZPtr {
4262                                 err: Box::into_raw(Box::new(<crate::lightning::util::errors::APIError>::clone(unsafe { &*self.contents.err })))
4263                         } }
4264                 }
4265         }
4266 }
4267 #[no_mangle]
4268 /// Creates a new CResult_PaymentSecretAPIErrorZ which has the same data as `orig`
4269 /// but with all dynamically-allocated buffers duplicated in new buffers.
4270 pub extern "C" fn CResult_PaymentSecretAPIErrorZ_clone(orig: &CResult_PaymentSecretAPIErrorZ) -> CResult_PaymentSecretAPIErrorZ { orig.clone() }
4271 #[repr(C)]
4272 /// A dynamically-allocated array of crate::lightning::chain::channelmonitor::ChannelMonitors of arbitrary size.
4273 /// This corresponds to std::vector in C++
4274 pub struct CVec_ChannelMonitorZ {
4275         /// The elements in the array.
4276         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4277         pub data: *mut crate::lightning::chain::channelmonitor::ChannelMonitor,
4278         /// The number of elements pointed to by `data`.
4279         pub datalen: usize
4280 }
4281 impl CVec_ChannelMonitorZ {
4282         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::chain::channelmonitor::ChannelMonitor> {
4283                 if self.datalen == 0 { return Vec::new(); }
4284                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
4285                 self.data = std::ptr::null_mut();
4286                 self.datalen = 0;
4287                 ret
4288         }
4289         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::chain::channelmonitor::ChannelMonitor] {
4290                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
4291         }
4292 }
4293 impl From<Vec<crate::lightning::chain::channelmonitor::ChannelMonitor>> for CVec_ChannelMonitorZ {
4294         fn from(v: Vec<crate::lightning::chain::channelmonitor::ChannelMonitor>) -> Self {
4295                 let datalen = v.len();
4296                 let data = Box::into_raw(v.into_boxed_slice());
4297                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
4298         }
4299 }
4300 #[no_mangle]
4301 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
4302 pub extern "C" fn CVec_ChannelMonitorZ_free(_res: CVec_ChannelMonitorZ) { }
4303 impl Drop for CVec_ChannelMonitorZ {
4304         fn drop(&mut self) {
4305                 if self.datalen == 0 { return; }
4306                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
4307         }
4308 }
4309 #[repr(C)]
4310 /// A tuple of 2 elements. See the individual fields for the types contained.
4311 pub struct C2Tuple_BlockHashChannelManagerZ {
4312         /// The element at position 0
4313         pub a: crate::c_types::ThirtyTwoBytes,
4314         /// The element at position 1
4315         pub b: crate::lightning::ln::channelmanager::ChannelManager,
4316 }
4317 impl From<(crate::c_types::ThirtyTwoBytes, crate::lightning::ln::channelmanager::ChannelManager)> for C2Tuple_BlockHashChannelManagerZ {
4318         fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::lightning::ln::channelmanager::ChannelManager)) -> Self {
4319                 Self {
4320                         a: tup.0,
4321                         b: tup.1,
4322                 }
4323         }
4324 }
4325 impl C2Tuple_BlockHashChannelManagerZ {
4326         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::lightning::ln::channelmanager::ChannelManager) {
4327                 (self.a, self.b)
4328         }
4329 }
4330 /// Creates a new C2Tuple_BlockHashChannelManagerZ from the contained elements.
4331 #[no_mangle]
4332 pub extern "C" fn C2Tuple_BlockHashChannelManagerZ_new(a: crate::c_types::ThirtyTwoBytes, b: crate::lightning::ln::channelmanager::ChannelManager) -> C2Tuple_BlockHashChannelManagerZ {
4333         C2Tuple_BlockHashChannelManagerZ { a, b, }
4334 }
4335
4336 #[no_mangle]
4337 /// Frees any resources used by the C2Tuple_BlockHashChannelManagerZ.
4338 pub extern "C" fn C2Tuple_BlockHashChannelManagerZ_free(_res: C2Tuple_BlockHashChannelManagerZ) { }
4339 #[repr(C)]
4340 /// The contents of CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ
4341 pub union CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr {
4342         /// A pointer to the contents in the success state.
4343         /// Reading from this pointer when `result_ok` is not set is undefined.
4344         pub result: *mut crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ,
4345         /// A pointer to the contents in the error state.
4346         /// Reading from this pointer when `result_ok` is set is undefined.
4347         pub err: *mut crate::lightning::ln::msgs::DecodeError,
4348 }
4349 #[repr(C)]
4350 /// A CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ represents the result of a fallible operation,
4351 /// containing a crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
4352 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4353 pub struct CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
4354         /// The contents of this CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ, accessible via either
4355         /// `err` or `result` depending on the state of `result_ok`.
4356         pub contents: CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr,
4357         /// Whether this CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ represents a success state.
4358         pub result_ok: bool,
4359 }
4360 #[no_mangle]
4361 /// Creates a new CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ in the success state.
4362 pub extern "C" fn CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_ok(o: crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ) -> CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
4363         CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
4364                 contents: CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr {
4365                         result: Box::into_raw(Box::new(o)),
4366                 },
4367                 result_ok: true,
4368         }
4369 }
4370 #[no_mangle]
4371 /// Creates a new CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ in the error state.
4372 pub extern "C" fn CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
4373         CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
4374                 contents: CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr {
4375                         err: Box::into_raw(Box::new(e)),
4376                 },
4377                 result_ok: false,
4378         }
4379 }
4380 #[no_mangle]
4381 /// Frees any resources used by the CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ.
4382 pub extern "C" fn CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_free(_res: CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ) { }
4383 impl Drop for CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
4384         fn drop(&mut self) {
4385                 if self.result_ok {
4386                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
4387                                 let _ = unsafe { Box::from_raw(self.contents.result) };
4388                         }
4389                 } else {
4390                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
4391                                 let _ = unsafe { Box::from_raw(self.contents.err) };
4392                         }
4393                 }
4394         }
4395 }
4396 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ, crate::lightning::ln::msgs::DecodeError>> for CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
4397         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
4398                 let contents = if o.result_ok {
4399                         let result = unsafe { o.contents.result };
4400                         unsafe { o.contents.result = std::ptr::null_mut() };
4401                         CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr { result }
4402                 } else {
4403                         let err = unsafe { o.contents.err };
4404                         unsafe { o.contents.err = std::ptr::null_mut(); }
4405                         CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr { err }
4406                 };
4407                 Self {
4408                         contents,
4409                         result_ok: o.result_ok,
4410                 }
4411         }
4412 }
4413 #[repr(C)]
4414 /// The contents of CResult_ChannelConfigDecodeErrorZ
4415 pub union CResult_ChannelConfigDecodeErrorZPtr {
4416         /// A pointer to the contents in the success state.
4417         /// Reading from this pointer when `result_ok` is not set is undefined.
4418         pub result: *mut crate::lightning::util::config::ChannelConfig,
4419         /// A pointer to the contents in the error state.
4420         /// Reading from this pointer when `result_ok` is set is undefined.
4421         pub err: *mut crate::lightning::ln::msgs::DecodeError,
4422 }
4423 #[repr(C)]
4424 /// A CResult_ChannelConfigDecodeErrorZ represents the result of a fallible operation,
4425 /// containing a crate::lightning::util::config::ChannelConfig on success and a crate::lightning::ln::msgs::DecodeError on failure.
4426 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4427 pub struct CResult_ChannelConfigDecodeErrorZ {
4428         /// The contents of this CResult_ChannelConfigDecodeErrorZ, accessible via either
4429         /// `err` or `result` depending on the state of `result_ok`.
4430         pub contents: CResult_ChannelConfigDecodeErrorZPtr,
4431         /// Whether this CResult_ChannelConfigDecodeErrorZ represents a success state.
4432         pub result_ok: bool,
4433 }
4434 #[no_mangle]
4435 /// Creates a new CResult_ChannelConfigDecodeErrorZ in the success state.
4436 pub extern "C" fn CResult_ChannelConfigDecodeErrorZ_ok(o: crate::lightning::util::config::ChannelConfig) -> CResult_ChannelConfigDecodeErrorZ {
4437         CResult_ChannelConfigDecodeErrorZ {
4438                 contents: CResult_ChannelConfigDecodeErrorZPtr {
4439                         result: Box::into_raw(Box::new(o)),
4440                 },
4441                 result_ok: true,
4442         }
4443 }
4444 #[no_mangle]
4445 /// Creates a new CResult_ChannelConfigDecodeErrorZ in the error state.
4446 pub extern "C" fn CResult_ChannelConfigDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelConfigDecodeErrorZ {
4447         CResult_ChannelConfigDecodeErrorZ {
4448                 contents: CResult_ChannelConfigDecodeErrorZPtr {
4449                         err: Box::into_raw(Box::new(e)),
4450                 },
4451                 result_ok: false,
4452         }
4453 }
4454 #[no_mangle]
4455 /// Frees any resources used by the CResult_ChannelConfigDecodeErrorZ.
4456 pub extern "C" fn CResult_ChannelConfigDecodeErrorZ_free(_res: CResult_ChannelConfigDecodeErrorZ) { }
4457 impl Drop for CResult_ChannelConfigDecodeErrorZ {
4458         fn drop(&mut self) {
4459                 if self.result_ok {
4460                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
4461                                 let _ = unsafe { Box::from_raw(self.contents.result) };
4462                         }
4463                 } else {
4464                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
4465                                 let _ = unsafe { Box::from_raw(self.contents.err) };
4466                         }
4467                 }
4468         }
4469 }
4470 impl From<crate::c_types::CResultTempl<crate::lightning::util::config::ChannelConfig, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelConfigDecodeErrorZ {
4471         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::util::config::ChannelConfig, crate::lightning::ln::msgs::DecodeError>) -> Self {
4472                 let contents = if o.result_ok {
4473                         let result = unsafe { o.contents.result };
4474                         unsafe { o.contents.result = std::ptr::null_mut() };
4475                         CResult_ChannelConfigDecodeErrorZPtr { result }
4476                 } else {
4477                         let err = unsafe { o.contents.err };
4478                         unsafe { o.contents.err = std::ptr::null_mut(); }
4479                         CResult_ChannelConfigDecodeErrorZPtr { err }
4480                 };
4481                 Self {
4482                         contents,
4483                         result_ok: o.result_ok,
4484                 }
4485         }
4486 }
4487 impl Clone for CResult_ChannelConfigDecodeErrorZ {
4488         fn clone(&self) -> Self {
4489                 if self.result_ok {
4490                         Self { result_ok: true, contents: CResult_ChannelConfigDecodeErrorZPtr {
4491                                 result: Box::into_raw(Box::new(<crate::lightning::util::config::ChannelConfig>::clone(unsafe { &*self.contents.result })))
4492                         } }
4493                 } else {
4494                         Self { result_ok: false, contents: CResult_ChannelConfigDecodeErrorZPtr {
4495                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
4496                         } }
4497                 }
4498         }
4499 }
4500 #[no_mangle]
4501 /// Creates a new CResult_ChannelConfigDecodeErrorZ which has the same data as `orig`
4502 /// but with all dynamically-allocated buffers duplicated in new buffers.
4503 pub extern "C" fn CResult_ChannelConfigDecodeErrorZ_clone(orig: &CResult_ChannelConfigDecodeErrorZ) -> CResult_ChannelConfigDecodeErrorZ { orig.clone() }
4504 #[repr(C)]
4505 /// The contents of CResult_OutPointDecodeErrorZ
4506 pub union CResult_OutPointDecodeErrorZPtr {
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::chain::transaction::OutPoint,
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_OutPointDecodeErrorZ represents the result of a fallible operation,
4516 /// containing a crate::lightning::chain::transaction::OutPoint 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_OutPointDecodeErrorZ {
4519         /// The contents of this CResult_OutPointDecodeErrorZ, accessible via either
4520         /// `err` or `result` depending on the state of `result_ok`.
4521         pub contents: CResult_OutPointDecodeErrorZPtr,
4522         /// Whether this CResult_OutPointDecodeErrorZ represents a success state.
4523         pub result_ok: bool,
4524 }
4525 #[no_mangle]
4526 /// Creates a new CResult_OutPointDecodeErrorZ in the success state.
4527 pub extern "C" fn CResult_OutPointDecodeErrorZ_ok(o: crate::lightning::chain::transaction::OutPoint) -> CResult_OutPointDecodeErrorZ {
4528         CResult_OutPointDecodeErrorZ {
4529                 contents: CResult_OutPointDecodeErrorZPtr {
4530                         result: Box::into_raw(Box::new(o)),
4531                 },
4532                 result_ok: true,
4533         }
4534 }
4535 #[no_mangle]
4536 /// Creates a new CResult_OutPointDecodeErrorZ in the error state.
4537 pub extern "C" fn CResult_OutPointDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_OutPointDecodeErrorZ {
4538         CResult_OutPointDecodeErrorZ {
4539                 contents: CResult_OutPointDecodeErrorZPtr {
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_OutPointDecodeErrorZ.
4547 pub extern "C" fn CResult_OutPointDecodeErrorZ_free(_res: CResult_OutPointDecodeErrorZ) { }
4548 impl Drop for CResult_OutPointDecodeErrorZ {
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::chain::transaction::OutPoint, crate::lightning::ln::msgs::DecodeError>> for CResult_OutPointDecodeErrorZ {
4562         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::transaction::OutPoint, 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_OutPointDecodeErrorZPtr { result }
4567                 } else {
4568                         let err = unsafe { o.contents.err };
4569                         unsafe { o.contents.err = std::ptr::null_mut(); }
4570                         CResult_OutPointDecodeErrorZPtr { err }
4571                 };
4572                 Self {
4573                         contents,
4574                         result_ok: o.result_ok,
4575                 }
4576         }
4577 }
4578 impl Clone for CResult_OutPointDecodeErrorZ {
4579         fn clone(&self) -> Self {
4580                 if self.result_ok {
4581                         Self { result_ok: true, contents: CResult_OutPointDecodeErrorZPtr {
4582                                 result: Box::into_raw(Box::new(<crate::lightning::chain::transaction::OutPoint>::clone(unsafe { &*self.contents.result })))
4583                         } }
4584                 } else {
4585                         Self { result_ok: false, contents: CResult_OutPointDecodeErrorZPtr {
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_OutPointDecodeErrorZ which has the same data as `orig`
4593 /// but with all dynamically-allocated buffers duplicated in new buffers.
4594 pub extern "C" fn CResult_OutPointDecodeErrorZ_clone(orig: &CResult_OutPointDecodeErrorZ) -> CResult_OutPointDecodeErrorZ { orig.clone() }
4595 #[repr(C)]
4596 /// The contents of CResult_SiPrefixNoneZ
4597 pub union CResult_SiPrefixNoneZPtr {
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_invoice::SiPrefix,
4601         /// Note that this value is always NULL, as there are no contents in the Err variant
4602         pub err: *mut std::ffi::c_void,
4603 }
4604 #[repr(C)]
4605 /// A CResult_SiPrefixNoneZ represents the result of a fallible operation,
4606 /// containing a crate::lightning_invoice::SiPrefix on success and a () on failure.
4607 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4608 pub struct CResult_SiPrefixNoneZ {
4609         /// The contents of this CResult_SiPrefixNoneZ, accessible via either
4610         /// `err` or `result` depending on the state of `result_ok`.
4611         pub contents: CResult_SiPrefixNoneZPtr,
4612         /// Whether this CResult_SiPrefixNoneZ represents a success state.
4613         pub result_ok: bool,
4614 }
4615 #[no_mangle]
4616 /// Creates a new CResult_SiPrefixNoneZ in the success state.
4617 pub extern "C" fn CResult_SiPrefixNoneZ_ok(o: crate::lightning_invoice::SiPrefix) -> CResult_SiPrefixNoneZ {
4618         CResult_SiPrefixNoneZ {
4619                 contents: CResult_SiPrefixNoneZPtr {
4620                         result: Box::into_raw(Box::new(o)),
4621                 },
4622                 result_ok: true,
4623         }
4624 }
4625 #[no_mangle]
4626 /// Creates a new CResult_SiPrefixNoneZ in the error state.
4627 pub extern "C" fn CResult_SiPrefixNoneZ_err() -> CResult_SiPrefixNoneZ {
4628         CResult_SiPrefixNoneZ {
4629                 contents: CResult_SiPrefixNoneZPtr {
4630                         err: std::ptr::null_mut(),
4631                 },
4632                 result_ok: false,
4633         }
4634 }
4635 #[no_mangle]
4636 /// Frees any resources used by the CResult_SiPrefixNoneZ.
4637 pub extern "C" fn CResult_SiPrefixNoneZ_free(_res: CResult_SiPrefixNoneZ) { }
4638 impl Drop for CResult_SiPrefixNoneZ {
4639         fn drop(&mut self) {
4640                 if self.result_ok {
4641                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
4642                                 let _ = unsafe { Box::from_raw(self.contents.result) };
4643                         }
4644                 } else {
4645                 }
4646         }
4647 }
4648 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::SiPrefix, ()>> for CResult_SiPrefixNoneZ {
4649         fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::SiPrefix, ()>) -> Self {
4650                 let contents = if o.result_ok {
4651                         let result = unsafe { o.contents.result };
4652                         unsafe { o.contents.result = std::ptr::null_mut() };
4653                         CResult_SiPrefixNoneZPtr { result }
4654                 } else {
4655                         let _ = unsafe { Box::from_raw(o.contents.err) };
4656                         o.contents.err = std::ptr::null_mut();
4657                         CResult_SiPrefixNoneZPtr { err: std::ptr::null_mut() }
4658                 };
4659                 Self {
4660                         contents,
4661                         result_ok: o.result_ok,
4662                 }
4663         }
4664 }
4665 impl Clone for CResult_SiPrefixNoneZ {
4666         fn clone(&self) -> Self {
4667                 if self.result_ok {
4668                         Self { result_ok: true, contents: CResult_SiPrefixNoneZPtr {
4669                                 result: Box::into_raw(Box::new(<crate::lightning_invoice::SiPrefix>::clone(unsafe { &*self.contents.result })))
4670                         } }
4671                 } else {
4672                         Self { result_ok: false, contents: CResult_SiPrefixNoneZPtr {
4673                                 err: std::ptr::null_mut()
4674                         } }
4675                 }
4676         }
4677 }
4678 #[no_mangle]
4679 /// Creates a new CResult_SiPrefixNoneZ which has the same data as `orig`
4680 /// but with all dynamically-allocated buffers duplicated in new buffers.
4681 pub extern "C" fn CResult_SiPrefixNoneZ_clone(orig: &CResult_SiPrefixNoneZ) -> CResult_SiPrefixNoneZ { orig.clone() }
4682 #[repr(C)]
4683 /// The contents of CResult_InvoiceNoneZ
4684 pub union CResult_InvoiceNoneZPtr {
4685         /// A pointer to the contents in the success state.
4686         /// Reading from this pointer when `result_ok` is not set is undefined.
4687         pub result: *mut crate::lightning_invoice::Invoice,
4688         /// Note that this value is always NULL, as there are no contents in the Err variant
4689         pub err: *mut std::ffi::c_void,
4690 }
4691 #[repr(C)]
4692 /// A CResult_InvoiceNoneZ represents the result of a fallible operation,
4693 /// containing a crate::lightning_invoice::Invoice on success and a () on failure.
4694 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4695 pub struct CResult_InvoiceNoneZ {
4696         /// The contents of this CResult_InvoiceNoneZ, accessible via either
4697         /// `err` or `result` depending on the state of `result_ok`.
4698         pub contents: CResult_InvoiceNoneZPtr,
4699         /// Whether this CResult_InvoiceNoneZ represents a success state.
4700         pub result_ok: bool,
4701 }
4702 #[no_mangle]
4703 /// Creates a new CResult_InvoiceNoneZ in the success state.
4704 pub extern "C" fn CResult_InvoiceNoneZ_ok(o: crate::lightning_invoice::Invoice) -> CResult_InvoiceNoneZ {
4705         CResult_InvoiceNoneZ {
4706                 contents: CResult_InvoiceNoneZPtr {
4707                         result: Box::into_raw(Box::new(o)),
4708                 },
4709                 result_ok: true,
4710         }
4711 }
4712 #[no_mangle]
4713 /// Creates a new CResult_InvoiceNoneZ in the error state.
4714 pub extern "C" fn CResult_InvoiceNoneZ_err() -> CResult_InvoiceNoneZ {
4715         CResult_InvoiceNoneZ {
4716                 contents: CResult_InvoiceNoneZPtr {
4717                         err: std::ptr::null_mut(),
4718                 },
4719                 result_ok: false,
4720         }
4721 }
4722 #[no_mangle]
4723 /// Frees any resources used by the CResult_InvoiceNoneZ.
4724 pub extern "C" fn CResult_InvoiceNoneZ_free(_res: CResult_InvoiceNoneZ) { }
4725 impl Drop for CResult_InvoiceNoneZ {
4726         fn drop(&mut self) {
4727                 if self.result_ok {
4728                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
4729                                 let _ = unsafe { Box::from_raw(self.contents.result) };
4730                         }
4731                 } else {
4732                 }
4733         }
4734 }
4735 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::Invoice, ()>> for CResult_InvoiceNoneZ {
4736         fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::Invoice, ()>) -> Self {
4737                 let contents = if o.result_ok {
4738                         let result = unsafe { o.contents.result };
4739                         unsafe { o.contents.result = std::ptr::null_mut() };
4740                         CResult_InvoiceNoneZPtr { result }
4741                 } else {
4742                         let _ = unsafe { Box::from_raw(o.contents.err) };
4743                         o.contents.err = std::ptr::null_mut();
4744                         CResult_InvoiceNoneZPtr { err: std::ptr::null_mut() }
4745                 };
4746                 Self {
4747                         contents,
4748                         result_ok: o.result_ok,
4749                 }
4750         }
4751 }
4752 impl Clone for CResult_InvoiceNoneZ {
4753         fn clone(&self) -> Self {
4754                 if self.result_ok {
4755                         Self { result_ok: true, contents: CResult_InvoiceNoneZPtr {
4756                                 result: Box::into_raw(Box::new(<crate::lightning_invoice::Invoice>::clone(unsafe { &*self.contents.result })))
4757                         } }
4758                 } else {
4759                         Self { result_ok: false, contents: CResult_InvoiceNoneZPtr {
4760                                 err: std::ptr::null_mut()
4761                         } }
4762                 }
4763         }
4764 }
4765 #[no_mangle]
4766 /// Creates a new CResult_InvoiceNoneZ which has the same data as `orig`
4767 /// but with all dynamically-allocated buffers duplicated in new buffers.
4768 pub extern "C" fn CResult_InvoiceNoneZ_clone(orig: &CResult_InvoiceNoneZ) -> CResult_InvoiceNoneZ { orig.clone() }
4769 #[repr(C)]
4770 /// The contents of CResult_SignedRawInvoiceNoneZ
4771 pub union CResult_SignedRawInvoiceNoneZPtr {
4772         /// A pointer to the contents in the success state.
4773         /// Reading from this pointer when `result_ok` is not set is undefined.
4774         pub result: *mut crate::lightning_invoice::SignedRawInvoice,
4775         /// Note that this value is always NULL, as there are no contents in the Err variant
4776         pub err: *mut std::ffi::c_void,
4777 }
4778 #[repr(C)]
4779 /// A CResult_SignedRawInvoiceNoneZ represents the result of a fallible operation,
4780 /// containing a crate::lightning_invoice::SignedRawInvoice on success and a () on failure.
4781 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4782 pub struct CResult_SignedRawInvoiceNoneZ {
4783         /// The contents of this CResult_SignedRawInvoiceNoneZ, accessible via either
4784         /// `err` or `result` depending on the state of `result_ok`.
4785         pub contents: CResult_SignedRawInvoiceNoneZPtr,
4786         /// Whether this CResult_SignedRawInvoiceNoneZ represents a success state.
4787         pub result_ok: bool,
4788 }
4789 #[no_mangle]
4790 /// Creates a new CResult_SignedRawInvoiceNoneZ in the success state.
4791 pub extern "C" fn CResult_SignedRawInvoiceNoneZ_ok(o: crate::lightning_invoice::SignedRawInvoice) -> CResult_SignedRawInvoiceNoneZ {
4792         CResult_SignedRawInvoiceNoneZ {
4793                 contents: CResult_SignedRawInvoiceNoneZPtr {
4794                         result: Box::into_raw(Box::new(o)),
4795                 },
4796                 result_ok: true,
4797         }
4798 }
4799 #[no_mangle]
4800 /// Creates a new CResult_SignedRawInvoiceNoneZ in the error state.
4801 pub extern "C" fn CResult_SignedRawInvoiceNoneZ_err() -> CResult_SignedRawInvoiceNoneZ {
4802         CResult_SignedRawInvoiceNoneZ {
4803                 contents: CResult_SignedRawInvoiceNoneZPtr {
4804                         err: std::ptr::null_mut(),
4805                 },
4806                 result_ok: false,
4807         }
4808 }
4809 #[no_mangle]
4810 /// Frees any resources used by the CResult_SignedRawInvoiceNoneZ.
4811 pub extern "C" fn CResult_SignedRawInvoiceNoneZ_free(_res: CResult_SignedRawInvoiceNoneZ) { }
4812 impl Drop for CResult_SignedRawInvoiceNoneZ {
4813         fn drop(&mut self) {
4814                 if self.result_ok {
4815                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
4816                                 let _ = unsafe { Box::from_raw(self.contents.result) };
4817                         }
4818                 } else {
4819                 }
4820         }
4821 }
4822 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::SignedRawInvoice, ()>> for CResult_SignedRawInvoiceNoneZ {
4823         fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::SignedRawInvoice, ()>) -> Self {
4824                 let contents = if o.result_ok {
4825                         let result = unsafe { o.contents.result };
4826                         unsafe { o.contents.result = std::ptr::null_mut() };
4827                         CResult_SignedRawInvoiceNoneZPtr { result }
4828                 } else {
4829                         let _ = unsafe { Box::from_raw(o.contents.err) };
4830                         o.contents.err = std::ptr::null_mut();
4831                         CResult_SignedRawInvoiceNoneZPtr { err: std::ptr::null_mut() }
4832                 };
4833                 Self {
4834                         contents,
4835                         result_ok: o.result_ok,
4836                 }
4837         }
4838 }
4839 impl Clone for CResult_SignedRawInvoiceNoneZ {
4840         fn clone(&self) -> Self {
4841                 if self.result_ok {
4842                         Self { result_ok: true, contents: CResult_SignedRawInvoiceNoneZPtr {
4843                                 result: Box::into_raw(Box::new(<crate::lightning_invoice::SignedRawInvoice>::clone(unsafe { &*self.contents.result })))
4844                         } }
4845                 } else {
4846                         Self { result_ok: false, contents: CResult_SignedRawInvoiceNoneZPtr {
4847                                 err: std::ptr::null_mut()
4848                         } }
4849                 }
4850         }
4851 }
4852 #[no_mangle]
4853 /// Creates a new CResult_SignedRawInvoiceNoneZ which has the same data as `orig`
4854 /// but with all dynamically-allocated buffers duplicated in new buffers.
4855 pub extern "C" fn CResult_SignedRawInvoiceNoneZ_clone(orig: &CResult_SignedRawInvoiceNoneZ) -> CResult_SignedRawInvoiceNoneZ { orig.clone() }
4856 #[repr(C)]
4857 /// A tuple of 3 elements. See the individual fields for the types contained.
4858 pub struct C3Tuple_RawInvoice_u832InvoiceSignatureZ {
4859         /// The element at position 0
4860         pub a: crate::lightning_invoice::RawInvoice,
4861         /// The element at position 1
4862         pub b: crate::c_types::ThirtyTwoBytes,
4863         /// The element at position 2
4864         pub c: crate::lightning_invoice::InvoiceSignature,
4865 }
4866 impl From<(crate::lightning_invoice::RawInvoice, crate::c_types::ThirtyTwoBytes, crate::lightning_invoice::InvoiceSignature)> for C3Tuple_RawInvoice_u832InvoiceSignatureZ {
4867         fn from (tup: (crate::lightning_invoice::RawInvoice, crate::c_types::ThirtyTwoBytes, crate::lightning_invoice::InvoiceSignature)) -> Self {
4868                 Self {
4869                         a: tup.0,
4870                         b: tup.1,
4871                         c: tup.2,
4872                 }
4873         }
4874 }
4875 impl C3Tuple_RawInvoice_u832InvoiceSignatureZ {
4876         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::lightning_invoice::RawInvoice, crate::c_types::ThirtyTwoBytes, crate::lightning_invoice::InvoiceSignature) {
4877                 (self.a, self.b, self.c)
4878         }
4879 }
4880 impl Clone for C3Tuple_RawInvoice_u832InvoiceSignatureZ {
4881         fn clone(&self) -> Self {
4882                 Self {
4883                         a: self.a.clone(),
4884                         b: self.b.clone(),
4885                         c: self.c.clone(),
4886                 }
4887         }
4888 }
4889 #[no_mangle]
4890 /// Creates a new tuple which has the same data as `orig`
4891 /// but with all dynamically-allocated buffers duplicated in new buffers.
4892 pub extern "C" fn C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone(orig: &C3Tuple_RawInvoice_u832InvoiceSignatureZ) -> C3Tuple_RawInvoice_u832InvoiceSignatureZ { orig.clone() }
4893 /// Creates a new C3Tuple_RawInvoice_u832InvoiceSignatureZ from the contained elements.
4894 #[no_mangle]
4895 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 {
4896         C3Tuple_RawInvoice_u832InvoiceSignatureZ { a, b, c, }
4897 }
4898
4899 #[no_mangle]
4900 /// Frees any resources used by the C3Tuple_RawInvoice_u832InvoiceSignatureZ.
4901 pub extern "C" fn C3Tuple_RawInvoice_u832InvoiceSignatureZ_free(_res: C3Tuple_RawInvoice_u832InvoiceSignatureZ) { }
4902 #[repr(C)]
4903 /// The contents of CResult_PayeePubKeyErrorZ
4904 pub union CResult_PayeePubKeyErrorZPtr {
4905         /// A pointer to the contents in the success state.
4906         /// Reading from this pointer when `result_ok` is not set is undefined.
4907         pub result: *mut crate::lightning_invoice::PayeePubKey,
4908         /// A pointer to the contents in the error state.
4909         /// Reading from this pointer when `result_ok` is set is undefined.
4910         pub err: *mut crate::c_types::Secp256k1Error,
4911 }
4912 #[repr(C)]
4913 /// A CResult_PayeePubKeyErrorZ represents the result of a fallible operation,
4914 /// containing a crate::lightning_invoice::PayeePubKey on success and a crate::c_types::Secp256k1Error on failure.
4915 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4916 pub struct CResult_PayeePubKeyErrorZ {
4917         /// The contents of this CResult_PayeePubKeyErrorZ, accessible via either
4918         /// `err` or `result` depending on the state of `result_ok`.
4919         pub contents: CResult_PayeePubKeyErrorZPtr,
4920         /// Whether this CResult_PayeePubKeyErrorZ represents a success state.
4921         pub result_ok: bool,
4922 }
4923 #[no_mangle]
4924 /// Creates a new CResult_PayeePubKeyErrorZ in the success state.
4925 pub extern "C" fn CResult_PayeePubKeyErrorZ_ok(o: crate::lightning_invoice::PayeePubKey) -> CResult_PayeePubKeyErrorZ {
4926         CResult_PayeePubKeyErrorZ {
4927                 contents: CResult_PayeePubKeyErrorZPtr {
4928                         result: Box::into_raw(Box::new(o)),
4929                 },
4930                 result_ok: true,
4931         }
4932 }
4933 #[no_mangle]
4934 /// Creates a new CResult_PayeePubKeyErrorZ in the error state.
4935 pub extern "C" fn CResult_PayeePubKeyErrorZ_err(e: crate::c_types::Secp256k1Error) -> CResult_PayeePubKeyErrorZ {
4936         CResult_PayeePubKeyErrorZ {
4937                 contents: CResult_PayeePubKeyErrorZPtr {
4938                         err: Box::into_raw(Box::new(e)),
4939                 },
4940                 result_ok: false,
4941         }
4942 }
4943 #[no_mangle]
4944 /// Frees any resources used by the CResult_PayeePubKeyErrorZ.
4945 pub extern "C" fn CResult_PayeePubKeyErrorZ_free(_res: CResult_PayeePubKeyErrorZ) { }
4946 impl Drop for CResult_PayeePubKeyErrorZ {
4947         fn drop(&mut self) {
4948                 if self.result_ok {
4949                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
4950                                 let _ = unsafe { Box::from_raw(self.contents.result) };
4951                         }
4952                 } else {
4953                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
4954                                 let _ = unsafe { Box::from_raw(self.contents.err) };
4955                         }
4956                 }
4957         }
4958 }
4959 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::PayeePubKey, crate::c_types::Secp256k1Error>> for CResult_PayeePubKeyErrorZ {
4960         fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::PayeePubKey, crate::c_types::Secp256k1Error>) -> Self {
4961                 let contents = if o.result_ok {
4962                         let result = unsafe { o.contents.result };
4963                         unsafe { o.contents.result = std::ptr::null_mut() };
4964                         CResult_PayeePubKeyErrorZPtr { result }
4965                 } else {
4966                         let err = unsafe { o.contents.err };
4967                         unsafe { o.contents.err = std::ptr::null_mut(); }
4968                         CResult_PayeePubKeyErrorZPtr { err }
4969                 };
4970                 Self {
4971                         contents,
4972                         result_ok: o.result_ok,
4973                 }
4974         }
4975 }
4976 impl Clone for CResult_PayeePubKeyErrorZ {
4977         fn clone(&self) -> Self {
4978                 if self.result_ok {
4979                         Self { result_ok: true, contents: CResult_PayeePubKeyErrorZPtr {
4980                                 result: Box::into_raw(Box::new(<crate::lightning_invoice::PayeePubKey>::clone(unsafe { &*self.contents.result })))
4981                         } }
4982                 } else {
4983                         Self { result_ok: false, contents: CResult_PayeePubKeyErrorZPtr {
4984                                 err: Box::into_raw(Box::new(<crate::c_types::Secp256k1Error>::clone(unsafe { &*self.contents.err })))
4985                         } }
4986                 }
4987         }
4988 }
4989 #[no_mangle]
4990 /// Creates a new CResult_PayeePubKeyErrorZ which has the same data as `orig`
4991 /// but with all dynamically-allocated buffers duplicated in new buffers.
4992 pub extern "C" fn CResult_PayeePubKeyErrorZ_clone(orig: &CResult_PayeePubKeyErrorZ) -> CResult_PayeePubKeyErrorZ { orig.clone() }
4993 #[repr(C)]
4994 /// A dynamically-allocated array of crate::lightning_invoice::PrivateRoutes of arbitrary size.
4995 /// This corresponds to std::vector in C++
4996 pub struct CVec_PrivateRouteZ {
4997         /// The elements in the array.
4998         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4999         pub data: *mut crate::lightning_invoice::PrivateRoute,
5000         /// The number of elements pointed to by `data`.
5001         pub datalen: usize
5002 }
5003 impl CVec_PrivateRouteZ {
5004         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning_invoice::PrivateRoute> {
5005                 if self.datalen == 0 { return Vec::new(); }
5006                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
5007                 self.data = std::ptr::null_mut();
5008                 self.datalen = 0;
5009                 ret
5010         }
5011         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning_invoice::PrivateRoute] {
5012                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
5013         }
5014 }
5015 impl From<Vec<crate::lightning_invoice::PrivateRoute>> for CVec_PrivateRouteZ {
5016         fn from(v: Vec<crate::lightning_invoice::PrivateRoute>) -> Self {
5017                 let datalen = v.len();
5018                 let data = Box::into_raw(v.into_boxed_slice());
5019                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
5020         }
5021 }
5022 #[no_mangle]
5023 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
5024 pub extern "C" fn CVec_PrivateRouteZ_free(_res: CVec_PrivateRouteZ) { }
5025 impl Drop for CVec_PrivateRouteZ {
5026         fn drop(&mut self) {
5027                 if self.datalen == 0 { return; }
5028                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
5029         }
5030 }
5031 impl Clone for CVec_PrivateRouteZ {
5032         fn clone(&self) -> Self {
5033                 let mut res = Vec::new();
5034                 if self.datalen == 0 { return Self::from(res); }
5035                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
5036                 Self::from(res)
5037         }
5038 }
5039 #[repr(C)]
5040 /// The contents of CResult_PositiveTimestampCreationErrorZ
5041 pub union CResult_PositiveTimestampCreationErrorZPtr {
5042         /// A pointer to the contents in the success state.
5043         /// Reading from this pointer when `result_ok` is not set is undefined.
5044         pub result: *mut crate::lightning_invoice::PositiveTimestamp,
5045         /// A pointer to the contents in the error state.
5046         /// Reading from this pointer when `result_ok` is set is undefined.
5047         pub err: *mut crate::lightning_invoice::CreationError,
5048 }
5049 #[repr(C)]
5050 /// A CResult_PositiveTimestampCreationErrorZ represents the result of a fallible operation,
5051 /// containing a crate::lightning_invoice::PositiveTimestamp on success and a crate::lightning_invoice::CreationError on failure.
5052 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5053 pub struct CResult_PositiveTimestampCreationErrorZ {
5054         /// The contents of this CResult_PositiveTimestampCreationErrorZ, accessible via either
5055         /// `err` or `result` depending on the state of `result_ok`.
5056         pub contents: CResult_PositiveTimestampCreationErrorZPtr,
5057         /// Whether this CResult_PositiveTimestampCreationErrorZ represents a success state.
5058         pub result_ok: bool,
5059 }
5060 #[no_mangle]
5061 /// Creates a new CResult_PositiveTimestampCreationErrorZ in the success state.
5062 pub extern "C" fn CResult_PositiveTimestampCreationErrorZ_ok(o: crate::lightning_invoice::PositiveTimestamp) -> CResult_PositiveTimestampCreationErrorZ {
5063         CResult_PositiveTimestampCreationErrorZ {
5064                 contents: CResult_PositiveTimestampCreationErrorZPtr {
5065                         result: Box::into_raw(Box::new(o)),
5066                 },
5067                 result_ok: true,
5068         }
5069 }
5070 #[no_mangle]
5071 /// Creates a new CResult_PositiveTimestampCreationErrorZ in the error state.
5072 pub extern "C" fn CResult_PositiveTimestampCreationErrorZ_err(e: crate::lightning_invoice::CreationError) -> CResult_PositiveTimestampCreationErrorZ {
5073         CResult_PositiveTimestampCreationErrorZ {
5074                 contents: CResult_PositiveTimestampCreationErrorZPtr {
5075                         err: Box::into_raw(Box::new(e)),
5076                 },
5077                 result_ok: false,
5078         }
5079 }
5080 #[no_mangle]
5081 /// Frees any resources used by the CResult_PositiveTimestampCreationErrorZ.
5082 pub extern "C" fn CResult_PositiveTimestampCreationErrorZ_free(_res: CResult_PositiveTimestampCreationErrorZ) { }
5083 impl Drop for CResult_PositiveTimestampCreationErrorZ {
5084         fn drop(&mut self) {
5085                 if self.result_ok {
5086                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
5087                                 let _ = unsafe { Box::from_raw(self.contents.result) };
5088                         }
5089                 } else {
5090                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
5091                                 let _ = unsafe { Box::from_raw(self.contents.err) };
5092                         }
5093                 }
5094         }
5095 }
5096 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::PositiveTimestamp, crate::lightning_invoice::CreationError>> for CResult_PositiveTimestampCreationErrorZ {
5097         fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::PositiveTimestamp, crate::lightning_invoice::CreationError>) -> Self {
5098                 let contents = if o.result_ok {
5099                         let result = unsafe { o.contents.result };
5100                         unsafe { o.contents.result = std::ptr::null_mut() };
5101                         CResult_PositiveTimestampCreationErrorZPtr { result }
5102                 } else {
5103                         let err = unsafe { o.contents.err };
5104                         unsafe { o.contents.err = std::ptr::null_mut(); }
5105                         CResult_PositiveTimestampCreationErrorZPtr { err }
5106                 };
5107                 Self {
5108                         contents,
5109                         result_ok: o.result_ok,
5110                 }
5111         }
5112 }
5113 impl Clone for CResult_PositiveTimestampCreationErrorZ {
5114         fn clone(&self) -> Self {
5115                 if self.result_ok {
5116                         Self { result_ok: true, contents: CResult_PositiveTimestampCreationErrorZPtr {
5117                                 result: Box::into_raw(Box::new(<crate::lightning_invoice::PositiveTimestamp>::clone(unsafe { &*self.contents.result })))
5118                         } }
5119                 } else {
5120                         Self { result_ok: false, contents: CResult_PositiveTimestampCreationErrorZPtr {
5121                                 err: Box::into_raw(Box::new(<crate::lightning_invoice::CreationError>::clone(unsafe { &*self.contents.err })))
5122                         } }
5123                 }
5124         }
5125 }
5126 #[no_mangle]
5127 /// Creates a new CResult_PositiveTimestampCreationErrorZ which has the same data as `orig`
5128 /// but with all dynamically-allocated buffers duplicated in new buffers.
5129 pub extern "C" fn CResult_PositiveTimestampCreationErrorZ_clone(orig: &CResult_PositiveTimestampCreationErrorZ) -> CResult_PositiveTimestampCreationErrorZ { orig.clone() }
5130 #[repr(C)]
5131 /// The contents of CResult_NoneSemanticErrorZ
5132 pub union CResult_NoneSemanticErrorZPtr {
5133         /// Note that this value is always NULL, as there are no contents in the OK variant
5134         pub result: *mut std::ffi::c_void,
5135         /// A pointer to the contents in the error state.
5136         /// Reading from this pointer when `result_ok` is set is undefined.
5137         pub err: *mut crate::lightning_invoice::SemanticError,
5138 }
5139 #[repr(C)]
5140 /// A CResult_NoneSemanticErrorZ represents the result of a fallible operation,
5141 /// containing a () on success and a crate::lightning_invoice::SemanticError on failure.
5142 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5143 pub struct CResult_NoneSemanticErrorZ {
5144         /// The contents of this CResult_NoneSemanticErrorZ, accessible via either
5145         /// `err` or `result` depending on the state of `result_ok`.
5146         pub contents: CResult_NoneSemanticErrorZPtr,
5147         /// Whether this CResult_NoneSemanticErrorZ represents a success state.
5148         pub result_ok: bool,
5149 }
5150 #[no_mangle]
5151 /// Creates a new CResult_NoneSemanticErrorZ in the success state.
5152 pub extern "C" fn CResult_NoneSemanticErrorZ_ok() -> CResult_NoneSemanticErrorZ {
5153         CResult_NoneSemanticErrorZ {
5154                 contents: CResult_NoneSemanticErrorZPtr {
5155                         result: std::ptr::null_mut(),
5156                 },
5157                 result_ok: true,
5158         }
5159 }
5160 #[no_mangle]
5161 /// Creates a new CResult_NoneSemanticErrorZ in the error state.
5162 pub extern "C" fn CResult_NoneSemanticErrorZ_err(e: crate::lightning_invoice::SemanticError) -> CResult_NoneSemanticErrorZ {
5163         CResult_NoneSemanticErrorZ {
5164                 contents: CResult_NoneSemanticErrorZPtr {
5165                         err: Box::into_raw(Box::new(e)),
5166                 },
5167                 result_ok: false,
5168         }
5169 }
5170 #[no_mangle]
5171 /// Frees any resources used by the CResult_NoneSemanticErrorZ.
5172 pub extern "C" fn CResult_NoneSemanticErrorZ_free(_res: CResult_NoneSemanticErrorZ) { }
5173 impl Drop for CResult_NoneSemanticErrorZ {
5174         fn drop(&mut self) {
5175                 if self.result_ok {
5176                 } else {
5177                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
5178                                 let _ = unsafe { Box::from_raw(self.contents.err) };
5179                         }
5180                 }
5181         }
5182 }
5183 impl From<crate::c_types::CResultTempl<(), crate::lightning_invoice::SemanticError>> for CResult_NoneSemanticErrorZ {
5184         fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning_invoice::SemanticError>) -> Self {
5185                 let contents = if o.result_ok {
5186                         let _ = unsafe { Box::from_raw(o.contents.result) };
5187                         o.contents.result = std::ptr::null_mut();
5188                         CResult_NoneSemanticErrorZPtr { result: std::ptr::null_mut() }
5189                 } else {
5190                         let err = unsafe { o.contents.err };
5191                         unsafe { o.contents.err = std::ptr::null_mut(); }
5192                         CResult_NoneSemanticErrorZPtr { err }
5193                 };
5194                 Self {
5195                         contents,
5196                         result_ok: o.result_ok,
5197                 }
5198         }
5199 }
5200 impl Clone for CResult_NoneSemanticErrorZ {
5201         fn clone(&self) -> Self {
5202                 if self.result_ok {
5203                         Self { result_ok: true, contents: CResult_NoneSemanticErrorZPtr {
5204                                 result: std::ptr::null_mut()
5205                         } }
5206                 } else {
5207                         Self { result_ok: false, contents: CResult_NoneSemanticErrorZPtr {
5208                                 err: Box::into_raw(Box::new(<crate::lightning_invoice::SemanticError>::clone(unsafe { &*self.contents.err })))
5209                         } }
5210                 }
5211         }
5212 }
5213 #[no_mangle]
5214 /// Creates a new CResult_NoneSemanticErrorZ which has the same data as `orig`
5215 /// but with all dynamically-allocated buffers duplicated in new buffers.
5216 pub extern "C" fn CResult_NoneSemanticErrorZ_clone(orig: &CResult_NoneSemanticErrorZ) -> CResult_NoneSemanticErrorZ { orig.clone() }
5217 #[repr(C)]
5218 /// The contents of CResult_InvoiceSemanticErrorZ
5219 pub union CResult_InvoiceSemanticErrorZPtr {
5220         /// A pointer to the contents in the success state.
5221         /// Reading from this pointer when `result_ok` is not set is undefined.
5222         pub result: *mut crate::lightning_invoice::Invoice,
5223         /// A pointer to the contents in the error state.
5224         /// Reading from this pointer when `result_ok` is set is undefined.
5225         pub err: *mut crate::lightning_invoice::SemanticError,
5226 }
5227 #[repr(C)]
5228 /// A CResult_InvoiceSemanticErrorZ represents the result of a fallible operation,
5229 /// containing a crate::lightning_invoice::Invoice on success and a crate::lightning_invoice::SemanticError on failure.
5230 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5231 pub struct CResult_InvoiceSemanticErrorZ {
5232         /// The contents of this CResult_InvoiceSemanticErrorZ, accessible via either
5233         /// `err` or `result` depending on the state of `result_ok`.
5234         pub contents: CResult_InvoiceSemanticErrorZPtr,
5235         /// Whether this CResult_InvoiceSemanticErrorZ represents a success state.
5236         pub result_ok: bool,
5237 }
5238 #[no_mangle]
5239 /// Creates a new CResult_InvoiceSemanticErrorZ in the success state.
5240 pub extern "C" fn CResult_InvoiceSemanticErrorZ_ok(o: crate::lightning_invoice::Invoice) -> CResult_InvoiceSemanticErrorZ {
5241         CResult_InvoiceSemanticErrorZ {
5242                 contents: CResult_InvoiceSemanticErrorZPtr {
5243                         result: Box::into_raw(Box::new(o)),
5244                 },
5245                 result_ok: true,
5246         }
5247 }
5248 #[no_mangle]
5249 /// Creates a new CResult_InvoiceSemanticErrorZ in the error state.
5250 pub extern "C" fn CResult_InvoiceSemanticErrorZ_err(e: crate::lightning_invoice::SemanticError) -> CResult_InvoiceSemanticErrorZ {
5251         CResult_InvoiceSemanticErrorZ {
5252                 contents: CResult_InvoiceSemanticErrorZPtr {
5253                         err: Box::into_raw(Box::new(e)),
5254                 },
5255                 result_ok: false,
5256         }
5257 }
5258 #[no_mangle]
5259 /// Frees any resources used by the CResult_InvoiceSemanticErrorZ.
5260 pub extern "C" fn CResult_InvoiceSemanticErrorZ_free(_res: CResult_InvoiceSemanticErrorZ) { }
5261 impl Drop for CResult_InvoiceSemanticErrorZ {
5262         fn drop(&mut self) {
5263                 if self.result_ok {
5264                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
5265                                 let _ = unsafe { Box::from_raw(self.contents.result) };
5266                         }
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::Invoice, crate::lightning_invoice::SemanticError>> for CResult_InvoiceSemanticErrorZ {
5275         fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::Invoice, crate::lightning_invoice::SemanticError>) -> Self {
5276                 let contents = if o.result_ok {
5277                         let result = unsafe { o.contents.result };
5278                         unsafe { o.contents.result = std::ptr::null_mut() };
5279                         CResult_InvoiceSemanticErrorZPtr { result }
5280                 } else {
5281                         let err = unsafe { o.contents.err };
5282                         unsafe { o.contents.err = std::ptr::null_mut(); }
5283                         CResult_InvoiceSemanticErrorZPtr { err }
5284                 };
5285                 Self {
5286                         contents,
5287                         result_ok: o.result_ok,
5288                 }
5289         }
5290 }
5291 impl Clone for CResult_InvoiceSemanticErrorZ {
5292         fn clone(&self) -> Self {
5293                 if self.result_ok {
5294                         Self { result_ok: true, contents: CResult_InvoiceSemanticErrorZPtr {
5295                                 result: Box::into_raw(Box::new(<crate::lightning_invoice::Invoice>::clone(unsafe { &*self.contents.result })))
5296                         } }
5297                 } else {
5298                         Self { result_ok: false, contents: CResult_InvoiceSemanticErrorZPtr {
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_InvoiceSemanticErrorZ which has the same data as `orig`
5306 /// but with all dynamically-allocated buffers duplicated in new buffers.
5307 pub extern "C" fn CResult_InvoiceSemanticErrorZ_clone(orig: &CResult_InvoiceSemanticErrorZ) -> CResult_InvoiceSemanticErrorZ { orig.clone() }
5308 #[repr(C)]
5309 /// The contents of CResult_DescriptionCreationErrorZ
5310 pub union CResult_DescriptionCreationErrorZPtr {
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::Description,
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::CreationError,
5317 }
5318 #[repr(C)]
5319 /// A CResult_DescriptionCreationErrorZ represents the result of a fallible operation,
5320 /// containing a crate::lightning_invoice::Description on success and a crate::lightning_invoice::CreationError on failure.
5321 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5322 pub struct CResult_DescriptionCreationErrorZ {
5323         /// The contents of this CResult_DescriptionCreationErrorZ, accessible via either
5324         /// `err` or `result` depending on the state of `result_ok`.
5325         pub contents: CResult_DescriptionCreationErrorZPtr,
5326         /// Whether this CResult_DescriptionCreationErrorZ represents a success state.
5327         pub result_ok: bool,
5328 }
5329 #[no_mangle]
5330 /// Creates a new CResult_DescriptionCreationErrorZ in the success state.
5331 pub extern "C" fn CResult_DescriptionCreationErrorZ_ok(o: crate::lightning_invoice::Description) -> CResult_DescriptionCreationErrorZ {
5332         CResult_DescriptionCreationErrorZ {
5333                 contents: CResult_DescriptionCreationErrorZPtr {
5334                         result: Box::into_raw(Box::new(o)),
5335                 },
5336                 result_ok: true,
5337         }
5338 }
5339 #[no_mangle]
5340 /// Creates a new CResult_DescriptionCreationErrorZ in the error state.
5341 pub extern "C" fn CResult_DescriptionCreationErrorZ_err(e: crate::lightning_invoice::CreationError) -> CResult_DescriptionCreationErrorZ {
5342         CResult_DescriptionCreationErrorZ {
5343                 contents: CResult_DescriptionCreationErrorZPtr {
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_DescriptionCreationErrorZ.
5351 pub extern "C" fn CResult_DescriptionCreationErrorZ_free(_res: CResult_DescriptionCreationErrorZ) { }
5352 impl Drop for CResult_DescriptionCreationErrorZ {
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::Description, crate::lightning_invoice::CreationError>> for CResult_DescriptionCreationErrorZ {
5366         fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::Description, crate::lightning_invoice::CreationError>) -> 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_DescriptionCreationErrorZPtr { result }
5371                 } else {
5372                         let err = unsafe { o.contents.err };
5373                         unsafe { o.contents.err = std::ptr::null_mut(); }
5374                         CResult_DescriptionCreationErrorZPtr { err }
5375                 };
5376                 Self {
5377                         contents,
5378                         result_ok: o.result_ok,
5379                 }
5380         }
5381 }
5382 impl Clone for CResult_DescriptionCreationErrorZ {
5383         fn clone(&self) -> Self {
5384                 if self.result_ok {
5385                         Self { result_ok: true, contents: CResult_DescriptionCreationErrorZPtr {
5386                                 result: Box::into_raw(Box::new(<crate::lightning_invoice::Description>::clone(unsafe { &*self.contents.result })))
5387                         } }
5388                 } else {
5389                         Self { result_ok: false, contents: CResult_DescriptionCreationErrorZPtr {
5390                                 err: Box::into_raw(Box::new(<crate::lightning_invoice::CreationError>::clone(unsafe { &*self.contents.err })))
5391                         } }
5392                 }
5393         }
5394 }
5395 #[no_mangle]
5396 /// Creates a new CResult_DescriptionCreationErrorZ which has the same data as `orig`
5397 /// but with all dynamically-allocated buffers duplicated in new buffers.
5398 pub extern "C" fn CResult_DescriptionCreationErrorZ_clone(orig: &CResult_DescriptionCreationErrorZ) -> CResult_DescriptionCreationErrorZ { orig.clone() }
5399 #[repr(C)]
5400 /// The contents of CResult_ExpiryTimeCreationErrorZ
5401 pub union CResult_ExpiryTimeCreationErrorZPtr {
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::ExpiryTime,
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_ExpiryTimeCreationErrorZ represents the result of a fallible operation,
5411 /// containing a crate::lightning_invoice::ExpiryTime 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_ExpiryTimeCreationErrorZ {
5414         /// The contents of this CResult_ExpiryTimeCreationErrorZ, accessible via either
5415         /// `err` or `result` depending on the state of `result_ok`.
5416         pub contents: CResult_ExpiryTimeCreationErrorZPtr,
5417         /// Whether this CResult_ExpiryTimeCreationErrorZ represents a success state.
5418         pub result_ok: bool,
5419 }
5420 #[no_mangle]
5421 /// Creates a new CResult_ExpiryTimeCreationErrorZ in the success state.
5422 pub extern "C" fn CResult_ExpiryTimeCreationErrorZ_ok(o: crate::lightning_invoice::ExpiryTime) -> CResult_ExpiryTimeCreationErrorZ {
5423         CResult_ExpiryTimeCreationErrorZ {
5424                 contents: CResult_ExpiryTimeCreationErrorZPtr {
5425                         result: Box::into_raw(Box::new(o)),
5426                 },
5427                 result_ok: true,
5428         }
5429 }
5430 #[no_mangle]
5431 /// Creates a new CResult_ExpiryTimeCreationErrorZ in the error state.
5432 pub extern "C" fn CResult_ExpiryTimeCreationErrorZ_err(e: crate::lightning_invoice::CreationError) -> CResult_ExpiryTimeCreationErrorZ {
5433         CResult_ExpiryTimeCreationErrorZ {
5434                 contents: CResult_ExpiryTimeCreationErrorZPtr {
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_ExpiryTimeCreationErrorZ.
5442 pub extern "C" fn CResult_ExpiryTimeCreationErrorZ_free(_res: CResult_ExpiryTimeCreationErrorZ) { }
5443 impl Drop for CResult_ExpiryTimeCreationErrorZ {
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::ExpiryTime, crate::lightning_invoice::CreationError>> for CResult_ExpiryTimeCreationErrorZ {
5457         fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::ExpiryTime, 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_ExpiryTimeCreationErrorZPtr { result }
5462                 } else {
5463                         let err = unsafe { o.contents.err };
5464                         unsafe { o.contents.err = std::ptr::null_mut(); }
5465                         CResult_ExpiryTimeCreationErrorZPtr { err }
5466                 };
5467                 Self {
5468                         contents,
5469                         result_ok: o.result_ok,
5470                 }
5471         }
5472 }
5473 impl Clone for CResult_ExpiryTimeCreationErrorZ {
5474         fn clone(&self) -> Self {
5475                 if self.result_ok {
5476                         Self { result_ok: true, contents: CResult_ExpiryTimeCreationErrorZPtr {
5477                                 result: Box::into_raw(Box::new(<crate::lightning_invoice::ExpiryTime>::clone(unsafe { &*self.contents.result })))
5478                         } }
5479                 } else {
5480                         Self { result_ok: false, contents: CResult_ExpiryTimeCreationErrorZPtr {
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_ExpiryTimeCreationErrorZ which has the same data as `orig`
5488 /// but with all dynamically-allocated buffers duplicated in new buffers.
5489 pub extern "C" fn CResult_ExpiryTimeCreationErrorZ_clone(orig: &CResult_ExpiryTimeCreationErrorZ) -> CResult_ExpiryTimeCreationErrorZ { orig.clone() }
5490 #[repr(C)]
5491 /// The contents of CResult_PrivateRouteCreationErrorZ
5492 pub union CResult_PrivateRouteCreationErrorZPtr {
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::PrivateRoute,
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_PrivateRouteCreationErrorZ represents the result of a fallible operation,
5502 /// containing a crate::lightning_invoice::PrivateRoute 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_PrivateRouteCreationErrorZ {
5505         /// The contents of this CResult_PrivateRouteCreationErrorZ, accessible via either
5506         /// `err` or `result` depending on the state of `result_ok`.
5507         pub contents: CResult_PrivateRouteCreationErrorZPtr,
5508         /// Whether this CResult_PrivateRouteCreationErrorZ represents a success state.
5509         pub result_ok: bool,
5510 }
5511 #[no_mangle]
5512 /// Creates a new CResult_PrivateRouteCreationErrorZ in the success state.
5513 pub extern "C" fn CResult_PrivateRouteCreationErrorZ_ok(o: crate::lightning_invoice::PrivateRoute) -> CResult_PrivateRouteCreationErrorZ {
5514         CResult_PrivateRouteCreationErrorZ {
5515                 contents: CResult_PrivateRouteCreationErrorZPtr {
5516                         result: Box::into_raw(Box::new(o)),
5517                 },
5518                 result_ok: true,
5519         }
5520 }
5521 #[no_mangle]
5522 /// Creates a new CResult_PrivateRouteCreationErrorZ in the error state.
5523 pub extern "C" fn CResult_PrivateRouteCreationErrorZ_err(e: crate::lightning_invoice::CreationError) -> CResult_PrivateRouteCreationErrorZ {
5524         CResult_PrivateRouteCreationErrorZ {
5525                 contents: CResult_PrivateRouteCreationErrorZPtr {
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_PrivateRouteCreationErrorZ.
5533 pub extern "C" fn CResult_PrivateRouteCreationErrorZ_free(_res: CResult_PrivateRouteCreationErrorZ) { }
5534 impl Drop for CResult_PrivateRouteCreationErrorZ {
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::PrivateRoute, crate::lightning_invoice::CreationError>> for CResult_PrivateRouteCreationErrorZ {
5548         fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::PrivateRoute, 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_PrivateRouteCreationErrorZPtr { result }
5553                 } else {
5554                         let err = unsafe { o.contents.err };
5555                         unsafe { o.contents.err = std::ptr::null_mut(); }
5556                         CResult_PrivateRouteCreationErrorZPtr { err }
5557                 };
5558                 Self {
5559                         contents,
5560                         result_ok: o.result_ok,
5561                 }
5562         }
5563 }
5564 impl Clone for CResult_PrivateRouteCreationErrorZ {
5565         fn clone(&self) -> Self {
5566                 if self.result_ok {
5567                         Self { result_ok: true, contents: CResult_PrivateRouteCreationErrorZPtr {
5568                                 result: Box::into_raw(Box::new(<crate::lightning_invoice::PrivateRoute>::clone(unsafe { &*self.contents.result })))
5569                         } }
5570                 } else {
5571                         Self { result_ok: false, contents: CResult_PrivateRouteCreationErrorZPtr {
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_PrivateRouteCreationErrorZ which has the same data as `orig`
5579 /// but with all dynamically-allocated buffers duplicated in new buffers.
5580 pub extern "C" fn CResult_PrivateRouteCreationErrorZ_clone(orig: &CResult_PrivateRouteCreationErrorZ) -> CResult_PrivateRouteCreationErrorZ { orig.clone() }
5581 #[repr(C)]
5582 /// The contents of CResult_StringErrorZ
5583 pub union CResult_StringErrorZPtr {
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::c_types::Str,
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::c_types::Secp256k1Error,
5590 }
5591 #[repr(C)]
5592 /// A CResult_StringErrorZ represents the result of a fallible operation,
5593 /// containing a crate::c_types::Str on success and a crate::c_types::Secp256k1Error on failure.
5594 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5595 pub struct CResult_StringErrorZ {
5596         /// The contents of this CResult_StringErrorZ, accessible via either
5597         /// `err` or `result` depending on the state of `result_ok`.
5598         pub contents: CResult_StringErrorZPtr,
5599         /// Whether this CResult_StringErrorZ represents a success state.
5600         pub result_ok: bool,
5601 }
5602 #[no_mangle]
5603 /// Creates a new CResult_StringErrorZ in the success state.
5604 pub extern "C" fn CResult_StringErrorZ_ok(o: crate::c_types::Str) -> CResult_StringErrorZ {
5605         CResult_StringErrorZ {
5606                 contents: CResult_StringErrorZPtr {
5607                         result: Box::into_raw(Box::new(o)),
5608                 },
5609                 result_ok: true,
5610         }
5611 }
5612 #[no_mangle]
5613 /// Creates a new CResult_StringErrorZ in the error state.
5614 pub extern "C" fn CResult_StringErrorZ_err(e: crate::c_types::Secp256k1Error) -> CResult_StringErrorZ {
5615         CResult_StringErrorZ {
5616                 contents: CResult_StringErrorZPtr {
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_StringErrorZ.
5624 pub extern "C" fn CResult_StringErrorZ_free(_res: CResult_StringErrorZ) { }
5625 impl Drop for CResult_StringErrorZ {
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::c_types::Str, crate::c_types::Secp256k1Error>> for CResult_StringErrorZ {
5639         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::Str, crate::c_types::Secp256k1Error>) -> 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_StringErrorZPtr { result }
5644                 } else {
5645                         let err = unsafe { o.contents.err };
5646                         unsafe { o.contents.err = std::ptr::null_mut(); }
5647                         CResult_StringErrorZPtr { err }
5648                 };
5649                 Self {
5650                         contents,
5651                         result_ok: o.result_ok,
5652                 }
5653         }
5654 }
5655 #[repr(C)]
5656 /// The contents of CResult_ChannelMonitorUpdateDecodeErrorZ
5657 pub union CResult_ChannelMonitorUpdateDecodeErrorZPtr {
5658         /// A pointer to the contents in the success state.
5659         /// Reading from this pointer when `result_ok` is not set is undefined.
5660         pub result: *mut crate::lightning::chain::channelmonitor::ChannelMonitorUpdate,
5661         /// A pointer to the contents in the error state.
5662         /// Reading from this pointer when `result_ok` is set is undefined.
5663         pub err: *mut crate::lightning::ln::msgs::DecodeError,
5664 }
5665 #[repr(C)]
5666 /// A CResult_ChannelMonitorUpdateDecodeErrorZ represents the result of a fallible operation,
5667 /// containing a crate::lightning::chain::channelmonitor::ChannelMonitorUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
5668 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5669 pub struct CResult_ChannelMonitorUpdateDecodeErrorZ {
5670         /// The contents of this CResult_ChannelMonitorUpdateDecodeErrorZ, accessible via either
5671         /// `err` or `result` depending on the state of `result_ok`.
5672         pub contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr,
5673         /// Whether this CResult_ChannelMonitorUpdateDecodeErrorZ represents a success state.
5674         pub result_ok: bool,
5675 }
5676 #[no_mangle]
5677 /// Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ in the success state.
5678 pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_ok(o: crate::lightning::chain::channelmonitor::ChannelMonitorUpdate) -> CResult_ChannelMonitorUpdateDecodeErrorZ {
5679         CResult_ChannelMonitorUpdateDecodeErrorZ {
5680                 contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr {
5681                         result: Box::into_raw(Box::new(o)),
5682                 },
5683                 result_ok: true,
5684         }
5685 }
5686 #[no_mangle]
5687 /// Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ in the error state.
5688 pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelMonitorUpdateDecodeErrorZ {
5689         CResult_ChannelMonitorUpdateDecodeErrorZ {
5690                 contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr {
5691                         err: Box::into_raw(Box::new(e)),
5692                 },
5693                 result_ok: false,
5694         }
5695 }
5696 #[no_mangle]
5697 /// Frees any resources used by the CResult_ChannelMonitorUpdateDecodeErrorZ.
5698 pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_free(_res: CResult_ChannelMonitorUpdateDecodeErrorZ) { }
5699 impl Drop for CResult_ChannelMonitorUpdateDecodeErrorZ {
5700         fn drop(&mut self) {
5701                 if self.result_ok {
5702                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
5703                                 let _ = unsafe { Box::from_raw(self.contents.result) };
5704                         }
5705                 } else {
5706                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
5707                                 let _ = unsafe { Box::from_raw(self.contents.err) };
5708                         }
5709                 }
5710         }
5711 }
5712 impl From<crate::c_types::CResultTempl<crate::lightning::chain::channelmonitor::ChannelMonitorUpdate, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelMonitorUpdateDecodeErrorZ {
5713         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::channelmonitor::ChannelMonitorUpdate, crate::lightning::ln::msgs::DecodeError>) -> Self {
5714                 let contents = if o.result_ok {
5715                         let result = unsafe { o.contents.result };
5716                         unsafe { o.contents.result = std::ptr::null_mut() };
5717                         CResult_ChannelMonitorUpdateDecodeErrorZPtr { result }
5718                 } else {
5719                         let err = unsafe { o.contents.err };
5720                         unsafe { o.contents.err = std::ptr::null_mut(); }
5721                         CResult_ChannelMonitorUpdateDecodeErrorZPtr { err }
5722                 };
5723                 Self {
5724                         contents,
5725                         result_ok: o.result_ok,
5726                 }
5727         }
5728 }
5729 impl Clone for CResult_ChannelMonitorUpdateDecodeErrorZ {
5730         fn clone(&self) -> Self {
5731                 if self.result_ok {
5732                         Self { result_ok: true, contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr {
5733                                 result: Box::into_raw(Box::new(<crate::lightning::chain::channelmonitor::ChannelMonitorUpdate>::clone(unsafe { &*self.contents.result })))
5734                         } }
5735                 } else {
5736                         Self { result_ok: false, contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr {
5737                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
5738                         } }
5739                 }
5740         }
5741 }
5742 #[no_mangle]
5743 /// Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ which has the same data as `orig`
5744 /// but with all dynamically-allocated buffers duplicated in new buffers.
5745 pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_clone(orig: &CResult_ChannelMonitorUpdateDecodeErrorZ) -> CResult_ChannelMonitorUpdateDecodeErrorZ { orig.clone() }
5746 #[repr(C)]
5747 /// The contents of CResult_HTLCUpdateDecodeErrorZ
5748 pub union CResult_HTLCUpdateDecodeErrorZPtr {
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::HTLCUpdate,
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_HTLCUpdateDecodeErrorZ represents the result of a fallible operation,
5758 /// containing a crate::lightning::chain::channelmonitor::HTLCUpdate 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_HTLCUpdateDecodeErrorZ {
5761         /// The contents of this CResult_HTLCUpdateDecodeErrorZ, accessible via either
5762         /// `err` or `result` depending on the state of `result_ok`.
5763         pub contents: CResult_HTLCUpdateDecodeErrorZPtr,
5764         /// Whether this CResult_HTLCUpdateDecodeErrorZ represents a success state.
5765         pub result_ok: bool,
5766 }
5767 #[no_mangle]
5768 /// Creates a new CResult_HTLCUpdateDecodeErrorZ in the success state.
5769 pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_ok(o: crate::lightning::chain::channelmonitor::HTLCUpdate) -> CResult_HTLCUpdateDecodeErrorZ {
5770         CResult_HTLCUpdateDecodeErrorZ {
5771                 contents: CResult_HTLCUpdateDecodeErrorZPtr {
5772                         result: Box::into_raw(Box::new(o)),
5773                 },
5774                 result_ok: true,
5775         }
5776 }
5777 #[no_mangle]
5778 /// Creates a new CResult_HTLCUpdateDecodeErrorZ in the error state.
5779 pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_HTLCUpdateDecodeErrorZ {
5780         CResult_HTLCUpdateDecodeErrorZ {
5781                 contents: CResult_HTLCUpdateDecodeErrorZPtr {
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_HTLCUpdateDecodeErrorZ.
5789 pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_free(_res: CResult_HTLCUpdateDecodeErrorZ) { }
5790 impl Drop for CResult_HTLCUpdateDecodeErrorZ {
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::HTLCUpdate, crate::lightning::ln::msgs::DecodeError>> for CResult_HTLCUpdateDecodeErrorZ {
5804         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::channelmonitor::HTLCUpdate, 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_HTLCUpdateDecodeErrorZPtr { result }
5809                 } else {
5810                         let err = unsafe { o.contents.err };
5811                         unsafe { o.contents.err = std::ptr::null_mut(); }
5812                         CResult_HTLCUpdateDecodeErrorZPtr { err }
5813                 };
5814                 Self {
5815                         contents,
5816                         result_ok: o.result_ok,
5817                 }
5818         }
5819 }
5820 impl Clone for CResult_HTLCUpdateDecodeErrorZ {
5821         fn clone(&self) -> Self {
5822                 if self.result_ok {
5823                         Self { result_ok: true, contents: CResult_HTLCUpdateDecodeErrorZPtr {
5824                                 result: Box::into_raw(Box::new(<crate::lightning::chain::channelmonitor::HTLCUpdate>::clone(unsafe { &*self.contents.result })))
5825                         } }
5826                 } else {
5827                         Self { result_ok: false, contents: CResult_HTLCUpdateDecodeErrorZPtr {
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_HTLCUpdateDecodeErrorZ which has the same data as `orig`
5835 /// but with all dynamically-allocated buffers duplicated in new buffers.
5836 pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_clone(orig: &CResult_HTLCUpdateDecodeErrorZ) -> CResult_HTLCUpdateDecodeErrorZ { orig.clone() }
5837 #[repr(C)]
5838 /// The contents of CResult_NoneMonitorUpdateErrorZ
5839 pub union CResult_NoneMonitorUpdateErrorZPtr {
5840         /// Note that this value is always NULL, as there are no contents in the OK variant
5841         pub result: *mut std::ffi::c_void,
5842         /// A pointer to the contents in the error state.
5843         /// Reading from this pointer when `result_ok` is set is undefined.
5844         pub err: *mut crate::lightning::chain::channelmonitor::MonitorUpdateError,
5845 }
5846 #[repr(C)]
5847 /// A CResult_NoneMonitorUpdateErrorZ represents the result of a fallible operation,
5848 /// containing a () on success and a crate::lightning::chain::channelmonitor::MonitorUpdateError on failure.
5849 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5850 pub struct CResult_NoneMonitorUpdateErrorZ {
5851         /// The contents of this CResult_NoneMonitorUpdateErrorZ, accessible via either
5852         /// `err` or `result` depending on the state of `result_ok`.
5853         pub contents: CResult_NoneMonitorUpdateErrorZPtr,
5854         /// Whether this CResult_NoneMonitorUpdateErrorZ represents a success state.
5855         pub result_ok: bool,
5856 }
5857 #[no_mangle]
5858 /// Creates a new CResult_NoneMonitorUpdateErrorZ in the success state.
5859 pub extern "C" fn CResult_NoneMonitorUpdateErrorZ_ok() -> CResult_NoneMonitorUpdateErrorZ {
5860         CResult_NoneMonitorUpdateErrorZ {
5861                 contents: CResult_NoneMonitorUpdateErrorZPtr {
5862                         result: std::ptr::null_mut(),
5863                 },
5864                 result_ok: true,
5865         }
5866 }
5867 #[no_mangle]
5868 /// Creates a new CResult_NoneMonitorUpdateErrorZ in the error state.
5869 pub extern "C" fn CResult_NoneMonitorUpdateErrorZ_err(e: crate::lightning::chain::channelmonitor::MonitorUpdateError) -> CResult_NoneMonitorUpdateErrorZ {
5870         CResult_NoneMonitorUpdateErrorZ {
5871                 contents: CResult_NoneMonitorUpdateErrorZPtr {
5872                         err: Box::into_raw(Box::new(e)),
5873                 },
5874                 result_ok: false,
5875         }
5876 }
5877 #[no_mangle]
5878 /// Frees any resources used by the CResult_NoneMonitorUpdateErrorZ.
5879 pub extern "C" fn CResult_NoneMonitorUpdateErrorZ_free(_res: CResult_NoneMonitorUpdateErrorZ) { }
5880 impl Drop for CResult_NoneMonitorUpdateErrorZ {
5881         fn drop(&mut self) {
5882                 if self.result_ok {
5883                 } else {
5884                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
5885                                 let _ = unsafe { Box::from_raw(self.contents.err) };
5886                         }
5887                 }
5888         }
5889 }
5890 impl From<crate::c_types::CResultTempl<(), crate::lightning::chain::channelmonitor::MonitorUpdateError>> for CResult_NoneMonitorUpdateErrorZ {
5891         fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::chain::channelmonitor::MonitorUpdateError>) -> Self {
5892                 let contents = if o.result_ok {
5893                         let _ = unsafe { Box::from_raw(o.contents.result) };
5894                         o.contents.result = std::ptr::null_mut();
5895                         CResult_NoneMonitorUpdateErrorZPtr { result: std::ptr::null_mut() }
5896                 } else {
5897                         let err = unsafe { o.contents.err };
5898                         unsafe { o.contents.err = std::ptr::null_mut(); }
5899                         CResult_NoneMonitorUpdateErrorZPtr { err }
5900                 };
5901                 Self {
5902                         contents,
5903                         result_ok: o.result_ok,
5904                 }
5905         }
5906 }
5907 impl Clone for CResult_NoneMonitorUpdateErrorZ {
5908         fn clone(&self) -> Self {
5909                 if self.result_ok {
5910                         Self { result_ok: true, contents: CResult_NoneMonitorUpdateErrorZPtr {
5911                                 result: std::ptr::null_mut()
5912                         } }
5913                 } else {
5914                         Self { result_ok: false, contents: CResult_NoneMonitorUpdateErrorZPtr {
5915                                 err: Box::into_raw(Box::new(<crate::lightning::chain::channelmonitor::MonitorUpdateError>::clone(unsafe { &*self.contents.err })))
5916                         } }
5917                 }
5918         }
5919 }
5920 #[no_mangle]
5921 /// Creates a new CResult_NoneMonitorUpdateErrorZ which has the same data as `orig`
5922 /// but with all dynamically-allocated buffers duplicated in new buffers.
5923 pub extern "C" fn CResult_NoneMonitorUpdateErrorZ_clone(orig: &CResult_NoneMonitorUpdateErrorZ) -> CResult_NoneMonitorUpdateErrorZ { orig.clone() }
5924 #[repr(C)]
5925 /// A tuple of 2 elements. See the individual fields for the types contained.
5926 pub struct C2Tuple_OutPointScriptZ {
5927         /// The element at position 0
5928         pub a: crate::lightning::chain::transaction::OutPoint,
5929         /// The element at position 1
5930         pub b: crate::c_types::derived::CVec_u8Z,
5931 }
5932 impl From<(crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_u8Z)> for C2Tuple_OutPointScriptZ {
5933         fn from (tup: (crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_u8Z)) -> Self {
5934                 Self {
5935                         a: tup.0,
5936                         b: tup.1,
5937                 }
5938         }
5939 }
5940 impl C2Tuple_OutPointScriptZ {
5941         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_u8Z) {
5942                 (self.a, self.b)
5943         }
5944 }
5945 impl Clone for C2Tuple_OutPointScriptZ {
5946         fn clone(&self) -> Self {
5947                 Self {
5948                         a: self.a.clone(),
5949                         b: self.b.clone(),
5950                 }
5951         }
5952 }
5953 #[no_mangle]
5954 /// Creates a new tuple which has the same data as `orig`
5955 /// but with all dynamically-allocated buffers duplicated in new buffers.
5956 pub extern "C" fn C2Tuple_OutPointScriptZ_clone(orig: &C2Tuple_OutPointScriptZ) -> C2Tuple_OutPointScriptZ { orig.clone() }
5957 /// Creates a new C2Tuple_OutPointScriptZ from the contained elements.
5958 #[no_mangle]
5959 pub extern "C" fn C2Tuple_OutPointScriptZ_new(a: crate::lightning::chain::transaction::OutPoint, b: crate::c_types::derived::CVec_u8Z) -> C2Tuple_OutPointScriptZ {
5960         C2Tuple_OutPointScriptZ { a, b, }
5961 }
5962
5963 #[no_mangle]
5964 /// Frees any resources used by the C2Tuple_OutPointScriptZ.
5965 pub extern "C" fn C2Tuple_OutPointScriptZ_free(_res: C2Tuple_OutPointScriptZ) { }
5966 #[repr(C)]
5967 /// A tuple of 2 elements. See the individual fields for the types contained.
5968 pub struct C2Tuple_u32ScriptZ {
5969         /// The element at position 0
5970         pub a: u32,
5971         /// The element at position 1
5972         pub b: crate::c_types::derived::CVec_u8Z,
5973 }
5974 impl From<(u32, crate::c_types::derived::CVec_u8Z)> for C2Tuple_u32ScriptZ {
5975         fn from (tup: (u32, crate::c_types::derived::CVec_u8Z)) -> Self {
5976                 Self {
5977                         a: tup.0,
5978                         b: tup.1,
5979                 }
5980         }
5981 }
5982 impl C2Tuple_u32ScriptZ {
5983         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (u32, crate::c_types::derived::CVec_u8Z) {
5984                 (self.a, self.b)
5985         }
5986 }
5987 impl Clone for C2Tuple_u32ScriptZ {
5988         fn clone(&self) -> Self {
5989                 Self {
5990                         a: self.a.clone(),
5991                         b: self.b.clone(),
5992                 }
5993         }
5994 }
5995 #[no_mangle]
5996 /// Creates a new tuple which has the same data as `orig`
5997 /// but with all dynamically-allocated buffers duplicated in new buffers.
5998 pub extern "C" fn C2Tuple_u32ScriptZ_clone(orig: &C2Tuple_u32ScriptZ) -> C2Tuple_u32ScriptZ { orig.clone() }
5999 /// Creates a new C2Tuple_u32ScriptZ from the contained elements.
6000 #[no_mangle]
6001 pub extern "C" fn C2Tuple_u32ScriptZ_new(a: u32, b: crate::c_types::derived::CVec_u8Z) -> C2Tuple_u32ScriptZ {
6002         C2Tuple_u32ScriptZ { a, b, }
6003 }
6004
6005 #[no_mangle]
6006 /// Frees any resources used by the C2Tuple_u32ScriptZ.
6007 pub extern "C" fn C2Tuple_u32ScriptZ_free(_res: C2Tuple_u32ScriptZ) { }
6008 #[repr(C)]
6009 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_u32ScriptZs of arbitrary size.
6010 /// This corresponds to std::vector in C++
6011 pub struct CVec_C2Tuple_u32ScriptZZ {
6012         /// The elements in the array.
6013         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
6014         pub data: *mut crate::c_types::derived::C2Tuple_u32ScriptZ,
6015         /// The number of elements pointed to by `data`.
6016         pub datalen: usize
6017 }
6018 impl CVec_C2Tuple_u32ScriptZZ {
6019         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_u32ScriptZ> {
6020                 if self.datalen == 0 { return Vec::new(); }
6021                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
6022                 self.data = std::ptr::null_mut();
6023                 self.datalen = 0;
6024                 ret
6025         }
6026         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_u32ScriptZ] {
6027                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
6028         }
6029 }
6030 impl From<Vec<crate::c_types::derived::C2Tuple_u32ScriptZ>> for CVec_C2Tuple_u32ScriptZZ {
6031         fn from(v: Vec<crate::c_types::derived::C2Tuple_u32ScriptZ>) -> Self {
6032                 let datalen = v.len();
6033                 let data = Box::into_raw(v.into_boxed_slice());
6034                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
6035         }
6036 }
6037 #[no_mangle]
6038 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
6039 pub extern "C" fn CVec_C2Tuple_u32ScriptZZ_free(_res: CVec_C2Tuple_u32ScriptZZ) { }
6040 impl Drop for CVec_C2Tuple_u32ScriptZZ {
6041         fn drop(&mut self) {
6042                 if self.datalen == 0 { return; }
6043                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
6044         }
6045 }
6046 impl Clone for CVec_C2Tuple_u32ScriptZZ {
6047         fn clone(&self) -> Self {
6048                 let mut res = Vec::new();
6049                 if self.datalen == 0 { return Self::from(res); }
6050                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
6051                 Self::from(res)
6052         }
6053 }
6054 #[repr(C)]
6055 /// A tuple of 2 elements. See the individual fields for the types contained.
6056 pub struct C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ {
6057         /// The element at position 0
6058         pub a: crate::c_types::ThirtyTwoBytes,
6059         /// The element at position 1
6060         pub b: crate::c_types::derived::CVec_C2Tuple_u32ScriptZZ,
6061 }
6062 impl From<(crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32ScriptZZ)> for C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ {
6063         fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32ScriptZZ)) -> Self {
6064                 Self {
6065                         a: tup.0,
6066                         b: tup.1,
6067                 }
6068         }
6069 }
6070 impl C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ {
6071         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32ScriptZZ) {
6072                 (self.a, self.b)
6073         }
6074 }
6075 impl Clone for C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ {
6076         fn clone(&self) -> Self {
6077                 Self {
6078                         a: self.a.clone(),
6079                         b: self.b.clone(),
6080                 }
6081         }
6082 }
6083 #[no_mangle]
6084 /// Creates a new tuple which has the same data as `orig`
6085 /// but with all dynamically-allocated buffers duplicated in new buffers.
6086 pub extern "C" fn C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone(orig: &C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ) -> C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ { orig.clone() }
6087 /// Creates a new C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ from the contained elements.
6088 #[no_mangle]
6089 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 {
6090         C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ { a, b, }
6091 }
6092
6093 #[no_mangle]
6094 /// Frees any resources used by the C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ.
6095 pub extern "C" fn C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_free(_res: C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ) { }
6096 #[repr(C)]
6097 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZs of arbitrary size.
6098 /// This corresponds to std::vector in C++
6099 pub struct CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ {
6100         /// The elements in the array.
6101         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
6102         pub data: *mut crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ,
6103         /// The number of elements pointed to by `data`.
6104         pub datalen: usize
6105 }
6106 impl CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ {
6107         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ> {
6108                 if self.datalen == 0 { return Vec::new(); }
6109                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
6110                 self.data = std::ptr::null_mut();
6111                 self.datalen = 0;
6112                 ret
6113         }
6114         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ] {
6115                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
6116         }
6117 }
6118 impl From<Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ>> for CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ {
6119         fn from(v: Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ>) -> Self {
6120                 let datalen = v.len();
6121                 let data = Box::into_raw(v.into_boxed_slice());
6122                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
6123         }
6124 }
6125 #[no_mangle]
6126 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
6127 pub extern "C" fn CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ_free(_res: CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ) { }
6128 impl Drop for CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ {
6129         fn drop(&mut self) {
6130                 if self.datalen == 0 { return; }
6131                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
6132         }
6133 }
6134 impl Clone for CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ {
6135         fn clone(&self) -> Self {
6136                 let mut res = Vec::new();
6137                 if self.datalen == 0 { return Self::from(res); }
6138                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
6139                 Self::from(res)
6140         }
6141 }
6142 #[repr(C)]
6143 /// A dynamically-allocated array of crate::lightning::util::events::Events of arbitrary size.
6144 /// This corresponds to std::vector in C++
6145 pub struct CVec_EventZ {
6146         /// The elements in the array.
6147         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
6148         pub data: *mut crate::lightning::util::events::Event,
6149         /// The number of elements pointed to by `data`.
6150         pub datalen: usize
6151 }
6152 impl CVec_EventZ {
6153         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::util::events::Event> {
6154                 if self.datalen == 0 { return Vec::new(); }
6155                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
6156                 self.data = std::ptr::null_mut();
6157                 self.datalen = 0;
6158                 ret
6159         }
6160         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::util::events::Event] {
6161                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
6162         }
6163 }
6164 impl From<Vec<crate::lightning::util::events::Event>> for CVec_EventZ {
6165         fn from(v: Vec<crate::lightning::util::events::Event>) -> Self {
6166                 let datalen = v.len();
6167                 let data = Box::into_raw(v.into_boxed_slice());
6168                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
6169         }
6170 }
6171 #[no_mangle]
6172 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
6173 pub extern "C" fn CVec_EventZ_free(_res: CVec_EventZ) { }
6174 impl Drop for CVec_EventZ {
6175         fn drop(&mut self) {
6176                 if self.datalen == 0 { return; }
6177                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
6178         }
6179 }
6180 impl Clone for CVec_EventZ {
6181         fn clone(&self) -> Self {
6182                 let mut res = Vec::new();
6183                 if self.datalen == 0 { return Self::from(res); }
6184                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
6185                 Self::from(res)
6186         }
6187 }
6188 #[repr(C)]
6189 /// A dynamically-allocated array of crate::c_types::Transactions of arbitrary size.
6190 /// This corresponds to std::vector in C++
6191 pub struct CVec_TransactionZ {
6192         /// The elements in the array.
6193         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
6194         pub data: *mut crate::c_types::Transaction,
6195         /// The number of elements pointed to by `data`.
6196         pub datalen: usize
6197 }
6198 impl CVec_TransactionZ {
6199         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::Transaction> {
6200                 if self.datalen == 0 { return Vec::new(); }
6201                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
6202                 self.data = std::ptr::null_mut();
6203                 self.datalen = 0;
6204                 ret
6205         }
6206         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::Transaction] {
6207                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
6208         }
6209 }
6210 impl From<Vec<crate::c_types::Transaction>> for CVec_TransactionZ {
6211         fn from(v: Vec<crate::c_types::Transaction>) -> Self {
6212                 let datalen = v.len();
6213                 let data = Box::into_raw(v.into_boxed_slice());
6214                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
6215         }
6216 }
6217 #[no_mangle]
6218 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
6219 pub extern "C" fn CVec_TransactionZ_free(_res: CVec_TransactionZ) { }
6220 impl Drop for CVec_TransactionZ {
6221         fn drop(&mut self) {
6222                 if self.datalen == 0 { return; }
6223                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
6224         }
6225 }
6226 impl Clone for CVec_TransactionZ {
6227         fn clone(&self) -> Self {
6228                 let mut res = Vec::new();
6229                 if self.datalen == 0 { return Self::from(res); }
6230                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
6231                 Self::from(res)
6232         }
6233 }
6234 #[repr(C)]
6235 /// A tuple of 2 elements. See the individual fields for the types contained.
6236 pub struct C2Tuple_u32TxOutZ {
6237         /// The element at position 0
6238         pub a: u32,
6239         /// The element at position 1
6240         pub b: crate::c_types::TxOut,
6241 }
6242 impl From<(u32, crate::c_types::TxOut)> for C2Tuple_u32TxOutZ {
6243         fn from (tup: (u32, crate::c_types::TxOut)) -> Self {
6244                 Self {
6245                         a: tup.0,
6246                         b: tup.1,
6247                 }
6248         }
6249 }
6250 impl C2Tuple_u32TxOutZ {
6251         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (u32, crate::c_types::TxOut) {
6252                 (self.a, self.b)
6253         }
6254 }
6255 impl Clone for C2Tuple_u32TxOutZ {
6256         fn clone(&self) -> Self {
6257                 Self {
6258                         a: self.a.clone(),
6259                         b: self.b.clone(),
6260                 }
6261         }
6262 }
6263 #[no_mangle]
6264 /// Creates a new tuple which has the same data as `orig`
6265 /// but with all dynamically-allocated buffers duplicated in new buffers.
6266 pub extern "C" fn C2Tuple_u32TxOutZ_clone(orig: &C2Tuple_u32TxOutZ) -> C2Tuple_u32TxOutZ { orig.clone() }
6267 /// Creates a new C2Tuple_u32TxOutZ from the contained elements.
6268 #[no_mangle]
6269 pub extern "C" fn C2Tuple_u32TxOutZ_new(a: u32, b: crate::c_types::TxOut) -> C2Tuple_u32TxOutZ {
6270         C2Tuple_u32TxOutZ { a, b, }
6271 }
6272
6273 #[no_mangle]
6274 /// Frees any resources used by the C2Tuple_u32TxOutZ.
6275 pub extern "C" fn C2Tuple_u32TxOutZ_free(_res: C2Tuple_u32TxOutZ) { }
6276 #[repr(C)]
6277 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_u32TxOutZs of arbitrary size.
6278 /// This corresponds to std::vector in C++
6279 pub struct CVec_C2Tuple_u32TxOutZZ {
6280         /// The elements in the array.
6281         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
6282         pub data: *mut crate::c_types::derived::C2Tuple_u32TxOutZ,
6283         /// The number of elements pointed to by `data`.
6284         pub datalen: usize
6285 }
6286 impl CVec_C2Tuple_u32TxOutZZ {
6287         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_u32TxOutZ> {
6288                 if self.datalen == 0 { return Vec::new(); }
6289                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
6290                 self.data = std::ptr::null_mut();
6291                 self.datalen = 0;
6292                 ret
6293         }
6294         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_u32TxOutZ] {
6295                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
6296         }
6297 }
6298 impl From<Vec<crate::c_types::derived::C2Tuple_u32TxOutZ>> for CVec_C2Tuple_u32TxOutZZ {
6299         fn from(v: Vec<crate::c_types::derived::C2Tuple_u32TxOutZ>) -> Self {
6300                 let datalen = v.len();
6301                 let data = Box::into_raw(v.into_boxed_slice());
6302                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
6303         }
6304 }
6305 #[no_mangle]
6306 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
6307 pub extern "C" fn CVec_C2Tuple_u32TxOutZZ_free(_res: CVec_C2Tuple_u32TxOutZZ) { }
6308 impl Drop for CVec_C2Tuple_u32TxOutZZ {
6309         fn drop(&mut self) {
6310                 if self.datalen == 0 { return; }
6311                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
6312         }
6313 }
6314 impl Clone for CVec_C2Tuple_u32TxOutZZ {
6315         fn clone(&self) -> Self {
6316                 let mut res = Vec::new();
6317                 if self.datalen == 0 { return Self::from(res); }
6318                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
6319                 Self::from(res)
6320         }
6321 }
6322 #[repr(C)]
6323 /// A tuple of 2 elements. See the individual fields for the types contained.
6324 pub struct C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ {
6325         /// The element at position 0
6326         pub a: crate::c_types::ThirtyTwoBytes,
6327         /// The element at position 1
6328         pub b: crate::c_types::derived::CVec_C2Tuple_u32TxOutZZ,
6329 }
6330 impl From<(crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32TxOutZZ)> for C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ {
6331         fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32TxOutZZ)) -> Self {
6332                 Self {
6333                         a: tup.0,
6334                         b: tup.1,
6335                 }
6336         }
6337 }
6338 impl C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ {
6339         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32TxOutZZ) {
6340                 (self.a, self.b)
6341         }
6342 }
6343 impl Clone for C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ {
6344         fn clone(&self) -> Self {
6345                 Self {
6346                         a: self.a.clone(),
6347                         b: self.b.clone(),
6348                 }
6349         }
6350 }
6351 #[no_mangle]
6352 /// Creates a new tuple which has the same data as `orig`
6353 /// but with all dynamically-allocated buffers duplicated in new buffers.
6354 pub extern "C" fn C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone(orig: &C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ) -> C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ { orig.clone() }
6355 /// Creates a new C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ from the contained elements.
6356 #[no_mangle]
6357 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 {
6358         C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ { a, b, }
6359 }
6360
6361 #[no_mangle]
6362 /// Frees any resources used by the C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ.
6363 pub extern "C" fn C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_free(_res: C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ) { }
6364 #[repr(C)]
6365 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZs of arbitrary size.
6366 /// This corresponds to std::vector in C++
6367 pub struct CVec_TransactionOutputsZ {
6368         /// The elements in the array.
6369         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
6370         pub data: *mut crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ,
6371         /// The number of elements pointed to by `data`.
6372         pub datalen: usize
6373 }
6374 impl CVec_TransactionOutputsZ {
6375         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ> {
6376                 if self.datalen == 0 { return Vec::new(); }
6377                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
6378                 self.data = std::ptr::null_mut();
6379                 self.datalen = 0;
6380                 ret
6381         }
6382         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ] {
6383                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
6384         }
6385 }
6386 impl From<Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ>> for CVec_TransactionOutputsZ {
6387         fn from(v: Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ>) -> Self {
6388                 let datalen = v.len();
6389                 let data = Box::into_raw(v.into_boxed_slice());
6390                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
6391         }
6392 }
6393 #[no_mangle]
6394 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
6395 pub extern "C" fn CVec_TransactionOutputsZ_free(_res: CVec_TransactionOutputsZ) { }
6396 impl Drop for CVec_TransactionOutputsZ {
6397         fn drop(&mut self) {
6398                 if self.datalen == 0 { return; }
6399                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
6400         }
6401 }
6402 impl Clone for CVec_TransactionOutputsZ {
6403         fn clone(&self) -> Self {
6404                 let mut res = Vec::new();
6405                 if self.datalen == 0 { return Self::from(res); }
6406                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
6407                 Self::from(res)
6408         }
6409 }
6410 #[repr(C)]
6411 /// The contents of CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ
6412 pub union CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr {
6413         /// A pointer to the contents in the success state.
6414         /// Reading from this pointer when `result_ok` is not set is undefined.
6415         pub result: *mut crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ,
6416         /// A pointer to the contents in the error state.
6417         /// Reading from this pointer when `result_ok` is set is undefined.
6418         pub err: *mut crate::lightning::ln::msgs::DecodeError,
6419 }
6420 #[repr(C)]
6421 /// A CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ represents the result of a fallible operation,
6422 /// containing a crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
6423 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6424 pub struct CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
6425         /// The contents of this CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ, accessible via either
6426         /// `err` or `result` depending on the state of `result_ok`.
6427         pub contents: CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr,
6428         /// Whether this CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ represents a success state.
6429         pub result_ok: bool,
6430 }
6431 #[no_mangle]
6432 /// Creates a new CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ in the success state.
6433 pub extern "C" fn CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_ok(o: crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ) -> CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
6434         CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
6435                 contents: CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr {
6436                         result: Box::into_raw(Box::new(o)),
6437                 },
6438                 result_ok: true,
6439         }
6440 }
6441 #[no_mangle]
6442 /// Creates a new CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ in the error state.
6443 pub extern "C" fn CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
6444         CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
6445                 contents: CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr {
6446                         err: Box::into_raw(Box::new(e)),
6447                 },
6448                 result_ok: false,
6449         }
6450 }
6451 #[no_mangle]
6452 /// Frees any resources used by the CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ.
6453 pub extern "C" fn CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_free(_res: CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ) { }
6454 impl Drop for CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
6455         fn drop(&mut self) {
6456                 if self.result_ok {
6457                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
6458                                 let _ = unsafe { Box::from_raw(self.contents.result) };
6459                         }
6460                 } else {
6461                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
6462                                 let _ = unsafe { Box::from_raw(self.contents.err) };
6463                         }
6464                 }
6465         }
6466 }
6467 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ, crate::lightning::ln::msgs::DecodeError>> for CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
6468         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
6469                 let contents = if o.result_ok {
6470                         let result = unsafe { o.contents.result };
6471                         unsafe { o.contents.result = std::ptr::null_mut() };
6472                         CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr { result }
6473                 } else {
6474                         let err = unsafe { o.contents.err };
6475                         unsafe { o.contents.err = std::ptr::null_mut(); }
6476                         CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr { err }
6477                 };
6478                 Self {
6479                         contents,
6480                         result_ok: o.result_ok,
6481                 }
6482         }
6483 }
6484 #[repr(C)]
6485 /// The contents of CResult_boolLightningErrorZ
6486 pub union CResult_boolLightningErrorZPtr {
6487         /// A pointer to the contents in the success state.
6488         /// Reading from this pointer when `result_ok` is not set is undefined.
6489         pub result: *mut bool,
6490         /// A pointer to the contents in the error state.
6491         /// Reading from this pointer when `result_ok` is set is undefined.
6492         pub err: *mut crate::lightning::ln::msgs::LightningError,
6493 }
6494 #[repr(C)]
6495 /// A CResult_boolLightningErrorZ represents the result of a fallible operation,
6496 /// containing a bool on success and a crate::lightning::ln::msgs::LightningError on failure.
6497 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6498 pub struct CResult_boolLightningErrorZ {
6499         /// The contents of this CResult_boolLightningErrorZ, accessible via either
6500         /// `err` or `result` depending on the state of `result_ok`.
6501         pub contents: CResult_boolLightningErrorZPtr,
6502         /// Whether this CResult_boolLightningErrorZ represents a success state.
6503         pub result_ok: bool,
6504 }
6505 #[no_mangle]
6506 /// Creates a new CResult_boolLightningErrorZ in the success state.
6507 pub extern "C" fn CResult_boolLightningErrorZ_ok(o: bool) -> CResult_boolLightningErrorZ {
6508         CResult_boolLightningErrorZ {
6509                 contents: CResult_boolLightningErrorZPtr {
6510                         result: Box::into_raw(Box::new(o)),
6511                 },
6512                 result_ok: true,
6513         }
6514 }
6515 #[no_mangle]
6516 /// Creates a new CResult_boolLightningErrorZ in the error state.
6517 pub extern "C" fn CResult_boolLightningErrorZ_err(e: crate::lightning::ln::msgs::LightningError) -> CResult_boolLightningErrorZ {
6518         CResult_boolLightningErrorZ {
6519                 contents: CResult_boolLightningErrorZPtr {
6520                         err: Box::into_raw(Box::new(e)),
6521                 },
6522                 result_ok: false,
6523         }
6524 }
6525 #[no_mangle]
6526 /// Frees any resources used by the CResult_boolLightningErrorZ.
6527 pub extern "C" fn CResult_boolLightningErrorZ_free(_res: CResult_boolLightningErrorZ) { }
6528 impl Drop for CResult_boolLightningErrorZ {
6529         fn drop(&mut self) {
6530                 if self.result_ok {
6531                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
6532                                 let _ = unsafe { Box::from_raw(self.contents.result) };
6533                         }
6534                 } else {
6535                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
6536                                 let _ = unsafe { Box::from_raw(self.contents.err) };
6537                         }
6538                 }
6539         }
6540 }
6541 impl From<crate::c_types::CResultTempl<bool, crate::lightning::ln::msgs::LightningError>> for CResult_boolLightningErrorZ {
6542         fn from(mut o: crate::c_types::CResultTempl<bool, crate::lightning::ln::msgs::LightningError>) -> Self {
6543                 let contents = if o.result_ok {
6544                         let result = unsafe { o.contents.result };
6545                         unsafe { o.contents.result = std::ptr::null_mut() };
6546                         CResult_boolLightningErrorZPtr { result }
6547                 } else {
6548                         let err = unsafe { o.contents.err };
6549                         unsafe { o.contents.err = std::ptr::null_mut(); }
6550                         CResult_boolLightningErrorZPtr { err }
6551                 };
6552                 Self {
6553                         contents,
6554                         result_ok: o.result_ok,
6555                 }
6556         }
6557 }
6558 impl Clone for CResult_boolLightningErrorZ {
6559         fn clone(&self) -> Self {
6560                 if self.result_ok {
6561                         Self { result_ok: true, contents: CResult_boolLightningErrorZPtr {
6562                                 result: Box::into_raw(Box::new(<bool>::clone(unsafe { &*self.contents.result })))
6563                         } }
6564                 } else {
6565                         Self { result_ok: false, contents: CResult_boolLightningErrorZPtr {
6566                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::LightningError>::clone(unsafe { &*self.contents.err })))
6567                         } }
6568                 }
6569         }
6570 }
6571 #[no_mangle]
6572 /// Creates a new CResult_boolLightningErrorZ which has the same data as `orig`
6573 /// but with all dynamically-allocated buffers duplicated in new buffers.
6574 pub extern "C" fn CResult_boolLightningErrorZ_clone(orig: &CResult_boolLightningErrorZ) -> CResult_boolLightningErrorZ { orig.clone() }
6575 #[repr(C)]
6576 /// A tuple of 3 elements. See the individual fields for the types contained.
6577 pub struct C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
6578         /// The element at position 0
6579         pub a: crate::lightning::ln::msgs::ChannelAnnouncement,
6580         /// The element at position 1
6581         pub b: crate::lightning::ln::msgs::ChannelUpdate,
6582         /// The element at position 2
6583         pub c: crate::lightning::ln::msgs::ChannelUpdate,
6584 }
6585 impl From<(crate::lightning::ln::msgs::ChannelAnnouncement, crate::lightning::ln::msgs::ChannelUpdate, crate::lightning::ln::msgs::ChannelUpdate)> for C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
6586         fn from (tup: (crate::lightning::ln::msgs::ChannelAnnouncement, crate::lightning::ln::msgs::ChannelUpdate, crate::lightning::ln::msgs::ChannelUpdate)) -> Self {
6587                 Self {
6588                         a: tup.0,
6589                         b: tup.1,
6590                         c: tup.2,
6591                 }
6592         }
6593 }
6594 impl C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
6595         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::lightning::ln::msgs::ChannelAnnouncement, crate::lightning::ln::msgs::ChannelUpdate, crate::lightning::ln::msgs::ChannelUpdate) {
6596                 (self.a, self.b, self.c)
6597         }
6598 }
6599 impl Clone for C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
6600         fn clone(&self) -> Self {
6601                 Self {
6602                         a: self.a.clone(),
6603                         b: self.b.clone(),
6604                         c: self.c.clone(),
6605                 }
6606         }
6607 }
6608 #[no_mangle]
6609 /// Creates a new tuple which has the same data as `orig`
6610 /// but with all dynamically-allocated buffers duplicated in new buffers.
6611 pub extern "C" fn C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(orig: &C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ) -> C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ { orig.clone() }
6612 /// Creates a new C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ from the contained elements.
6613 #[no_mangle]
6614 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 {
6615         C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ { a, b, c, }
6616 }
6617
6618 #[no_mangle]
6619 /// Frees any resources used by the C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ.
6620 pub extern "C" fn C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free(_res: C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ) { }
6621 #[repr(C)]
6622 /// A dynamically-allocated array of crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZs of arbitrary size.
6623 /// This corresponds to std::vector in C++
6624 pub struct CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
6625         /// The elements in the array.
6626         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
6627         pub data: *mut crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ,
6628         /// The number of elements pointed to by `data`.
6629         pub datalen: usize
6630 }
6631 impl CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
6632         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ> {
6633                 if self.datalen == 0 { return Vec::new(); }
6634                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
6635                 self.data = std::ptr::null_mut();
6636                 self.datalen = 0;
6637                 ret
6638         }
6639         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ] {
6640                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
6641         }
6642 }
6643 impl From<Vec<crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ>> for CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
6644         fn from(v: Vec<crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ>) -> Self {
6645                 let datalen = v.len();
6646                 let data = Box::into_raw(v.into_boxed_slice());
6647                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
6648         }
6649 }
6650 #[no_mangle]
6651 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
6652 pub extern "C" fn CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free(_res: CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ) { }
6653 impl Drop for CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
6654         fn drop(&mut self) {
6655                 if self.datalen == 0 { return; }
6656                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
6657         }
6658 }
6659 impl Clone for CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
6660         fn clone(&self) -> Self {
6661                 let mut res = Vec::new();
6662                 if self.datalen == 0 { return Self::from(res); }
6663                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
6664                 Self::from(res)
6665         }
6666 }
6667 #[repr(C)]
6668 /// A dynamically-allocated array of crate::lightning::ln::msgs::NodeAnnouncements of arbitrary size.
6669 /// This corresponds to std::vector in C++
6670 pub struct CVec_NodeAnnouncementZ {
6671         /// The elements in the array.
6672         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
6673         pub data: *mut crate::lightning::ln::msgs::NodeAnnouncement,
6674         /// The number of elements pointed to by `data`.
6675         pub datalen: usize
6676 }
6677 impl CVec_NodeAnnouncementZ {
6678         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::NodeAnnouncement> {
6679                 if self.datalen == 0 { return Vec::new(); }
6680                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
6681                 self.data = std::ptr::null_mut();
6682                 self.datalen = 0;
6683                 ret
6684         }
6685         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::NodeAnnouncement] {
6686                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
6687         }
6688 }
6689 impl From<Vec<crate::lightning::ln::msgs::NodeAnnouncement>> for CVec_NodeAnnouncementZ {
6690         fn from(v: Vec<crate::lightning::ln::msgs::NodeAnnouncement>) -> Self {
6691                 let datalen = v.len();
6692                 let data = Box::into_raw(v.into_boxed_slice());
6693                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
6694         }
6695 }
6696 #[no_mangle]
6697 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
6698 pub extern "C" fn CVec_NodeAnnouncementZ_free(_res: CVec_NodeAnnouncementZ) { }
6699 impl Drop for CVec_NodeAnnouncementZ {
6700         fn drop(&mut self) {
6701                 if self.datalen == 0 { return; }
6702                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
6703         }
6704 }
6705 impl Clone for CVec_NodeAnnouncementZ {
6706         fn clone(&self) -> Self {
6707                 let mut res = Vec::new();
6708                 if self.datalen == 0 { return Self::from(res); }
6709                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
6710                 Self::from(res)
6711         }
6712 }
6713 #[repr(C)]
6714 /// The contents of CResult_NoneLightningErrorZ
6715 pub union CResult_NoneLightningErrorZPtr {
6716         /// Note that this value is always NULL, as there are no contents in the OK variant
6717         pub result: *mut std::ffi::c_void,
6718         /// A pointer to the contents in the error state.
6719         /// Reading from this pointer when `result_ok` is set is undefined.
6720         pub err: *mut crate::lightning::ln::msgs::LightningError,
6721 }
6722 #[repr(C)]
6723 /// A CResult_NoneLightningErrorZ represents the result of a fallible operation,
6724 /// containing a () on success and a crate::lightning::ln::msgs::LightningError on failure.
6725 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6726 pub struct CResult_NoneLightningErrorZ {
6727         /// The contents of this CResult_NoneLightningErrorZ, accessible via either
6728         /// `err` or `result` depending on the state of `result_ok`.
6729         pub contents: CResult_NoneLightningErrorZPtr,
6730         /// Whether this CResult_NoneLightningErrorZ represents a success state.
6731         pub result_ok: bool,
6732 }
6733 #[no_mangle]
6734 /// Creates a new CResult_NoneLightningErrorZ in the success state.
6735 pub extern "C" fn CResult_NoneLightningErrorZ_ok() -> CResult_NoneLightningErrorZ {
6736         CResult_NoneLightningErrorZ {
6737                 contents: CResult_NoneLightningErrorZPtr {
6738                         result: std::ptr::null_mut(),
6739                 },
6740                 result_ok: true,
6741         }
6742 }
6743 #[no_mangle]
6744 /// Creates a new CResult_NoneLightningErrorZ in the error state.
6745 pub extern "C" fn CResult_NoneLightningErrorZ_err(e: crate::lightning::ln::msgs::LightningError) -> CResult_NoneLightningErrorZ {
6746         CResult_NoneLightningErrorZ {
6747                 contents: CResult_NoneLightningErrorZPtr {
6748                         err: Box::into_raw(Box::new(e)),
6749                 },
6750                 result_ok: false,
6751         }
6752 }
6753 #[no_mangle]
6754 /// Frees any resources used by the CResult_NoneLightningErrorZ.
6755 pub extern "C" fn CResult_NoneLightningErrorZ_free(_res: CResult_NoneLightningErrorZ) { }
6756 impl Drop for CResult_NoneLightningErrorZ {
6757         fn drop(&mut self) {
6758                 if self.result_ok {
6759                 } else {
6760                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
6761                                 let _ = unsafe { Box::from_raw(self.contents.err) };
6762                         }
6763                 }
6764         }
6765 }
6766 impl From<crate::c_types::CResultTempl<(), crate::lightning::ln::msgs::LightningError>> for CResult_NoneLightningErrorZ {
6767         fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::ln::msgs::LightningError>) -> Self {
6768                 let contents = if o.result_ok {
6769                         let _ = unsafe { Box::from_raw(o.contents.result) };
6770                         o.contents.result = std::ptr::null_mut();
6771                         CResult_NoneLightningErrorZPtr { result: std::ptr::null_mut() }
6772                 } else {
6773                         let err = unsafe { o.contents.err };
6774                         unsafe { o.contents.err = std::ptr::null_mut(); }
6775                         CResult_NoneLightningErrorZPtr { err }
6776                 };
6777                 Self {
6778                         contents,
6779                         result_ok: o.result_ok,
6780                 }
6781         }
6782 }
6783 impl Clone for CResult_NoneLightningErrorZ {
6784         fn clone(&self) -> Self {
6785                 if self.result_ok {
6786                         Self { result_ok: true, contents: CResult_NoneLightningErrorZPtr {
6787                                 result: std::ptr::null_mut()
6788                         } }
6789                 } else {
6790                         Self { result_ok: false, contents: CResult_NoneLightningErrorZPtr {
6791                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::LightningError>::clone(unsafe { &*self.contents.err })))
6792                         } }
6793                 }
6794         }
6795 }
6796 #[no_mangle]
6797 /// Creates a new CResult_NoneLightningErrorZ which has the same data as `orig`
6798 /// but with all dynamically-allocated buffers duplicated in new buffers.
6799 pub extern "C" fn CResult_NoneLightningErrorZ_clone(orig: &CResult_NoneLightningErrorZ) -> CResult_NoneLightningErrorZ { orig.clone() }
6800 #[repr(C)]
6801 /// A dynamically-allocated array of crate::c_types::PublicKeys of arbitrary size.
6802 /// This corresponds to std::vector in C++
6803 pub struct CVec_PublicKeyZ {
6804         /// The elements in the array.
6805         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
6806         pub data: *mut crate::c_types::PublicKey,
6807         /// The number of elements pointed to by `data`.
6808         pub datalen: usize
6809 }
6810 impl CVec_PublicKeyZ {
6811         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::PublicKey> {
6812                 if self.datalen == 0 { return Vec::new(); }
6813                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
6814                 self.data = std::ptr::null_mut();
6815                 self.datalen = 0;
6816                 ret
6817         }
6818         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::PublicKey] {
6819                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
6820         }
6821 }
6822 impl From<Vec<crate::c_types::PublicKey>> for CVec_PublicKeyZ {
6823         fn from(v: Vec<crate::c_types::PublicKey>) -> Self {
6824                 let datalen = v.len();
6825                 let data = Box::into_raw(v.into_boxed_slice());
6826                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
6827         }
6828 }
6829 #[no_mangle]
6830 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
6831 pub extern "C" fn CVec_PublicKeyZ_free(_res: CVec_PublicKeyZ) { }
6832 impl Drop for CVec_PublicKeyZ {
6833         fn drop(&mut self) {
6834                 if self.datalen == 0 { return; }
6835                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
6836         }
6837 }
6838 impl Clone for CVec_PublicKeyZ {
6839         fn clone(&self) -> Self {
6840                 let mut res = Vec::new();
6841                 if self.datalen == 0 { return Self::from(res); }
6842                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
6843                 Self::from(res)
6844         }
6845 }
6846 #[repr(C)]
6847 /// The contents of CResult_CVec_u8ZPeerHandleErrorZ
6848 pub union CResult_CVec_u8ZPeerHandleErrorZPtr {
6849         /// A pointer to the contents in the success state.
6850         /// Reading from this pointer when `result_ok` is not set is undefined.
6851         pub result: *mut crate::c_types::derived::CVec_u8Z,
6852         /// A pointer to the contents in the error state.
6853         /// Reading from this pointer when `result_ok` is set is undefined.
6854         pub err: *mut crate::lightning::ln::peer_handler::PeerHandleError,
6855 }
6856 #[repr(C)]
6857 /// A CResult_CVec_u8ZPeerHandleErrorZ represents the result of a fallible operation,
6858 /// containing a crate::c_types::derived::CVec_u8Z on success and a crate::lightning::ln::peer_handler::PeerHandleError on failure.
6859 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6860 pub struct CResult_CVec_u8ZPeerHandleErrorZ {
6861         /// The contents of this CResult_CVec_u8ZPeerHandleErrorZ, accessible via either
6862         /// `err` or `result` depending on the state of `result_ok`.
6863         pub contents: CResult_CVec_u8ZPeerHandleErrorZPtr,
6864         /// Whether this CResult_CVec_u8ZPeerHandleErrorZ represents a success state.
6865         pub result_ok: bool,
6866 }
6867 #[no_mangle]
6868 /// Creates a new CResult_CVec_u8ZPeerHandleErrorZ in the success state.
6869 pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_ok(o: crate::c_types::derived::CVec_u8Z) -> CResult_CVec_u8ZPeerHandleErrorZ {
6870         CResult_CVec_u8ZPeerHandleErrorZ {
6871                 contents: CResult_CVec_u8ZPeerHandleErrorZPtr {
6872                         result: Box::into_raw(Box::new(o)),
6873                 },
6874                 result_ok: true,
6875         }
6876 }
6877 #[no_mangle]
6878 /// Creates a new CResult_CVec_u8ZPeerHandleErrorZ in the error state.
6879 pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_err(e: crate::lightning::ln::peer_handler::PeerHandleError) -> CResult_CVec_u8ZPeerHandleErrorZ {
6880         CResult_CVec_u8ZPeerHandleErrorZ {
6881                 contents: CResult_CVec_u8ZPeerHandleErrorZPtr {
6882                         err: Box::into_raw(Box::new(e)),
6883                 },
6884                 result_ok: false,
6885         }
6886 }
6887 #[no_mangle]
6888 /// Frees any resources used by the CResult_CVec_u8ZPeerHandleErrorZ.
6889 pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_free(_res: CResult_CVec_u8ZPeerHandleErrorZ) { }
6890 impl Drop for CResult_CVec_u8ZPeerHandleErrorZ {
6891         fn drop(&mut self) {
6892                 if self.result_ok {
6893                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
6894                                 let _ = unsafe { Box::from_raw(self.contents.result) };
6895                         }
6896                 } else {
6897                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
6898                                 let _ = unsafe { Box::from_raw(self.contents.err) };
6899                         }
6900                 }
6901         }
6902 }
6903 impl From<crate::c_types::CResultTempl<crate::c_types::derived::CVec_u8Z, crate::lightning::ln::peer_handler::PeerHandleError>> for CResult_CVec_u8ZPeerHandleErrorZ {
6904         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CVec_u8Z, crate::lightning::ln::peer_handler::PeerHandleError>) -> Self {
6905                 let contents = if o.result_ok {
6906                         let result = unsafe { o.contents.result };
6907                         unsafe { o.contents.result = std::ptr::null_mut() };
6908                         CResult_CVec_u8ZPeerHandleErrorZPtr { result }
6909                 } else {
6910                         let err = unsafe { o.contents.err };
6911                         unsafe { o.contents.err = std::ptr::null_mut(); }
6912                         CResult_CVec_u8ZPeerHandleErrorZPtr { err }
6913                 };
6914                 Self {
6915                         contents,
6916                         result_ok: o.result_ok,
6917                 }
6918         }
6919 }
6920 impl Clone for CResult_CVec_u8ZPeerHandleErrorZ {
6921         fn clone(&self) -> Self {
6922                 if self.result_ok {
6923                         Self { result_ok: true, contents: CResult_CVec_u8ZPeerHandleErrorZPtr {
6924                                 result: Box::into_raw(Box::new(<crate::c_types::derived::CVec_u8Z>::clone(unsafe { &*self.contents.result })))
6925                         } }
6926                 } else {
6927                         Self { result_ok: false, contents: CResult_CVec_u8ZPeerHandleErrorZPtr {
6928                                 err: Box::into_raw(Box::new(<crate::lightning::ln::peer_handler::PeerHandleError>::clone(unsafe { &*self.contents.err })))
6929                         } }
6930                 }
6931         }
6932 }
6933 #[no_mangle]
6934 /// Creates a new CResult_CVec_u8ZPeerHandleErrorZ which has the same data as `orig`
6935 /// but with all dynamically-allocated buffers duplicated in new buffers.
6936 pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_clone(orig: &CResult_CVec_u8ZPeerHandleErrorZ) -> CResult_CVec_u8ZPeerHandleErrorZ { orig.clone() }
6937 #[repr(C)]
6938 /// The contents of CResult_NonePeerHandleErrorZ
6939 pub union CResult_NonePeerHandleErrorZPtr {
6940         /// Note that this value is always NULL, as there are no contents in the OK variant
6941         pub result: *mut std::ffi::c_void,
6942         /// A pointer to the contents in the error state.
6943         /// Reading from this pointer when `result_ok` is set is undefined.
6944         pub err: *mut crate::lightning::ln::peer_handler::PeerHandleError,
6945 }
6946 #[repr(C)]
6947 /// A CResult_NonePeerHandleErrorZ represents the result of a fallible operation,
6948 /// containing a () on success and a crate::lightning::ln::peer_handler::PeerHandleError on failure.
6949 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6950 pub struct CResult_NonePeerHandleErrorZ {
6951         /// The contents of this CResult_NonePeerHandleErrorZ, accessible via either
6952         /// `err` or `result` depending on the state of `result_ok`.
6953         pub contents: CResult_NonePeerHandleErrorZPtr,
6954         /// Whether this CResult_NonePeerHandleErrorZ represents a success state.
6955         pub result_ok: bool,
6956 }
6957 #[no_mangle]
6958 /// Creates a new CResult_NonePeerHandleErrorZ in the success state.
6959 pub extern "C" fn CResult_NonePeerHandleErrorZ_ok() -> CResult_NonePeerHandleErrorZ {
6960         CResult_NonePeerHandleErrorZ {
6961                 contents: CResult_NonePeerHandleErrorZPtr {
6962                         result: std::ptr::null_mut(),
6963                 },
6964                 result_ok: true,
6965         }
6966 }
6967 #[no_mangle]
6968 /// Creates a new CResult_NonePeerHandleErrorZ in the error state.
6969 pub extern "C" fn CResult_NonePeerHandleErrorZ_err(e: crate::lightning::ln::peer_handler::PeerHandleError) -> CResult_NonePeerHandleErrorZ {
6970         CResult_NonePeerHandleErrorZ {
6971                 contents: CResult_NonePeerHandleErrorZPtr {
6972                         err: Box::into_raw(Box::new(e)),
6973                 },
6974                 result_ok: false,
6975         }
6976 }
6977 #[no_mangle]
6978 /// Frees any resources used by the CResult_NonePeerHandleErrorZ.
6979 pub extern "C" fn CResult_NonePeerHandleErrorZ_free(_res: CResult_NonePeerHandleErrorZ) { }
6980 impl Drop for CResult_NonePeerHandleErrorZ {
6981         fn drop(&mut self) {
6982                 if self.result_ok {
6983                 } else {
6984                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
6985                                 let _ = unsafe { Box::from_raw(self.contents.err) };
6986                         }
6987                 }
6988         }
6989 }
6990 impl From<crate::c_types::CResultTempl<(), crate::lightning::ln::peer_handler::PeerHandleError>> for CResult_NonePeerHandleErrorZ {
6991         fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::ln::peer_handler::PeerHandleError>) -> Self {
6992                 let contents = if o.result_ok {
6993                         let _ = unsafe { Box::from_raw(o.contents.result) };
6994                         o.contents.result = std::ptr::null_mut();
6995                         CResult_NonePeerHandleErrorZPtr { result: std::ptr::null_mut() }
6996                 } else {
6997                         let err = unsafe { o.contents.err };
6998                         unsafe { o.contents.err = std::ptr::null_mut(); }
6999                         CResult_NonePeerHandleErrorZPtr { err }
7000                 };
7001                 Self {
7002                         contents,
7003                         result_ok: o.result_ok,
7004                 }
7005         }
7006 }
7007 impl Clone for CResult_NonePeerHandleErrorZ {
7008         fn clone(&self) -> Self {
7009                 if self.result_ok {
7010                         Self { result_ok: true, contents: CResult_NonePeerHandleErrorZPtr {
7011                                 result: std::ptr::null_mut()
7012                         } }
7013                 } else {
7014                         Self { result_ok: false, contents: CResult_NonePeerHandleErrorZPtr {
7015                                 err: Box::into_raw(Box::new(<crate::lightning::ln::peer_handler::PeerHandleError>::clone(unsafe { &*self.contents.err })))
7016                         } }
7017                 }
7018         }
7019 }
7020 #[no_mangle]
7021 /// Creates a new CResult_NonePeerHandleErrorZ which has the same data as `orig`
7022 /// but with all dynamically-allocated buffers duplicated in new buffers.
7023 pub extern "C" fn CResult_NonePeerHandleErrorZ_clone(orig: &CResult_NonePeerHandleErrorZ) -> CResult_NonePeerHandleErrorZ { orig.clone() }
7024 #[repr(C)]
7025 /// The contents of CResult_boolPeerHandleErrorZ
7026 pub union CResult_boolPeerHandleErrorZPtr {
7027         /// A pointer to the contents in the success state.
7028         /// Reading from this pointer when `result_ok` is not set is undefined.
7029         pub result: *mut bool,
7030         /// A pointer to the contents in the error state.
7031         /// Reading from this pointer when `result_ok` is set is undefined.
7032         pub err: *mut crate::lightning::ln::peer_handler::PeerHandleError,
7033 }
7034 #[repr(C)]
7035 /// A CResult_boolPeerHandleErrorZ represents the result of a fallible operation,
7036 /// containing a bool on success and a crate::lightning::ln::peer_handler::PeerHandleError on failure.
7037 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7038 pub struct CResult_boolPeerHandleErrorZ {
7039         /// The contents of this CResult_boolPeerHandleErrorZ, accessible via either
7040         /// `err` or `result` depending on the state of `result_ok`.
7041         pub contents: CResult_boolPeerHandleErrorZPtr,
7042         /// Whether this CResult_boolPeerHandleErrorZ represents a success state.
7043         pub result_ok: bool,
7044 }
7045 #[no_mangle]
7046 /// Creates a new CResult_boolPeerHandleErrorZ in the success state.
7047 pub extern "C" fn CResult_boolPeerHandleErrorZ_ok(o: bool) -> CResult_boolPeerHandleErrorZ {
7048         CResult_boolPeerHandleErrorZ {
7049                 contents: CResult_boolPeerHandleErrorZPtr {
7050                         result: Box::into_raw(Box::new(o)),
7051                 },
7052                 result_ok: true,
7053         }
7054 }
7055 #[no_mangle]
7056 /// Creates a new CResult_boolPeerHandleErrorZ in the error state.
7057 pub extern "C" fn CResult_boolPeerHandleErrorZ_err(e: crate::lightning::ln::peer_handler::PeerHandleError) -> CResult_boolPeerHandleErrorZ {
7058         CResult_boolPeerHandleErrorZ {
7059                 contents: CResult_boolPeerHandleErrorZPtr {
7060                         err: Box::into_raw(Box::new(e)),
7061                 },
7062                 result_ok: false,
7063         }
7064 }
7065 #[no_mangle]
7066 /// Frees any resources used by the CResult_boolPeerHandleErrorZ.
7067 pub extern "C" fn CResult_boolPeerHandleErrorZ_free(_res: CResult_boolPeerHandleErrorZ) { }
7068 impl Drop for CResult_boolPeerHandleErrorZ {
7069         fn drop(&mut self) {
7070                 if self.result_ok {
7071                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
7072                                 let _ = unsafe { Box::from_raw(self.contents.result) };
7073                         }
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<bool, crate::lightning::ln::peer_handler::PeerHandleError>> for CResult_boolPeerHandleErrorZ {
7082         fn from(mut o: crate::c_types::CResultTempl<bool, crate::lightning::ln::peer_handler::PeerHandleError>) -> Self {
7083                 let contents = if o.result_ok {
7084                         let result = unsafe { o.contents.result };
7085                         unsafe { o.contents.result = std::ptr::null_mut() };
7086                         CResult_boolPeerHandleErrorZPtr { result }
7087                 } else {
7088                         let err = unsafe { o.contents.err };
7089                         unsafe { o.contents.err = std::ptr::null_mut(); }
7090                         CResult_boolPeerHandleErrorZPtr { err }
7091                 };
7092                 Self {
7093                         contents,
7094                         result_ok: o.result_ok,
7095                 }
7096         }
7097 }
7098 impl Clone for CResult_boolPeerHandleErrorZ {
7099         fn clone(&self) -> Self {
7100                 if self.result_ok {
7101                         Self { result_ok: true, contents: CResult_boolPeerHandleErrorZPtr {
7102                                 result: Box::into_raw(Box::new(<bool>::clone(unsafe { &*self.contents.result })))
7103                         } }
7104                 } else {
7105                         Self { result_ok: false, contents: CResult_boolPeerHandleErrorZPtr {
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_boolPeerHandleErrorZ which has the same data as `orig`
7113 /// but with all dynamically-allocated buffers duplicated in new buffers.
7114 pub extern "C" fn CResult_boolPeerHandleErrorZ_clone(orig: &CResult_boolPeerHandleErrorZ) -> CResult_boolPeerHandleErrorZ { orig.clone() }
7115 #[repr(C)]
7116 /// The contents of CResult_DirectionalChannelInfoDecodeErrorZ
7117 pub union CResult_DirectionalChannelInfoDecodeErrorZPtr {
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 crate::lightning::routing::network_graph::DirectionalChannelInfo,
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::msgs::DecodeError,
7124 }
7125 #[repr(C)]
7126 /// A CResult_DirectionalChannelInfoDecodeErrorZ represents the result of a fallible operation,
7127 /// containing a crate::lightning::routing::network_graph::DirectionalChannelInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
7128 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7129 pub struct CResult_DirectionalChannelInfoDecodeErrorZ {
7130         /// The contents of this CResult_DirectionalChannelInfoDecodeErrorZ, accessible via either
7131         /// `err` or `result` depending on the state of `result_ok`.
7132         pub contents: CResult_DirectionalChannelInfoDecodeErrorZPtr,
7133         /// Whether this CResult_DirectionalChannelInfoDecodeErrorZ represents a success state.
7134         pub result_ok: bool,
7135 }
7136 #[no_mangle]
7137 /// Creates a new CResult_DirectionalChannelInfoDecodeErrorZ in the success state.
7138 pub extern "C" fn CResult_DirectionalChannelInfoDecodeErrorZ_ok(o: crate::lightning::routing::network_graph::DirectionalChannelInfo) -> CResult_DirectionalChannelInfoDecodeErrorZ {
7139         CResult_DirectionalChannelInfoDecodeErrorZ {
7140                 contents: CResult_DirectionalChannelInfoDecodeErrorZPtr {
7141                         result: Box::into_raw(Box::new(o)),
7142                 },
7143                 result_ok: true,
7144         }
7145 }
7146 #[no_mangle]
7147 /// Creates a new CResult_DirectionalChannelInfoDecodeErrorZ in the error state.
7148 pub extern "C" fn CResult_DirectionalChannelInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_DirectionalChannelInfoDecodeErrorZ {
7149         CResult_DirectionalChannelInfoDecodeErrorZ {
7150                 contents: CResult_DirectionalChannelInfoDecodeErrorZPtr {
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_DirectionalChannelInfoDecodeErrorZ.
7158 pub extern "C" fn CResult_DirectionalChannelInfoDecodeErrorZ_free(_res: CResult_DirectionalChannelInfoDecodeErrorZ) { }
7159 impl Drop for CResult_DirectionalChannelInfoDecodeErrorZ {
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<crate::lightning::routing::network_graph::DirectionalChannelInfo, crate::lightning::ln::msgs::DecodeError>> for CResult_DirectionalChannelInfoDecodeErrorZ {
7173         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::network_graph::DirectionalChannelInfo, crate::lightning::ln::msgs::DecodeError>) -> 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_DirectionalChannelInfoDecodeErrorZPtr { result }
7178                 } else {
7179                         let err = unsafe { o.contents.err };
7180                         unsafe { o.contents.err = std::ptr::null_mut(); }
7181                         CResult_DirectionalChannelInfoDecodeErrorZPtr { err }
7182                 };
7183                 Self {
7184                         contents,
7185                         result_ok: o.result_ok,
7186                 }
7187         }
7188 }
7189 impl Clone for CResult_DirectionalChannelInfoDecodeErrorZ {
7190         fn clone(&self) -> Self {
7191                 if self.result_ok {
7192                         Self { result_ok: true, contents: CResult_DirectionalChannelInfoDecodeErrorZPtr {
7193                                 result: Box::into_raw(Box::new(<crate::lightning::routing::network_graph::DirectionalChannelInfo>::clone(unsafe { &*self.contents.result })))
7194                         } }
7195                 } else {
7196                         Self { result_ok: false, contents: CResult_DirectionalChannelInfoDecodeErrorZPtr {
7197                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
7198                         } }
7199                 }
7200         }
7201 }
7202 #[no_mangle]
7203 /// Creates a new CResult_DirectionalChannelInfoDecodeErrorZ which has the same data as `orig`
7204 /// but with all dynamically-allocated buffers duplicated in new buffers.
7205 pub extern "C" fn CResult_DirectionalChannelInfoDecodeErrorZ_clone(orig: &CResult_DirectionalChannelInfoDecodeErrorZ) -> CResult_DirectionalChannelInfoDecodeErrorZ { orig.clone() }
7206 #[repr(C)]
7207 /// The contents of CResult_ChannelInfoDecodeErrorZ
7208 pub union CResult_ChannelInfoDecodeErrorZPtr {
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::ChannelInfo,
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_ChannelInfoDecodeErrorZ represents the result of a fallible operation,
7218 /// containing a crate::lightning::routing::network_graph::ChannelInfo 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_ChannelInfoDecodeErrorZ {
7221         /// The contents of this CResult_ChannelInfoDecodeErrorZ, accessible via either
7222         /// `err` or `result` depending on the state of `result_ok`.
7223         pub contents: CResult_ChannelInfoDecodeErrorZPtr,
7224         /// Whether this CResult_ChannelInfoDecodeErrorZ represents a success state.
7225         pub result_ok: bool,
7226 }
7227 #[no_mangle]
7228 /// Creates a new CResult_ChannelInfoDecodeErrorZ in the success state.
7229 pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_ok(o: crate::lightning::routing::network_graph::ChannelInfo) -> CResult_ChannelInfoDecodeErrorZ {
7230         CResult_ChannelInfoDecodeErrorZ {
7231                 contents: CResult_ChannelInfoDecodeErrorZPtr {
7232                         result: Box::into_raw(Box::new(o)),
7233                 },
7234                 result_ok: true,
7235         }
7236 }
7237 #[no_mangle]
7238 /// Creates a new CResult_ChannelInfoDecodeErrorZ in the error state.
7239 pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelInfoDecodeErrorZ {
7240         CResult_ChannelInfoDecodeErrorZ {
7241                 contents: CResult_ChannelInfoDecodeErrorZPtr {
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_ChannelInfoDecodeErrorZ.
7249 pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_free(_res: CResult_ChannelInfoDecodeErrorZ) { }
7250 impl Drop for CResult_ChannelInfoDecodeErrorZ {
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::ChannelInfo, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelInfoDecodeErrorZ {
7264         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::network_graph::ChannelInfo, 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_ChannelInfoDecodeErrorZPtr { result }
7269                 } else {
7270                         let err = unsafe { o.contents.err };
7271                         unsafe { o.contents.err = std::ptr::null_mut(); }
7272                         CResult_ChannelInfoDecodeErrorZPtr { err }
7273                 };
7274                 Self {
7275                         contents,
7276                         result_ok: o.result_ok,
7277                 }
7278         }
7279 }
7280 impl Clone for CResult_ChannelInfoDecodeErrorZ {
7281         fn clone(&self) -> Self {
7282                 if self.result_ok {
7283                         Self { result_ok: true, contents: CResult_ChannelInfoDecodeErrorZPtr {
7284                                 result: Box::into_raw(Box::new(<crate::lightning::routing::network_graph::ChannelInfo>::clone(unsafe { &*self.contents.result })))
7285                         } }
7286                 } else {
7287                         Self { result_ok: false, contents: CResult_ChannelInfoDecodeErrorZPtr {
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_ChannelInfoDecodeErrorZ which has the same data as `orig`
7295 /// but with all dynamically-allocated buffers duplicated in new buffers.
7296 pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_clone(orig: &CResult_ChannelInfoDecodeErrorZ) -> CResult_ChannelInfoDecodeErrorZ { orig.clone() }
7297 #[repr(C)]
7298 /// The contents of CResult_RoutingFeesDecodeErrorZ
7299 pub union CResult_RoutingFeesDecodeErrorZPtr {
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::RoutingFees,
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_RoutingFeesDecodeErrorZ represents the result of a fallible operation,
7309 /// containing a crate::lightning::routing::network_graph::RoutingFees 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_RoutingFeesDecodeErrorZ {
7312         /// The contents of this CResult_RoutingFeesDecodeErrorZ, accessible via either
7313         /// `err` or `result` depending on the state of `result_ok`.
7314         pub contents: CResult_RoutingFeesDecodeErrorZPtr,
7315         /// Whether this CResult_RoutingFeesDecodeErrorZ represents a success state.
7316         pub result_ok: bool,
7317 }
7318 #[no_mangle]
7319 /// Creates a new CResult_RoutingFeesDecodeErrorZ in the success state.
7320 pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_ok(o: crate::lightning::routing::network_graph::RoutingFees) -> CResult_RoutingFeesDecodeErrorZ {
7321         CResult_RoutingFeesDecodeErrorZ {
7322                 contents: CResult_RoutingFeesDecodeErrorZPtr {
7323                         result: Box::into_raw(Box::new(o)),
7324                 },
7325                 result_ok: true,
7326         }
7327 }
7328 #[no_mangle]
7329 /// Creates a new CResult_RoutingFeesDecodeErrorZ in the error state.
7330 pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RoutingFeesDecodeErrorZ {
7331         CResult_RoutingFeesDecodeErrorZ {
7332                 contents: CResult_RoutingFeesDecodeErrorZPtr {
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_RoutingFeesDecodeErrorZ.
7340 pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_free(_res: CResult_RoutingFeesDecodeErrorZ) { }
7341 impl Drop for CResult_RoutingFeesDecodeErrorZ {
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::RoutingFees, crate::lightning::ln::msgs::DecodeError>> for CResult_RoutingFeesDecodeErrorZ {
7355         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::network_graph::RoutingFees, 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_RoutingFeesDecodeErrorZPtr { result }
7360                 } else {
7361                         let err = unsafe { o.contents.err };
7362                         unsafe { o.contents.err = std::ptr::null_mut(); }
7363                         CResult_RoutingFeesDecodeErrorZPtr { err }
7364                 };
7365                 Self {
7366                         contents,
7367                         result_ok: o.result_ok,
7368                 }
7369         }
7370 }
7371 impl Clone for CResult_RoutingFeesDecodeErrorZ {
7372         fn clone(&self) -> Self {
7373                 if self.result_ok {
7374                         Self { result_ok: true, contents: CResult_RoutingFeesDecodeErrorZPtr {
7375                                 result: Box::into_raw(Box::new(<crate::lightning::routing::network_graph::RoutingFees>::clone(unsafe { &*self.contents.result })))
7376                         } }
7377                 } else {
7378                         Self { result_ok: false, contents: CResult_RoutingFeesDecodeErrorZPtr {
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_RoutingFeesDecodeErrorZ which has the same data as `orig`
7386 /// but with all dynamically-allocated buffers duplicated in new buffers.
7387 pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_clone(orig: &CResult_RoutingFeesDecodeErrorZ) -> CResult_RoutingFeesDecodeErrorZ { orig.clone() }
7388 #[repr(C)]
7389 /// The contents of CResult_NodeAnnouncementInfoDecodeErrorZ
7390 pub union CResult_NodeAnnouncementInfoDecodeErrorZPtr {
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::NodeAnnouncementInfo,
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_NodeAnnouncementInfoDecodeErrorZ represents the result of a fallible operation,
7400 /// containing a crate::lightning::routing::network_graph::NodeAnnouncementInfo 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_NodeAnnouncementInfoDecodeErrorZ {
7403         /// The contents of this CResult_NodeAnnouncementInfoDecodeErrorZ, accessible via either
7404         /// `err` or `result` depending on the state of `result_ok`.
7405         pub contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr,
7406         /// Whether this CResult_NodeAnnouncementInfoDecodeErrorZ represents a success state.
7407         pub result_ok: bool,
7408 }
7409 #[no_mangle]
7410 /// Creates a new CResult_NodeAnnouncementInfoDecodeErrorZ in the success state.
7411 pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_ok(o: crate::lightning::routing::network_graph::NodeAnnouncementInfo) -> CResult_NodeAnnouncementInfoDecodeErrorZ {
7412         CResult_NodeAnnouncementInfoDecodeErrorZ {
7413                 contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr {
7414                         result: Box::into_raw(Box::new(o)),
7415                 },
7416                 result_ok: true,
7417         }
7418 }
7419 #[no_mangle]
7420 /// Creates a new CResult_NodeAnnouncementInfoDecodeErrorZ in the error state.
7421 pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeAnnouncementInfoDecodeErrorZ {
7422         CResult_NodeAnnouncementInfoDecodeErrorZ {
7423                 contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr {
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_NodeAnnouncementInfoDecodeErrorZ.
7431 pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_free(_res: CResult_NodeAnnouncementInfoDecodeErrorZ) { }
7432 impl Drop for CResult_NodeAnnouncementInfoDecodeErrorZ {
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::NodeAnnouncementInfo, crate::lightning::ln::msgs::DecodeError>> for CResult_NodeAnnouncementInfoDecodeErrorZ {
7446         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::network_graph::NodeAnnouncementInfo, 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_NodeAnnouncementInfoDecodeErrorZPtr { result }
7451                 } else {
7452                         let err = unsafe { o.contents.err };
7453                         unsafe { o.contents.err = std::ptr::null_mut(); }
7454                         CResult_NodeAnnouncementInfoDecodeErrorZPtr { err }
7455                 };
7456                 Self {
7457                         contents,
7458                         result_ok: o.result_ok,
7459                 }
7460         }
7461 }
7462 impl Clone for CResult_NodeAnnouncementInfoDecodeErrorZ {
7463         fn clone(&self) -> Self {
7464                 if self.result_ok {
7465                         Self { result_ok: true, contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr {
7466                                 result: Box::into_raw(Box::new(<crate::lightning::routing::network_graph::NodeAnnouncementInfo>::clone(unsafe { &*self.contents.result })))
7467                         } }
7468                 } else {
7469                         Self { result_ok: false, contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr {
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_NodeAnnouncementInfoDecodeErrorZ which has the same data as `orig`
7477 /// but with all dynamically-allocated buffers duplicated in new buffers.
7478 pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_clone(orig: &CResult_NodeAnnouncementInfoDecodeErrorZ) -> CResult_NodeAnnouncementInfoDecodeErrorZ { orig.clone() }
7479 #[repr(C)]
7480 /// A dynamically-allocated array of u64s of arbitrary size.
7481 /// This corresponds to std::vector in C++
7482 pub struct CVec_u64Z {
7483         /// The elements in the array.
7484         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
7485         pub data: *mut u64,
7486         /// The number of elements pointed to by `data`.
7487         pub datalen: usize
7488 }
7489 impl CVec_u64Z {
7490         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<u64> {
7491                 if self.datalen == 0 { return Vec::new(); }
7492                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
7493                 self.data = std::ptr::null_mut();
7494                 self.datalen = 0;
7495                 ret
7496         }
7497         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[u64] {
7498                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
7499         }
7500 }
7501 impl From<Vec<u64>> for CVec_u64Z {
7502         fn from(v: Vec<u64>) -> Self {
7503                 let datalen = v.len();
7504                 let data = Box::into_raw(v.into_boxed_slice());
7505                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
7506         }
7507 }
7508 #[no_mangle]
7509 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
7510 pub extern "C" fn CVec_u64Z_free(_res: CVec_u64Z) { }
7511 impl Drop for CVec_u64Z {
7512         fn drop(&mut self) {
7513                 if self.datalen == 0 { return; }
7514                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
7515         }
7516 }
7517 impl Clone for CVec_u64Z {
7518         fn clone(&self) -> Self {
7519                 let mut res = Vec::new();
7520                 if self.datalen == 0 { return Self::from(res); }
7521                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
7522                 Self::from(res)
7523         }
7524 }
7525 #[repr(C)]
7526 /// The contents of CResult_NodeInfoDecodeErrorZ
7527 pub union CResult_NodeInfoDecodeErrorZPtr {
7528         /// A pointer to the contents in the success state.
7529         /// Reading from this pointer when `result_ok` is not set is undefined.
7530         pub result: *mut crate::lightning::routing::network_graph::NodeInfo,
7531         /// A pointer to the contents in the error state.
7532         /// Reading from this pointer when `result_ok` is set is undefined.
7533         pub err: *mut crate::lightning::ln::msgs::DecodeError,
7534 }
7535 #[repr(C)]
7536 /// A CResult_NodeInfoDecodeErrorZ represents the result of a fallible operation,
7537 /// containing a crate::lightning::routing::network_graph::NodeInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
7538 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7539 pub struct CResult_NodeInfoDecodeErrorZ {
7540         /// The contents of this CResult_NodeInfoDecodeErrorZ, accessible via either
7541         /// `err` or `result` depending on the state of `result_ok`.
7542         pub contents: CResult_NodeInfoDecodeErrorZPtr,
7543         /// Whether this CResult_NodeInfoDecodeErrorZ represents a success state.
7544         pub result_ok: bool,
7545 }
7546 #[no_mangle]
7547 /// Creates a new CResult_NodeInfoDecodeErrorZ in the success state.
7548 pub extern "C" fn CResult_NodeInfoDecodeErrorZ_ok(o: crate::lightning::routing::network_graph::NodeInfo) -> CResult_NodeInfoDecodeErrorZ {
7549         CResult_NodeInfoDecodeErrorZ {
7550                 contents: CResult_NodeInfoDecodeErrorZPtr {
7551                         result: Box::into_raw(Box::new(o)),
7552                 },
7553                 result_ok: true,
7554         }
7555 }
7556 #[no_mangle]
7557 /// Creates a new CResult_NodeInfoDecodeErrorZ in the error state.
7558 pub extern "C" fn CResult_NodeInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeInfoDecodeErrorZ {
7559         CResult_NodeInfoDecodeErrorZ {
7560                 contents: CResult_NodeInfoDecodeErrorZPtr {
7561                         err: Box::into_raw(Box::new(e)),
7562                 },
7563                 result_ok: false,
7564         }
7565 }
7566 #[no_mangle]
7567 /// Frees any resources used by the CResult_NodeInfoDecodeErrorZ.
7568 pub extern "C" fn CResult_NodeInfoDecodeErrorZ_free(_res: CResult_NodeInfoDecodeErrorZ) { }
7569 impl Drop for CResult_NodeInfoDecodeErrorZ {
7570         fn drop(&mut self) {
7571                 if self.result_ok {
7572                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
7573                                 let _ = unsafe { Box::from_raw(self.contents.result) };
7574                         }
7575                 } else {
7576                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
7577                                 let _ = unsafe { Box::from_raw(self.contents.err) };
7578                         }
7579                 }
7580         }
7581 }
7582 impl From<crate::c_types::CResultTempl<crate::lightning::routing::network_graph::NodeInfo, crate::lightning::ln::msgs::DecodeError>> for CResult_NodeInfoDecodeErrorZ {
7583         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::network_graph::NodeInfo, crate::lightning::ln::msgs::DecodeError>) -> Self {
7584                 let contents = if o.result_ok {
7585                         let result = unsafe { o.contents.result };
7586                         unsafe { o.contents.result = std::ptr::null_mut() };
7587                         CResult_NodeInfoDecodeErrorZPtr { result }
7588                 } else {
7589                         let err = unsafe { o.contents.err };
7590                         unsafe { o.contents.err = std::ptr::null_mut(); }
7591                         CResult_NodeInfoDecodeErrorZPtr { err }
7592                 };
7593                 Self {
7594                         contents,
7595                         result_ok: o.result_ok,
7596                 }
7597         }
7598 }
7599 impl Clone for CResult_NodeInfoDecodeErrorZ {
7600         fn clone(&self) -> Self {
7601                 if self.result_ok {
7602                         Self { result_ok: true, contents: CResult_NodeInfoDecodeErrorZPtr {
7603                                 result: Box::into_raw(Box::new(<crate::lightning::routing::network_graph::NodeInfo>::clone(unsafe { &*self.contents.result })))
7604                         } }
7605                 } else {
7606                         Self { result_ok: false, contents: CResult_NodeInfoDecodeErrorZPtr {
7607                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
7608                         } }
7609                 }
7610         }
7611 }
7612 #[no_mangle]
7613 /// Creates a new CResult_NodeInfoDecodeErrorZ which has the same data as `orig`
7614 /// but with all dynamically-allocated buffers duplicated in new buffers.
7615 pub extern "C" fn CResult_NodeInfoDecodeErrorZ_clone(orig: &CResult_NodeInfoDecodeErrorZ) -> CResult_NodeInfoDecodeErrorZ { orig.clone() }
7616 #[repr(C)]
7617 /// The contents of CResult_NetworkGraphDecodeErrorZ
7618 pub union CResult_NetworkGraphDecodeErrorZPtr {
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::NetworkGraph,
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_NetworkGraphDecodeErrorZ represents the result of a fallible operation,
7628 /// containing a crate::lightning::routing::network_graph::NetworkGraph 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_NetworkGraphDecodeErrorZ {
7631         /// The contents of this CResult_NetworkGraphDecodeErrorZ, accessible via either
7632         /// `err` or `result` depending on the state of `result_ok`.
7633         pub contents: CResult_NetworkGraphDecodeErrorZPtr,
7634         /// Whether this CResult_NetworkGraphDecodeErrorZ represents a success state.
7635         pub result_ok: bool,
7636 }
7637 #[no_mangle]
7638 /// Creates a new CResult_NetworkGraphDecodeErrorZ in the success state.
7639 pub extern "C" fn CResult_NetworkGraphDecodeErrorZ_ok(o: crate::lightning::routing::network_graph::NetworkGraph) -> CResult_NetworkGraphDecodeErrorZ {
7640         CResult_NetworkGraphDecodeErrorZ {
7641                 contents: CResult_NetworkGraphDecodeErrorZPtr {
7642                         result: Box::into_raw(Box::new(o)),
7643                 },
7644                 result_ok: true,
7645         }
7646 }
7647 #[no_mangle]
7648 /// Creates a new CResult_NetworkGraphDecodeErrorZ in the error state.
7649 pub extern "C" fn CResult_NetworkGraphDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NetworkGraphDecodeErrorZ {
7650         CResult_NetworkGraphDecodeErrorZ {
7651                 contents: CResult_NetworkGraphDecodeErrorZPtr {
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_NetworkGraphDecodeErrorZ.
7659 pub extern "C" fn CResult_NetworkGraphDecodeErrorZ_free(_res: CResult_NetworkGraphDecodeErrorZ) { }
7660 impl Drop for CResult_NetworkGraphDecodeErrorZ {
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::NetworkGraph, crate::lightning::ln::msgs::DecodeError>> for CResult_NetworkGraphDecodeErrorZ {
7674         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::network_graph::NetworkGraph, 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_NetworkGraphDecodeErrorZPtr { result }
7679                 } else {
7680                         let err = unsafe { o.contents.err };
7681                         unsafe { o.contents.err = std::ptr::null_mut(); }
7682                         CResult_NetworkGraphDecodeErrorZPtr { err }
7683                 };
7684                 Self {
7685                         contents,
7686                         result_ok: o.result_ok,
7687                 }
7688         }
7689 }
7690 impl Clone for CResult_NetworkGraphDecodeErrorZ {
7691         fn clone(&self) -> Self {
7692                 if self.result_ok {
7693                         Self { result_ok: true, contents: CResult_NetworkGraphDecodeErrorZPtr {
7694                                 result: Box::into_raw(Box::new(<crate::lightning::routing::network_graph::NetworkGraph>::clone(unsafe { &*self.contents.result })))
7695                         } }
7696                 } else {
7697                         Self { result_ok: false, contents: CResult_NetworkGraphDecodeErrorZPtr {
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_NetworkGraphDecodeErrorZ which has the same data as `orig`
7705 /// but with all dynamically-allocated buffers duplicated in new buffers.
7706 pub extern "C" fn CResult_NetworkGraphDecodeErrorZ_clone(orig: &CResult_NetworkGraphDecodeErrorZ) -> CResult_NetworkGraphDecodeErrorZ { orig.clone() }
7707 #[repr(C)]
7708 /// The contents of CResult_NetAddressu8Z
7709 pub union CResult_NetAddressu8ZPtr {
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::ln::msgs::NetAddress,
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 u8,
7716 }
7717 #[repr(C)]
7718 /// A CResult_NetAddressu8Z represents the result of a fallible operation,
7719 /// containing a crate::lightning::ln::msgs::NetAddress on success and a u8 on failure.
7720 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7721 pub struct CResult_NetAddressu8Z {
7722         /// The contents of this CResult_NetAddressu8Z, accessible via either
7723         /// `err` or `result` depending on the state of `result_ok`.
7724         pub contents: CResult_NetAddressu8ZPtr,
7725         /// Whether this CResult_NetAddressu8Z represents a success state.
7726         pub result_ok: bool,
7727 }
7728 #[no_mangle]
7729 /// Creates a new CResult_NetAddressu8Z in the success state.
7730 pub extern "C" fn CResult_NetAddressu8Z_ok(o: crate::lightning::ln::msgs::NetAddress) -> CResult_NetAddressu8Z {
7731         CResult_NetAddressu8Z {
7732                 contents: CResult_NetAddressu8ZPtr {
7733                         result: Box::into_raw(Box::new(o)),
7734                 },
7735                 result_ok: true,
7736         }
7737 }
7738 #[no_mangle]
7739 /// Creates a new CResult_NetAddressu8Z in the error state.
7740 pub extern "C" fn CResult_NetAddressu8Z_err(e: u8) -> CResult_NetAddressu8Z {
7741         CResult_NetAddressu8Z {
7742                 contents: CResult_NetAddressu8ZPtr {
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_NetAddressu8Z.
7750 pub extern "C" fn CResult_NetAddressu8Z_free(_res: CResult_NetAddressu8Z) { }
7751 impl Drop for CResult_NetAddressu8Z {
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::ln::msgs::NetAddress, u8>> for CResult_NetAddressu8Z {
7765         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::NetAddress, u8>) -> 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_NetAddressu8ZPtr { result }
7770                 } else {
7771                         let err = unsafe { o.contents.err };
7772                         unsafe { o.contents.err = std::ptr::null_mut(); }
7773                         CResult_NetAddressu8ZPtr { err }
7774                 };
7775                 Self {
7776                         contents,
7777                         result_ok: o.result_ok,
7778                 }
7779         }
7780 }
7781 impl Clone for CResult_NetAddressu8Z {
7782         fn clone(&self) -> Self {
7783                 if self.result_ok {
7784                         Self { result_ok: true, contents: CResult_NetAddressu8ZPtr {
7785                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::NetAddress>::clone(unsafe { &*self.contents.result })))
7786                         } }
7787                 } else {
7788                         Self { result_ok: false, contents: CResult_NetAddressu8ZPtr {
7789                                 err: Box::into_raw(Box::new(<u8>::clone(unsafe { &*self.contents.err })))
7790                         } }
7791                 }
7792         }
7793 }
7794 #[no_mangle]
7795 /// Creates a new CResult_NetAddressu8Z which has the same data as `orig`
7796 /// but with all dynamically-allocated buffers duplicated in new buffers.
7797 pub extern "C" fn CResult_NetAddressu8Z_clone(orig: &CResult_NetAddressu8Z) -> CResult_NetAddressu8Z { orig.clone() }
7798 #[repr(C)]
7799 /// The contents of CResult_CResult_NetAddressu8ZDecodeErrorZ
7800 pub union CResult_CResult_NetAddressu8ZDecodeErrorZPtr {
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::c_types::derived::CResult_NetAddressu8Z,
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 crate::lightning::ln::msgs::DecodeError,
7807 }
7808 #[repr(C)]
7809 /// A CResult_CResult_NetAddressu8ZDecodeErrorZ represents the result of a fallible operation,
7810 /// containing a crate::c_types::derived::CResult_NetAddressu8Z on success and a crate::lightning::ln::msgs::DecodeError on failure.
7811 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7812 pub struct CResult_CResult_NetAddressu8ZDecodeErrorZ {
7813         /// The contents of this CResult_CResult_NetAddressu8ZDecodeErrorZ, accessible via either
7814         /// `err` or `result` depending on the state of `result_ok`.
7815         pub contents: CResult_CResult_NetAddressu8ZDecodeErrorZPtr,
7816         /// Whether this CResult_CResult_NetAddressu8ZDecodeErrorZ represents a success state.
7817         pub result_ok: bool,
7818 }
7819 #[no_mangle]
7820 /// Creates a new CResult_CResult_NetAddressu8ZDecodeErrorZ in the success state.
7821 pub extern "C" fn CResult_CResult_NetAddressu8ZDecodeErrorZ_ok(o: crate::c_types::derived::CResult_NetAddressu8Z) -> CResult_CResult_NetAddressu8ZDecodeErrorZ {
7822         CResult_CResult_NetAddressu8ZDecodeErrorZ {
7823                 contents: CResult_CResult_NetAddressu8ZDecodeErrorZPtr {
7824                         result: Box::into_raw(Box::new(o)),
7825                 },
7826                 result_ok: true,
7827         }
7828 }
7829 #[no_mangle]
7830 /// Creates a new CResult_CResult_NetAddressu8ZDecodeErrorZ in the error state.
7831 pub extern "C" fn CResult_CResult_NetAddressu8ZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_CResult_NetAddressu8ZDecodeErrorZ {
7832         CResult_CResult_NetAddressu8ZDecodeErrorZ {
7833                 contents: CResult_CResult_NetAddressu8ZDecodeErrorZPtr {
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_CResult_NetAddressu8ZDecodeErrorZ.
7841 pub extern "C" fn CResult_CResult_NetAddressu8ZDecodeErrorZ_free(_res: CResult_CResult_NetAddressu8ZDecodeErrorZ) { }
7842 impl Drop for CResult_CResult_NetAddressu8ZDecodeErrorZ {
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::c_types::derived::CResult_NetAddressu8Z, crate::lightning::ln::msgs::DecodeError>> for CResult_CResult_NetAddressu8ZDecodeErrorZ {
7856         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CResult_NetAddressu8Z, crate::lightning::ln::msgs::DecodeError>) -> 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_CResult_NetAddressu8ZDecodeErrorZPtr { result }
7861                 } else {
7862                         let err = unsafe { o.contents.err };
7863                         unsafe { o.contents.err = std::ptr::null_mut(); }
7864                         CResult_CResult_NetAddressu8ZDecodeErrorZPtr { err }
7865                 };
7866                 Self {
7867                         contents,
7868                         result_ok: o.result_ok,
7869                 }
7870         }
7871 }
7872 impl Clone for CResult_CResult_NetAddressu8ZDecodeErrorZ {
7873         fn clone(&self) -> Self {
7874                 if self.result_ok {
7875                         Self { result_ok: true, contents: CResult_CResult_NetAddressu8ZDecodeErrorZPtr {
7876                                 result: Box::into_raw(Box::new(<crate::c_types::derived::CResult_NetAddressu8Z>::clone(unsafe { &*self.contents.result })))
7877                         } }
7878                 } else {
7879                         Self { result_ok: false, contents: CResult_CResult_NetAddressu8ZDecodeErrorZPtr {
7880                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
7881                         } }
7882                 }
7883         }
7884 }
7885 #[no_mangle]
7886 /// Creates a new CResult_CResult_NetAddressu8ZDecodeErrorZ which has the same data as `orig`
7887 /// but with all dynamically-allocated buffers duplicated in new buffers.
7888 pub extern "C" fn CResult_CResult_NetAddressu8ZDecodeErrorZ_clone(orig: &CResult_CResult_NetAddressu8ZDecodeErrorZ) -> CResult_CResult_NetAddressu8ZDecodeErrorZ { orig.clone() }
7889 #[repr(C)]
7890 /// The contents of CResult_NetAddressDecodeErrorZ
7891 pub union CResult_NetAddressDecodeErrorZPtr {
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::lightning::ln::msgs::NetAddress,
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_NetAddressDecodeErrorZ represents the result of a fallible operation,
7901 /// containing a crate::lightning::ln::msgs::NetAddress 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_NetAddressDecodeErrorZ {
7904         /// The contents of this CResult_NetAddressDecodeErrorZ, accessible via either
7905         /// `err` or `result` depending on the state of `result_ok`.
7906         pub contents: CResult_NetAddressDecodeErrorZPtr,
7907         /// Whether this CResult_NetAddressDecodeErrorZ represents a success state.
7908         pub result_ok: bool,
7909 }
7910 #[no_mangle]
7911 /// Creates a new CResult_NetAddressDecodeErrorZ in the success state.
7912 pub extern "C" fn CResult_NetAddressDecodeErrorZ_ok(o: crate::lightning::ln::msgs::NetAddress) -> CResult_NetAddressDecodeErrorZ {
7913         CResult_NetAddressDecodeErrorZ {
7914                 contents: CResult_NetAddressDecodeErrorZPtr {
7915                         result: Box::into_raw(Box::new(o)),
7916                 },
7917                 result_ok: true,
7918         }
7919 }
7920 #[no_mangle]
7921 /// Creates a new CResult_NetAddressDecodeErrorZ in the error state.
7922 pub extern "C" fn CResult_NetAddressDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NetAddressDecodeErrorZ {
7923         CResult_NetAddressDecodeErrorZ {
7924                 contents: CResult_NetAddressDecodeErrorZPtr {
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_NetAddressDecodeErrorZ.
7932 pub extern "C" fn CResult_NetAddressDecodeErrorZ_free(_res: CResult_NetAddressDecodeErrorZ) { }
7933 impl Drop for CResult_NetAddressDecodeErrorZ {
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::lightning::ln::msgs::NetAddress, crate::lightning::ln::msgs::DecodeError>> for CResult_NetAddressDecodeErrorZ {
7947         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::NetAddress, 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_NetAddressDecodeErrorZPtr { result }
7952                 } else {
7953                         let err = unsafe { o.contents.err };
7954                         unsafe { o.contents.err = std::ptr::null_mut(); }
7955                         CResult_NetAddressDecodeErrorZPtr { err }
7956                 };
7957                 Self {
7958                         contents,
7959                         result_ok: o.result_ok,
7960                 }
7961         }
7962 }
7963 impl Clone for CResult_NetAddressDecodeErrorZ {
7964         fn clone(&self) -> Self {
7965                 if self.result_ok {
7966                         Self { result_ok: true, contents: CResult_NetAddressDecodeErrorZPtr {
7967                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::NetAddress>::clone(unsafe { &*self.contents.result })))
7968                         } }
7969                 } else {
7970                         Self { result_ok: false, contents: CResult_NetAddressDecodeErrorZPtr {
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_NetAddressDecodeErrorZ which has the same data as `orig`
7978 /// but with all dynamically-allocated buffers duplicated in new buffers.
7979 pub extern "C" fn CResult_NetAddressDecodeErrorZ_clone(orig: &CResult_NetAddressDecodeErrorZ) -> CResult_NetAddressDecodeErrorZ { orig.clone() }
7980 #[repr(C)]
7981 /// A dynamically-allocated array of crate::lightning::ln::msgs::UpdateAddHTLCs of arbitrary size.
7982 /// This corresponds to std::vector in C++
7983 pub struct CVec_UpdateAddHTLCZ {
7984         /// The elements in the array.
7985         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
7986         pub data: *mut crate::lightning::ln::msgs::UpdateAddHTLC,
7987         /// The number of elements pointed to by `data`.
7988         pub datalen: usize
7989 }
7990 impl CVec_UpdateAddHTLCZ {
7991         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::UpdateAddHTLC> {
7992                 if self.datalen == 0 { return Vec::new(); }
7993                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
7994                 self.data = std::ptr::null_mut();
7995                 self.datalen = 0;
7996                 ret
7997         }
7998         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::UpdateAddHTLC] {
7999                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
8000         }
8001 }
8002 impl From<Vec<crate::lightning::ln::msgs::UpdateAddHTLC>> for CVec_UpdateAddHTLCZ {
8003         fn from(v: Vec<crate::lightning::ln::msgs::UpdateAddHTLC>) -> Self {
8004                 let datalen = v.len();
8005                 let data = Box::into_raw(v.into_boxed_slice());
8006                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
8007         }
8008 }
8009 #[no_mangle]
8010 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
8011 pub extern "C" fn CVec_UpdateAddHTLCZ_free(_res: CVec_UpdateAddHTLCZ) { }
8012 impl Drop for CVec_UpdateAddHTLCZ {
8013         fn drop(&mut self) {
8014                 if self.datalen == 0 { return; }
8015                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
8016         }
8017 }
8018 impl Clone for CVec_UpdateAddHTLCZ {
8019         fn clone(&self) -> Self {
8020                 let mut res = Vec::new();
8021                 if self.datalen == 0 { return Self::from(res); }
8022                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
8023                 Self::from(res)
8024         }
8025 }
8026 #[repr(C)]
8027 /// A dynamically-allocated array of crate::lightning::ln::msgs::UpdateFulfillHTLCs of arbitrary size.
8028 /// This corresponds to std::vector in C++
8029 pub struct CVec_UpdateFulfillHTLCZ {
8030         /// The elements in the array.
8031         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
8032         pub data: *mut crate::lightning::ln::msgs::UpdateFulfillHTLC,
8033         /// The number of elements pointed to by `data`.
8034         pub datalen: usize
8035 }
8036 impl CVec_UpdateFulfillHTLCZ {
8037         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::UpdateFulfillHTLC> {
8038                 if self.datalen == 0 { return Vec::new(); }
8039                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
8040                 self.data = std::ptr::null_mut();
8041                 self.datalen = 0;
8042                 ret
8043         }
8044         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::UpdateFulfillHTLC] {
8045                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
8046         }
8047 }
8048 impl From<Vec<crate::lightning::ln::msgs::UpdateFulfillHTLC>> for CVec_UpdateFulfillHTLCZ {
8049         fn from(v: Vec<crate::lightning::ln::msgs::UpdateFulfillHTLC>) -> Self {
8050                 let datalen = v.len();
8051                 let data = Box::into_raw(v.into_boxed_slice());
8052                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
8053         }
8054 }
8055 #[no_mangle]
8056 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
8057 pub extern "C" fn CVec_UpdateFulfillHTLCZ_free(_res: CVec_UpdateFulfillHTLCZ) { }
8058 impl Drop for CVec_UpdateFulfillHTLCZ {
8059         fn drop(&mut self) {
8060                 if self.datalen == 0 { return; }
8061                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
8062         }
8063 }
8064 impl Clone for CVec_UpdateFulfillHTLCZ {
8065         fn clone(&self) -> Self {
8066                 let mut res = Vec::new();
8067                 if self.datalen == 0 { return Self::from(res); }
8068                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
8069                 Self::from(res)
8070         }
8071 }
8072 #[repr(C)]
8073 /// A dynamically-allocated array of crate::lightning::ln::msgs::UpdateFailHTLCs of arbitrary size.
8074 /// This corresponds to std::vector in C++
8075 pub struct CVec_UpdateFailHTLCZ {
8076         /// The elements in the array.
8077         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
8078         pub data: *mut crate::lightning::ln::msgs::UpdateFailHTLC,
8079         /// The number of elements pointed to by `data`.
8080         pub datalen: usize
8081 }
8082 impl CVec_UpdateFailHTLCZ {
8083         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::UpdateFailHTLC> {
8084                 if self.datalen == 0 { return Vec::new(); }
8085                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
8086                 self.data = std::ptr::null_mut();
8087                 self.datalen = 0;
8088                 ret
8089         }
8090         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::UpdateFailHTLC] {
8091                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
8092         }
8093 }
8094 impl From<Vec<crate::lightning::ln::msgs::UpdateFailHTLC>> for CVec_UpdateFailHTLCZ {
8095         fn from(v: Vec<crate::lightning::ln::msgs::UpdateFailHTLC>) -> Self {
8096                 let datalen = v.len();
8097                 let data = Box::into_raw(v.into_boxed_slice());
8098                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
8099         }
8100 }
8101 #[no_mangle]
8102 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
8103 pub extern "C" fn CVec_UpdateFailHTLCZ_free(_res: CVec_UpdateFailHTLCZ) { }
8104 impl Drop for CVec_UpdateFailHTLCZ {
8105         fn drop(&mut self) {
8106                 if self.datalen == 0 { return; }
8107                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
8108         }
8109 }
8110 impl Clone for CVec_UpdateFailHTLCZ {
8111         fn clone(&self) -> Self {
8112                 let mut res = Vec::new();
8113                 if self.datalen == 0 { return Self::from(res); }
8114                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
8115                 Self::from(res)
8116         }
8117 }
8118 #[repr(C)]
8119 /// A dynamically-allocated array of crate::lightning::ln::msgs::UpdateFailMalformedHTLCs of arbitrary size.
8120 /// This corresponds to std::vector in C++
8121 pub struct CVec_UpdateFailMalformedHTLCZ {
8122         /// The elements in the array.
8123         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
8124         pub data: *mut crate::lightning::ln::msgs::UpdateFailMalformedHTLC,
8125         /// The number of elements pointed to by `data`.
8126         pub datalen: usize
8127 }
8128 impl CVec_UpdateFailMalformedHTLCZ {
8129         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::UpdateFailMalformedHTLC> {
8130                 if self.datalen == 0 { return Vec::new(); }
8131                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
8132                 self.data = std::ptr::null_mut();
8133                 self.datalen = 0;
8134                 ret
8135         }
8136         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::UpdateFailMalformedHTLC] {
8137                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
8138         }
8139 }
8140 impl From<Vec<crate::lightning::ln::msgs::UpdateFailMalformedHTLC>> for CVec_UpdateFailMalformedHTLCZ {
8141         fn from(v: Vec<crate::lightning::ln::msgs::UpdateFailMalformedHTLC>) -> Self {
8142                 let datalen = v.len();
8143                 let data = Box::into_raw(v.into_boxed_slice());
8144                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
8145         }
8146 }
8147 #[no_mangle]
8148 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
8149 pub extern "C" fn CVec_UpdateFailMalformedHTLCZ_free(_res: CVec_UpdateFailMalformedHTLCZ) { }
8150 impl Drop for CVec_UpdateFailMalformedHTLCZ {
8151         fn drop(&mut self) {
8152                 if self.datalen == 0 { return; }
8153                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
8154         }
8155 }
8156 impl Clone for CVec_UpdateFailMalformedHTLCZ {
8157         fn clone(&self) -> Self {
8158                 let mut res = Vec::new();
8159                 if self.datalen == 0 { return Self::from(res); }
8160                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
8161                 Self::from(res)
8162         }
8163 }
8164 #[repr(C)]
8165 /// The contents of CResult_AcceptChannelDecodeErrorZ
8166 pub union CResult_AcceptChannelDecodeErrorZPtr {
8167         /// A pointer to the contents in the success state.
8168         /// Reading from this pointer when `result_ok` is not set is undefined.
8169         pub result: *mut crate::lightning::ln::msgs::AcceptChannel,
8170         /// A pointer to the contents in the error state.
8171         /// Reading from this pointer when `result_ok` is set is undefined.
8172         pub err: *mut crate::lightning::ln::msgs::DecodeError,
8173 }
8174 #[repr(C)]
8175 /// A CResult_AcceptChannelDecodeErrorZ represents the result of a fallible operation,
8176 /// containing a crate::lightning::ln::msgs::AcceptChannel on success and a crate::lightning::ln::msgs::DecodeError on failure.
8177 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8178 pub struct CResult_AcceptChannelDecodeErrorZ {
8179         /// The contents of this CResult_AcceptChannelDecodeErrorZ, accessible via either
8180         /// `err` or `result` depending on the state of `result_ok`.
8181         pub contents: CResult_AcceptChannelDecodeErrorZPtr,
8182         /// Whether this CResult_AcceptChannelDecodeErrorZ represents a success state.
8183         pub result_ok: bool,
8184 }
8185 #[no_mangle]
8186 /// Creates a new CResult_AcceptChannelDecodeErrorZ in the success state.
8187 pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_ok(o: crate::lightning::ln::msgs::AcceptChannel) -> CResult_AcceptChannelDecodeErrorZ {
8188         CResult_AcceptChannelDecodeErrorZ {
8189                 contents: CResult_AcceptChannelDecodeErrorZPtr {
8190                         result: Box::into_raw(Box::new(o)),
8191                 },
8192                 result_ok: true,
8193         }
8194 }
8195 #[no_mangle]
8196 /// Creates a new CResult_AcceptChannelDecodeErrorZ in the error state.
8197 pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_AcceptChannelDecodeErrorZ {
8198         CResult_AcceptChannelDecodeErrorZ {
8199                 contents: CResult_AcceptChannelDecodeErrorZPtr {
8200                         err: Box::into_raw(Box::new(e)),
8201                 },
8202                 result_ok: false,
8203         }
8204 }
8205 #[no_mangle]
8206 /// Frees any resources used by the CResult_AcceptChannelDecodeErrorZ.
8207 pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_free(_res: CResult_AcceptChannelDecodeErrorZ) { }
8208 impl Drop for CResult_AcceptChannelDecodeErrorZ {
8209         fn drop(&mut self) {
8210                 if self.result_ok {
8211                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
8212                                 let _ = unsafe { Box::from_raw(self.contents.result) };
8213                         }
8214                 } else {
8215                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
8216                                 let _ = unsafe { Box::from_raw(self.contents.err) };
8217                         }
8218                 }
8219         }
8220 }
8221 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::AcceptChannel, crate::lightning::ln::msgs::DecodeError>> for CResult_AcceptChannelDecodeErrorZ {
8222         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::AcceptChannel, crate::lightning::ln::msgs::DecodeError>) -> Self {
8223                 let contents = if o.result_ok {
8224                         let result = unsafe { o.contents.result };
8225                         unsafe { o.contents.result = std::ptr::null_mut() };
8226                         CResult_AcceptChannelDecodeErrorZPtr { result }
8227                 } else {
8228                         let err = unsafe { o.contents.err };
8229                         unsafe { o.contents.err = std::ptr::null_mut(); }
8230                         CResult_AcceptChannelDecodeErrorZPtr { err }
8231                 };
8232                 Self {
8233                         contents,
8234                         result_ok: o.result_ok,
8235                 }
8236         }
8237 }
8238 impl Clone for CResult_AcceptChannelDecodeErrorZ {
8239         fn clone(&self) -> Self {
8240                 if self.result_ok {
8241                         Self { result_ok: true, contents: CResult_AcceptChannelDecodeErrorZPtr {
8242                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::AcceptChannel>::clone(unsafe { &*self.contents.result })))
8243                         } }
8244                 } else {
8245                         Self { result_ok: false, contents: CResult_AcceptChannelDecodeErrorZPtr {
8246                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
8247                         } }
8248                 }
8249         }
8250 }
8251 #[no_mangle]
8252 /// Creates a new CResult_AcceptChannelDecodeErrorZ which has the same data as `orig`
8253 /// but with all dynamically-allocated buffers duplicated in new buffers.
8254 pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_clone(orig: &CResult_AcceptChannelDecodeErrorZ) -> CResult_AcceptChannelDecodeErrorZ { orig.clone() }
8255 #[repr(C)]
8256 /// The contents of CResult_AnnouncementSignaturesDecodeErrorZ
8257 pub union CResult_AnnouncementSignaturesDecodeErrorZPtr {
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::AnnouncementSignatures,
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_AnnouncementSignaturesDecodeErrorZ represents the result of a fallible operation,
8267 /// containing a crate::lightning::ln::msgs::AnnouncementSignatures 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_AnnouncementSignaturesDecodeErrorZ {
8270         /// The contents of this CResult_AnnouncementSignaturesDecodeErrorZ, accessible via either
8271         /// `err` or `result` depending on the state of `result_ok`.
8272         pub contents: CResult_AnnouncementSignaturesDecodeErrorZPtr,
8273         /// Whether this CResult_AnnouncementSignaturesDecodeErrorZ represents a success state.
8274         pub result_ok: bool,
8275 }
8276 #[no_mangle]
8277 /// Creates a new CResult_AnnouncementSignaturesDecodeErrorZ in the success state.
8278 pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_ok(o: crate::lightning::ln::msgs::AnnouncementSignatures) -> CResult_AnnouncementSignaturesDecodeErrorZ {
8279         CResult_AnnouncementSignaturesDecodeErrorZ {
8280                 contents: CResult_AnnouncementSignaturesDecodeErrorZPtr {
8281                         result: Box::into_raw(Box::new(o)),
8282                 },
8283                 result_ok: true,
8284         }
8285 }
8286 #[no_mangle]
8287 /// Creates a new CResult_AnnouncementSignaturesDecodeErrorZ in the error state.
8288 pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_AnnouncementSignaturesDecodeErrorZ {
8289         CResult_AnnouncementSignaturesDecodeErrorZ {
8290                 contents: CResult_AnnouncementSignaturesDecodeErrorZPtr {
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_AnnouncementSignaturesDecodeErrorZ.
8298 pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_free(_res: CResult_AnnouncementSignaturesDecodeErrorZ) { }
8299 impl Drop for CResult_AnnouncementSignaturesDecodeErrorZ {
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::AnnouncementSignatures, crate::lightning::ln::msgs::DecodeError>> for CResult_AnnouncementSignaturesDecodeErrorZ {
8313         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::AnnouncementSignatures, 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_AnnouncementSignaturesDecodeErrorZPtr { result }
8318                 } else {
8319                         let err = unsafe { o.contents.err };
8320                         unsafe { o.contents.err = std::ptr::null_mut(); }
8321                         CResult_AnnouncementSignaturesDecodeErrorZPtr { err }
8322                 };
8323                 Self {
8324                         contents,
8325                         result_ok: o.result_ok,
8326                 }
8327         }
8328 }
8329 impl Clone for CResult_AnnouncementSignaturesDecodeErrorZ {
8330         fn clone(&self) -> Self {
8331                 if self.result_ok {
8332                         Self { result_ok: true, contents: CResult_AnnouncementSignaturesDecodeErrorZPtr {
8333                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::AnnouncementSignatures>::clone(unsafe { &*self.contents.result })))
8334                         } }
8335                 } else {
8336                         Self { result_ok: false, contents: CResult_AnnouncementSignaturesDecodeErrorZPtr {
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_AnnouncementSignaturesDecodeErrorZ which has the same data as `orig`
8344 /// but with all dynamically-allocated buffers duplicated in new buffers.
8345 pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_clone(orig: &CResult_AnnouncementSignaturesDecodeErrorZ) -> CResult_AnnouncementSignaturesDecodeErrorZ { orig.clone() }
8346 #[repr(C)]
8347 /// The contents of CResult_ChannelReestablishDecodeErrorZ
8348 pub union CResult_ChannelReestablishDecodeErrorZPtr {
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::ChannelReestablish,
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_ChannelReestablishDecodeErrorZ represents the result of a fallible operation,
8358 /// containing a crate::lightning::ln::msgs::ChannelReestablish 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_ChannelReestablishDecodeErrorZ {
8361         /// The contents of this CResult_ChannelReestablishDecodeErrorZ, accessible via either
8362         /// `err` or `result` depending on the state of `result_ok`.
8363         pub contents: CResult_ChannelReestablishDecodeErrorZPtr,
8364         /// Whether this CResult_ChannelReestablishDecodeErrorZ represents a success state.
8365         pub result_ok: bool,
8366 }
8367 #[no_mangle]
8368 /// Creates a new CResult_ChannelReestablishDecodeErrorZ in the success state.
8369 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ChannelReestablish) -> CResult_ChannelReestablishDecodeErrorZ {
8370         CResult_ChannelReestablishDecodeErrorZ {
8371                 contents: CResult_ChannelReestablishDecodeErrorZPtr {
8372                         result: Box::into_raw(Box::new(o)),
8373                 },
8374                 result_ok: true,
8375         }
8376 }
8377 #[no_mangle]
8378 /// Creates a new CResult_ChannelReestablishDecodeErrorZ in the error state.
8379 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelReestablishDecodeErrorZ {
8380         CResult_ChannelReestablishDecodeErrorZ {
8381                 contents: CResult_ChannelReestablishDecodeErrorZPtr {
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_ChannelReestablishDecodeErrorZ.
8389 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_free(_res: CResult_ChannelReestablishDecodeErrorZ) { }
8390 impl Drop for CResult_ChannelReestablishDecodeErrorZ {
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::ChannelReestablish, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelReestablishDecodeErrorZ {
8404         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelReestablish, 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_ChannelReestablishDecodeErrorZPtr { result }
8409                 } else {
8410                         let err = unsafe { o.contents.err };
8411                         unsafe { o.contents.err = std::ptr::null_mut(); }
8412                         CResult_ChannelReestablishDecodeErrorZPtr { err }
8413                 };
8414                 Self {
8415                         contents,
8416                         result_ok: o.result_ok,
8417                 }
8418         }
8419 }
8420 impl Clone for CResult_ChannelReestablishDecodeErrorZ {
8421         fn clone(&self) -> Self {
8422                 if self.result_ok {
8423                         Self { result_ok: true, contents: CResult_ChannelReestablishDecodeErrorZPtr {
8424                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ChannelReestablish>::clone(unsafe { &*self.contents.result })))
8425                         } }
8426                 } else {
8427                         Self { result_ok: false, contents: CResult_ChannelReestablishDecodeErrorZPtr {
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_ChannelReestablishDecodeErrorZ which has the same data as `orig`
8435 /// but with all dynamically-allocated buffers duplicated in new buffers.
8436 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_clone(orig: &CResult_ChannelReestablishDecodeErrorZ) -> CResult_ChannelReestablishDecodeErrorZ { orig.clone() }
8437 #[repr(C)]
8438 /// The contents of CResult_ClosingSignedDecodeErrorZ
8439 pub union CResult_ClosingSignedDecodeErrorZPtr {
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::ClosingSigned,
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_ClosingSignedDecodeErrorZ represents the result of a fallible operation,
8449 /// containing a crate::lightning::ln::msgs::ClosingSigned 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_ClosingSignedDecodeErrorZ {
8452         /// The contents of this CResult_ClosingSignedDecodeErrorZ, accessible via either
8453         /// `err` or `result` depending on the state of `result_ok`.
8454         pub contents: CResult_ClosingSignedDecodeErrorZPtr,
8455         /// Whether this CResult_ClosingSignedDecodeErrorZ represents a success state.
8456         pub result_ok: bool,
8457 }
8458 #[no_mangle]
8459 /// Creates a new CResult_ClosingSignedDecodeErrorZ in the success state.
8460 pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ClosingSigned) -> CResult_ClosingSignedDecodeErrorZ {
8461         CResult_ClosingSignedDecodeErrorZ {
8462                 contents: CResult_ClosingSignedDecodeErrorZPtr {
8463                         result: Box::into_raw(Box::new(o)),
8464                 },
8465                 result_ok: true,
8466         }
8467 }
8468 #[no_mangle]
8469 /// Creates a new CResult_ClosingSignedDecodeErrorZ in the error state.
8470 pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ClosingSignedDecodeErrorZ {
8471         CResult_ClosingSignedDecodeErrorZ {
8472                 contents: CResult_ClosingSignedDecodeErrorZPtr {
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_ClosingSignedDecodeErrorZ.
8480 pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_free(_res: CResult_ClosingSignedDecodeErrorZ) { }
8481 impl Drop for CResult_ClosingSignedDecodeErrorZ {
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::ClosingSigned, crate::lightning::ln::msgs::DecodeError>> for CResult_ClosingSignedDecodeErrorZ {
8495         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ClosingSigned, 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_ClosingSignedDecodeErrorZPtr { result }
8500                 } else {
8501                         let err = unsafe { o.contents.err };
8502                         unsafe { o.contents.err = std::ptr::null_mut(); }
8503                         CResult_ClosingSignedDecodeErrorZPtr { err }
8504                 };
8505                 Self {
8506                         contents,
8507                         result_ok: o.result_ok,
8508                 }
8509         }
8510 }
8511 impl Clone for CResult_ClosingSignedDecodeErrorZ {
8512         fn clone(&self) -> Self {
8513                 if self.result_ok {
8514                         Self { result_ok: true, contents: CResult_ClosingSignedDecodeErrorZPtr {
8515                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ClosingSigned>::clone(unsafe { &*self.contents.result })))
8516                         } }
8517                 } else {
8518                         Self { result_ok: false, contents: CResult_ClosingSignedDecodeErrorZPtr {
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_ClosingSignedDecodeErrorZ which has the same data as `orig`
8526 /// but with all dynamically-allocated buffers duplicated in new buffers.
8527 pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_clone(orig: &CResult_ClosingSignedDecodeErrorZ) -> CResult_ClosingSignedDecodeErrorZ { orig.clone() }
8528 #[repr(C)]
8529 /// The contents of CResult_CommitmentSignedDecodeErrorZ
8530 pub union CResult_CommitmentSignedDecodeErrorZPtr {
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::CommitmentSigned,
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_CommitmentSignedDecodeErrorZ represents the result of a fallible operation,
8540 /// containing a crate::lightning::ln::msgs::CommitmentSigned 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_CommitmentSignedDecodeErrorZ {
8543         /// The contents of this CResult_CommitmentSignedDecodeErrorZ, accessible via either
8544         /// `err` or `result` depending on the state of `result_ok`.
8545         pub contents: CResult_CommitmentSignedDecodeErrorZPtr,
8546         /// Whether this CResult_CommitmentSignedDecodeErrorZ represents a success state.
8547         pub result_ok: bool,
8548 }
8549 #[no_mangle]
8550 /// Creates a new CResult_CommitmentSignedDecodeErrorZ in the success state.
8551 pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_ok(o: crate::lightning::ln::msgs::CommitmentSigned) -> CResult_CommitmentSignedDecodeErrorZ {
8552         CResult_CommitmentSignedDecodeErrorZ {
8553                 contents: CResult_CommitmentSignedDecodeErrorZPtr {
8554                         result: Box::into_raw(Box::new(o)),
8555                 },
8556                 result_ok: true,
8557         }
8558 }
8559 #[no_mangle]
8560 /// Creates a new CResult_CommitmentSignedDecodeErrorZ in the error state.
8561 pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_CommitmentSignedDecodeErrorZ {
8562         CResult_CommitmentSignedDecodeErrorZ {
8563                 contents: CResult_CommitmentSignedDecodeErrorZPtr {
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_CommitmentSignedDecodeErrorZ.
8571 pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_free(_res: CResult_CommitmentSignedDecodeErrorZ) { }
8572 impl Drop for CResult_CommitmentSignedDecodeErrorZ {
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::CommitmentSigned, crate::lightning::ln::msgs::DecodeError>> for CResult_CommitmentSignedDecodeErrorZ {
8586         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::CommitmentSigned, 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_CommitmentSignedDecodeErrorZPtr { result }
8591                 } else {
8592                         let err = unsafe { o.contents.err };
8593                         unsafe { o.contents.err = std::ptr::null_mut(); }
8594                         CResult_CommitmentSignedDecodeErrorZPtr { err }
8595                 };
8596                 Self {
8597                         contents,
8598                         result_ok: o.result_ok,
8599                 }
8600         }
8601 }
8602 impl Clone for CResult_CommitmentSignedDecodeErrorZ {
8603         fn clone(&self) -> Self {
8604                 if self.result_ok {
8605                         Self { result_ok: true, contents: CResult_CommitmentSignedDecodeErrorZPtr {
8606                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::CommitmentSigned>::clone(unsafe { &*self.contents.result })))
8607                         } }
8608                 } else {
8609                         Self { result_ok: false, contents: CResult_CommitmentSignedDecodeErrorZPtr {
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_CommitmentSignedDecodeErrorZ which has the same data as `orig`
8617 /// but with all dynamically-allocated buffers duplicated in new buffers.
8618 pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_clone(orig: &CResult_CommitmentSignedDecodeErrorZ) -> CResult_CommitmentSignedDecodeErrorZ { orig.clone() }
8619 #[repr(C)]
8620 /// The contents of CResult_FundingCreatedDecodeErrorZ
8621 pub union CResult_FundingCreatedDecodeErrorZPtr {
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::FundingCreated,
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_FundingCreatedDecodeErrorZ represents the result of a fallible operation,
8631 /// containing a crate::lightning::ln::msgs::FundingCreated 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_FundingCreatedDecodeErrorZ {
8634         /// The contents of this CResult_FundingCreatedDecodeErrorZ, accessible via either
8635         /// `err` or `result` depending on the state of `result_ok`.
8636         pub contents: CResult_FundingCreatedDecodeErrorZPtr,
8637         /// Whether this CResult_FundingCreatedDecodeErrorZ represents a success state.
8638         pub result_ok: bool,
8639 }
8640 #[no_mangle]
8641 /// Creates a new CResult_FundingCreatedDecodeErrorZ in the success state.
8642 pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_ok(o: crate::lightning::ln::msgs::FundingCreated) -> CResult_FundingCreatedDecodeErrorZ {
8643         CResult_FundingCreatedDecodeErrorZ {
8644                 contents: CResult_FundingCreatedDecodeErrorZPtr {
8645                         result: Box::into_raw(Box::new(o)),
8646                 },
8647                 result_ok: true,
8648         }
8649 }
8650 #[no_mangle]
8651 /// Creates a new CResult_FundingCreatedDecodeErrorZ in the error state.
8652 pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_FundingCreatedDecodeErrorZ {
8653         CResult_FundingCreatedDecodeErrorZ {
8654                 contents: CResult_FundingCreatedDecodeErrorZPtr {
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_FundingCreatedDecodeErrorZ.
8662 pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_free(_res: CResult_FundingCreatedDecodeErrorZ) { }
8663 impl Drop for CResult_FundingCreatedDecodeErrorZ {
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::FundingCreated, crate::lightning::ln::msgs::DecodeError>> for CResult_FundingCreatedDecodeErrorZ {
8677         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::FundingCreated, 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_FundingCreatedDecodeErrorZPtr { result }
8682                 } else {
8683                         let err = unsafe { o.contents.err };
8684                         unsafe { o.contents.err = std::ptr::null_mut(); }
8685                         CResult_FundingCreatedDecodeErrorZPtr { err }
8686                 };
8687                 Self {
8688                         contents,
8689                         result_ok: o.result_ok,
8690                 }
8691         }
8692 }
8693 impl Clone for CResult_FundingCreatedDecodeErrorZ {
8694         fn clone(&self) -> Self {
8695                 if self.result_ok {
8696                         Self { result_ok: true, contents: CResult_FundingCreatedDecodeErrorZPtr {
8697                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::FundingCreated>::clone(unsafe { &*self.contents.result })))
8698                         } }
8699                 } else {
8700                         Self { result_ok: false, contents: CResult_FundingCreatedDecodeErrorZPtr {
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_FundingCreatedDecodeErrorZ which has the same data as `orig`
8708 /// but with all dynamically-allocated buffers duplicated in new buffers.
8709 pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_clone(orig: &CResult_FundingCreatedDecodeErrorZ) -> CResult_FundingCreatedDecodeErrorZ { orig.clone() }
8710 #[repr(C)]
8711 /// The contents of CResult_FundingSignedDecodeErrorZ
8712 pub union CResult_FundingSignedDecodeErrorZPtr {
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::FundingSigned,
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_FundingSignedDecodeErrorZ represents the result of a fallible operation,
8722 /// containing a crate::lightning::ln::msgs::FundingSigned 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_FundingSignedDecodeErrorZ {
8725         /// The contents of this CResult_FundingSignedDecodeErrorZ, accessible via either
8726         /// `err` or `result` depending on the state of `result_ok`.
8727         pub contents: CResult_FundingSignedDecodeErrorZPtr,
8728         /// Whether this CResult_FundingSignedDecodeErrorZ represents a success state.
8729         pub result_ok: bool,
8730 }
8731 #[no_mangle]
8732 /// Creates a new CResult_FundingSignedDecodeErrorZ in the success state.
8733 pub extern "C" fn CResult_FundingSignedDecodeErrorZ_ok(o: crate::lightning::ln::msgs::FundingSigned) -> CResult_FundingSignedDecodeErrorZ {
8734         CResult_FundingSignedDecodeErrorZ {
8735                 contents: CResult_FundingSignedDecodeErrorZPtr {
8736                         result: Box::into_raw(Box::new(o)),
8737                 },
8738                 result_ok: true,
8739         }
8740 }
8741 #[no_mangle]
8742 /// Creates a new CResult_FundingSignedDecodeErrorZ in the error state.
8743 pub extern "C" fn CResult_FundingSignedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_FundingSignedDecodeErrorZ {
8744         CResult_FundingSignedDecodeErrorZ {
8745                 contents: CResult_FundingSignedDecodeErrorZPtr {
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_FundingSignedDecodeErrorZ.
8753 pub extern "C" fn CResult_FundingSignedDecodeErrorZ_free(_res: CResult_FundingSignedDecodeErrorZ) { }
8754 impl Drop for CResult_FundingSignedDecodeErrorZ {
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::FundingSigned, crate::lightning::ln::msgs::DecodeError>> for CResult_FundingSignedDecodeErrorZ {
8768         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::FundingSigned, 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_FundingSignedDecodeErrorZPtr { result }
8773                 } else {
8774                         let err = unsafe { o.contents.err };
8775                         unsafe { o.contents.err = std::ptr::null_mut(); }
8776                         CResult_FundingSignedDecodeErrorZPtr { err }
8777                 };
8778                 Self {
8779                         contents,
8780                         result_ok: o.result_ok,
8781                 }
8782         }
8783 }
8784 impl Clone for CResult_FundingSignedDecodeErrorZ {
8785         fn clone(&self) -> Self {
8786                 if self.result_ok {
8787                         Self { result_ok: true, contents: CResult_FundingSignedDecodeErrorZPtr {
8788                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::FundingSigned>::clone(unsafe { &*self.contents.result })))
8789                         } }
8790                 } else {
8791                         Self { result_ok: false, contents: CResult_FundingSignedDecodeErrorZPtr {
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_FundingSignedDecodeErrorZ which has the same data as `orig`
8799 /// but with all dynamically-allocated buffers duplicated in new buffers.
8800 pub extern "C" fn CResult_FundingSignedDecodeErrorZ_clone(orig: &CResult_FundingSignedDecodeErrorZ) -> CResult_FundingSignedDecodeErrorZ { orig.clone() }
8801 #[repr(C)]
8802 /// The contents of CResult_FundingLockedDecodeErrorZ
8803 pub union CResult_FundingLockedDecodeErrorZPtr {
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::FundingLocked,
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_FundingLockedDecodeErrorZ represents the result of a fallible operation,
8813 /// containing a crate::lightning::ln::msgs::FundingLocked 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_FundingLockedDecodeErrorZ {
8816         /// The contents of this CResult_FundingLockedDecodeErrorZ, accessible via either
8817         /// `err` or `result` depending on the state of `result_ok`.
8818         pub contents: CResult_FundingLockedDecodeErrorZPtr,
8819         /// Whether this CResult_FundingLockedDecodeErrorZ represents a success state.
8820         pub result_ok: bool,
8821 }
8822 #[no_mangle]
8823 /// Creates a new CResult_FundingLockedDecodeErrorZ in the success state.
8824 pub extern "C" fn CResult_FundingLockedDecodeErrorZ_ok(o: crate::lightning::ln::msgs::FundingLocked) -> CResult_FundingLockedDecodeErrorZ {
8825         CResult_FundingLockedDecodeErrorZ {
8826                 contents: CResult_FundingLockedDecodeErrorZPtr {
8827                         result: Box::into_raw(Box::new(o)),
8828                 },
8829                 result_ok: true,
8830         }
8831 }
8832 #[no_mangle]
8833 /// Creates a new CResult_FundingLockedDecodeErrorZ in the error state.
8834 pub extern "C" fn CResult_FundingLockedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_FundingLockedDecodeErrorZ {
8835         CResult_FundingLockedDecodeErrorZ {
8836                 contents: CResult_FundingLockedDecodeErrorZPtr {
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_FundingLockedDecodeErrorZ.
8844 pub extern "C" fn CResult_FundingLockedDecodeErrorZ_free(_res: CResult_FundingLockedDecodeErrorZ) { }
8845 impl Drop for CResult_FundingLockedDecodeErrorZ {
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::FundingLocked, crate::lightning::ln::msgs::DecodeError>> for CResult_FundingLockedDecodeErrorZ {
8859         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::FundingLocked, 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_FundingLockedDecodeErrorZPtr { result }
8864                 } else {
8865                         let err = unsafe { o.contents.err };
8866                         unsafe { o.contents.err = std::ptr::null_mut(); }
8867                         CResult_FundingLockedDecodeErrorZPtr { err }
8868                 };
8869                 Self {
8870                         contents,
8871                         result_ok: o.result_ok,
8872                 }
8873         }
8874 }
8875 impl Clone for CResult_FundingLockedDecodeErrorZ {
8876         fn clone(&self) -> Self {
8877                 if self.result_ok {
8878                         Self { result_ok: true, contents: CResult_FundingLockedDecodeErrorZPtr {
8879                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::FundingLocked>::clone(unsafe { &*self.contents.result })))
8880                         } }
8881                 } else {
8882                         Self { result_ok: false, contents: CResult_FundingLockedDecodeErrorZPtr {
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_FundingLockedDecodeErrorZ which has the same data as `orig`
8890 /// but with all dynamically-allocated buffers duplicated in new buffers.
8891 pub extern "C" fn CResult_FundingLockedDecodeErrorZ_clone(orig: &CResult_FundingLockedDecodeErrorZ) -> CResult_FundingLockedDecodeErrorZ { orig.clone() }
8892 #[repr(C)]
8893 /// The contents of CResult_InitDecodeErrorZ
8894 pub union CResult_InitDecodeErrorZPtr {
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::Init,
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_InitDecodeErrorZ represents the result of a fallible operation,
8904 /// containing a crate::lightning::ln::msgs::Init 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_InitDecodeErrorZ {
8907         /// The contents of this CResult_InitDecodeErrorZ, accessible via either
8908         /// `err` or `result` depending on the state of `result_ok`.
8909         pub contents: CResult_InitDecodeErrorZPtr,
8910         /// Whether this CResult_InitDecodeErrorZ represents a success state.
8911         pub result_ok: bool,
8912 }
8913 #[no_mangle]
8914 /// Creates a new CResult_InitDecodeErrorZ in the success state.
8915 pub extern "C" fn CResult_InitDecodeErrorZ_ok(o: crate::lightning::ln::msgs::Init) -> CResult_InitDecodeErrorZ {
8916         CResult_InitDecodeErrorZ {
8917                 contents: CResult_InitDecodeErrorZPtr {
8918                         result: Box::into_raw(Box::new(o)),
8919                 },
8920                 result_ok: true,
8921         }
8922 }
8923 #[no_mangle]
8924 /// Creates a new CResult_InitDecodeErrorZ in the error state.
8925 pub extern "C" fn CResult_InitDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_InitDecodeErrorZ {
8926         CResult_InitDecodeErrorZ {
8927                 contents: CResult_InitDecodeErrorZPtr {
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_InitDecodeErrorZ.
8935 pub extern "C" fn CResult_InitDecodeErrorZ_free(_res: CResult_InitDecodeErrorZ) { }
8936 impl Drop for CResult_InitDecodeErrorZ {
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::Init, crate::lightning::ln::msgs::DecodeError>> for CResult_InitDecodeErrorZ {
8950         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::Init, 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_InitDecodeErrorZPtr { result }
8955                 } else {
8956                         let err = unsafe { o.contents.err };
8957                         unsafe { o.contents.err = std::ptr::null_mut(); }
8958                         CResult_InitDecodeErrorZPtr { err }
8959                 };
8960                 Self {
8961                         contents,
8962                         result_ok: o.result_ok,
8963                 }
8964         }
8965 }
8966 impl Clone for CResult_InitDecodeErrorZ {
8967         fn clone(&self) -> Self {
8968                 if self.result_ok {
8969                         Self { result_ok: true, contents: CResult_InitDecodeErrorZPtr {
8970                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::Init>::clone(unsafe { &*self.contents.result })))
8971                         } }
8972                 } else {
8973                         Self { result_ok: false, contents: CResult_InitDecodeErrorZPtr {
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_InitDecodeErrorZ which has the same data as `orig`
8981 /// but with all dynamically-allocated buffers duplicated in new buffers.
8982 pub extern "C" fn CResult_InitDecodeErrorZ_clone(orig: &CResult_InitDecodeErrorZ) -> CResult_InitDecodeErrorZ { orig.clone() }
8983 #[repr(C)]
8984 /// The contents of CResult_OpenChannelDecodeErrorZ
8985 pub union CResult_OpenChannelDecodeErrorZPtr {
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::OpenChannel,
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_OpenChannelDecodeErrorZ represents the result of a fallible operation,
8995 /// containing a crate::lightning::ln::msgs::OpenChannel 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_OpenChannelDecodeErrorZ {
8998         /// The contents of this CResult_OpenChannelDecodeErrorZ, accessible via either
8999         /// `err` or `result` depending on the state of `result_ok`.
9000         pub contents: CResult_OpenChannelDecodeErrorZPtr,
9001         /// Whether this CResult_OpenChannelDecodeErrorZ represents a success state.
9002         pub result_ok: bool,
9003 }
9004 #[no_mangle]
9005 /// Creates a new CResult_OpenChannelDecodeErrorZ in the success state.
9006 pub extern "C" fn CResult_OpenChannelDecodeErrorZ_ok(o: crate::lightning::ln::msgs::OpenChannel) -> CResult_OpenChannelDecodeErrorZ {
9007         CResult_OpenChannelDecodeErrorZ {
9008                 contents: CResult_OpenChannelDecodeErrorZPtr {
9009                         result: Box::into_raw(Box::new(o)),
9010                 },
9011                 result_ok: true,
9012         }
9013 }
9014 #[no_mangle]
9015 /// Creates a new CResult_OpenChannelDecodeErrorZ in the error state.
9016 pub extern "C" fn CResult_OpenChannelDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_OpenChannelDecodeErrorZ {
9017         CResult_OpenChannelDecodeErrorZ {
9018                 contents: CResult_OpenChannelDecodeErrorZPtr {
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_OpenChannelDecodeErrorZ.
9026 pub extern "C" fn CResult_OpenChannelDecodeErrorZ_free(_res: CResult_OpenChannelDecodeErrorZ) { }
9027 impl Drop for CResult_OpenChannelDecodeErrorZ {
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::OpenChannel, crate::lightning::ln::msgs::DecodeError>> for CResult_OpenChannelDecodeErrorZ {
9041         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::OpenChannel, 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_OpenChannelDecodeErrorZPtr { result }
9046                 } else {
9047                         let err = unsafe { o.contents.err };
9048                         unsafe { o.contents.err = std::ptr::null_mut(); }
9049                         CResult_OpenChannelDecodeErrorZPtr { err }
9050                 };
9051                 Self {
9052                         contents,
9053                         result_ok: o.result_ok,
9054                 }
9055         }
9056 }
9057 impl Clone for CResult_OpenChannelDecodeErrorZ {
9058         fn clone(&self) -> Self {
9059                 if self.result_ok {
9060                         Self { result_ok: true, contents: CResult_OpenChannelDecodeErrorZPtr {
9061                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::OpenChannel>::clone(unsafe { &*self.contents.result })))
9062                         } }
9063                 } else {
9064                         Self { result_ok: false, contents: CResult_OpenChannelDecodeErrorZPtr {
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_OpenChannelDecodeErrorZ which has the same data as `orig`
9072 /// but with all dynamically-allocated buffers duplicated in new buffers.
9073 pub extern "C" fn CResult_OpenChannelDecodeErrorZ_clone(orig: &CResult_OpenChannelDecodeErrorZ) -> CResult_OpenChannelDecodeErrorZ { orig.clone() }
9074 #[repr(C)]
9075 /// The contents of CResult_RevokeAndACKDecodeErrorZ
9076 pub union CResult_RevokeAndACKDecodeErrorZPtr {
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::RevokeAndACK,
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_RevokeAndACKDecodeErrorZ represents the result of a fallible operation,
9086 /// containing a crate::lightning::ln::msgs::RevokeAndACK 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_RevokeAndACKDecodeErrorZ {
9089         /// The contents of this CResult_RevokeAndACKDecodeErrorZ, accessible via either
9090         /// `err` or `result` depending on the state of `result_ok`.
9091         pub contents: CResult_RevokeAndACKDecodeErrorZPtr,
9092         /// Whether this CResult_RevokeAndACKDecodeErrorZ represents a success state.
9093         pub result_ok: bool,
9094 }
9095 #[no_mangle]
9096 /// Creates a new CResult_RevokeAndACKDecodeErrorZ in the success state.
9097 pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_ok(o: crate::lightning::ln::msgs::RevokeAndACK) -> CResult_RevokeAndACKDecodeErrorZ {
9098         CResult_RevokeAndACKDecodeErrorZ {
9099                 contents: CResult_RevokeAndACKDecodeErrorZPtr {
9100                         result: Box::into_raw(Box::new(o)),
9101                 },
9102                 result_ok: true,
9103         }
9104 }
9105 #[no_mangle]
9106 /// Creates a new CResult_RevokeAndACKDecodeErrorZ in the error state.
9107 pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RevokeAndACKDecodeErrorZ {
9108         CResult_RevokeAndACKDecodeErrorZ {
9109                 contents: CResult_RevokeAndACKDecodeErrorZPtr {
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_RevokeAndACKDecodeErrorZ.
9117 pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_free(_res: CResult_RevokeAndACKDecodeErrorZ) { }
9118 impl Drop for CResult_RevokeAndACKDecodeErrorZ {
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::RevokeAndACK, crate::lightning::ln::msgs::DecodeError>> for CResult_RevokeAndACKDecodeErrorZ {
9132         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::RevokeAndACK, 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_RevokeAndACKDecodeErrorZPtr { result }
9137                 } else {
9138                         let err = unsafe { o.contents.err };
9139                         unsafe { o.contents.err = std::ptr::null_mut(); }
9140                         CResult_RevokeAndACKDecodeErrorZPtr { err }
9141                 };
9142                 Self {
9143                         contents,
9144                         result_ok: o.result_ok,
9145                 }
9146         }
9147 }
9148 impl Clone for CResult_RevokeAndACKDecodeErrorZ {
9149         fn clone(&self) -> Self {
9150                 if self.result_ok {
9151                         Self { result_ok: true, contents: CResult_RevokeAndACKDecodeErrorZPtr {
9152                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::RevokeAndACK>::clone(unsafe { &*self.contents.result })))
9153                         } }
9154                 } else {
9155                         Self { result_ok: false, contents: CResult_RevokeAndACKDecodeErrorZPtr {
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_RevokeAndACKDecodeErrorZ which has the same data as `orig`
9163 /// but with all dynamically-allocated buffers duplicated in new buffers.
9164 pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_clone(orig: &CResult_RevokeAndACKDecodeErrorZ) -> CResult_RevokeAndACKDecodeErrorZ { orig.clone() }
9165 #[repr(C)]
9166 /// The contents of CResult_ShutdownDecodeErrorZ
9167 pub union CResult_ShutdownDecodeErrorZPtr {
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::Shutdown,
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_ShutdownDecodeErrorZ represents the result of a fallible operation,
9177 /// containing a crate::lightning::ln::msgs::Shutdown 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_ShutdownDecodeErrorZ {
9180         /// The contents of this CResult_ShutdownDecodeErrorZ, accessible via either
9181         /// `err` or `result` depending on the state of `result_ok`.
9182         pub contents: CResult_ShutdownDecodeErrorZPtr,
9183         /// Whether this CResult_ShutdownDecodeErrorZ represents a success state.
9184         pub result_ok: bool,
9185 }
9186 #[no_mangle]
9187 /// Creates a new CResult_ShutdownDecodeErrorZ in the success state.
9188 pub extern "C" fn CResult_ShutdownDecodeErrorZ_ok(o: crate::lightning::ln::msgs::Shutdown) -> CResult_ShutdownDecodeErrorZ {
9189         CResult_ShutdownDecodeErrorZ {
9190                 contents: CResult_ShutdownDecodeErrorZPtr {
9191                         result: Box::into_raw(Box::new(o)),
9192                 },
9193                 result_ok: true,
9194         }
9195 }
9196 #[no_mangle]
9197 /// Creates a new CResult_ShutdownDecodeErrorZ in the error state.
9198 pub extern "C" fn CResult_ShutdownDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ShutdownDecodeErrorZ {
9199         CResult_ShutdownDecodeErrorZ {
9200                 contents: CResult_ShutdownDecodeErrorZPtr {
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_ShutdownDecodeErrorZ.
9208 pub extern "C" fn CResult_ShutdownDecodeErrorZ_free(_res: CResult_ShutdownDecodeErrorZ) { }
9209 impl Drop for CResult_ShutdownDecodeErrorZ {
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::Shutdown, crate::lightning::ln::msgs::DecodeError>> for CResult_ShutdownDecodeErrorZ {
9223         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::Shutdown, 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_ShutdownDecodeErrorZPtr { result }
9228                 } else {
9229                         let err = unsafe { o.contents.err };
9230                         unsafe { o.contents.err = std::ptr::null_mut(); }
9231                         CResult_ShutdownDecodeErrorZPtr { err }
9232                 };
9233                 Self {
9234                         contents,
9235                         result_ok: o.result_ok,
9236                 }
9237         }
9238 }
9239 impl Clone for CResult_ShutdownDecodeErrorZ {
9240         fn clone(&self) -> Self {
9241                 if self.result_ok {
9242                         Self { result_ok: true, contents: CResult_ShutdownDecodeErrorZPtr {
9243                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::Shutdown>::clone(unsafe { &*self.contents.result })))
9244                         } }
9245                 } else {
9246                         Self { result_ok: false, contents: CResult_ShutdownDecodeErrorZPtr {
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_ShutdownDecodeErrorZ which has the same data as `orig`
9254 /// but with all dynamically-allocated buffers duplicated in new buffers.
9255 pub extern "C" fn CResult_ShutdownDecodeErrorZ_clone(orig: &CResult_ShutdownDecodeErrorZ) -> CResult_ShutdownDecodeErrorZ { orig.clone() }
9256 #[repr(C)]
9257 /// The contents of CResult_UpdateFailHTLCDecodeErrorZ
9258 pub union CResult_UpdateFailHTLCDecodeErrorZPtr {
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::UpdateFailHTLC,
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_UpdateFailHTLCDecodeErrorZ represents the result of a fallible operation,
9268 /// containing a crate::lightning::ln::msgs::UpdateFailHTLC 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_UpdateFailHTLCDecodeErrorZ {
9271         /// The contents of this CResult_UpdateFailHTLCDecodeErrorZ, accessible via either
9272         /// `err` or `result` depending on the state of `result_ok`.
9273         pub contents: CResult_UpdateFailHTLCDecodeErrorZPtr,
9274         /// Whether this CResult_UpdateFailHTLCDecodeErrorZ represents a success state.
9275         pub result_ok: bool,
9276 }
9277 #[no_mangle]
9278 /// Creates a new CResult_UpdateFailHTLCDecodeErrorZ in the success state.
9279 pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateFailHTLC) -> CResult_UpdateFailHTLCDecodeErrorZ {
9280         CResult_UpdateFailHTLCDecodeErrorZ {
9281                 contents: CResult_UpdateFailHTLCDecodeErrorZPtr {
9282                         result: Box::into_raw(Box::new(o)),
9283                 },
9284                 result_ok: true,
9285         }
9286 }
9287 #[no_mangle]
9288 /// Creates a new CResult_UpdateFailHTLCDecodeErrorZ in the error state.
9289 pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateFailHTLCDecodeErrorZ {
9290         CResult_UpdateFailHTLCDecodeErrorZ {
9291                 contents: CResult_UpdateFailHTLCDecodeErrorZPtr {
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_UpdateFailHTLCDecodeErrorZ.
9299 pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_free(_res: CResult_UpdateFailHTLCDecodeErrorZ) { }
9300 impl Drop for CResult_UpdateFailHTLCDecodeErrorZ {
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::UpdateFailHTLC, crate::lightning::ln::msgs::DecodeError>> for CResult_UpdateFailHTLCDecodeErrorZ {
9314         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFailHTLC, 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_UpdateFailHTLCDecodeErrorZPtr { result }
9319                 } else {
9320                         let err = unsafe { o.contents.err };
9321                         unsafe { o.contents.err = std::ptr::null_mut(); }
9322                         CResult_UpdateFailHTLCDecodeErrorZPtr { err }
9323                 };
9324                 Self {
9325                         contents,
9326                         result_ok: o.result_ok,
9327                 }
9328         }
9329 }
9330 impl Clone for CResult_UpdateFailHTLCDecodeErrorZ {
9331         fn clone(&self) -> Self {
9332                 if self.result_ok {
9333                         Self { result_ok: true, contents: CResult_UpdateFailHTLCDecodeErrorZPtr {
9334                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UpdateFailHTLC>::clone(unsafe { &*self.contents.result })))
9335                         } }
9336                 } else {
9337                         Self { result_ok: false, contents: CResult_UpdateFailHTLCDecodeErrorZPtr {
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_UpdateFailHTLCDecodeErrorZ which has the same data as `orig`
9345 /// but with all dynamically-allocated buffers duplicated in new buffers.
9346 pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_clone(orig: &CResult_UpdateFailHTLCDecodeErrorZ) -> CResult_UpdateFailHTLCDecodeErrorZ { orig.clone() }
9347 #[repr(C)]
9348 /// The contents of CResult_UpdateFailMalformedHTLCDecodeErrorZ
9349 pub union CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
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::UpdateFailMalformedHTLC,
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_UpdateFailMalformedHTLCDecodeErrorZ represents the result of a fallible operation,
9359 /// containing a crate::lightning::ln::msgs::UpdateFailMalformedHTLC 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_UpdateFailMalformedHTLCDecodeErrorZ {
9362         /// The contents of this CResult_UpdateFailMalformedHTLCDecodeErrorZ, accessible via either
9363         /// `err` or `result` depending on the state of `result_ok`.
9364         pub contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr,
9365         /// Whether this CResult_UpdateFailMalformedHTLCDecodeErrorZ represents a success state.
9366         pub result_ok: bool,
9367 }
9368 #[no_mangle]
9369 /// Creates a new CResult_UpdateFailMalformedHTLCDecodeErrorZ in the success state.
9370 pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateFailMalformedHTLC) -> CResult_UpdateFailMalformedHTLCDecodeErrorZ {
9371         CResult_UpdateFailMalformedHTLCDecodeErrorZ {
9372                 contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
9373                         result: Box::into_raw(Box::new(o)),
9374                 },
9375                 result_ok: true,
9376         }
9377 }
9378 #[no_mangle]
9379 /// Creates a new CResult_UpdateFailMalformedHTLCDecodeErrorZ in the error state.
9380 pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateFailMalformedHTLCDecodeErrorZ {
9381         CResult_UpdateFailMalformedHTLCDecodeErrorZ {
9382                 contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
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_UpdateFailMalformedHTLCDecodeErrorZ.
9390 pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_free(_res: CResult_UpdateFailMalformedHTLCDecodeErrorZ) { }
9391 impl Drop for CResult_UpdateFailMalformedHTLCDecodeErrorZ {
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::UpdateFailMalformedHTLC, crate::lightning::ln::msgs::DecodeError>> for CResult_UpdateFailMalformedHTLCDecodeErrorZ {
9405         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFailMalformedHTLC, 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_UpdateFailMalformedHTLCDecodeErrorZPtr { result }
9410                 } else {
9411                         let err = unsafe { o.contents.err };
9412                         unsafe { o.contents.err = std::ptr::null_mut(); }
9413                         CResult_UpdateFailMalformedHTLCDecodeErrorZPtr { err }
9414                 };
9415                 Self {
9416                         contents,
9417                         result_ok: o.result_ok,
9418                 }
9419         }
9420 }
9421 impl Clone for CResult_UpdateFailMalformedHTLCDecodeErrorZ {
9422         fn clone(&self) -> Self {
9423                 if self.result_ok {
9424                         Self { result_ok: true, contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
9425                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UpdateFailMalformedHTLC>::clone(unsafe { &*self.contents.result })))
9426                         } }
9427                 } else {
9428                         Self { result_ok: false, contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
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_UpdateFailMalformedHTLCDecodeErrorZ which has the same data as `orig`
9436 /// but with all dynamically-allocated buffers duplicated in new buffers.
9437 pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone(orig: &CResult_UpdateFailMalformedHTLCDecodeErrorZ) -> CResult_UpdateFailMalformedHTLCDecodeErrorZ { orig.clone() }
9438 #[repr(C)]
9439 /// The contents of CResult_UpdateFeeDecodeErrorZ
9440 pub union CResult_UpdateFeeDecodeErrorZPtr {
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::UpdateFee,
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_UpdateFeeDecodeErrorZ represents the result of a fallible operation,
9450 /// containing a crate::lightning::ln::msgs::UpdateFee 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_UpdateFeeDecodeErrorZ {
9453         /// The contents of this CResult_UpdateFeeDecodeErrorZ, accessible via either
9454         /// `err` or `result` depending on the state of `result_ok`.
9455         pub contents: CResult_UpdateFeeDecodeErrorZPtr,
9456         /// Whether this CResult_UpdateFeeDecodeErrorZ represents a success state.
9457         pub result_ok: bool,
9458 }
9459 #[no_mangle]
9460 /// Creates a new CResult_UpdateFeeDecodeErrorZ in the success state.
9461 pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateFee) -> CResult_UpdateFeeDecodeErrorZ {
9462         CResult_UpdateFeeDecodeErrorZ {
9463                 contents: CResult_UpdateFeeDecodeErrorZPtr {
9464                         result: Box::into_raw(Box::new(o)),
9465                 },
9466                 result_ok: true,
9467         }
9468 }
9469 #[no_mangle]
9470 /// Creates a new CResult_UpdateFeeDecodeErrorZ in the error state.
9471 pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateFeeDecodeErrorZ {
9472         CResult_UpdateFeeDecodeErrorZ {
9473                 contents: CResult_UpdateFeeDecodeErrorZPtr {
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_UpdateFeeDecodeErrorZ.
9481 pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_free(_res: CResult_UpdateFeeDecodeErrorZ) { }
9482 impl Drop for CResult_UpdateFeeDecodeErrorZ {
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::UpdateFee, crate::lightning::ln::msgs::DecodeError>> for CResult_UpdateFeeDecodeErrorZ {
9496         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFee, 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_UpdateFeeDecodeErrorZPtr { result }
9501                 } else {
9502                         let err = unsafe { o.contents.err };
9503                         unsafe { o.contents.err = std::ptr::null_mut(); }
9504                         CResult_UpdateFeeDecodeErrorZPtr { err }
9505                 };
9506                 Self {
9507                         contents,
9508                         result_ok: o.result_ok,
9509                 }
9510         }
9511 }
9512 impl Clone for CResult_UpdateFeeDecodeErrorZ {
9513         fn clone(&self) -> Self {
9514                 if self.result_ok {
9515                         Self { result_ok: true, contents: CResult_UpdateFeeDecodeErrorZPtr {
9516                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UpdateFee>::clone(unsafe { &*self.contents.result })))
9517                         } }
9518                 } else {
9519                         Self { result_ok: false, contents: CResult_UpdateFeeDecodeErrorZPtr {
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_UpdateFeeDecodeErrorZ which has the same data as `orig`
9527 /// but with all dynamically-allocated buffers duplicated in new buffers.
9528 pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_clone(orig: &CResult_UpdateFeeDecodeErrorZ) -> CResult_UpdateFeeDecodeErrorZ { orig.clone() }
9529 #[repr(C)]
9530 /// The contents of CResult_UpdateFulfillHTLCDecodeErrorZ
9531 pub union CResult_UpdateFulfillHTLCDecodeErrorZPtr {
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::UpdateFulfillHTLC,
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_UpdateFulfillHTLCDecodeErrorZ represents the result of a fallible operation,
9541 /// containing a crate::lightning::ln::msgs::UpdateFulfillHTLC 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_UpdateFulfillHTLCDecodeErrorZ {
9544         /// The contents of this CResult_UpdateFulfillHTLCDecodeErrorZ, accessible via either
9545         /// `err` or `result` depending on the state of `result_ok`.
9546         pub contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr,
9547         /// Whether this CResult_UpdateFulfillHTLCDecodeErrorZ represents a success state.
9548         pub result_ok: bool,
9549 }
9550 #[no_mangle]
9551 /// Creates a new CResult_UpdateFulfillHTLCDecodeErrorZ in the success state.
9552 pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateFulfillHTLC) -> CResult_UpdateFulfillHTLCDecodeErrorZ {
9553         CResult_UpdateFulfillHTLCDecodeErrorZ {
9554                 contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr {
9555                         result: Box::into_raw(Box::new(o)),
9556                 },
9557                 result_ok: true,
9558         }
9559 }
9560 #[no_mangle]
9561 /// Creates a new CResult_UpdateFulfillHTLCDecodeErrorZ in the error state.
9562 pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateFulfillHTLCDecodeErrorZ {
9563         CResult_UpdateFulfillHTLCDecodeErrorZ {
9564                 contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr {
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_UpdateFulfillHTLCDecodeErrorZ.
9572 pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_free(_res: CResult_UpdateFulfillHTLCDecodeErrorZ) { }
9573 impl Drop for CResult_UpdateFulfillHTLCDecodeErrorZ {
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::UpdateFulfillHTLC, crate::lightning::ln::msgs::DecodeError>> for CResult_UpdateFulfillHTLCDecodeErrorZ {
9587         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFulfillHTLC, 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_UpdateFulfillHTLCDecodeErrorZPtr { result }
9592                 } else {
9593                         let err = unsafe { o.contents.err };
9594                         unsafe { o.contents.err = std::ptr::null_mut(); }
9595                         CResult_UpdateFulfillHTLCDecodeErrorZPtr { err }
9596                 };
9597                 Self {
9598                         contents,
9599                         result_ok: o.result_ok,
9600                 }
9601         }
9602 }
9603 impl Clone for CResult_UpdateFulfillHTLCDecodeErrorZ {
9604         fn clone(&self) -> Self {
9605                 if self.result_ok {
9606                         Self { result_ok: true, contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr {
9607                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UpdateFulfillHTLC>::clone(unsafe { &*self.contents.result })))
9608                         } }
9609                 } else {
9610                         Self { result_ok: false, contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr {
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_UpdateFulfillHTLCDecodeErrorZ which has the same data as `orig`
9618 /// but with all dynamically-allocated buffers duplicated in new buffers.
9619 pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_clone(orig: &CResult_UpdateFulfillHTLCDecodeErrorZ) -> CResult_UpdateFulfillHTLCDecodeErrorZ { orig.clone() }
9620 #[repr(C)]
9621 /// The contents of CResult_UpdateAddHTLCDecodeErrorZ
9622 pub union CResult_UpdateAddHTLCDecodeErrorZPtr {
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::UpdateAddHTLC,
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_UpdateAddHTLCDecodeErrorZ represents the result of a fallible operation,
9632 /// containing a crate::lightning::ln::msgs::UpdateAddHTLC 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_UpdateAddHTLCDecodeErrorZ {
9635         /// The contents of this CResult_UpdateAddHTLCDecodeErrorZ, accessible via either
9636         /// `err` or `result` depending on the state of `result_ok`.
9637         pub contents: CResult_UpdateAddHTLCDecodeErrorZPtr,
9638         /// Whether this CResult_UpdateAddHTLCDecodeErrorZ represents a success state.
9639         pub result_ok: bool,
9640 }
9641 #[no_mangle]
9642 /// Creates a new CResult_UpdateAddHTLCDecodeErrorZ in the success state.
9643 pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateAddHTLC) -> CResult_UpdateAddHTLCDecodeErrorZ {
9644         CResult_UpdateAddHTLCDecodeErrorZ {
9645                 contents: CResult_UpdateAddHTLCDecodeErrorZPtr {
9646                         result: Box::into_raw(Box::new(o)),
9647                 },
9648                 result_ok: true,
9649         }
9650 }
9651 #[no_mangle]
9652 /// Creates a new CResult_UpdateAddHTLCDecodeErrorZ in the error state.
9653 pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateAddHTLCDecodeErrorZ {
9654         CResult_UpdateAddHTLCDecodeErrorZ {
9655                 contents: CResult_UpdateAddHTLCDecodeErrorZPtr {
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_UpdateAddHTLCDecodeErrorZ.
9663 pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_free(_res: CResult_UpdateAddHTLCDecodeErrorZ) { }
9664 impl Drop for CResult_UpdateAddHTLCDecodeErrorZ {
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::UpdateAddHTLC, crate::lightning::ln::msgs::DecodeError>> for CResult_UpdateAddHTLCDecodeErrorZ {
9678         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateAddHTLC, 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_UpdateAddHTLCDecodeErrorZPtr { result }
9683                 } else {
9684                         let err = unsafe { o.contents.err };
9685                         unsafe { o.contents.err = std::ptr::null_mut(); }
9686                         CResult_UpdateAddHTLCDecodeErrorZPtr { err }
9687                 };
9688                 Self {
9689                         contents,
9690                         result_ok: o.result_ok,
9691                 }
9692         }
9693 }
9694 impl Clone for CResult_UpdateAddHTLCDecodeErrorZ {
9695         fn clone(&self) -> Self {
9696                 if self.result_ok {
9697                         Self { result_ok: true, contents: CResult_UpdateAddHTLCDecodeErrorZPtr {
9698                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UpdateAddHTLC>::clone(unsafe { &*self.contents.result })))
9699                         } }
9700                 } else {
9701                         Self { result_ok: false, contents: CResult_UpdateAddHTLCDecodeErrorZPtr {
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_UpdateAddHTLCDecodeErrorZ which has the same data as `orig`
9709 /// but with all dynamically-allocated buffers duplicated in new buffers.
9710 pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_clone(orig: &CResult_UpdateAddHTLCDecodeErrorZ) -> CResult_UpdateAddHTLCDecodeErrorZ { orig.clone() }
9711 #[repr(C)]
9712 /// The contents of CResult_PingDecodeErrorZ
9713 pub union CResult_PingDecodeErrorZPtr {
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::Ping,
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_PingDecodeErrorZ represents the result of a fallible operation,
9723 /// containing a crate::lightning::ln::msgs::Ping 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_PingDecodeErrorZ {
9726         /// The contents of this CResult_PingDecodeErrorZ, accessible via either
9727         /// `err` or `result` depending on the state of `result_ok`.
9728         pub contents: CResult_PingDecodeErrorZPtr,
9729         /// Whether this CResult_PingDecodeErrorZ represents a success state.
9730         pub result_ok: bool,
9731 }
9732 #[no_mangle]
9733 /// Creates a new CResult_PingDecodeErrorZ in the success state.
9734 pub extern "C" fn CResult_PingDecodeErrorZ_ok(o: crate::lightning::ln::msgs::Ping) -> CResult_PingDecodeErrorZ {
9735         CResult_PingDecodeErrorZ {
9736                 contents: CResult_PingDecodeErrorZPtr {
9737                         result: Box::into_raw(Box::new(o)),
9738                 },
9739                 result_ok: true,
9740         }
9741 }
9742 #[no_mangle]
9743 /// Creates a new CResult_PingDecodeErrorZ in the error state.
9744 pub extern "C" fn CResult_PingDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_PingDecodeErrorZ {
9745         CResult_PingDecodeErrorZ {
9746                 contents: CResult_PingDecodeErrorZPtr {
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_PingDecodeErrorZ.
9754 pub extern "C" fn CResult_PingDecodeErrorZ_free(_res: CResult_PingDecodeErrorZ) { }
9755 impl Drop for CResult_PingDecodeErrorZ {
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::Ping, crate::lightning::ln::msgs::DecodeError>> for CResult_PingDecodeErrorZ {
9769         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::Ping, 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_PingDecodeErrorZPtr { result }
9774                 } else {
9775                         let err = unsafe { o.contents.err };
9776                         unsafe { o.contents.err = std::ptr::null_mut(); }
9777                         CResult_PingDecodeErrorZPtr { err }
9778                 };
9779                 Self {
9780                         contents,
9781                         result_ok: o.result_ok,
9782                 }
9783         }
9784 }
9785 impl Clone for CResult_PingDecodeErrorZ {
9786         fn clone(&self) -> Self {
9787                 if self.result_ok {
9788                         Self { result_ok: true, contents: CResult_PingDecodeErrorZPtr {
9789                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::Ping>::clone(unsafe { &*self.contents.result })))
9790                         } }
9791                 } else {
9792                         Self { result_ok: false, contents: CResult_PingDecodeErrorZPtr {
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_PingDecodeErrorZ which has the same data as `orig`
9800 /// but with all dynamically-allocated buffers duplicated in new buffers.
9801 pub extern "C" fn CResult_PingDecodeErrorZ_clone(orig: &CResult_PingDecodeErrorZ) -> CResult_PingDecodeErrorZ { orig.clone() }
9802 #[repr(C)]
9803 /// The contents of CResult_PongDecodeErrorZ
9804 pub union CResult_PongDecodeErrorZPtr {
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::Pong,
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_PongDecodeErrorZ represents the result of a fallible operation,
9814 /// containing a crate::lightning::ln::msgs::Pong 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_PongDecodeErrorZ {
9817         /// The contents of this CResult_PongDecodeErrorZ, accessible via either
9818         /// `err` or `result` depending on the state of `result_ok`.
9819         pub contents: CResult_PongDecodeErrorZPtr,
9820         /// Whether this CResult_PongDecodeErrorZ represents a success state.
9821         pub result_ok: bool,
9822 }
9823 #[no_mangle]
9824 /// Creates a new CResult_PongDecodeErrorZ in the success state.
9825 pub extern "C" fn CResult_PongDecodeErrorZ_ok(o: crate::lightning::ln::msgs::Pong) -> CResult_PongDecodeErrorZ {
9826         CResult_PongDecodeErrorZ {
9827                 contents: CResult_PongDecodeErrorZPtr {
9828                         result: Box::into_raw(Box::new(o)),
9829                 },
9830                 result_ok: true,
9831         }
9832 }
9833 #[no_mangle]
9834 /// Creates a new CResult_PongDecodeErrorZ in the error state.
9835 pub extern "C" fn CResult_PongDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_PongDecodeErrorZ {
9836         CResult_PongDecodeErrorZ {
9837                 contents: CResult_PongDecodeErrorZPtr {
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_PongDecodeErrorZ.
9845 pub extern "C" fn CResult_PongDecodeErrorZ_free(_res: CResult_PongDecodeErrorZ) { }
9846 impl Drop for CResult_PongDecodeErrorZ {
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::Pong, crate::lightning::ln::msgs::DecodeError>> for CResult_PongDecodeErrorZ {
9860         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::Pong, 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_PongDecodeErrorZPtr { result }
9865                 } else {
9866                         let err = unsafe { o.contents.err };
9867                         unsafe { o.contents.err = std::ptr::null_mut(); }
9868                         CResult_PongDecodeErrorZPtr { err }
9869                 };
9870                 Self {
9871                         contents,
9872                         result_ok: o.result_ok,
9873                 }
9874         }
9875 }
9876 impl Clone for CResult_PongDecodeErrorZ {
9877         fn clone(&self) -> Self {
9878                 if self.result_ok {
9879                         Self { result_ok: true, contents: CResult_PongDecodeErrorZPtr {
9880                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::Pong>::clone(unsafe { &*self.contents.result })))
9881                         } }
9882                 } else {
9883                         Self { result_ok: false, contents: CResult_PongDecodeErrorZPtr {
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_PongDecodeErrorZ which has the same data as `orig`
9891 /// but with all dynamically-allocated buffers duplicated in new buffers.
9892 pub extern "C" fn CResult_PongDecodeErrorZ_clone(orig: &CResult_PongDecodeErrorZ) -> CResult_PongDecodeErrorZ { orig.clone() }
9893 #[repr(C)]
9894 /// The contents of CResult_UnsignedChannelAnnouncementDecodeErrorZ
9895 pub union CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
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::UnsignedChannelAnnouncement,
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_UnsignedChannelAnnouncementDecodeErrorZ represents the result of a fallible operation,
9905 /// containing a crate::lightning::ln::msgs::UnsignedChannelAnnouncement 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_UnsignedChannelAnnouncementDecodeErrorZ {
9908         /// The contents of this CResult_UnsignedChannelAnnouncementDecodeErrorZ, accessible via either
9909         /// `err` or `result` depending on the state of `result_ok`.
9910         pub contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr,
9911         /// Whether this CResult_UnsignedChannelAnnouncementDecodeErrorZ represents a success state.
9912         pub result_ok: bool,
9913 }
9914 #[no_mangle]
9915 /// Creates a new CResult_UnsignedChannelAnnouncementDecodeErrorZ in the success state.
9916 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UnsignedChannelAnnouncement) -> CResult_UnsignedChannelAnnouncementDecodeErrorZ {
9917         CResult_UnsignedChannelAnnouncementDecodeErrorZ {
9918                 contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
9919                         result: Box::into_raw(Box::new(o)),
9920                 },
9921                 result_ok: true,
9922         }
9923 }
9924 #[no_mangle]
9925 /// Creates a new CResult_UnsignedChannelAnnouncementDecodeErrorZ in the error state.
9926 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UnsignedChannelAnnouncementDecodeErrorZ {
9927         CResult_UnsignedChannelAnnouncementDecodeErrorZ {
9928                 contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
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_UnsignedChannelAnnouncementDecodeErrorZ.
9936 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_free(_res: CResult_UnsignedChannelAnnouncementDecodeErrorZ) { }
9937 impl Drop for CResult_UnsignedChannelAnnouncementDecodeErrorZ {
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::UnsignedChannelAnnouncement, crate::lightning::ln::msgs::DecodeError>> for CResult_UnsignedChannelAnnouncementDecodeErrorZ {
9951         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedChannelAnnouncement, 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_UnsignedChannelAnnouncementDecodeErrorZPtr { result }
9956                 } else {
9957                         let err = unsafe { o.contents.err };
9958                         unsafe { o.contents.err = std::ptr::null_mut(); }
9959                         CResult_UnsignedChannelAnnouncementDecodeErrorZPtr { err }
9960                 };
9961                 Self {
9962                         contents,
9963                         result_ok: o.result_ok,
9964                 }
9965         }
9966 }
9967 impl Clone for CResult_UnsignedChannelAnnouncementDecodeErrorZ {
9968         fn clone(&self) -> Self {
9969                 if self.result_ok {
9970                         Self { result_ok: true, contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
9971                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UnsignedChannelAnnouncement>::clone(unsafe { &*self.contents.result })))
9972                         } }
9973                 } else {
9974                         Self { result_ok: false, contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
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_UnsignedChannelAnnouncementDecodeErrorZ which has the same data as `orig`
9982 /// but with all dynamically-allocated buffers duplicated in new buffers.
9983 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone(orig: &CResult_UnsignedChannelAnnouncementDecodeErrorZ) -> CResult_UnsignedChannelAnnouncementDecodeErrorZ { orig.clone() }
9984 #[repr(C)]
9985 /// The contents of CResult_ChannelAnnouncementDecodeErrorZ
9986 pub union CResult_ChannelAnnouncementDecodeErrorZPtr {
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::ChannelAnnouncement,
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_ChannelAnnouncementDecodeErrorZ represents the result of a fallible operation,
9996 /// containing a crate::lightning::ln::msgs::ChannelAnnouncement 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_ChannelAnnouncementDecodeErrorZ {
9999         /// The contents of this CResult_ChannelAnnouncementDecodeErrorZ, accessible via either
10000         /// `err` or `result` depending on the state of `result_ok`.
10001         pub contents: CResult_ChannelAnnouncementDecodeErrorZPtr,
10002         /// Whether this CResult_ChannelAnnouncementDecodeErrorZ represents a success state.
10003         pub result_ok: bool,
10004 }
10005 #[no_mangle]
10006 /// Creates a new CResult_ChannelAnnouncementDecodeErrorZ in the success state.
10007 pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ChannelAnnouncement) -> CResult_ChannelAnnouncementDecodeErrorZ {
10008         CResult_ChannelAnnouncementDecodeErrorZ {
10009                 contents: CResult_ChannelAnnouncementDecodeErrorZPtr {
10010                         result: Box::into_raw(Box::new(o)),
10011                 },
10012                 result_ok: true,
10013         }
10014 }
10015 #[no_mangle]
10016 /// Creates a new CResult_ChannelAnnouncementDecodeErrorZ in the error state.
10017 pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelAnnouncementDecodeErrorZ {
10018         CResult_ChannelAnnouncementDecodeErrorZ {
10019                 contents: CResult_ChannelAnnouncementDecodeErrorZPtr {
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_ChannelAnnouncementDecodeErrorZ.
10027 pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_free(_res: CResult_ChannelAnnouncementDecodeErrorZ) { }
10028 impl Drop for CResult_ChannelAnnouncementDecodeErrorZ {
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::ChannelAnnouncement, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelAnnouncementDecodeErrorZ {
10042         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelAnnouncement, 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_ChannelAnnouncementDecodeErrorZPtr { result }
10047                 } else {
10048                         let err = unsafe { o.contents.err };
10049                         unsafe { o.contents.err = std::ptr::null_mut(); }
10050                         CResult_ChannelAnnouncementDecodeErrorZPtr { err }
10051                 };
10052                 Self {
10053                         contents,
10054                         result_ok: o.result_ok,
10055                 }
10056         }
10057 }
10058 impl Clone for CResult_ChannelAnnouncementDecodeErrorZ {
10059         fn clone(&self) -> Self {
10060                 if self.result_ok {
10061                         Self { result_ok: true, contents: CResult_ChannelAnnouncementDecodeErrorZPtr {
10062                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ChannelAnnouncement>::clone(unsafe { &*self.contents.result })))
10063                         } }
10064                 } else {
10065                         Self { result_ok: false, contents: CResult_ChannelAnnouncementDecodeErrorZPtr {
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_ChannelAnnouncementDecodeErrorZ which has the same data as `orig`
10073 /// but with all dynamically-allocated buffers duplicated in new buffers.
10074 pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_clone(orig: &CResult_ChannelAnnouncementDecodeErrorZ) -> CResult_ChannelAnnouncementDecodeErrorZ { orig.clone() }
10075 #[repr(C)]
10076 /// The contents of CResult_UnsignedChannelUpdateDecodeErrorZ
10077 pub union CResult_UnsignedChannelUpdateDecodeErrorZPtr {
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::UnsignedChannelUpdate,
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_UnsignedChannelUpdateDecodeErrorZ represents the result of a fallible operation,
10087 /// containing a crate::lightning::ln::msgs::UnsignedChannelUpdate 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_UnsignedChannelUpdateDecodeErrorZ {
10090         /// The contents of this CResult_UnsignedChannelUpdateDecodeErrorZ, accessible via either
10091         /// `err` or `result` depending on the state of `result_ok`.
10092         pub contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr,
10093         /// Whether this CResult_UnsignedChannelUpdateDecodeErrorZ represents a success state.
10094         pub result_ok: bool,
10095 }
10096 #[no_mangle]
10097 /// Creates a new CResult_UnsignedChannelUpdateDecodeErrorZ in the success state.
10098 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UnsignedChannelUpdate) -> CResult_UnsignedChannelUpdateDecodeErrorZ {
10099         CResult_UnsignedChannelUpdateDecodeErrorZ {
10100                 contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr {
10101                         result: Box::into_raw(Box::new(o)),
10102                 },
10103                 result_ok: true,
10104         }
10105 }
10106 #[no_mangle]
10107 /// Creates a new CResult_UnsignedChannelUpdateDecodeErrorZ in the error state.
10108 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UnsignedChannelUpdateDecodeErrorZ {
10109         CResult_UnsignedChannelUpdateDecodeErrorZ {
10110                 contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr {
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_UnsignedChannelUpdateDecodeErrorZ.
10118 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_free(_res: CResult_UnsignedChannelUpdateDecodeErrorZ) { }
10119 impl Drop for CResult_UnsignedChannelUpdateDecodeErrorZ {
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::UnsignedChannelUpdate, crate::lightning::ln::msgs::DecodeError>> for CResult_UnsignedChannelUpdateDecodeErrorZ {
10133         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedChannelUpdate, 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_UnsignedChannelUpdateDecodeErrorZPtr { result }
10138                 } else {
10139                         let err = unsafe { o.contents.err };
10140                         unsafe { o.contents.err = std::ptr::null_mut(); }
10141                         CResult_UnsignedChannelUpdateDecodeErrorZPtr { err }
10142                 };
10143                 Self {
10144                         contents,
10145                         result_ok: o.result_ok,
10146                 }
10147         }
10148 }
10149 impl Clone for CResult_UnsignedChannelUpdateDecodeErrorZ {
10150         fn clone(&self) -> Self {
10151                 if self.result_ok {
10152                         Self { result_ok: true, contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr {
10153                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UnsignedChannelUpdate>::clone(unsafe { &*self.contents.result })))
10154                         } }
10155                 } else {
10156                         Self { result_ok: false, contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr {
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_UnsignedChannelUpdateDecodeErrorZ which has the same data as `orig`
10164 /// but with all dynamically-allocated buffers duplicated in new buffers.
10165 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_clone(orig: &CResult_UnsignedChannelUpdateDecodeErrorZ) -> CResult_UnsignedChannelUpdateDecodeErrorZ { orig.clone() }
10166 #[repr(C)]
10167 /// The contents of CResult_ChannelUpdateDecodeErrorZ
10168 pub union CResult_ChannelUpdateDecodeErrorZPtr {
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::ChannelUpdate,
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_ChannelUpdateDecodeErrorZ represents the result of a fallible operation,
10178 /// containing a crate::lightning::ln::msgs::ChannelUpdate 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_ChannelUpdateDecodeErrorZ {
10181         /// The contents of this CResult_ChannelUpdateDecodeErrorZ, accessible via either
10182         /// `err` or `result` depending on the state of `result_ok`.
10183         pub contents: CResult_ChannelUpdateDecodeErrorZPtr,
10184         /// Whether this CResult_ChannelUpdateDecodeErrorZ represents a success state.
10185         pub result_ok: bool,
10186 }
10187 #[no_mangle]
10188 /// Creates a new CResult_ChannelUpdateDecodeErrorZ in the success state.
10189 pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ChannelUpdate) -> CResult_ChannelUpdateDecodeErrorZ {
10190         CResult_ChannelUpdateDecodeErrorZ {
10191                 contents: CResult_ChannelUpdateDecodeErrorZPtr {
10192                         result: Box::into_raw(Box::new(o)),
10193                 },
10194                 result_ok: true,
10195         }
10196 }
10197 #[no_mangle]
10198 /// Creates a new CResult_ChannelUpdateDecodeErrorZ in the error state.
10199 pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelUpdateDecodeErrorZ {
10200         CResult_ChannelUpdateDecodeErrorZ {
10201                 contents: CResult_ChannelUpdateDecodeErrorZPtr {
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_ChannelUpdateDecodeErrorZ.
10209 pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_free(_res: CResult_ChannelUpdateDecodeErrorZ) { }
10210 impl Drop for CResult_ChannelUpdateDecodeErrorZ {
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::ChannelUpdate, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelUpdateDecodeErrorZ {
10224         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelUpdate, 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_ChannelUpdateDecodeErrorZPtr { result }
10229                 } else {
10230                         let err = unsafe { o.contents.err };
10231                         unsafe { o.contents.err = std::ptr::null_mut(); }
10232                         CResult_ChannelUpdateDecodeErrorZPtr { err }
10233                 };
10234                 Self {
10235                         contents,
10236                         result_ok: o.result_ok,
10237                 }
10238         }
10239 }
10240 impl Clone for CResult_ChannelUpdateDecodeErrorZ {
10241         fn clone(&self) -> Self {
10242                 if self.result_ok {
10243                         Self { result_ok: true, contents: CResult_ChannelUpdateDecodeErrorZPtr {
10244                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ChannelUpdate>::clone(unsafe { &*self.contents.result })))
10245                         } }
10246                 } else {
10247                         Self { result_ok: false, contents: CResult_ChannelUpdateDecodeErrorZPtr {
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_ChannelUpdateDecodeErrorZ which has the same data as `orig`
10255 /// but with all dynamically-allocated buffers duplicated in new buffers.
10256 pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_clone(orig: &CResult_ChannelUpdateDecodeErrorZ) -> CResult_ChannelUpdateDecodeErrorZ { orig.clone() }
10257 #[repr(C)]
10258 /// The contents of CResult_ErrorMessageDecodeErrorZ
10259 pub union CResult_ErrorMessageDecodeErrorZPtr {
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::ErrorMessage,
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_ErrorMessageDecodeErrorZ represents the result of a fallible operation,
10269 /// containing a crate::lightning::ln::msgs::ErrorMessage 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_ErrorMessageDecodeErrorZ {
10272         /// The contents of this CResult_ErrorMessageDecodeErrorZ, accessible via either
10273         /// `err` or `result` depending on the state of `result_ok`.
10274         pub contents: CResult_ErrorMessageDecodeErrorZPtr,
10275         /// Whether this CResult_ErrorMessageDecodeErrorZ represents a success state.
10276         pub result_ok: bool,
10277 }
10278 #[no_mangle]
10279 /// Creates a new CResult_ErrorMessageDecodeErrorZ in the success state.
10280 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ErrorMessage) -> CResult_ErrorMessageDecodeErrorZ {
10281         CResult_ErrorMessageDecodeErrorZ {
10282                 contents: CResult_ErrorMessageDecodeErrorZPtr {
10283                         result: Box::into_raw(Box::new(o)),
10284                 },
10285                 result_ok: true,
10286         }
10287 }
10288 #[no_mangle]
10289 /// Creates a new CResult_ErrorMessageDecodeErrorZ in the error state.
10290 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ErrorMessageDecodeErrorZ {
10291         CResult_ErrorMessageDecodeErrorZ {
10292                 contents: CResult_ErrorMessageDecodeErrorZPtr {
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_ErrorMessageDecodeErrorZ.
10300 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_free(_res: CResult_ErrorMessageDecodeErrorZ) { }
10301 impl Drop for CResult_ErrorMessageDecodeErrorZ {
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::ErrorMessage, crate::lightning::ln::msgs::DecodeError>> for CResult_ErrorMessageDecodeErrorZ {
10315         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ErrorMessage, 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_ErrorMessageDecodeErrorZPtr { result }
10320                 } else {
10321                         let err = unsafe { o.contents.err };
10322                         unsafe { o.contents.err = std::ptr::null_mut(); }
10323                         CResult_ErrorMessageDecodeErrorZPtr { err }
10324                 };
10325                 Self {
10326                         contents,
10327                         result_ok: o.result_ok,
10328                 }
10329         }
10330 }
10331 impl Clone for CResult_ErrorMessageDecodeErrorZ {
10332         fn clone(&self) -> Self {
10333                 if self.result_ok {
10334                         Self { result_ok: true, contents: CResult_ErrorMessageDecodeErrorZPtr {
10335                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ErrorMessage>::clone(unsafe { &*self.contents.result })))
10336                         } }
10337                 } else {
10338                         Self { result_ok: false, contents: CResult_ErrorMessageDecodeErrorZPtr {
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_ErrorMessageDecodeErrorZ which has the same data as `orig`
10346 /// but with all dynamically-allocated buffers duplicated in new buffers.
10347 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_clone(orig: &CResult_ErrorMessageDecodeErrorZ) -> CResult_ErrorMessageDecodeErrorZ { orig.clone() }
10348 #[repr(C)]
10349 /// The contents of CResult_UnsignedNodeAnnouncementDecodeErrorZ
10350 pub union CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
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::UnsignedNodeAnnouncement,
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_UnsignedNodeAnnouncementDecodeErrorZ represents the result of a fallible operation,
10360 /// containing a crate::lightning::ln::msgs::UnsignedNodeAnnouncement 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_UnsignedNodeAnnouncementDecodeErrorZ {
10363         /// The contents of this CResult_UnsignedNodeAnnouncementDecodeErrorZ, accessible via either
10364         /// `err` or `result` depending on the state of `result_ok`.
10365         pub contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr,
10366         /// Whether this CResult_UnsignedNodeAnnouncementDecodeErrorZ represents a success state.
10367         pub result_ok: bool,
10368 }
10369 #[no_mangle]
10370 /// Creates a new CResult_UnsignedNodeAnnouncementDecodeErrorZ in the success state.
10371 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UnsignedNodeAnnouncement) -> CResult_UnsignedNodeAnnouncementDecodeErrorZ {
10372         CResult_UnsignedNodeAnnouncementDecodeErrorZ {
10373                 contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
10374                         result: Box::into_raw(Box::new(o)),
10375                 },
10376                 result_ok: true,
10377         }
10378 }
10379 #[no_mangle]
10380 /// Creates a new CResult_UnsignedNodeAnnouncementDecodeErrorZ in the error state.
10381 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UnsignedNodeAnnouncementDecodeErrorZ {
10382         CResult_UnsignedNodeAnnouncementDecodeErrorZ {
10383                 contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
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_UnsignedNodeAnnouncementDecodeErrorZ.
10391 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_free(_res: CResult_UnsignedNodeAnnouncementDecodeErrorZ) { }
10392 impl Drop for CResult_UnsignedNodeAnnouncementDecodeErrorZ {
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::UnsignedNodeAnnouncement, crate::lightning::ln::msgs::DecodeError>> for CResult_UnsignedNodeAnnouncementDecodeErrorZ {
10406         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedNodeAnnouncement, 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_UnsignedNodeAnnouncementDecodeErrorZPtr { result }
10411                 } else {
10412                         let err = unsafe { o.contents.err };
10413                         unsafe { o.contents.err = std::ptr::null_mut(); }
10414                         CResult_UnsignedNodeAnnouncementDecodeErrorZPtr { err }
10415                 };
10416                 Self {
10417                         contents,
10418                         result_ok: o.result_ok,
10419                 }
10420         }
10421 }
10422 impl Clone for CResult_UnsignedNodeAnnouncementDecodeErrorZ {
10423         fn clone(&self) -> Self {
10424                 if self.result_ok {
10425                         Self { result_ok: true, contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
10426                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UnsignedNodeAnnouncement>::clone(unsafe { &*self.contents.result })))
10427                         } }
10428                 } else {
10429                         Self { result_ok: false, contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
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_UnsignedNodeAnnouncementDecodeErrorZ which has the same data as `orig`
10437 /// but with all dynamically-allocated buffers duplicated in new buffers.
10438 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone(orig: &CResult_UnsignedNodeAnnouncementDecodeErrorZ) -> CResult_UnsignedNodeAnnouncementDecodeErrorZ { orig.clone() }
10439 #[repr(C)]
10440 /// The contents of CResult_NodeAnnouncementDecodeErrorZ
10441 pub union CResult_NodeAnnouncementDecodeErrorZPtr {
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::NodeAnnouncement,
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_NodeAnnouncementDecodeErrorZ represents the result of a fallible operation,
10451 /// containing a crate::lightning::ln::msgs::NodeAnnouncement 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_NodeAnnouncementDecodeErrorZ {
10454         /// The contents of this CResult_NodeAnnouncementDecodeErrorZ, accessible via either
10455         /// `err` or `result` depending on the state of `result_ok`.
10456         pub contents: CResult_NodeAnnouncementDecodeErrorZPtr,
10457         /// Whether this CResult_NodeAnnouncementDecodeErrorZ represents a success state.
10458         pub result_ok: bool,
10459 }
10460 #[no_mangle]
10461 /// Creates a new CResult_NodeAnnouncementDecodeErrorZ in the success state.
10462 pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_ok(o: crate::lightning::ln::msgs::NodeAnnouncement) -> CResult_NodeAnnouncementDecodeErrorZ {
10463         CResult_NodeAnnouncementDecodeErrorZ {
10464                 contents: CResult_NodeAnnouncementDecodeErrorZPtr {
10465                         result: Box::into_raw(Box::new(o)),
10466                 },
10467                 result_ok: true,
10468         }
10469 }
10470 #[no_mangle]
10471 /// Creates a new CResult_NodeAnnouncementDecodeErrorZ in the error state.
10472 pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeAnnouncementDecodeErrorZ {
10473         CResult_NodeAnnouncementDecodeErrorZ {
10474                 contents: CResult_NodeAnnouncementDecodeErrorZPtr {
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_NodeAnnouncementDecodeErrorZ.
10482 pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_free(_res: CResult_NodeAnnouncementDecodeErrorZ) { }
10483 impl Drop for CResult_NodeAnnouncementDecodeErrorZ {
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::NodeAnnouncement, crate::lightning::ln::msgs::DecodeError>> for CResult_NodeAnnouncementDecodeErrorZ {
10497         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::NodeAnnouncement, 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_NodeAnnouncementDecodeErrorZPtr { result }
10502                 } else {
10503                         let err = unsafe { o.contents.err };
10504                         unsafe { o.contents.err = std::ptr::null_mut(); }
10505                         CResult_NodeAnnouncementDecodeErrorZPtr { err }
10506                 };
10507                 Self {
10508                         contents,
10509                         result_ok: o.result_ok,
10510                 }
10511         }
10512 }
10513 impl Clone for CResult_NodeAnnouncementDecodeErrorZ {
10514         fn clone(&self) -> Self {
10515                 if self.result_ok {
10516                         Self { result_ok: true, contents: CResult_NodeAnnouncementDecodeErrorZPtr {
10517                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::NodeAnnouncement>::clone(unsafe { &*self.contents.result })))
10518                         } }
10519                 } else {
10520                         Self { result_ok: false, contents: CResult_NodeAnnouncementDecodeErrorZPtr {
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_NodeAnnouncementDecodeErrorZ which has the same data as `orig`
10528 /// but with all dynamically-allocated buffers duplicated in new buffers.
10529 pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_clone(orig: &CResult_NodeAnnouncementDecodeErrorZ) -> CResult_NodeAnnouncementDecodeErrorZ { orig.clone() }
10530 #[repr(C)]
10531 /// The contents of CResult_QueryShortChannelIdsDecodeErrorZ
10532 pub union CResult_QueryShortChannelIdsDecodeErrorZPtr {
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::QueryShortChannelIds,
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_QueryShortChannelIdsDecodeErrorZ represents the result of a fallible operation,
10542 /// containing a crate::lightning::ln::msgs::QueryShortChannelIds 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_QueryShortChannelIdsDecodeErrorZ {
10545         /// The contents of this CResult_QueryShortChannelIdsDecodeErrorZ, accessible via either
10546         /// `err` or `result` depending on the state of `result_ok`.
10547         pub contents: CResult_QueryShortChannelIdsDecodeErrorZPtr,
10548         /// Whether this CResult_QueryShortChannelIdsDecodeErrorZ represents a success state.
10549         pub result_ok: bool,
10550 }
10551 #[no_mangle]
10552 /// Creates a new CResult_QueryShortChannelIdsDecodeErrorZ in the success state.
10553 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_ok(o: crate::lightning::ln::msgs::QueryShortChannelIds) -> CResult_QueryShortChannelIdsDecodeErrorZ {
10554         CResult_QueryShortChannelIdsDecodeErrorZ {
10555                 contents: CResult_QueryShortChannelIdsDecodeErrorZPtr {
10556                         result: Box::into_raw(Box::new(o)),
10557                 },
10558                 result_ok: true,
10559         }
10560 }
10561 #[no_mangle]
10562 /// Creates a new CResult_QueryShortChannelIdsDecodeErrorZ in the error state.
10563 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_QueryShortChannelIdsDecodeErrorZ {
10564         CResult_QueryShortChannelIdsDecodeErrorZ {
10565                 contents: CResult_QueryShortChannelIdsDecodeErrorZPtr {
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_QueryShortChannelIdsDecodeErrorZ.
10573 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_free(_res: CResult_QueryShortChannelIdsDecodeErrorZ) { }
10574 impl Drop for CResult_QueryShortChannelIdsDecodeErrorZ {
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::QueryShortChannelIds, crate::lightning::ln::msgs::DecodeError>> for CResult_QueryShortChannelIdsDecodeErrorZ {
10588         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::QueryShortChannelIds, 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_QueryShortChannelIdsDecodeErrorZPtr { result }
10593                 } else {
10594                         let err = unsafe { o.contents.err };
10595                         unsafe { o.contents.err = std::ptr::null_mut(); }
10596                         CResult_QueryShortChannelIdsDecodeErrorZPtr { err }
10597                 };
10598                 Self {
10599                         contents,
10600                         result_ok: o.result_ok,
10601                 }
10602         }
10603 }
10604 impl Clone for CResult_QueryShortChannelIdsDecodeErrorZ {
10605         fn clone(&self) -> Self {
10606                 if self.result_ok {
10607                         Self { result_ok: true, contents: CResult_QueryShortChannelIdsDecodeErrorZPtr {
10608                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::QueryShortChannelIds>::clone(unsafe { &*self.contents.result })))
10609                         } }
10610                 } else {
10611                         Self { result_ok: false, contents: CResult_QueryShortChannelIdsDecodeErrorZPtr {
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_QueryShortChannelIdsDecodeErrorZ which has the same data as `orig`
10619 /// but with all dynamically-allocated buffers duplicated in new buffers.
10620 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_clone(orig: &CResult_QueryShortChannelIdsDecodeErrorZ) -> CResult_QueryShortChannelIdsDecodeErrorZ { orig.clone() }
10621 #[repr(C)]
10622 /// The contents of CResult_ReplyShortChannelIdsEndDecodeErrorZ
10623 pub union CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
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::ReplyShortChannelIdsEnd,
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_ReplyShortChannelIdsEndDecodeErrorZ represents the result of a fallible operation,
10633 /// containing a crate::lightning::ln::msgs::ReplyShortChannelIdsEnd 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_ReplyShortChannelIdsEndDecodeErrorZ {
10636         /// The contents of this CResult_ReplyShortChannelIdsEndDecodeErrorZ, accessible via either
10637         /// `err` or `result` depending on the state of `result_ok`.
10638         pub contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr,
10639         /// Whether this CResult_ReplyShortChannelIdsEndDecodeErrorZ represents a success state.
10640         pub result_ok: bool,
10641 }
10642 #[no_mangle]
10643 /// Creates a new CResult_ReplyShortChannelIdsEndDecodeErrorZ in the success state.
10644 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ReplyShortChannelIdsEnd) -> CResult_ReplyShortChannelIdsEndDecodeErrorZ {
10645         CResult_ReplyShortChannelIdsEndDecodeErrorZ {
10646                 contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
10647                         result: Box::into_raw(Box::new(o)),
10648                 },
10649                 result_ok: true,
10650         }
10651 }
10652 #[no_mangle]
10653 /// Creates a new CResult_ReplyShortChannelIdsEndDecodeErrorZ in the error state.
10654 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ReplyShortChannelIdsEndDecodeErrorZ {
10655         CResult_ReplyShortChannelIdsEndDecodeErrorZ {
10656                 contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
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_ReplyShortChannelIdsEndDecodeErrorZ.
10664 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_free(_res: CResult_ReplyShortChannelIdsEndDecodeErrorZ) { }
10665 impl Drop for CResult_ReplyShortChannelIdsEndDecodeErrorZ {
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::ReplyShortChannelIdsEnd, crate::lightning::ln::msgs::DecodeError>> for CResult_ReplyShortChannelIdsEndDecodeErrorZ {
10679         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ReplyShortChannelIdsEnd, 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_ReplyShortChannelIdsEndDecodeErrorZPtr { result }
10684                 } else {
10685                         let err = unsafe { o.contents.err };
10686                         unsafe { o.contents.err = std::ptr::null_mut(); }
10687                         CResult_ReplyShortChannelIdsEndDecodeErrorZPtr { err }
10688                 };
10689                 Self {
10690                         contents,
10691                         result_ok: o.result_ok,
10692                 }
10693         }
10694 }
10695 impl Clone for CResult_ReplyShortChannelIdsEndDecodeErrorZ {
10696         fn clone(&self) -> Self {
10697                 if self.result_ok {
10698                         Self { result_ok: true, contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
10699                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ReplyShortChannelIdsEnd>::clone(unsafe { &*self.contents.result })))
10700                         } }
10701                 } else {
10702                         Self { result_ok: false, contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
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_ReplyShortChannelIdsEndDecodeErrorZ which has the same data as `orig`
10710 /// but with all dynamically-allocated buffers duplicated in new buffers.
10711 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone(orig: &CResult_ReplyShortChannelIdsEndDecodeErrorZ) -> CResult_ReplyShortChannelIdsEndDecodeErrorZ { orig.clone() }
10712 #[repr(C)]
10713 /// The contents of CResult_QueryChannelRangeDecodeErrorZ
10714 pub union CResult_QueryChannelRangeDecodeErrorZPtr {
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::QueryChannelRange,
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_QueryChannelRangeDecodeErrorZ represents the result of a fallible operation,
10724 /// containing a crate::lightning::ln::msgs::QueryChannelRange 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_QueryChannelRangeDecodeErrorZ {
10727         /// The contents of this CResult_QueryChannelRangeDecodeErrorZ, accessible via either
10728         /// `err` or `result` depending on the state of `result_ok`.
10729         pub contents: CResult_QueryChannelRangeDecodeErrorZPtr,
10730         /// Whether this CResult_QueryChannelRangeDecodeErrorZ represents a success state.
10731         pub result_ok: bool,
10732 }
10733 #[no_mangle]
10734 /// Creates a new CResult_QueryChannelRangeDecodeErrorZ in the success state.
10735 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_ok(o: crate::lightning::ln::msgs::QueryChannelRange) -> CResult_QueryChannelRangeDecodeErrorZ {
10736         CResult_QueryChannelRangeDecodeErrorZ {
10737                 contents: CResult_QueryChannelRangeDecodeErrorZPtr {
10738                         result: Box::into_raw(Box::new(o)),
10739                 },
10740                 result_ok: true,
10741         }
10742 }
10743 #[no_mangle]
10744 /// Creates a new CResult_QueryChannelRangeDecodeErrorZ in the error state.
10745 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_QueryChannelRangeDecodeErrorZ {
10746         CResult_QueryChannelRangeDecodeErrorZ {
10747                 contents: CResult_QueryChannelRangeDecodeErrorZPtr {
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_QueryChannelRangeDecodeErrorZ.
10755 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_free(_res: CResult_QueryChannelRangeDecodeErrorZ) { }
10756 impl Drop for CResult_QueryChannelRangeDecodeErrorZ {
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::QueryChannelRange, crate::lightning::ln::msgs::DecodeError>> for CResult_QueryChannelRangeDecodeErrorZ {
10770         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::QueryChannelRange, 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_QueryChannelRangeDecodeErrorZPtr { result }
10775                 } else {
10776                         let err = unsafe { o.contents.err };
10777                         unsafe { o.contents.err = std::ptr::null_mut(); }
10778                         CResult_QueryChannelRangeDecodeErrorZPtr { err }
10779                 };
10780                 Self {
10781                         contents,
10782                         result_ok: o.result_ok,
10783                 }
10784         }
10785 }
10786 impl Clone for CResult_QueryChannelRangeDecodeErrorZ {
10787         fn clone(&self) -> Self {
10788                 if self.result_ok {
10789                         Self { result_ok: true, contents: CResult_QueryChannelRangeDecodeErrorZPtr {
10790                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::QueryChannelRange>::clone(unsafe { &*self.contents.result })))
10791                         } }
10792                 } else {
10793                         Self { result_ok: false, contents: CResult_QueryChannelRangeDecodeErrorZPtr {
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_QueryChannelRangeDecodeErrorZ which has the same data as `orig`
10801 /// but with all dynamically-allocated buffers duplicated in new buffers.
10802 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_clone(orig: &CResult_QueryChannelRangeDecodeErrorZ) -> CResult_QueryChannelRangeDecodeErrorZ { orig.clone() }
10803 #[repr(C)]
10804 /// The contents of CResult_ReplyChannelRangeDecodeErrorZ
10805 pub union CResult_ReplyChannelRangeDecodeErrorZPtr {
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::ReplyChannelRange,
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_ReplyChannelRangeDecodeErrorZ represents the result of a fallible operation,
10815 /// containing a crate::lightning::ln::msgs::ReplyChannelRange 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_ReplyChannelRangeDecodeErrorZ {
10818         /// The contents of this CResult_ReplyChannelRangeDecodeErrorZ, accessible via either
10819         /// `err` or `result` depending on the state of `result_ok`.
10820         pub contents: CResult_ReplyChannelRangeDecodeErrorZPtr,
10821         /// Whether this CResult_ReplyChannelRangeDecodeErrorZ represents a success state.
10822         pub result_ok: bool,
10823 }
10824 #[no_mangle]
10825 /// Creates a new CResult_ReplyChannelRangeDecodeErrorZ in the success state.
10826 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ReplyChannelRange) -> CResult_ReplyChannelRangeDecodeErrorZ {
10827         CResult_ReplyChannelRangeDecodeErrorZ {
10828                 contents: CResult_ReplyChannelRangeDecodeErrorZPtr {
10829                         result: Box::into_raw(Box::new(o)),
10830                 },
10831                 result_ok: true,
10832         }
10833 }
10834 #[no_mangle]
10835 /// Creates a new CResult_ReplyChannelRangeDecodeErrorZ in the error state.
10836 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ReplyChannelRangeDecodeErrorZ {
10837         CResult_ReplyChannelRangeDecodeErrorZ {
10838                 contents: CResult_ReplyChannelRangeDecodeErrorZPtr {
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_ReplyChannelRangeDecodeErrorZ.
10846 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_free(_res: CResult_ReplyChannelRangeDecodeErrorZ) { }
10847 impl Drop for CResult_ReplyChannelRangeDecodeErrorZ {
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::ReplyChannelRange, crate::lightning::ln::msgs::DecodeError>> for CResult_ReplyChannelRangeDecodeErrorZ {
10861         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ReplyChannelRange, 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_ReplyChannelRangeDecodeErrorZPtr { result }
10866                 } else {
10867                         let err = unsafe { o.contents.err };
10868                         unsafe { o.contents.err = std::ptr::null_mut(); }
10869                         CResult_ReplyChannelRangeDecodeErrorZPtr { err }
10870                 };
10871                 Self {
10872                         contents,
10873                         result_ok: o.result_ok,
10874                 }
10875         }
10876 }
10877 impl Clone for CResult_ReplyChannelRangeDecodeErrorZ {
10878         fn clone(&self) -> Self {
10879                 if self.result_ok {
10880                         Self { result_ok: true, contents: CResult_ReplyChannelRangeDecodeErrorZPtr {
10881                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ReplyChannelRange>::clone(unsafe { &*self.contents.result })))
10882                         } }
10883                 } else {
10884                         Self { result_ok: false, contents: CResult_ReplyChannelRangeDecodeErrorZPtr {
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_ReplyChannelRangeDecodeErrorZ which has the same data as `orig`
10892 /// but with all dynamically-allocated buffers duplicated in new buffers.
10893 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_clone(orig: &CResult_ReplyChannelRangeDecodeErrorZ) -> CResult_ReplyChannelRangeDecodeErrorZ { orig.clone() }
10894 #[repr(C)]
10895 /// The contents of CResult_GossipTimestampFilterDecodeErrorZ
10896 pub union CResult_GossipTimestampFilterDecodeErrorZPtr {
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::GossipTimestampFilter,
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_GossipTimestampFilterDecodeErrorZ represents the result of a fallible operation,
10906 /// containing a crate::lightning::ln::msgs::GossipTimestampFilter 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_GossipTimestampFilterDecodeErrorZ {
10909         /// The contents of this CResult_GossipTimestampFilterDecodeErrorZ, accessible via either
10910         /// `err` or `result` depending on the state of `result_ok`.
10911         pub contents: CResult_GossipTimestampFilterDecodeErrorZPtr,
10912         /// Whether this CResult_GossipTimestampFilterDecodeErrorZ represents a success state.
10913         pub result_ok: bool,
10914 }
10915 #[no_mangle]
10916 /// Creates a new CResult_GossipTimestampFilterDecodeErrorZ in the success state.
10917 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_ok(o: crate::lightning::ln::msgs::GossipTimestampFilter) -> CResult_GossipTimestampFilterDecodeErrorZ {
10918         CResult_GossipTimestampFilterDecodeErrorZ {
10919                 contents: CResult_GossipTimestampFilterDecodeErrorZPtr {
10920                         result: Box::into_raw(Box::new(o)),
10921                 },
10922                 result_ok: true,
10923         }
10924 }
10925 #[no_mangle]
10926 /// Creates a new CResult_GossipTimestampFilterDecodeErrorZ in the error state.
10927 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_GossipTimestampFilterDecodeErrorZ {
10928         CResult_GossipTimestampFilterDecodeErrorZ {
10929                 contents: CResult_GossipTimestampFilterDecodeErrorZPtr {
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_GossipTimestampFilterDecodeErrorZ.
10937 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_free(_res: CResult_GossipTimestampFilterDecodeErrorZ) { }
10938 impl Drop for CResult_GossipTimestampFilterDecodeErrorZ {
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::GossipTimestampFilter, crate::lightning::ln::msgs::DecodeError>> for CResult_GossipTimestampFilterDecodeErrorZ {
10952         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::GossipTimestampFilter, 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_GossipTimestampFilterDecodeErrorZPtr { result }
10957                 } else {
10958                         let err = unsafe { o.contents.err };
10959                         unsafe { o.contents.err = std::ptr::null_mut(); }
10960                         CResult_GossipTimestampFilterDecodeErrorZPtr { err }
10961                 };
10962                 Self {
10963                         contents,
10964                         result_ok: o.result_ok,
10965                 }
10966         }
10967 }
10968 impl Clone for CResult_GossipTimestampFilterDecodeErrorZ {
10969         fn clone(&self) -> Self {
10970                 if self.result_ok {
10971                         Self { result_ok: true, contents: CResult_GossipTimestampFilterDecodeErrorZPtr {
10972                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::GossipTimestampFilter>::clone(unsafe { &*self.contents.result })))
10973                         } }
10974                 } else {
10975                         Self { result_ok: false, contents: CResult_GossipTimestampFilterDecodeErrorZPtr {
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_GossipTimestampFilterDecodeErrorZ which has the same data as `orig`
10983 /// but with all dynamically-allocated buffers duplicated in new buffers.
10984 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_clone(orig: &CResult_GossipTimestampFilterDecodeErrorZ) -> CResult_GossipTimestampFilterDecodeErrorZ { orig.clone() }
10985 #[repr(C)]
10986 /// The contents of CResult_InvoiceSignOrCreationErrorZ
10987 pub union CResult_InvoiceSignOrCreationErrorZPtr {
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_invoice::Invoice,
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_invoice::SignOrCreationError,
10994 }
10995 #[repr(C)]
10996 /// A CResult_InvoiceSignOrCreationErrorZ represents the result of a fallible operation,
10997 /// containing a crate::lightning_invoice::Invoice on success and a crate::lightning_invoice::SignOrCreationError on failure.
10998 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10999 pub struct CResult_InvoiceSignOrCreationErrorZ {
11000         /// The contents of this CResult_InvoiceSignOrCreationErrorZ, accessible via either
11001         /// `err` or `result` depending on the state of `result_ok`.
11002         pub contents: CResult_InvoiceSignOrCreationErrorZPtr,
11003         /// Whether this CResult_InvoiceSignOrCreationErrorZ represents a success state.
11004         pub result_ok: bool,
11005 }
11006 #[no_mangle]
11007 /// Creates a new CResult_InvoiceSignOrCreationErrorZ in the success state.
11008 pub extern "C" fn CResult_InvoiceSignOrCreationErrorZ_ok(o: crate::lightning_invoice::Invoice) -> CResult_InvoiceSignOrCreationErrorZ {
11009         CResult_InvoiceSignOrCreationErrorZ {
11010                 contents: CResult_InvoiceSignOrCreationErrorZPtr {
11011                         result: Box::into_raw(Box::new(o)),
11012                 },
11013                 result_ok: true,
11014         }
11015 }
11016 #[no_mangle]
11017 /// Creates a new CResult_InvoiceSignOrCreationErrorZ in the error state.
11018 pub extern "C" fn CResult_InvoiceSignOrCreationErrorZ_err(e: crate::lightning_invoice::SignOrCreationError) -> CResult_InvoiceSignOrCreationErrorZ {
11019         CResult_InvoiceSignOrCreationErrorZ {
11020                 contents: CResult_InvoiceSignOrCreationErrorZPtr {
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_InvoiceSignOrCreationErrorZ.
11028 pub extern "C" fn CResult_InvoiceSignOrCreationErrorZ_free(_res: CResult_InvoiceSignOrCreationErrorZ) { }
11029 impl Drop for CResult_InvoiceSignOrCreationErrorZ {
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_invoice::Invoice, crate::lightning_invoice::SignOrCreationError>> for CResult_InvoiceSignOrCreationErrorZ {
11043         fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::Invoice, crate::lightning_invoice::SignOrCreationError>) -> 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_InvoiceSignOrCreationErrorZPtr { result }
11048                 } else {
11049                         let err = unsafe { o.contents.err };
11050                         unsafe { o.contents.err = std::ptr::null_mut(); }
11051                         CResult_InvoiceSignOrCreationErrorZPtr { err }
11052                 };
11053                 Self {
11054                         contents,
11055                         result_ok: o.result_ok,
11056                 }
11057         }
11058 }
11059 impl Clone for CResult_InvoiceSignOrCreationErrorZ {
11060         fn clone(&self) -> Self {
11061                 if self.result_ok {
11062                         Self { result_ok: true, contents: CResult_InvoiceSignOrCreationErrorZPtr {
11063                                 result: Box::into_raw(Box::new(<crate::lightning_invoice::Invoice>::clone(unsafe { &*self.contents.result })))
11064                         } }
11065                 } else {
11066                         Self { result_ok: false, contents: CResult_InvoiceSignOrCreationErrorZPtr {
11067                                 err: Box::into_raw(Box::new(<crate::lightning_invoice::SignOrCreationError>::clone(unsafe { &*self.contents.err })))
11068                         } }
11069                 }
11070         }
11071 }
11072 #[no_mangle]
11073 /// Creates a new CResult_InvoiceSignOrCreationErrorZ which has the same data as `orig`
11074 /// but with all dynamically-allocated buffers duplicated in new buffers.
11075 pub extern "C" fn CResult_InvoiceSignOrCreationErrorZ_clone(orig: &CResult_InvoiceSignOrCreationErrorZ) -> CResult_InvoiceSignOrCreationErrorZ { orig.clone() }